class Buff::Config::Ruby::Evaluator
Attributes
attributes[R]
Public Class Methods
new(contents, path=nil, context=nil)
click to toggle source
@param [String] contents @param [String] path @param [Object] context
# File lib/buff/config/ruby.rb, line 24 def initialize(contents, path=nil, context=nil) path ||= "(buff-config)" @context = context @attributes = Hash.new instance_eval(contents, path) rescue Exception => ex raise Errors::InvalidConfig, ex end
parse(contents, path=nil, context=nil)
click to toggle source
Parse the contents of the Ruby
file into a Hash.
@param [String] contents @param [String] path file that should be used as __FILE__
during eval
@param [Object] context the parent Config
object
@return [Hash]
# File lib/buff/config/ruby.rb, line 16 def parse(contents, path=nil, context=nil) self.new(contents, path, context).send(:attributes) end
Public Instance Methods
platform_specific_path(path)
click to toggle source
@see {Buff::Config::Ruby.platform_specific_path}
# File lib/buff/config/ruby.rb, line 34 def platform_specific_path(path) Buff::Config::Ruby.platform_specific_path(path) end
Private Instance Methods
method_missing(m, *args, &block)
click to toggle source
# File lib/buff/config/ruby.rb, line 42 def method_missing(m, *args, &block) if args.size > 0 attributes[m.to_sym] = (args.length == 1) ? args[0] : args elsif @context && @context.respond_to?(m) @context.send(m, *args, &block) else Proxy.new end end