Class: Zedkit::Instance
Direct Known Subclasses
Instance Attribute Summary collapse
-
#locale ⇒ Object
(also: #lc)
Returns the value of attribute locale.
-
#user_key ⇒ Object
(also: #uk)
Returns the value of attribute user_key.
Instance Method Summary collapse
-
#initialize(api = {}) ⇒ Instance
constructor
A new instance of Instance.
- #method_missing(kk) ⇒ Object
- #set_with_hash(hh) ⇒ Object
Methods inherited from Hash
#flatten_zedkit_params!, #zdelete_keys!
Constructor Details
#initialize(api = {}) ⇒ Instance
Returns a new instance of Instance.
24 25 26 27 28 29 30 31 |
# File 'lib/zedkit/instances/instance.rb', line 24 def initialize(api = {}) @user_key = api[:user_key] || nil @locale = api[:locale] || :en if api.has_key?(:owner) && api.has_key?(:uuid) set_with_owner_and_uuid(api[:owner], api[:uuid]) && respond_to?(:set_with_owner_and_uuid) elsif api.has_key?(:uuid) && respond_to?(:uuid) set_with_uuid(api[:uuid]) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(kk) ⇒ Object
37 38 39 40 |
# File 'lib/zedkit/instances/instance.rb', line 37 def method_missing(kk) return self[kk.to_s] if self.has_key? kk.to_s super end |
Instance Attribute Details
#locale ⇒ Object Also known as: lc
Returns the value of attribute locale.
20 21 22 |
# File 'lib/zedkit/instances/instance.rb', line 20 def locale @locale end |
#user_key ⇒ Object Also known as: uk
Returns the value of attribute user_key.
20 21 22 |
# File 'lib/zedkit/instances/instance.rb', line 20 def user_key @user_key end |
Instance Method Details
#set_with_hash(hh) ⇒ Object
33 34 35 |
# File 'lib/zedkit/instances/instance.rb', line 33 def set_with_hash(hh) replace hh end |