Class: Minidusen::Token

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Token

Returns a new instance of Token.



6
7
8
9
10
# File 'lib/minidusen/token.rb', line 6

def initialize(options)
  @value = options.fetch(:value)
  @exclude = options.fetch(:exclude, false)
  @field = options.fetch(:field).to_s
end

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



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

def exclude
  @exclude
end

#fieldObject (readonly)

Returns the value of attribute field.



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

def field
  @field
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#exclude?Boolean

Returns:

  • (Boolean)


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

def exclude?
  exclude
end

#text?Boolean

Returns:

  • (Boolean)


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

def text?
  field == 'text'
end

#to_sObject



12
13
14
# File 'lib/minidusen/token.rb', line 12

def to_s
  value
end