Module: Gexp::Object

Extended by:
ActiveSupport::Concern
Includes:
StateDefinition::StateMachine
Included in:
ItemExample
Defined in:
lib/gexp/object.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/gexp/object.rb', line 9

def self.included(base)
  self.linked_config base
end

.linked_config(base) ⇒ Object

Определяет конфиг как переменную класса Определяя ключ конфига как имя класса



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gexp/object.rb', line 17

def self.linked_config(base)
  @config_name = base.name.gsub('::', '.').underscore
  @end_class_name = base.name.split('::').last

  @config = Configuration.for(@config_name)

  base.instance_variable_set("@config_name", @config_name)
  base.instance_variable_set("@config", @config)

  if @config.respond_to? :states
    base.define_state_by @config.states.to_hash
  end
end

Instance Method Details

#configObject



31
32
33
# File 'lib/gexp/object.rb', line 31

def config
  self.class.config
end