Class: Kaiseki::GetVar

Inherits:
BasicParser show all
Defined in:
lib/var_get.rb

Instance Attribute Summary collapse

Attributes inherited from BasicParser

#expected

Instance Method Summary collapse

Methods included from Parseable

#&, #action, #and?, #cast, #filter, #list, #merge, #not!, #one_or_more, #optional, #override, #parse, #predicate?, #protect, #repeat, #set, #skip, #tag_error, #tag_result, #to_parseable, #validate, #zero_or_more, #|

Constructor Details

#initialize(expected, parser) ⇒ GetVar

Returns a new instance of GetVar.



5
6
7
8
# File 'lib/var_get.rb', line 5

def initialize expected, parser
	super expected
	@parser = parser.to_parseable
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



3
4
5
# File 'lib/var_get.rb', line 3

def parser
  @parser
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


10
11
12
# File 'lib/var_get.rb', line 10

def eql? other
	other.is_a?(self.class) and other.expected == @expected and other.parser == @parser
end

#to_sObject



16
17
18
# File 'lib/var_get.rb', line 16

def to_s
	"#{@expected.is_a?(Symbol) ? "$#{@expected}" : @expected.inspect} (match)"
end