Class: Ast::Merge::SourceRender::SourceFragment
- Inherits:
-
Object
- Object
- Ast::Merge::SourceRender::SourceFragment
- Defined in:
- lib/ast/merge/source_render/fragment.rb,
sig/ast/merge.rbs
Overview
Exact whole-line range selected from one source revision.
Instance Attribute Summary collapse
-
#end_line ⇒ Integer
readonly
Returns the value of attribute end_line.
-
#metadata ⇒ Hash[untyped, untyped]
readonly
Returns the value of attribute metadata.
-
#revision ⇒ Symbol
readonly
Returns the value of attribute revision.
-
#start_line ⇒ Integer
readonly
Returns the value of attribute start_line.
Instance Method Summary collapse
-
#initialize(revision:, start_line:, end_line:, metadata: {}) ⇒ SourceFragment
constructor
A new instance of SourceFragment.
- #kind ⇒ :source
- #line_range ⇒ Range[Integer]
Constructor Details
#initialize(revision:, start_line:, end_line:, metadata: {}) ⇒ SourceFragment
Returns a new instance of SourceFragment.
10 11 12 13 14 15 16 17 |
# File 'lib/ast/merge/source_render/fragment.rb', line 10 def initialize(revision:, start_line:, end_line:, metadata: {}) @revision = revision.to_sym @start_line = Integer(start_line) @end_line = Integer(end_line) @metadata = .to_h.freeze validate! end |
Instance Attribute Details
#end_line ⇒ Integer (readonly)
Returns the value of attribute end_line.
8 9 10 |
# File 'lib/ast/merge/source_render/fragment.rb', line 8 def end_line @end_line end |
#metadata ⇒ Hash[untyped, untyped] (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/ast/merge/source_render/fragment.rb', line 8 def @metadata end |
#revision ⇒ Symbol (readonly)
Returns the value of attribute revision.
8 9 10 |
# File 'lib/ast/merge/source_render/fragment.rb', line 8 def revision @revision end |
#start_line ⇒ Integer (readonly)
Returns the value of attribute start_line.
8 9 10 |
# File 'lib/ast/merge/source_render/fragment.rb', line 8 def start_line @start_line end |
Instance Method Details
#kind ⇒ :source
19 20 21 |
# File 'lib/ast/merge/source_render/fragment.rb', line 19 def kind :source end |
#line_range ⇒ Range[Integer]
23 24 25 |
# File 'lib/ast/merge/source_render/fragment.rb', line 23 def line_range start_line..end_line end |