Class: Dusen::Token

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Token

Returns a new instance of Token.



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

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

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



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

def exclude
  @exclude
end

#fieldObject (readonly)

Returns the value of attribute field.



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

def field
  @field
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#exclude?Boolean

Returns:

  • (Boolean)


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

def exclude?
  exclude
end

#text?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/dusen/token.rb', line 18

def text?
  field == 'text'
end

#to_sObject



14
15
16
# File 'lib/dusen/token.rb', line 14

def to_s
  value
end