Class: Code::Node::String::Part::Text
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::String::Part::Text
- Defined in:
- lib/code/node/string.rb
Instance Method Summary collapse
- #evaluate(**_args) ⇒ Object
-
#initialize(parsed) ⇒ Text
constructor
A new instance of Text.
Methods inherited from Code::Node
Constructor Details
#initialize(parsed) ⇒ Text
Returns a new instance of Text.
20 21 22 23 24 |
# File 'lib/code/node/string.rb', line 20 def initialize(parsed) return if parsed.nil? @text = parsed end |
Instance Method Details
#evaluate(**_args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/code/node/string.rb', line 26 def evaluate(**_args) ::Code::Object::String.new( @text .to_s .gsub('\n', "\n") .gsub('\r', "\r") .gsub('\t', "\t") .gsub('\b', "\b") .gsub('\f', "\f") .gsub('\a', "\a") .gsub('\e', "\e") ) end |