Class: Pathway::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/pathway.rb

Defined Under Namespace

Classes: DSL

Class Method Summary collapse

Class Method Details

.inherited(subclass) ⇒ Object



21
22
23
24
# File 'lib/pathway.rb', line 21

def self.inherited(subclass)
  subclass.const_set :DSL, Class.new(self::DSL)
  super
end

.plugin(name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pathway.rb', line 9

def self.plugin(name)
  require "pathway/plugins/#{Inflecto.underscore(name)}" if name.is_a?(Symbol)

  plugin = name.is_a?(Module) ? name : Plugins.const_get(Inflecto.camelize(name))

  self.extend plugin::ClassMethods if plugin.const_defined? :ClassMethods
  self.include plugin::InstanceMethods if plugin.const_defined? :InstanceMethods
  self::DSL.include plugin::DSLMethods if plugin.const_defined? :DSLMethods

  plugin.apply(self) if plugin.respond_to?(:apply)
end