module Pakyow::Support::Definable
# Do something with some_arg, etc. defined!(&block) end end
@api private
Public Class Methods
included(base)
click to toggle source
# File lib/pakyow/support/definable.rb, line 40 def self.included(base) base.include CommonMethods base.extend ClassMethods, CommonMethods base.prepend Initializer base.extend Support::Makeable base.instance_variable_set(:@__state, {}) end
Public Instance Methods
defined!(&block)
click to toggle source
@api private
# File lib/pakyow/support/definable.rb, line 49 def defined!(&block) # set instance level state self.instance_eval(&block) if block_given? # merge global state @__state.each do |name, state| state.instances.concat(self.class.__state[name].instances) end # merge inherited state if inherited = self.class.__inherited_state @__state.each do |name, state| instances = state.instances instances.concat(inherited[name].instances) if inherited[name] end end end