Module: Pakyow::Support::Definable::CommonMethods Private

Defined in:
lib/pakyow/support/definable.rb

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.

Instance Method Summary collapse

Instance Method Details

#state(type = nil) ⇒ 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.

Returns registered state instances. If type is passed, returns state of that type.



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/pakyow/support/definable.rb', line 148

def state(type = nil)
  if instance_variable_defined?(:@__state)
    return @__state if type.nil?

    if @__state && @__state.key?(type)
      @__state[type].instances
    else
      []
    end
  else
    {}
  end
end