Class: Parser::ParsedElement

Inherits:
Struct
  • Object
show all
Defined in:
lib/appswarm/tools/parser/parser_lib.rb,
lib/appswarm/tools/parser/parser_lib.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



20
21
22
# File 'lib/appswarm/tools/parser/parser_lib.rb', line 20

def block
  @block
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



20
21
22
# File 'lib/appswarm/tools/parser/parser_lib.rb', line 20

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



20
21
22
# File 'lib/appswarm/tools/parser/parser_lib.rb', line 20

def value
  @value
end

Instance Method Details

#convertObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/appswarm/tools/parser/parser_lib.rb', line 27

def convert
  if block
    instance_eval(&block)
  else
    if value.is_a?(Array)
      if value.length>1
        value.map{|v|v.convert}
      else
        value[0].convert
      end
    else
      value
    end
  end
end

#to_sObject



23
24
25
# File 'lib/appswarm/tools/parser/parser_lib.rb', line 23

def to_s
  "[#{type} #{value}]"
end