Class: Dusen::Token
- Inherits:
-
Object
- Object
- Dusen::Token
- Defined in:
- lib/dusen/token.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Token
constructor
A new instance of Token.
- #text? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Token
Returns a new instance of Token.
8 9 10 11 12 13 14 15 16 |
# File 'lib/dusen/token.rb', line 8 def initialize(*args) if args.length == 2 @field, @value = args else @field = 'text' @value = args.first end @field = @field.to_s end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'lib/dusen/token.rb', line 6 def field @field end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/dusen/token.rb', line 6 def value @value end |
Instance Method Details
#text? ⇒ Boolean
22 23 24 |
# File 'lib/dusen/token.rb', line 22 def text? field == 'text' end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/dusen/token.rb', line 18 def to_s value end |