Class: Ast::Merge::Runtime::Frame
- Inherits:
-
Object
- Object
- Ast::Merge::Runtime::Frame
- Defined in:
- lib/ast/merge/runtime/frame.rb
Overview
One stack frame in a nested merge session.
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#language_chain ⇒ Object
readonly
Returns the value of attribute language_chain.
-
#operation_id ⇒ Object
readonly
Returns the value of attribute operation_id.
-
#parent_operation_id ⇒ Object
readonly
Returns the value of attribute parent_operation_id.
-
#surface_path ⇒ Object
readonly
Returns the value of attribute surface_path.
Instance Method Summary collapse
-
#initialize(operation_id:, depth:, surface_path:, parent_operation_id: nil, language_chain: []) ⇒ Frame
constructor
A new instance of Frame.
- #root? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(operation_id:, depth:, surface_path:, parent_operation_id: nil, language_chain: []) ⇒ Frame
Returns a new instance of Frame.
14 15 16 17 18 19 20 21 22 |
# File 'lib/ast/merge/runtime/frame.rb', line 14 def initialize(operation_id:, depth:, surface_path:, parent_operation_id: nil, language_chain: []) @parent_operation_id = parent_operation_id @operation_id = operation_id @depth = Integer(depth) @surface_path = surface_path.to_s @language_chain = Array(language_chain).map do |language| language.to_s.strip.downcase.tr('-', '_').to_sym end.freeze end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
8 9 10 |
# File 'lib/ast/merge/runtime/frame.rb', line 8 def depth @depth end |
#language_chain ⇒ Object (readonly)
Returns the value of attribute language_chain.
8 9 10 |
# File 'lib/ast/merge/runtime/frame.rb', line 8 def language_chain @language_chain end |
#operation_id ⇒ Object (readonly)
Returns the value of attribute operation_id.
8 9 10 |
# File 'lib/ast/merge/runtime/frame.rb', line 8 def operation_id @operation_id end |
#parent_operation_id ⇒ Object (readonly)
Returns the value of attribute parent_operation_id.
8 9 10 |
# File 'lib/ast/merge/runtime/frame.rb', line 8 def parent_operation_id @parent_operation_id end |
#surface_path ⇒ Object (readonly)
Returns the value of attribute surface_path.
8 9 10 |
# File 'lib/ast/merge/runtime/frame.rb', line 8 def surface_path @surface_path end |
Instance Method Details
#root? ⇒ Boolean
24 25 26 |
# File 'lib/ast/merge/runtime/frame.rb', line 24 def root? parent_operation_id.nil? end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ast/merge/runtime/frame.rb', line 28 def to_h { parent_operation_id: parent_operation_id, operation_id: operation_id, depth: depth, surface_path: surface_path, language_chain: language_chain, root: root? } end |