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



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

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

.plugin(name, *args) ⇒ Object



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

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

  plugin = name.is_a?(Module) ? name : Plugins.const_get(Inflector.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, *args) if plugin.respond_to?(:apply)
end