Module: Rosette::Core::PhraseToHash

Included in:
Phrase
Defined in:
lib/rosette/core/extractor/phrase/phrase_to_hash.rb

Overview

Turns a Phrase into a hash. Must be mixed into a Phrase-like class.

Examples:

p = Phrase.new
p.key = 'foo'
p.meta_key = 'bar'
p.file = '/path/to/file.yml'

p.to_h  # => { key: 'foo', meta_key: 'bar', file: '/path/to/file.yml' ... }

Instance Method Summary collapse

Instance Method Details

#to_hHash

Converts the attributes of a Rosette::Core::Phrase into a hash of attributes.

Returns:

  • (Hash)

    a hash of phrase attributes.


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rosette/core/extractor/phrase/phrase_to_hash.rb', line 19

def to_h
  {
    key: key,
    meta_key: meta_key,
    file: file,
    commit_id: commit_id,
    author_name: author_name,
    author_email: author_email,
    line_number: line_number
  }
end