Class: HFAM::DSL
- Inherits:
-
Object
show all
- Defined in:
- lib/hfam/dsl.rb
Overview
Should respond to method :tokenize and :route
Instance Method Summary
collapse
Constructor Details
#initialize(payload) ⇒ DSL
Returns a new instance of DSL.
4
5
6
|
# File 'lib/hfam/dsl.rb', line 4
def initialize(payload)
@payload = payload
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
25
26
27
|
# File 'lib/hfam/dsl.rb', line 25
def method_missing(method, *args, &block)
@payload.commands << [:unknown, { command: method, args: args }]
end
|
Instance Method Details
#route ⇒ Object
21
22
23
|
# File 'lib/hfam/dsl.rb', line 21
def route
@command_set.run_command
end
|
#source(file, options = {}) ⇒ Object
16
17
18
19
|
# File 'lib/hfam/dsl.rb', line 16
def source(file, options = {})
symlink(file)
@payload.commands << [:source, "#{dotfiles_path}/#{file}", dest_path(options)]
end
|
#symlink(file, options = {}) ⇒ Object
12
13
14
|
# File 'lib/hfam/dsl.rb', line 12
def symlink(file, options = {})
@payload.commands << [:symlink, "#{dotfiles_path}/#{file}", dest_path(options)]
end
|
#tokenize ⇒ Object
8
9
10
|
# File 'lib/hfam/dsl.rb', line 8
def tokenize
raw_commands = eval(::File.open("#{dotfiles_path}/.hfamconfig").read)
end
|