class Syllabus::Config
Attributes
commands[R]
Public Class Methods
new(args)
click to toggle source
# File lib/syllabus/config.rb, line 9 def initialize(args) @backend = args[:backend] @hosts = nil @commands = [] instance_eval(args[:config], args[:file] || '') end
new_from_file(args)
click to toggle source
# File lib/syllabus/config.rb, line 4 def self.new_from_file(args) config = File.read(args[:file]) new(config: config, file: args[:file], backend: args[:backend]) end
Public Instance Methods
hosts(arg = nil)
click to toggle source
# File lib/syllabus/config.rb, line 16 def hosts(arg = nil) if arg @hosts = arg.kind_of?(Proc) ? arg.call : arg end @hosts end
method_missing(name, *args)
click to toggle source
# File lib/syllabus/config.rb, line 32 def method_missing(name, *args) command = @backend.commands.send(name, *args) @commands.push(command) end
path(arg = nil)
click to toggle source
# File lib/syllabus/config.rb, line 24 def path(arg = nil) if arg @path = arg.kind_of?(Array) ? arg : arg.split(':') end @path end