Class: Fmt::PipelineParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/fmt/parsers/pipeline_parser.rb

Overview

Parses a pipeline from a string and builds an AST (Abstract Syntax Tree)

Constant Summary

Constants inherited from Parser

Fmt::Parser::Cache

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

esc

Constructor Details

#initialize(urtext = "") ⇒ PipelineParser

Constructor



10
11
12
# File 'lib/fmt/parsers/pipeline_parser.rb', line 10

def initialize(urtext = "")
  @urtext = urtext.to_s.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "?")
end

Instance Attribute Details

#urtextObject (readonly)

: String – original source code



14
15
16
# File 'lib/fmt/parsers/pipeline_parser.rb', line 14

def urtext
  @urtext
end

Instance Method Details

#parseObject

Parses the urtext (original source code)



18
19
20
# File 'lib/fmt/parsers/pipeline_parser.rb', line 18

def parse
  cache(urtext) { super }
end