Sha256: caaa379b38ed1ee5ad27481a8612920d7ac014daa126351956843db461882c2f
Contents?: true
Size: 888 Bytes
Versions: 33
Compression:
Stored size: 888 Bytes
Contents
require_relative 'parameter_set' module RakeFactory module Parameters def self.included(base) base.extend(ClassMethods) end def initialize(*args, &configuration_block) arity = self.method(:initialize).super_method.arity super(*args.slice(0, arity), &configuration_block) setup_parameter_defaults end def parameter_values self.class.parameter_set.read_from(self) end def setup_parameter_defaults self.class.parameter_set.apply_defaults_to(self) end def check_parameter_requirements self.class.parameter_set.enforce_requirements_on(self) end module ClassMethods def parameter_set @parameter_set ||= ParameterSet.new end def parameter(name, options = {}) parameter = parameter_set.add(name, options) parameter.define_on(self) end end end end
Version data entries
33 entries across 33 versions & 1 rubygems