Module: Sourcescrub::Utils::SsModel
- Included in:
- Apis::Companies, Apis::Sources
- Defined in:
- lib/sourcescrub/utils/ss_model.rb
Overview
API Request
Instance Attribute Summary collapse
-
#model_type ⇒ Object
Returns the value of attribute model_type.
Instance Method Summary collapse
- #exact_kclass_object ⇒ Object
- #kclass_name ⇒ Object
-
#sobject ⇒ Object
module_function.
Instance Attribute Details
#model_type ⇒ Object
Returns the value of attribute model_type.
8 9 10 |
# File 'lib/sourcescrub/utils/ss_model.rb', line 8 def model_type @model_type end |
Instance Method Details
#exact_kclass_object ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sourcescrub/utils/ss_model.rb', line 20 def exact_kclass_object return model_type if model_type.is_a?(Class) ss_type = [ 'Sourcescrub', 'Models', model_type.split('_').map(&:capitalize).join ].join('::') Kernel.const_get("::#{ss_type}") end |
#kclass_name ⇒ Object
16 17 18 |
# File 'lib/sourcescrub/utils/ss_model.rb', line 16 def kclass_name @kclass_name ||= exact_kclass_object end |
#sobject ⇒ Object
module_function
12 13 14 |
# File 'lib/sourcescrub/utils/ss_model.rb', line 12 def sobject kclass_name.new end |