Class: Ast::Merge::Runtime::Surface
- Inherits:
-
Object
- Object
- Ast::Merge::Runtime::Surface
- Defined in:
- lib/ast/merge/runtime/surface.rb
Overview
Value object describing one owned merge surface.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#declared_language ⇒ Object
readonly
Returns the value of attribute declared_language.
-
#effective_language ⇒ Object
readonly
Returns the value of attribute effective_language.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#parent_address ⇒ Object
readonly
Returns the value of attribute parent_address.
-
#reconstruction_strategy ⇒ Object
readonly
Returns the value of attribute reconstruction_strategy.
-
#span ⇒ Object
readonly
Returns the value of attribute span.
-
#surface_kind ⇒ Object
readonly
Returns the value of attribute surface_kind.
Instance Method Summary collapse
- #embedded? ⇒ Boolean
-
#initialize(surface_kind:, address:, declared_language: nil, effective_language: nil, parent_address: nil, span: nil, reconstruction_strategy: nil, metadata: {}) ⇒ Surface
constructor
A new instance of Surface.
- #root? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(surface_kind:, address:, declared_language: nil, effective_language: nil, parent_address: nil, span: nil, reconstruction_strategy: nil, metadata: {}) ⇒ Surface
Returns a new instance of Surface.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ast/merge/runtime/surface.rb', line 17 def initialize( surface_kind:, address:, declared_language: nil, effective_language: nil, parent_address: nil, span: nil, reconstruction_strategy: nil, metadata: {} ) @surface_kind = surface_kind&.to_sym @declared_language = normalize_language(declared_language) @effective_language = normalize_language(effective_language) @address = address.to_s @parent_address = parent_address&.to_s @span = span @reconstruction_strategy = reconstruction_strategy&.to_sym @metadata = .dup.freeze end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def address @address end |
#declared_language ⇒ Object (readonly)
Returns the value of attribute declared_language.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def declared_language @declared_language end |
#effective_language ⇒ Object (readonly)
Returns the value of attribute effective_language.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def effective_language @effective_language end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def @metadata end |
#parent_address ⇒ Object (readonly)
Returns the value of attribute parent_address.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def parent_address @parent_address end |
#reconstruction_strategy ⇒ Object (readonly)
Returns the value of attribute reconstruction_strategy.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def reconstruction_strategy @reconstruction_strategy end |
#span ⇒ Object (readonly)
Returns the value of attribute span.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def span @span end |
#surface_kind ⇒ Object (readonly)
Returns the value of attribute surface_kind.
8 9 10 |
# File 'lib/ast/merge/runtime/surface.rb', line 8 def surface_kind @surface_kind end |
Instance Method Details
#embedded? ⇒ Boolean
36 37 38 |
# File 'lib/ast/merge/runtime/surface.rb', line 36 def !parent_address.nil? end |
#root? ⇒ Boolean
40 41 42 |
# File 'lib/ast/merge/runtime/surface.rb', line 40 def root? ! end |
#to_h ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ast/merge/runtime/surface.rb', line 44 def to_h { surface_kind: surface_kind, declared_language: declared_language, effective_language: effective_language, address: address, parent_address: parent_address, span: span, reconstruction_strategy: reconstruction_strategy, metadata: , embedded: }.compact end |