Class: Fmt::ArgumentsParser

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

Overview

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

Constant Summary

Constants inherited from Parser

Parser::Cache

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

esc

Constructor Details

#initialize(tokens = []) ⇒ ArgumentsParser

Constructor



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

def initialize(tokens = [])
  @tokens = tokens
end

Instance Attribute Details

#tokensObject (readonly)

: Array – wrapped ripper tokens



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

def tokens
  @tokens
end

Instance Method Details

#parseObject

Parses the urtext (original source code)



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

def parse
  cache(tokens.to_s) { super }
end