Class: Sapluuna
- Inherits:
-
Object
show all
- Includes:
- ClassHelpers
- Defined in:
- lib/sapluuna/ip.rb,
lib/sapluuna/cli.rb,
lib/sapluuna/parser.rb,
lib/sapluuna/context.rb,
lib/sapluuna/sapluuna.rb,
lib/sapluuna/class_helpers.rb
Defined Under Namespace
Modules: ClassHelpers
Classes: CLI, Context, Error, IP, InvalidOption, InvalidType, MissingOption, Parser
Constant Summary
collapse
- Log =
Logger.new STDERR
Instance Method Summary
collapse
Constructor Details
#initialize(opts) ⇒ Sapluuna
Returns a new instance of Sapluuna.
14
15
16
17
18
19
|
# File 'lib/sapluuna/sapluuna.rb', line 14
def initialize opts
@context = (opts[:context] or Context)
@want_labels = read_labels (opts[:labels] or [])
@context = @context.new(opts) if @context.class == Class
@parser = Parser.new
end
|
Instance Method Details
#discovered_variables ⇒ Object
21
22
23
|
# File 'lib/sapluuna/sapluuna.rb', line 21
def discovered_variables
@context.discovered_variables
end
|
#parse(input) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/sapluuna/sapluuna.rb', line 29
def parse input
@parser.parse(input).each do |cfg|
type = cfg.shift
case type
when :template
template cfg
else
raise InvalidType, "#{type} was not recognized by parser"
end
end
@context.str
end
|
#variables ⇒ Object
25
26
27
|
# File 'lib/sapluuna/sapluuna.rb', line 25
def variables
@context.variables
end
|