Class: RLM::CodeExtractor
- Inherits:
-
Object
- Object
- RLM::CodeExtractor
- Defined in:
- lib/rlm/code_extractor.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- CODE_OPEN =
"<rlm-code>"- CODE_CLOSE =
"</rlm-code>"- FINAL_OPEN =
"<rlm-final>"- FINAL_CLOSE =
"</rlm-final>"- KNOWN_TAG_PATTERN =
%r{</?rlm-(?:code|final)>}- TYPES =
%i[code final].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extract(response) ⇒ Object
40 41 42 |
# File 'lib/rlm/code_extractor.rb', line 40 def self.extract(response) new.extract(response) end |
Instance Method Details
#extract(response) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rlm/code_extractor.rb', line 44 def extract(response) raise ParseError, "response must be a String" unless response.is_a?(String) = (response) raise ParseError, "response must contain one rlm-code or rlm-final block" if .empty? type = block_type_for() block = extract_block(response, , type) Result.new(type: type, content: parse_content(type, block)) end |