Class: RLM::CodeExtractor::Result
- Inherits:
-
Object
- Object
- RLM::CodeExtractor::Result
- Defined in:
- lib/rlm/code_extractor.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #code? ⇒ Boolean
- #final? ⇒ Boolean
-
#initialize(type:, content:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, content:) ⇒ Result
Returns a new instance of Result.
17 18 19 20 21 22 |
# File 'lib/rlm/code_extractor.rb', line 17 def initialize(type:, content:) raise ArgumentError, "Unknown code extraction result type: #{type.inspect}" unless TYPES.include?(type) @type = type @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
15 16 17 |
# File 'lib/rlm/code_extractor.rb', line 15 def content @content end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
15 16 17 |
# File 'lib/rlm/code_extractor.rb', line 15 def type @type end |
Instance Method Details
#code? ⇒ Boolean
24 25 26 |
# File 'lib/rlm/code_extractor.rb', line 24 def code? type == :code end |
#final? ⇒ Boolean
28 29 30 |
# File 'lib/rlm/code_extractor.rb', line 28 def final? type == :final end |
#to_h ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rlm/code_extractor.rb', line 32 def to_h { type: type, content: content } end |