Class: RLM::CodeExtractor::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/rlm/code_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, content:) ⇒ Result

Returns a new instance of Result.

Raises:

  • (ArgumentError)


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

#contentObject (readonly)

Returns the value of attribute content.



15
16
17
# File 'lib/rlm/code_extractor.rb', line 15

def content
  @content
end

#typeObject (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

Returns:

  • (Boolean)


24
25
26
# File 'lib/rlm/code_extractor.rb', line 24

def code?
  type == :code
end

#final?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rlm/code_extractor.rb', line 28

def final?
  type == :final
end

#to_hObject



32
33
34
35
36
37
# File 'lib/rlm/code_extractor.rb', line 32

def to_h
  {
    type: type,
    content: content
  }
end