Class: Dictation::Word
- Inherits:
-
Object
- Object
- Dictation::Word
- Defined in:
- lib/dictation/word.rb
Instance Attribute Summary collapse
-
#translation ⇒ Object
Returns the value of attribute translation.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value, translation = nil) ⇒ Word
constructor
A new instance of Word.
- #orthography ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(value, translation = nil) ⇒ Word
Returns a new instance of Word.
9 10 11 12 |
# File 'lib/dictation/word.rb', line 9 def initialize(value, translation = nil) @value = value @translation = translation end |
Instance Attribute Details
#translation ⇒ Object
Returns the value of attribute translation.
7 8 9 |
# File 'lib/dictation/word.rb', line 7 def translation @translation end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/dictation/word.rb', line 7 def value @value end |
Class Method Details
.json_create(object) ⇒ Object
42 43 44 |
# File 'lib/dictation/word.rb', line 42 def json_create(object) new(*object['data']) end |
Instance Method Details
#orthography ⇒ Object
14 15 16 |
# File 'lib/dictation/word.rb', line 14 def orthography decompose(@value) end |
#to_json(*args) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/dictation/word.rb', line 34 def to_json(*args) { 'json_class' => self.class.name, 'data' => [ @value, @translation ] }.to_json(*args) end |