Module: Lucid::Shopify::Resource::Base::ClassMethods
- Defined in:
- lib/lucid/shopify/resource/base.rb
Instance Method Summary collapse
-
#resource(resource_plural, resource_singular = nil) ⇒ Object
Set the remote API resource name for the subclass.
Instance Method Details
#resource(resource_plural, resource_singular = nil) ⇒ Object
Set the remote API resource name for the subclass. If a singular is not provided, the plural will be used, without any trailing ‘s’.
20 21 22 23 24 25 |
# File 'lib/lucid/shopify/resource/base.rb', line 20 def resource(resource_plural, resource_singular = nil) define_method(:resource) { resource_plural.to_s } define_method(:resource_singular) do resource_singular.nil? ? resource_plural.to_s.sub(/s$/, '') : resource_singular.to_s end end |