Class: Spree::Extension
- Includes:
- Annotatable, Simpleton
- Defined in:
- lib/spree/extension.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
writeonly
Sets the attribute active.
Class Method Summary collapse
- .activate_extension ⇒ Object (also: activate)
- .define_routes(&block) ⇒ Object
- .inherited(subclass) ⇒ Object
- .meta ⇒ Object
- .route_definitions ⇒ Object
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#meta ⇒ Object
def admin AdminUI.instance end.
- #migrator ⇒ Object
Methods included from Annotatable
Methods included from Simpleton
Instance Attribute Details
#active=(value) ⇒ Object (writeonly)
Sets the attribute active
12 13 14 |
# File 'lib/spree/extension.rb', line 12 def active=(value) @active = value end |
Class Method Details
.activate_extension ⇒ Object Also known as: activate
32 33 34 35 36 37 |
# File 'lib/spree/extension.rb', line 32 def activate_extension return if instance.active? instance.activate if instance.respond_to? :activate #ActionController::Routing::Routes.reload instance.active = true end |
.define_routes(&block) ⇒ Object
40 41 42 |
# File 'lib/spree/extension.rb', line 40 def define_routes(&block) route_definitions << block end |
.inherited(subclass) ⇒ Object
44 45 46 |
# File 'lib/spree/extension.rb', line 44 def inherited(subclass) subclass.extension_name = subclass.name.to_name('Extension') end |
.meta ⇒ Object
48 49 50 |
# File 'lib/spree/extension.rb', line 48 def Spree::ExtensionMeta.find_or_create_by_name(extension_name) end |
.route_definitions ⇒ Object
52 53 54 |
# File 'lib/spree/extension.rb', line 52 def route_definitions @route_definitions ||= [] end |
Instance Method Details
#active? ⇒ Boolean
14 15 16 |
# File 'lib/spree/extension.rb', line 14 def active? @active end |
#meta ⇒ Object
def admin
AdminUI.instance
end
26 27 28 |
# File 'lib/spree/extension.rb', line 26 def self.class. end |
#migrator ⇒ Object
18 19 20 |
# File 'lib/spree/extension.rb', line 18 def migrator ExtensionMigrator.new(self) end |