Module: Pakyow::Support::Definable Private
- Defined in:
- lib/pakyow/support/definable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
# Do something with some_arg, etc.
defined!(&block)
end
end
Defined Under Namespace
Modules: ClassMethods, CommonMethods, Initializer
Class Method Summary collapse
- .included(base) ⇒ Object private
Instance Method Summary collapse
- #defined!(&block) ⇒ Object private
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 43 44 45 46 |
# 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 |
Instance Method Details
#defined!(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# 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 |