Class: Code::Node::String
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::String
- Defined in:
- lib/code/node/string.rb
Defined Under Namespace
Classes: Part
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ String
constructor
A new instance of String.
Methods inherited from Code::Node
Constructor Details
#initialize(parsed) ⇒ String
Returns a new instance of String.
56 57 58 59 60 61 |
# File 'lib/code/node/string.rb', line 56 def initialize(parsed) return if parsed.blank? @parts = (parsed.presence || []).map { |part| Node::String::Part.new(part) } end |
Instance Method Details
#evaluate(**args) ⇒ Object
63 64 65 66 67 |
# File 'lib/code/node/string.rb', line 63 def evaluate(**args) ::Code::Object::String.new( (@parts || []).map { |part| part.evaluate(**args) }.map(&:to_s).join ) end |