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.



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

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.



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

def raw_value
  @raw_value
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#to_double_quotable_string(metacharacters) ⇒ Object



25
26
27
# File 'lib/fig/tokenized_string/token.rb', line 25

def to_double_quotable_string(metacharacters)
  return raw_value
end

#to_escaped_stringObject



21
22
23
# File 'lib/fig/tokenized_string/token.rb', line 21

def to_escaped_string()
  return raw_value
end

#to_expanded_string(&block) ⇒ Object



17
18
19
# File 'lib/fig/tokenized_string/token.rb', line 17

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

#to_single_quoted_stringObject



29
30
31
# File 'lib/fig/tokenized_string/token.rb', line 29

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