Class: Linguistics::Latin::Verb::TenseBlock

Inherits:
Object
  • Object
show all
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

NullTenseBlock

Defined Under Namespace

Classes: VectorResolutionDelegate

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#meaningObject (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

#resultsObject (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_sObject



31
32
33
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 31

def to_s
  to_a.to_s
end

#wordless?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/linguistics_latin_tense_block/tense_block.rb', line 35

def wordless?
  !@results.find{ |r| r =~ /\w/ }
end