Class: Strapper::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/strapper/parser.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/strapper/parser.rb', line 18

def method_missing(method, *args, &block)
  if Registry.keyword?(method)
    Registry.class_for_keyword(method).new(*args).run
  else
    super
  end
end

Instance Method Details

#brew(name, version = nil) ⇒ Object



10
11
12
# File 'lib/strapper/parser.rb', line 10

def brew(name, version=nil)
  Brew.new(name, version).run
end

#cmd(cmd_to_run) ⇒ Object



14
15
16
# File 'lib/strapper/parser.rb', line 14

def cmd(cmd_to_run)
  Cmd.new(cmd_to_run).run
end

#eval_strapfile(strapfile) ⇒ Object



5
6
7
8
# File 'lib/strapper/parser.rb', line 5

def eval_strapfile(strapfile)
  contents = File.open(strapfile, "rb") {|f| f.read }
  instance_eval(contents)
end