Class: Gearhead::Gear

Instance Attribute Summary collapse

Instance Method Summary collapse

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

included, #includes

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

#finder, included

Methods included from Extensions::CustomActions

#collection_action, #custom_action, included, #member_action

Methods included from Extensions::Associations

#belongs_to, included

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, options = {})
  @resource_class = resource_class
  @resource = @resource_class.to_s.constantize
  @options = options

  self.class.settings.each do |k,v|
    define_gear_setting k, v
  end
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



40
41
42
# File 'lib/gearhead/gear.rb', line 40

def resource
  @resource
end

Instance Method Details

#pathObject



52
53
54
# File 'lib/gearhead/gear.rb', line 52

def path
  @options[:path] || @resource.model_name.route_key
end