Class: Fig::TokenizedString::Token

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, raw_value) ⇒ Token

Returns a new instance of Token.



8
9
10
11
12
13
# File 'lib/fig/tokenized_string/token.rb', line 8

def initialize(type, raw_value)
  @type      = type
  @raw_value = raw_value

  return
end

Instance Attribute Details

#raw_valueObject (readonly)

Returns the value of attribute raw_value.



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

def raw_value
  @raw_value
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#to_double_quotable_string(metacharacters) ⇒ Object



23
24
25
# File 'lib/fig/tokenized_string/token.rb', line 23

def to_double_quotable_string(metacharacters)
  return raw_value
end

#to_escaped_stringObject



19
20
21
# File 'lib/fig/tokenized_string/token.rb', line 19

def to_escaped_string()
  return raw_value
end

#to_expanded_string(&block) ⇒ Object



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

def to_expanded_string(&block)
  return block.call self
end

#to_single_quoted_stringObject



27
28
29
# File 'lib/fig/tokenized_string/token.rb', line 27

def to_single_quoted_string()
  raise NotImplementedError.new 'Cannot single-quote a token.'
end