Class: Linguistics::Latin::Verb::TenseBlock
- Inherits:
-
Object
- Object
- Linguistics::Latin::Verb::TenseBlock
- Extended by:
- Forwardable
- Includes:
- Phonographia
- Defined in:
- lib/linguistics_latin_tense_block/tense_block.rb,
lib/linguistics_latin_tense_block/tense_block/vector_resolution_delegate.rb
Direct Known Subclasses
Defined Under Namespace
Classes: VectorResolutionDelegate
Instance Attribute Summary collapse
-
#meaning ⇒ Object
readonly
Returns the value of attribute meaning.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(r, opts = {}) ⇒ TenseBlock
constructor
A new instance of TenseBlock.
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
- #wordless? ⇒ Boolean
Constructor Details
#initialize(r, opts = {}) ⇒ TenseBlock
Returns a new instance of TenseBlock.
25 26 27 28 29 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 25 def initialize(r, opts={}) @results = Array(r).map{ |v| fix_macrons(v) } @meaning = opts[:meaning] || "" @resolver = VectorResolutionDelegate.new(@results) end |
Instance Attribute Details
#meaning ⇒ Object (readonly)
Returns the value of attribute meaning.
23 24 25 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 23 def meaning @meaning end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
23 24 25 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 23 def results @results end |
Class Method Details
.json_create(o) ⇒ Object
46 47 48 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 46 def TenseBlock.json_create(o) new(o['data']) end |
Instance Method Details
#to_json(*a) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 39 def to_json(*a) { 'json_class' => self.class.name, 'data' => @results.map{|i| i.to_json} }.to_json(*a) end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 31 def to_s to_a.to_s end |
#wordless? ⇒ Boolean
35 36 37 |
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 35 def wordless? !@results.find{ |r| r =~ /\w/ } end |