Class: Amrita2::Core::AttrMatcher

Inherits:
Matcher show all
Defined in:
lib/amrita2/core.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#find

Constructor Details

#initialize(sym, val) ⇒ AttrMatcher

Returns a new instance of AttrMatcher.



684
685
686
687
688
# File 'lib/amrita2/core.rb', line 684

def initialize(sym, val)
  @sym = sym
  @sym_s = sym.to_s
  @val = val
end

Instance Attribute Details

#symObject (readonly)

Returns the value of attribute sym.



683
684
685
# File 'lib/amrita2/core.rb', line 683

def sym
  @sym
end

Instance Method Details

#match(e) ⇒ Object



690
691
692
693
694
695
696
# File 'lib/amrita2/core.rb', line 690

def match(e)
  if @val != '*'
    @val == e.attributes[@sym_s]
  else
    e.attributes[@sym_s]
  end
end