Module: ModFactor::Owner::ClassMethods

Defined in:
lib/mod_factor/owner.rb

Instance Method Summary collapse

Instance Method Details

#factor(name, options = {}) ⇒ Object



93
94
95
96
# File 'lib/mod_factor/owner.rb', line 93

def factor name, options = {} 
	attr_accessor name
	factor_define[name] = options
end

#factor_defineObject



102
103
104
# File 'lib/mod_factor/owner.rb', line 102

def factor_define
	@factor_define ||= {}
end

#factors(model, options = {}) ⇒ Object



87
88
89
90
91
# File 'lib/mod_factor/owner.rb', line 87

def factors model, options = {}
	has_many model, :as=>:owner
	@factor_model = model
	yield if block_given?
end

#generate_listObject



98
99
100
# File 'lib/mod_factor/owner.rb', line 98

def generate_list
	@generate_list ||= []
end

#properties(model, options = {}) ⇒ Object



114
115
116
117
118
# File 'lib/mod_factor/owner.rb', line 114

def properties model, options = {}
	has_many model, :as=>:owner
	@property_model = model
	yield if block_given?
end

#property(name, type, options = {}) ⇒ Object



120
121
122
123
124
# File 'lib/mod_factor/owner.rb', line 120

def property name, type, options = {}
	attr_accessor name
	options[:type] = type
	property_define[name] = options
end

#property_defineObject



110
111
112
# File 'lib/mod_factor/owner.rb', line 110

def property_define
	@property_define ||= {}
end