Class: Org::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/org/token.rb

Direct Known Subclasses

RootToken

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, values, options = {}, &block) ⇒ Token

Returns a new instance of Token.



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

def initialize(name, values, options = {}, &block)
  @name, @values, @options, @block = name, values, options, block
  @childs = []
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



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

def block
  @block
end

#childsObject

Returns the value of attribute childs.



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

def childs
  @childs
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#parentObject

Returns the value of attribute parent.



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

def parent
  @parent
end

#valuesObject

Returns the value of attribute values.



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

def values
  @values
end

Instance Method Details

#<<(token) ⇒ Object



10
11
12
13
# File 'lib/org/token.rb', line 10

def <<(token)
  token.parent = self
  @childs << token
end

#pretty_inspectObject Also known as: inspect



15
16
17
# File 'lib/org/token.rb', line 15

def pretty_inspect
  {[name, values] => childs}.pretty_inspect
end