class StencilGroup
Attributes
stencils[R]
Public Class Methods
match(_stencil_map, _document_words)
click to toggle source
# File lib/stencils/stencil_group.rb, line 2 def self.match(_stencil_map, _document_words) stencils = {} _stencil_map.each do |face, stencil| stencils[face] = _document_words.include?(face) ? stencil.match(_document_words[face]) : nil end new(stencils) end
new(_stencils)
click to toggle source
# File lib/stencils/stencil_group.rb, line 13 def initialize(_stencils) @stencils = _stencils end
Public Instance Methods
get_all?(_field)
click to toggle source
# File lib/stencils/stencil_group.rb, line 25 def get_all?(_field) @stencils.values.each do |stencil| raise "#{self.class.name} has no field #{_field}" if !stencil.fields.include? _field end @stencils.values.all? { |stencil| stencil.public_send(_field) } end
get_any?(_field)
click to toggle source
# File lib/stencils/stencil_group.rb, line 17 def get_any?(_field) @stencils.values.each do |stencil| raise "#{self.class.name} has no field #{_field}" if !stencil.fields.include? _field end @stencils.values.any? { |stencil| stencil.public_send(_field) } end
get_attribute(_field)
click to toggle source
# File lib/stencils/stencil_group.rb, line 33 def get_attribute(_field) @stencils.values.each do |stencil| return stencil.public_send(_field) if stencil.fields.include? _field end raise "Unknown field #{_field}" end