Class: Yeti::Context
- Inherits:
-
Object
- Object
- Yeti::Context
- Defined in:
- lib/yeti/context.rb
Defined Under Namespace
Classes: NoAccount
Instance Method Summary collapse
- #account ⇒ Object
- #find_account_by_id(id) ⇒ Object
-
#initialize(hash = {}) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(hash = {}) ⇒ Context
Returns a new instance of Context.
9 10 11 |
# File 'lib/yeti/context.rb', line 9 def initialize(hash={}) @hash = hash end |
Instance Method Details
#account ⇒ Object
13 14 15 16 17 18 |
# File 'lib/yeti/context.rb', line 13 def account @account ||= begin given_account_id = hash[:account_id] (find_account_by_id given_account_id if given_account_id) || no_account end end |
#find_account_by_id(id) ⇒ Object
20 21 22 |
# File 'lib/yeti/context.rb', line 20 def find_account_by_id(id) raise NotImplementedError, "#{self.class}#find_account_by_id" end |