Class: Gearhead::Gear
- Inherits:
-
Object
- Object
- Gearhead::Gear
- Includes:
- Extensions::Actions, Extensions::Associations, Extensions::Attributes, Extensions::CustomActions, Extensions::Finder, Extensions::Pagination, Extensions::PermittedParams, Extensions::Querying, Extensions::Scoping, Extensions::Serialization, Settings
- Defined in:
- lib/gearhead/gear.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource_class, options = {}) ⇒ Gear
constructor
A new instance of Gear.
- #path ⇒ Object
Methods included from Extensions::Serialization
#collection_serializer, included, #serializer, #serializer_adapter, #serializer_class
Methods included from Extensions::Scoping
#default_scope, included, #register_scope
Methods included from Extensions::Querying
Methods included from Extensions::PermittedParams
included, #permit_params, #permitted_attributes, #permitted_params
Methods included from Extensions::Pagination
included, #paginate, #paginate?, #pagination_total, #per_page
Methods included from Extensions::Finder
Methods included from Extensions::CustomActions
#collection_action, #custom_action, included, #member_action
Methods included from Extensions::Associations
Methods included from Extensions::Attributes
#_gear_attributes, #attribute, #attributes, #default_attributes, included
Methods included from Extensions::Actions
#action_enabled?, #actions, #disable_actions, included
Methods included from Settings
#define_gear_setting, included
Constructor Details
#initialize(resource_class, options = {}) ⇒ Gear
Returns a new instance of Gear.
42 43 44 45 46 47 48 49 50 |
# File 'lib/gearhead/gear.rb', line 42 def initialize(resource_class, = {}) @resource_class = resource_class @resource = @resource_class.to_s.constantize @options = self.class.settings.each do |k,v| define_gear_setting k, v end end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
40 41 42 |
# File 'lib/gearhead/gear.rb', line 40 def resource @resource end |
Instance Method Details
#path ⇒ Object
52 53 54 |
# File 'lib/gearhead/gear.rb', line 52 def path @options[:path] || @resource.model_name.route_key end |