Class: StringEater::Token

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeToken

Returns a new instance of Token.



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

def initialize
  @opts = {}
  @breakpoints = [nil,nil]
end

Instance Attribute Details

#breakpointsObject

Returns the value of attribute breakpoints.



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

def breakpoints
  @breakpoints
end

#childrenObject

Returns the value of attribute children.



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

def children
  @children
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#optsObject

Returns the value of attribute opts.



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

def opts
  @opts
end

#stringObject

Returns the value of attribute string.



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

def string
  @string
end

Class Method Details

.new_field(name, opts) ⇒ Object



13
14
15
16
17
18
# File 'lib/token.rb', line 13

def self.new_field(name, opts)
  t = new
  t.name = name
  t.opts = {:extract => true}.merge(opts)
  t
end

.new_separator(string) ⇒ Object



20
21
22
23
24
# File 'lib/token.rb', line 20

def self.new_separator(string)
  t = new
  t.string = string
  t
end

Instance Method Details

#extract?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/token.rb', line 9

def extract?
  @opts[:extract]
end