Module: SmoothOperator::ResourceName
- Included in:
- OpenStruct
- Defined in:
- lib/smooth_operator/resource_name.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#resource_name(default_bypass = nil) ⇒ Object
12 13 14 15 16 |
# File 'lib/smooth_operator/resource_name.rb', line 12 def resource_name(default_bypass = nil) return @resource_name if defined?(@resource_name) (Helpers.super_method(self, :resource_name, true) || (default_bypass ? nil : self.model_name.to_s.underscore)) end |
#resources_name(default_bypass = nil) ⇒ Object
4 5 6 7 8 |
# File 'lib/smooth_operator/resource_name.rb', line 4 def resources_name(default_bypass = nil) return @resources_name if defined?(@resources_name) (Helpers.super_method(self, :resources_name, true) || (default_bypass ? nil : self.resource_name.pluralize)) end |
Instance Method Details
#custom_model_name ⇒ Object
34 35 36 |
# File 'lib/smooth_operator/resource_name.rb', line 34 def custom_model_name Helpers.get_instance_variable(self, :custom_model_name, nil) end |
#model_name ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/smooth_operator/resource_name.rb', line 20 def model_name return '' if custom_model_name == :none if defined? ActiveModel smooth_model_name else custom_model_name ||= name.split('::').last.underscore.capitalize end end |
#model_name=(name) ⇒ Object
30 31 32 |
# File 'lib/smooth_operator/resource_name.rb', line 30 def model_name=(name) @custom_model_name = name end |