Module: ModelFact::ModelHelper::ClassMethods
- Defined in:
- lib/model_fact/helpers/model_helper.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mtd, *args, &block) ⇒ Object
32
33
34
|
# File 'lib/model_fact/helpers/model_helper.rb', line 32
def method_missing(mtd, *args, &block)
ModelFact.instance(_model_key).send(mtd, *args, &block)
end
|
Instance Method Details
#_model_key ⇒ Object
28
29
30
|
# File 'lib/model_fact/helpers/model_helper.rb', line 28
def _model_key
@modelKey
end
|
#req_accessor(*fields) ⇒ Object
A way to document which fields are needed for the operational of this class
14
15
16
17
18
|
# File 'lib/model_fact/helpers/model_helper.rb', line 14
def req_accessor(*fields)
@reqFields = [] if @reqFields.nil?
@reqFields.concat(fields)
end
|
#req_fields ⇒ Object
20
21
22
|
# File 'lib/model_fact/helpers/model_helper.rb', line 20
def req_fields
(@reqFields || []).freeze
end
|
#respond_to_missing?(mtd, priv) ⇒ Boolean
36
37
38
|
# File 'lib/model_fact/helpers/model_helper.rb', line 36
def respond_to_missing?(mtd, priv)
ModelFact.instance(_model_key).respond_to_missing?(mtd, priv)
end
|
#set_model_key(key) ⇒ Object
24
25
26
|
# File 'lib/model_fact/helpers/model_helper.rb', line 24
def set_model_key(key)
@modelKey = key
end
|