Class: Twobook::AccountQuery::NameQuery

Inherits:
Twobook::AccountQuery show all
Defined in:
lib/twobook/account_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Twobook::AccountQuery

#after, #and, #named, named, none, #none, #none?, #or, where, #where

Constructor Details

#initialize(name, account: nil) ⇒ NameQuery

Returns a new instance of NameQuery.



159
160
161
162
# File 'lib/twobook/account_query.rb', line 159

def initialize(name, account: nil)
  @name = name
  @account = 
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



157
158
159
# File 'lib/twobook/account_query.rb', line 157

def name
  @name
end

Instance Method Details

#construct_accountObject



164
165
166
167
# File 'lib/twobook/account_query.rb', line 164

def 
  raise 'Could not construct an account from this name query: no data or category' if @account.nil?
  @account
end

#on(accounts) ⇒ Object



169
170
171
# File 'lib/twobook/account_query.rb', line 169

def on(accounts)
  accounts.select { || .name == @name }
end