Class: PF::QiniuProfile
- Inherits:
-
Object
- Object
- PF::QiniuProfile
- Defined in:
- lib/pf/profile/profile.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Returns the value of attribute accounts.
-
#default_account ⇒ Object
Returns the value of attribute default_account.
Instance Method Summary collapse
- #account(name = nil) ⇒ Object
- #exist_account?(name) ⇒ Boolean
-
#initialize(parent) ⇒ QiniuProfile
constructor
A new instance of QiniuProfile.
- #save ⇒ Object
Constructor Details
#initialize(parent) ⇒ QiniuProfile
Returns a new instance of QiniuProfile.
52 53 54 55 |
# File 'lib/pf/profile/profile.rb', line 52 def initialize(parent) @parent = parent @accounts = [] end |
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
50 51 52 |
# File 'lib/pf/profile/profile.rb', line 50 def accounts @accounts end |
#default_account ⇒ Object
Returns the value of attribute default_account.
50 51 52 |
# File 'lib/pf/profile/profile.rb', line 50 def default_account @default_account end |
Instance Method Details
#account(name = nil) ⇒ Object
61 62 63 64 |
# File 'lib/pf/profile/profile.rb', line 61 def account(name=nil) name = @default_account if name.nil? @accounts.find { |account| account.name == name} end |
#exist_account?(name) ⇒ Boolean
57 58 59 |
# File 'lib/pf/profile/profile.rb', line 57 def exist_account?(name) !account(name).nil? end |
#save ⇒ Object
66 67 68 |
# File 'lib/pf/profile/profile.rb', line 66 def save @parent.save end |