id
int32 0
24.9k
| repo
stringlengths 5
58
| path
stringlengths 9
168
| func_name
stringlengths 9
130
| original_string
stringlengths 66
10.5k
| language
stringclasses 1
value | code
stringlengths 66
10.5k
| code_tokens
list | docstring
stringlengths 8
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 94
266
|
|---|---|---|---|---|---|---|---|---|---|---|---|
20,600
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/resources/item_resource.rb
|
Promisepay.ItemResource.find
|
def find(id, type = :full)
case type
when :full
response = JSON.parse(@client.get("items/#{id}").body)
Promisepay::Item.new(@client, response['items'])
when :status
response = JSON.parse(@client.get("items/#{id}/status").body)
Promisepay::Item.new(@client, response['items'])
end
end
|
ruby
|
def find(id, type = :full)
case type
when :full
response = JSON.parse(@client.get("items/#{id}").body)
Promisepay::Item.new(@client, response['items'])
when :status
response = JSON.parse(@client.get("items/#{id}/status").body)
Promisepay::Item.new(@client, response['items'])
end
end
|
[
"def",
"find",
"(",
"id",
",",
"type",
"=",
":full",
")",
"case",
"type",
"when",
":full",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"items/#{id}\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"Item",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'items'",
"]",
")",
"when",
":status",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"items/#{id}/status\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"Item",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'items'",
"]",
")",
"end",
"end"
] |
Get a single item for a marketplace
@see https://reference.promisepay.com/#show-item
@param id [String] Marketplace item ID.
@return [Promisepay::Item]
|
[
"Get",
"a",
"single",
"item",
"for",
"a",
"marketplace"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/resources/item_resource.rb#L30-L39
|
20,601
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/user.rb
|
Promisepay.User.bank_account
|
def bank_account
response = JSON.parse(@client.get("users/#{send(:id)}/bank_accounts").body)
Promisepay::BankAccount.new(@client, response['bank_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
ruby
|
def bank_account
response = JSON.parse(@client.get("users/#{send(:id)}/bank_accounts").body)
Promisepay::BankAccount.new(@client, response['bank_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
[
"def",
"bank_account",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"users/#{send(:id)}/bank_accounts\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"BankAccount",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'bank_accounts'",
"]",
")",
"rescue",
"Promisepay",
"::",
"UnprocessableEntity",
"nil",
"end"
] |
Gets Bank account for a user on a marketplace.
@see https://reference.promisepay.com/#show-user-bank-account
@return [Promisepay::BankAccount]
|
[
"Gets",
"Bank",
"account",
"for",
"a",
"user",
"on",
"a",
"marketplace",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/user.rb#L34-L39
|
20,602
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/user.rb
|
Promisepay.User.card_account
|
def card_account
response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
Promisepay::CardAccount.new(@client, response['card_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
ruby
|
def card_account
response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
Promisepay::CardAccount.new(@client, response['card_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
[
"def",
"card_account",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"users/#{send(:id)}/card_accounts\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"CardAccount",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'card_accounts'",
"]",
")",
"rescue",
"Promisepay",
"::",
"UnprocessableEntity",
"nil",
"end"
] |
Gets Card account for a user on a marketplace.
@see https://reference.promisepay.com/#show-user-card-account
@return [Promisepay::CardAccount]
|
[
"Gets",
"Card",
"account",
"for",
"a",
"user",
"on",
"a",
"marketplace",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/user.rb#L46-L51
|
20,603
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/user.rb
|
Promisepay.User.paypal_account
|
def paypal_account
response = JSON.parse(@client.get("users/#{send(:id)}/paypal_accounts").body)
Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
ruby
|
def paypal_account
response = JSON.parse(@client.get("users/#{send(:id)}/paypal_accounts").body)
Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
rescue Promisepay::UnprocessableEntity
nil
end
|
[
"def",
"paypal_account",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"users/#{send(:id)}/paypal_accounts\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"PaypalAccount",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'paypal_accounts'",
"]",
")",
"rescue",
"Promisepay",
"::",
"UnprocessableEntity",
"nil",
"end"
] |
Gets PayPal account for a user on a marketplace.
@see https://reference.promisepay.com/#show-user-paypal-account
@return [Promisepay::PaypalAccount]
|
[
"Gets",
"PayPal",
"account",
"for",
"a",
"user",
"on",
"a",
"marketplace",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/user.rb#L58-L63
|
20,604
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/user.rb
|
Promisepay.User.disbursement_account
|
def disbursement_account(account_id)
options = { account_id: account_id }
JSON.parse(@client.post("users/#{send(:id)}/disbursement_account", options).body)
true
end
|
ruby
|
def disbursement_account(account_id)
options = { account_id: account_id }
JSON.parse(@client.post("users/#{send(:id)}/disbursement_account", options).body)
true
end
|
[
"def",
"disbursement_account",
"(",
"account_id",
")",
"options",
"=",
"{",
"account_id",
":",
"account_id",
"}",
"JSON",
".",
"parse",
"(",
"@client",
".",
"post",
"(",
"\"users/#{send(:id)}/disbursement_account\"",
",",
"options",
")",
".",
"body",
")",
"true",
"end"
] |
Set the disbursement account for a user.
@see https://reference.promisepay.com/#set-user-disbursement-account
@return [Boolean]
|
[
"Set",
"the",
"disbursement",
"account",
"for",
"a",
"user",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/user.rb#L82-L86
|
20,605
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/user.rb
|
Promisepay.User.company
|
def company
response = JSON.parse(@client.get("users/#{send(:id)}/companies").body)
Promisepay::Company.new(@client, response['companies'])
rescue Promisepay::NotFound
nil
end
|
ruby
|
def company
response = JSON.parse(@client.get("users/#{send(:id)}/companies").body)
Promisepay::Company.new(@client, response['companies'])
rescue Promisepay::NotFound
nil
end
|
[
"def",
"company",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"users/#{send(:id)}/companies\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"Company",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'companies'",
"]",
")",
"rescue",
"Promisepay",
"::",
"NotFound",
"nil",
"end"
] |
Gets company for a user on a marketplace.
@see
@return [Promisepay::Company]
|
[
"Gets",
"company",
"for",
"a",
"user",
"on",
"a",
"marketplace",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/user.rb#L93-L98
|
20,606
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/resources/fee_resource.rb
|
Promisepay.FeeResource.find
|
def find(id)
response = JSON.parse(@client.get("fees/#{id}").body)
Promisepay::Fee.new(@client, response['fees'])
end
|
ruby
|
def find(id)
response = JSON.parse(@client.get("fees/#{id}").body)
Promisepay::Fee.new(@client, response['fees'])
end
|
[
"def",
"find",
"(",
"id",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"fees/#{id}\"",
")",
".",
"body",
")",
"Promisepay",
"::",
"Fee",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'fees'",
"]",
")",
"end"
] |
Get a single fee for a marketplace
@see https://reference.promisepay.com/#show-fee
@param id [String] Marketplace Fee ID.
@return [Promisepay::Fee]
|
[
"Get",
"a",
"single",
"fee",
"for",
"a",
"marketplace"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/resources/fee_resource.rb#L30-L33
|
20,607
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/resources/fee_resource.rb
|
Promisepay.FeeResource.create
|
def create(attributes)
response = JSON.parse(@client.post('fees', attributes).body)
Promisepay::Fee.new(@client, response['fees'])
end
|
ruby
|
def create(attributes)
response = JSON.parse(@client.post('fees', attributes).body)
Promisepay::Fee.new(@client, response['fees'])
end
|
[
"def",
"create",
"(",
"attributes",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"post",
"(",
"'fees'",
",",
"attributes",
")",
".",
"body",
")",
"Promisepay",
"::",
"Fee",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'fees'",
"]",
")",
"end"
] |
Create a fee for a marketplace
@see https://reference.promisepay.com/#create-fee
@param attributes [Hash] Item's attributes.
@return [Promisepay::Item]
|
[
"Create",
"a",
"fee",
"for",
"a",
"marketplace"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/resources/fee_resource.rb#L42-L45
|
20,608
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/wallet_account.rb
|
Promisepay.WalletAccount.withdraw
|
def withdraw(options = {})
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/withdraw", options).body)
response.key?('disbursements') ? response['disbursements'] : {}
end
|
ruby
|
def withdraw(options = {})
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/withdraw", options).body)
response.key?('disbursements') ? response['disbursements'] : {}
end
|
[
"def",
"withdraw",
"(",
"options",
"=",
"{",
"}",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"post",
"(",
"\"wallet_accounts/#{send(:id)}/withdraw\"",
",",
"options",
")",
".",
"body",
")",
"response",
".",
"key?",
"(",
"'disbursements'",
")",
"?",
"response",
"[",
"'disbursements'",
"]",
":",
"{",
"}",
"end"
] |
Withdraw funds from a Wallet Account to a specified disbursement account.
@see https://reference.promisepay.com/#withdraw-funds
@param options [Hash] Optional options.
@option options [String] :account_id Account to withdraw to.
@option options [Integer] :amount Amount (in cents) to withdraw.
@return [Hash]
|
[
"Withdraw",
"funds",
"from",
"a",
"Wallet",
"Account",
"to",
"a",
"specified",
"disbursement",
"account",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/wallet_account.rb#L13-L16
|
20,609
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/wallet_account.rb
|
Promisepay.WalletAccount.deposit
|
def deposit(options = {})
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/deposit", options).body)
response.key?('disbursements') ? response['disbursements'] : {}
end
|
ruby
|
def deposit(options = {})
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/deposit", options).body)
response.key?('disbursements') ? response['disbursements'] : {}
end
|
[
"def",
"deposit",
"(",
"options",
"=",
"{",
"}",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"post",
"(",
"\"wallet_accounts/#{send(:id)}/deposit\"",
",",
"options",
")",
".",
"body",
")",
"response",
".",
"key?",
"(",
"'disbursements'",
")",
"?",
"response",
"[",
"'disbursements'",
"]",
":",
"{",
"}",
"end"
] |
Deposit funds to a Wallet Account from a specified payment account.
@see https://reference.promisepay.com/#deposit-funds
@param options [Hash] Optional options.
@option options [String] :account_id Account to deposit from.
@option options [Integer] :amount Amount (in cents) to deposit.
@return [Hash]
|
[
"Deposit",
"funds",
"to",
"a",
"Wallet",
"Account",
"from",
"a",
"specified",
"payment",
"account",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/wallet_account.rb#L27-L30
|
20,610
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/wallet_account.rb
|
Promisepay.WalletAccount.user
|
def user
response = JSON.parse(@client.get("wallet_accounts/#{send(:id)}/users").body)
response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
end
|
ruby
|
def user
response = JSON.parse(@client.get("wallet_accounts/#{send(:id)}/users").body)
response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
end
|
[
"def",
"user",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"wallet_accounts/#{send(:id)}/users\"",
")",
".",
"body",
")",
"response",
".",
"key?",
"(",
"'users'",
")",
"?",
"Promisepay",
"::",
"User",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'users'",
"]",
")",
":",
"nil",
"end"
] |
Show the User the Wallet Account is associated with
@return [Promisepay::User]
|
[
"Show",
"the",
"User",
"the",
"Wallet",
"Account",
"is",
"associated",
"with"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/wallet_account.rb#L35-L38
|
20,611
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/models/transaction.rb
|
Promisepay.Transaction.fee
|
def fee
response = JSON.parse(@client.get("transactions/#{send(:id)}/fees").body)
response.key?('fees') ? Promisepay::Fee.new(@client, response['fees']) : nil
end
|
ruby
|
def fee
response = JSON.parse(@client.get("transactions/#{send(:id)}/fees").body)
response.key?('fees') ? Promisepay::Fee.new(@client, response['fees']) : nil
end
|
[
"def",
"fee",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"\"transactions/#{send(:id)}/fees\"",
")",
".",
"body",
")",
"response",
".",
"key?",
"(",
"'fees'",
")",
"?",
"Promisepay",
"::",
"Fee",
".",
"new",
"(",
"@client",
",",
"response",
"[",
"'fees'",
"]",
")",
":",
"nil",
"end"
] |
Gets a transactions fee details if applicable.
@see https://reference.promisepay.com/#shows-transaction-fees
@return [Promisepay::Fee]
|
[
"Gets",
"a",
"transactions",
"fee",
"details",
"if",
"applicable",
"."
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/models/transaction.rb#L19-L22
|
20,612
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/resources/token_resource.rb
|
Promisepay.TokenResource.create
|
def create(type = :session, attributes)
case type
when :session
if attributes && attributes[:fee_ids] && attributes[:fee_ids].is_a?(Array)
attributes[:fee_ids] = attributes[:fee_ids].join(',')
end
response = @client.get('request_session_token', attributes)
JSON.parse(response.body)
when :eui
attributes[:token_type] = 'eui'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
when :card
attributes[:token_type] = 'card'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
when :approve
attributes[:token_type] = '4'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
end
end
|
ruby
|
def create(type = :session, attributes)
case type
when :session
if attributes && attributes[:fee_ids] && attributes[:fee_ids].is_a?(Array)
attributes[:fee_ids] = attributes[:fee_ids].join(',')
end
response = @client.get('request_session_token', attributes)
JSON.parse(response.body)
when :eui
attributes[:token_type] = 'eui'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
when :card
attributes[:token_type] = 'card'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
when :approve
attributes[:token_type] = '4'
response = @client.post('token_auths/', attributes)
JSON.parse(response.body)
end
end
|
[
"def",
"create",
"(",
"type",
"=",
":session",
",",
"attributes",
")",
"case",
"type",
"when",
":session",
"if",
"attributes",
"&&",
"attributes",
"[",
":fee_ids",
"]",
"&&",
"attributes",
"[",
":fee_ids",
"]",
".",
"is_a?",
"(",
"Array",
")",
"attributes",
"[",
":fee_ids",
"]",
"=",
"attributes",
"[",
":fee_ids",
"]",
".",
"join",
"(",
"','",
")",
"end",
"response",
"=",
"@client",
".",
"get",
"(",
"'request_session_token'",
",",
"attributes",
")",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"when",
":eui",
"attributes",
"[",
":token_type",
"]",
"=",
"'eui'",
"response",
"=",
"@client",
".",
"post",
"(",
"'token_auths/'",
",",
"attributes",
")",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"when",
":card",
"attributes",
"[",
":token_type",
"]",
"=",
"'card'",
"response",
"=",
"@client",
".",
"post",
"(",
"'token_auths/'",
",",
"attributes",
")",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"when",
":approve",
"attributes",
"[",
":token_type",
"]",
"=",
"'4'",
"response",
"=",
"@client",
".",
"post",
"(",
"'token_auths/'",
",",
"attributes",
")",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"end",
"end"
] |
Create a new token for an item
@see https://reference.promisepay.com/#generate-card-token
@param attributes [Hash] Token's attributes.
@return [Hash]
|
[
"Create",
"a",
"new",
"token",
"for",
"an",
"item"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/resources/token_resource.rb#L11-L32
|
20,613
|
AssemblyPayments/promisepay-ruby
|
lib/promisepay/resources/charge_resource.rb
|
Promisepay.ChargeResource.find_all
|
def find_all(options = {})
response = JSON.parse(@client.get('charges', options).body)
charges = response.key?('charges') ? response['charges'] : []
charges.map { |attributes| Promisepay::Charge.new(@client, attributes) }
end
|
ruby
|
def find_all(options = {})
response = JSON.parse(@client.get('charges', options).body)
charges = response.key?('charges') ? response['charges'] : []
charges.map { |attributes| Promisepay::Charge.new(@client, attributes) }
end
|
[
"def",
"find_all",
"(",
"options",
"=",
"{",
"}",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"@client",
".",
"get",
"(",
"'charges'",
",",
"options",
")",
".",
"body",
")",
"charges",
"=",
"response",
".",
"key?",
"(",
"'charges'",
")",
"?",
"response",
"[",
"'charges'",
"]",
":",
"[",
"]",
"charges",
".",
"map",
"{",
"|",
"attributes",
"|",
"Promisepay",
"::",
"Charge",
".",
"new",
"(",
"@client",
",",
"attributes",
")",
"}",
"end"
] |
List all charges
@see https://reference.promisepay.com/#list-charges
@param options [Hash] Optional options.
@option options [Integer] :limit Can ask for up to 200 charges. default: 10
@option options [Integer] :offset Pagination help. default: 0
@return [Array<Promisepay::Charge>] List all charges.
|
[
"List",
"all",
"charges"
] |
da0052cbc1a542fd2044c76c2536dd29da0fdda5
|
https://github.com/AssemblyPayments/promisepay-ruby/blob/da0052cbc1a542fd2044c76c2536dd29da0fdda5/lib/promisepay/resources/charge_resource.rb#L17-L21
|
20,614
|
DocRaptor/docraptor-ruby
|
lib/docraptor/api/doc_api.rb
|
DocRaptor.DocApi.create_async_doc
|
def create_async_doc(doc, opts = {})
data, _status_code, _headers = create_async_doc_with_http_info(doc, opts)
return data
end
|
ruby
|
def create_async_doc(doc, opts = {})
data, _status_code, _headers = create_async_doc_with_http_info(doc, opts)
return data
end
|
[
"def",
"create_async_doc",
"(",
"doc",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_async_doc_with_http_info",
"(",
"doc",
",",
"opts",
")",
"return",
"data",
"end"
] |
Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
@param doc The document to be created.
@param [Hash] opts the optional parameters
@return [AsyncDoc]
|
[
"Creates",
"a",
"document",
"asynchronously",
".",
"You",
"must",
"use",
"a",
"callback",
"url",
"or",
"the",
"the",
"returned",
"status",
"id",
"and",
"the",
"status",
"api",
"to",
"find",
"out",
"when",
"it",
"completes",
".",
"Then",
"use",
"the",
"download",
"api",
"to",
"get",
"the",
"document",
"."
] |
b50a8ce235a5742afd729c7f24c9e30da6876f62
|
https://github.com/DocRaptor/docraptor-ruby/blob/b50a8ce235a5742afd729c7f24c9e30da6876f62/lib/docraptor/api/doc_api.rb#L28-L31
|
20,615
|
DocRaptor/docraptor-ruby
|
lib/docraptor/api/doc_api.rb
|
DocRaptor.DocApi.create_doc
|
def create_doc(doc, opts = {})
data, _status_code, _headers = create_doc_with_http_info(doc, opts)
return data
end
|
ruby
|
def create_doc(doc, opts = {})
data, _status_code, _headers = create_doc_with_http_info(doc, opts)
return data
end
|
[
"def",
"create_doc",
"(",
"doc",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_doc_with_http_info",
"(",
"doc",
",",
"opts",
")",
"return",
"data",
"end"
] |
Creates a document synchronously.
@param doc The document to be created.
@param [Hash] opts the optional parameters
@return [String]
|
[
"Creates",
"a",
"document",
"synchronously",
"."
] |
b50a8ce235a5742afd729c7f24c9e30da6876f62
|
https://github.com/DocRaptor/docraptor-ruby/blob/b50a8ce235a5742afd729c7f24c9e30da6876f62/lib/docraptor/api/doc_api.rb#L81-L84
|
20,616
|
DocRaptor/docraptor-ruby
|
lib/docraptor/api/doc_api.rb
|
DocRaptor.DocApi.get_async_doc
|
def get_async_doc(id, opts = {})
data, _status_code, _headers = get_async_doc_with_http_info(id, opts)
return data
end
|
ruby
|
def get_async_doc(id, opts = {})
data, _status_code, _headers = get_async_doc_with_http_info(id, opts)
return data
end
|
[
"def",
"get_async_doc",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_async_doc_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Downloads a document.
@param id The download_id returned from status request or a callback.
@param [Hash] opts the optional parameters
@return [String]
|
[
"Downloads",
"a",
"document",
"."
] |
b50a8ce235a5742afd729c7f24c9e30da6876f62
|
https://github.com/DocRaptor/docraptor-ruby/blob/b50a8ce235a5742afd729c7f24c9e30da6876f62/lib/docraptor/api/doc_api.rb#L134-L137
|
20,617
|
DocRaptor/docraptor-ruby
|
lib/docraptor/api/doc_api.rb
|
DocRaptor.DocApi.get_async_doc_status
|
def get_async_doc_status(id, opts = {})
data, _status_code, _headers = get_async_doc_status_with_http_info(id, opts)
return data
end
|
ruby
|
def get_async_doc_status(id, opts = {})
data, _status_code, _headers = get_async_doc_status_with_http_info(id, opts)
return data
end
|
[
"def",
"get_async_doc_status",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_async_doc_status_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Check on the status of an asynchronously created document.
@param id The status_id returned when creating an asynchronous document.
@param [Hash] opts the optional parameters
@return [AsyncDocStatus]
|
[
"Check",
"on",
"the",
"status",
"of",
"an",
"asynchronously",
"created",
"document",
"."
] |
b50a8ce235a5742afd729c7f24c9e30da6876f62
|
https://github.com/DocRaptor/docraptor-ruby/blob/b50a8ce235a5742afd729c7f24c9e30da6876f62/lib/docraptor/api/doc_api.rb#L187-L190
|
20,618
|
socializer/socializer
|
app/models/socializer/person.rb
|
Socializer.Person.likes
|
def likes
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_actor_id(id: guid)
.with_target_id(id: nil)
.merge(Verb.with_display_name(name: verbs_of_interest))
@likes ||= query.group(:activity_object_id).having("COUNT(1) % 2 == 1")
end
|
ruby
|
def likes
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_actor_id(id: guid)
.with_target_id(id: nil)
.merge(Verb.with_display_name(name: verbs_of_interest))
@likes ||= query.group(:activity_object_id).having("COUNT(1) % 2 == 1")
end
|
[
"def",
"likes",
"verbs_of_interest",
"=",
"%w[",
"like",
"unlike",
"]",
"query",
"=",
"Activity",
".",
"joins",
"(",
":verb",
")",
".",
"with_actor_id",
"(",
"id",
":",
"guid",
")",
".",
"with_target_id",
"(",
"id",
":",
"nil",
")",
".",
"merge",
"(",
"Verb",
".",
"with_display_name",
"(",
"name",
":",
"verbs_of_interest",
")",
")",
"@likes",
"||=",
"query",
".",
"group",
"(",
":activity_object_id",
")",
".",
"having",
"(",
"\"COUNT(1) % 2 == 1\"",
")",
"end"
] |
A list of activities the user likes
@example
current_user.likes
@return [ActiveRecord::Relation]
|
[
"A",
"list",
"of",
"activities",
"the",
"user",
"likes"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/models/socializer/person.rb#L177-L186
|
20,619
|
socializer/socializer
|
app/models/socializer/person.rb
|
Socializer.Person.likes?
|
def likes?(object)
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_activity_object_id(id: object.id)
.with_actor_id(id: guid)
.merge(Verb.with_display_name(name: verbs_of_interest))
query.count.odd?
end
|
ruby
|
def likes?(object)
verbs_of_interest = %w[like unlike]
query = Activity.joins(:verb)
.with_activity_object_id(id: object.id)
.with_actor_id(id: guid)
.merge(Verb.with_display_name(name: verbs_of_interest))
query.count.odd?
end
|
[
"def",
"likes?",
"(",
"object",
")",
"verbs_of_interest",
"=",
"%w[",
"like",
"unlike",
"]",
"query",
"=",
"Activity",
".",
"joins",
"(",
":verb",
")",
".",
"with_activity_object_id",
"(",
"id",
":",
"object",
".",
"id",
")",
".",
"with_actor_id",
"(",
"id",
":",
"guid",
")",
".",
"merge",
"(",
"Verb",
".",
"with_display_name",
"(",
"name",
":",
"verbs_of_interest",
")",
")",
"query",
".",
"count",
".",
"odd?",
"end"
] |
Checks if the person likes the object or not
@example
current_user.likes?(object)
@param object [type]
@return [TrueClass] if the person likes the object
@return [FalseClass] if the person does not like the object
|
[
"Checks",
"if",
"the",
"person",
"likes",
"the",
"object",
"or",
"not"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/models/socializer/person.rb#L197-L206
|
20,620
|
socializer/socializer
|
app/services/socializer/create_activity.rb
|
Socializer.CreateActivity.add_audience_to_activity
|
def add_audience_to_activity(activity:)
object_ids_array.each do |audience_id|
privacy = audience_privacy(audience_id: audience_id)
audience = activity.audiences.build(privacy: privacy)
audience.activity_object_id = audience_id if privacy == limited_privacy
end
end
|
ruby
|
def add_audience_to_activity(activity:)
object_ids_array.each do |audience_id|
privacy = audience_privacy(audience_id: audience_id)
audience = activity.audiences.build(privacy: privacy)
audience.activity_object_id = audience_id if privacy == limited_privacy
end
end
|
[
"def",
"add_audience_to_activity",
"(",
"activity",
":",
")",
"object_ids_array",
".",
"each",
"do",
"|",
"audience_id",
"|",
"privacy",
"=",
"audience_privacy",
"(",
"audience_id",
":",
"audience_id",
")",
"audience",
"=",
"activity",
".",
"audiences",
".",
"build",
"(",
"privacy",
":",
"privacy",
")",
"audience",
".",
"activity_object_id",
"=",
"audience_id",
"if",
"privacy",
"==",
"limited_privacy",
"end",
"end"
] |
Add an audience to the activity
@param activity: [Socializer::Activity] The activity to add the audience
to
|
[
"Add",
"an",
"audience",
"to",
"the",
"activity"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/create_activity.rb#L51-L58
|
20,621
|
socializer/socializer
|
app/services/socializer/audience_list.rb
|
Socializer.AudienceList.call
|
def call
audiences = [merge_icon(list: privacy_hash(privacy_symbol: :public),
icon: "fa-globe")]
audiences << merge_icon(list: privacy_hash(privacy_symbol: :circles),
icon: "fa-google-circles")
# TODO: may use the avatar for the user
audiences.concat(merge_icon(list: person_list, icon: "fa-user"))
audiences.concat(merge_icon(list: audience_list(type: :circles),
icon: "fa-google-circles"))
audiences.concat(merge_icon(list: audience_list(type: :groups),
icon: "fa-users"))
end
|
ruby
|
def call
audiences = [merge_icon(list: privacy_hash(privacy_symbol: :public),
icon: "fa-globe")]
audiences << merge_icon(list: privacy_hash(privacy_symbol: :circles),
icon: "fa-google-circles")
# TODO: may use the avatar for the user
audiences.concat(merge_icon(list: person_list, icon: "fa-user"))
audiences.concat(merge_icon(list: audience_list(type: :circles),
icon: "fa-google-circles"))
audiences.concat(merge_icon(list: audience_list(type: :groups),
icon: "fa-users"))
end
|
[
"def",
"call",
"audiences",
"=",
"[",
"merge_icon",
"(",
"list",
":",
"privacy_hash",
"(",
"privacy_symbol",
":",
":public",
")",
",",
"icon",
":",
"\"fa-globe\"",
")",
"]",
"audiences",
"<<",
"merge_icon",
"(",
"list",
":",
"privacy_hash",
"(",
"privacy_symbol",
":",
":circles",
")",
",",
"icon",
":",
"\"fa-google-circles\"",
")",
"# TODO: may use the avatar for the user",
"audiences",
".",
"concat",
"(",
"merge_icon",
"(",
"list",
":",
"person_list",
",",
"icon",
":",
"\"fa-user\"",
")",
")",
"audiences",
".",
"concat",
"(",
"merge_icon",
"(",
"list",
":",
"audience_list",
"(",
"type",
":",
":circles",
")",
",",
"icon",
":",
"\"fa-google-circles\"",
")",
")",
"audiences",
".",
"concat",
"(",
"merge_icon",
"(",
"list",
":",
"audience_list",
"(",
"type",
":",
":groups",
")",
",",
"icon",
":",
"\"fa-users\"",
")",
")",
"end"
] |
Instance Methods
Invoke the AudienceList instance. This is the primary public API method.
Create the audience list
@return [Array]
DISCUSS: Should this return a Set instead of an Array
|
[
"Instance",
"Methods",
"Invoke",
"the",
"AudienceList",
"instance",
".",
"This",
"is",
"the",
"primary",
"public",
"API",
"method",
".",
"Create",
"the",
"audience",
"list"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/audience_list.rb#L51-L66
|
20,622
|
socializer/socializer
|
app/services/socializer/audience_list.rb
|
Socializer.AudienceList.person_list
|
def person_list
return Person.none if @query.blank?
result = select_display_name_alias_and_guids(query: Person)
result.display_name_like(query: "%#{@query}%")
end
|
ruby
|
def person_list
return Person.none if @query.blank?
result = select_display_name_alias_and_guids(query: Person)
result.display_name_like(query: "%#{@query}%")
end
|
[
"def",
"person_list",
"return",
"Person",
".",
"none",
"if",
"@query",
".",
"blank?",
"result",
"=",
"select_display_name_alias_and_guids",
"(",
"query",
":",
"Person",
")",
"result",
".",
"display_name_like",
"(",
"query",
":",
"\"%#{@query}%\"",
")",
"end"
] |
Build the list of people based on the query
@return [ActiveRecord::NullRelation] If query is nil or "", Person.none
is returned
@return [ActiveRecord::Relation] If a query is provided the display_name
and guid
for all records that match the query
|
[
"Build",
"the",
"list",
"of",
"people",
"based",
"on",
"the",
"query"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/audience_list.rb#L107-L112
|
20,623
|
socializer/socializer
|
app/models/socializer/activity_object.rb
|
Socializer.ActivityObject.liked_by
|
def liked_by
# subquery = Activity.where(activity_object_id: id)
# people = Person.joins(activity_object: { actor_activities: :verb })
# .merge(subquery)
# likers = people.merge(Verb.by_display_name("like"))
# unlikers = people.merge(Verb.by_display_name("unlike")).pluck(:id)
query = Activity.joins(:verb).with_activity_object_id(id: id)
likers = query.merge(Verb.with_display_name(name: "like"))
unlikers = query.merge(Verb.with_display_name(name: "unlike"))
people = likers.map(&:actor)
unlikers.each do |activity|
people.delete_at people.index(activity.actor)
end
people
end
|
ruby
|
def liked_by
# subquery = Activity.where(activity_object_id: id)
# people = Person.joins(activity_object: { actor_activities: :verb })
# .merge(subquery)
# likers = people.merge(Verb.by_display_name("like"))
# unlikers = people.merge(Verb.by_display_name("unlike")).pluck(:id)
query = Activity.joins(:verb).with_activity_object_id(id: id)
likers = query.merge(Verb.with_display_name(name: "like"))
unlikers = query.merge(Verb.with_display_name(name: "unlike"))
people = likers.map(&:actor)
unlikers.each do |activity|
people.delete_at people.index(activity.actor)
end
people
end
|
[
"def",
"liked_by",
"# subquery = Activity.where(activity_object_id: id)",
"# people = Person.joins(activity_object: { actor_activities: :verb })",
"# .merge(subquery)",
"# likers = people.merge(Verb.by_display_name(\"like\"))",
"# unlikers = people.merge(Verb.by_display_name(\"unlike\")).pluck(:id)",
"query",
"=",
"Activity",
".",
"joins",
"(",
":verb",
")",
".",
"with_activity_object_id",
"(",
"id",
":",
"id",
")",
"likers",
"=",
"query",
".",
"merge",
"(",
"Verb",
".",
"with_display_name",
"(",
"name",
":",
"\"like\"",
")",
")",
"unlikers",
"=",
"query",
".",
"merge",
"(",
"Verb",
".",
"with_display_name",
"(",
"name",
":",
"\"unlike\"",
")",
")",
"people",
"=",
"likers",
".",
"map",
"(",
":actor",
")",
"unlikers",
".",
"each",
"do",
"|",
"activity",
"|",
"people",
".",
"delete_at",
"people",
".",
"index",
"(",
"activity",
".",
"actor",
")",
"end",
"people",
"end"
] |
Instance Methods
A list of people that like this activity object
@return [Array]
REFACTOR: DRY this up. Reduce database calls
|
[
"Instance",
"Methods",
"A",
"list",
"of",
"people",
"that",
"like",
"this",
"activity",
"object"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/models/socializer/activity_object.rb#L130-L147
|
20,624
|
socializer/socializer
|
app/decorators/socializer/application_decorator.rb
|
Socializer.ApplicationDecorator.time_ago
|
def time_ago(options: {})
data = { behavior: "tooltip-on-hover", time_ago: "moment.js" }
options.reverse_merge!(title: created_updated_tooltip_text, data: data)
time_tag(options: options)
end
|
ruby
|
def time_ago(options: {})
data = { behavior: "tooltip-on-hover", time_ago: "moment.js" }
options.reverse_merge!(title: created_updated_tooltip_text, data: data)
time_tag(options: options)
end
|
[
"def",
"time_ago",
"(",
"options",
":",
"{",
"}",
")",
"data",
"=",
"{",
"behavior",
":",
"\"tooltip-on-hover\"",
",",
"time_ago",
":",
"\"moment.js\"",
"}",
"options",
".",
"reverse_merge!",
"(",
"title",
":",
"created_updated_tooltip_text",
",",
"data",
":",
"data",
")",
"time_tag",
"(",
"options",
":",
"options",
")",
"end"
] |
Builds an HTML time tag
@param options [Hash]
@return [String] An HTML time tag
|
[
"Builds",
"an",
"HTML",
"time",
"tag"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/decorators/socializer/application_decorator.rb#L26-L32
|
20,625
|
socializer/socializer
|
app/services/socializer/add_default_circles.rb
|
Socializer.AddDefaultCircles.call
|
def call
create_circle(display_name: "Friends",
content: friends_content)
create_circle(display_name: "Family",
content: family_content)
create_circle(display_name: "Acquaintances",
content: acquaintances_content)
create_circle(display_name: "Following",
content: following_content)
end
|
ruby
|
def call
create_circle(display_name: "Friends",
content: friends_content)
create_circle(display_name: "Family",
content: family_content)
create_circle(display_name: "Acquaintances",
content: acquaintances_content)
create_circle(display_name: "Following",
content: following_content)
end
|
[
"def",
"call",
"create_circle",
"(",
"display_name",
":",
"\"Friends\"",
",",
"content",
":",
"friends_content",
")",
"create_circle",
"(",
"display_name",
":",
"\"Family\"",
",",
"content",
":",
"family_content",
")",
"create_circle",
"(",
"display_name",
":",
"\"Acquaintances\"",
",",
"content",
":",
"acquaintances_content",
")",
"create_circle",
"(",
"display_name",
":",
"\"Following\"",
",",
"content",
":",
"following_content",
")",
"end"
] |
Instance Methods
Invoke the AddDefaultCircles instance. This is the primary public API
method.
Add the default circles
|
[
"Instance",
"Methods",
"Invoke",
"the",
"AddDefaultCircles",
"instance",
".",
"This",
"is",
"the",
"primary",
"public",
"API",
"method",
".",
"Add",
"the",
"default",
"circles"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/add_default_circles.rb#L47-L59
|
20,626
|
socializer/socializer
|
app/services/socializer/activity_audience_list.rb
|
Socializer.ActivityAudienceList.call
|
def call
list = []
@activity.audiences.each do |audience|
if audience.public?
message = I18n.t("tooltip.public",
scope: "socializer.activities.audiences.index")
return [message]
end
list.concat(audience_list(audience: audience))
end
list.unshift(@activity.activitable_actor.activitable.display_name)
end
|
ruby
|
def call
list = []
@activity.audiences.each do |audience|
if audience.public?
message = I18n.t("tooltip.public",
scope: "socializer.activities.audiences.index")
return [message]
end
list.concat(audience_list(audience: audience))
end
list.unshift(@activity.activitable_actor.activitable.display_name)
end
|
[
"def",
"call",
"list",
"=",
"[",
"]",
"@activity",
".",
"audiences",
".",
"each",
"do",
"|",
"audience",
"|",
"if",
"audience",
".",
"public?",
"message",
"=",
"I18n",
".",
"t",
"(",
"\"tooltip.public\"",
",",
"scope",
":",
"\"socializer.activities.audiences.index\"",
")",
"return",
"[",
"message",
"]",
"end",
"list",
".",
"concat",
"(",
"audience_list",
"(",
"audience",
":",
"audience",
")",
")",
"end",
"list",
".",
"unshift",
"(",
"@activity",
".",
"activitable_actor",
".",
"activitable",
".",
"display_name",
")",
"end"
] |
Instance Methods
Invoke the ActivityAudienceList instance. This is the primary public
API method.
@return [Array]
|
[
"Instance",
"Methods",
"Invoke",
"the",
"ActivityAudienceList",
"instance",
".",
"This",
"is",
"the",
"primary",
"public",
"API",
"method",
"."
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/activity_audience_list.rb#L49-L63
|
20,627
|
socializer/socializer
|
app/services/socializer/activity_audience_list.rb
|
Socializer.ActivityAudienceList.limited_audience_list
|
def limited_audience_list(activitable:)
# The target audience is either a group or a person,
# which means we can add it as it is in the audience list.
return [activitable.display_name] unless activitable.is_a?(Circle)
activitable.contacts.pluck(:display_name)
end
|
ruby
|
def limited_audience_list(activitable:)
# The target audience is either a group or a person,
# which means we can add it as it is in the audience list.
return [activitable.display_name] unless activitable.is_a?(Circle)
activitable.contacts.pluck(:display_name)
end
|
[
"def",
"limited_audience_list",
"(",
"activitable",
":",
")",
"# The target audience is either a group or a person,",
"# which means we can add it as it is in the audience list.",
"return",
"[",
"activitable",
".",
"display_name",
"]",
"unless",
"activitable",
".",
"is_a?",
"(",
"Circle",
")",
"activitable",
".",
"contacts",
".",
"pluck",
"(",
":display_name",
")",
"end"
] |
In the case of LIMITED audience, then go through all the audience
circles and add contacts from those circles in the list of allowed
audience.
|
[
"In",
"the",
"case",
"of",
"LIMITED",
"audience",
"then",
"go",
"through",
"all",
"the",
"audience",
"circles",
"and",
"add",
"contacts",
"from",
"those",
"circles",
"in",
"the",
"list",
"of",
"allowed",
"audience",
"."
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/services/socializer/activity_audience_list.rb#L82-L88
|
20,628
|
socializer/socializer
|
app/models/socializer/activity.rb
|
Socializer.Activity.comments
|
def comments
activitable_type =
ActivityObject.with_activitable_type(type: Comment.name)
@comments ||= children.joins(:activitable_object)
.merge(activitable_type)
end
|
ruby
|
def comments
activitable_type =
ActivityObject.with_activitable_type(type: Comment.name)
@comments ||= children.joins(:activitable_object)
.merge(activitable_type)
end
|
[
"def",
"comments",
"activitable_type",
"=",
"ActivityObject",
".",
"with_activitable_type",
"(",
"type",
":",
"Comment",
".",
"name",
")",
"@comments",
"||=",
"children",
".",
"joins",
"(",
":activitable_object",
")",
".",
"merge",
"(",
"activitable_type",
")",
"end"
] |
Retrieves the comments for an activity
@return [ActiveRecord::AssociationRelation] a collection of
{Socializer::Activity} objects
|
[
"Retrieves",
"the",
"comments",
"for",
"an",
"activity"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/models/socializer/activity.rb#L339-L345
|
20,629
|
socializer/socializer
|
app/decorators/socializer/activity_object_decorator.rb
|
Socializer.ActivityObjectDecorator.link_to_like_or_unlike
|
def link_to_like_or_unlike
return unless helpers.current_user
options = current_user_likes? ? like_options : unlike_options
like_or_unlike_link(options: options)
end
|
ruby
|
def link_to_like_or_unlike
return unless helpers.current_user
options = current_user_likes? ? like_options : unlike_options
like_or_unlike_link(options: options)
end
|
[
"def",
"link_to_like_or_unlike",
"return",
"unless",
"helpers",
".",
"current_user",
"options",
"=",
"current_user_likes?",
"?",
"like_options",
":",
"unlike_options",
"like_or_unlike_link",
"(",
"options",
":",
"options",
")",
"end"
] |
Builds the like or unlike link
@return [String] the html needed to display the like/unlike link
|
[
"Builds",
"the",
"like",
"or",
"unlike",
"link"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/decorators/socializer/activity_object_decorator.rb#L30-L36
|
20,630
|
socializer/socializer
|
app/decorators/socializer/person_decorator.rb
|
Socializer.PersonDecorator.image_tag_avatar
|
def image_tag_avatar(size: nil, css_class: nil, alt: "Avatar", title: nil)
width, height = parse_size(size: size) if size
helpers.tag.img(src: avatar_url, class: css_class, alt: alt,
title: title, width: width, height: height,
data: { behavior: "tooltip-on-hover" })
end
|
ruby
|
def image_tag_avatar(size: nil, css_class: nil, alt: "Avatar", title: nil)
width, height = parse_size(size: size) if size
helpers.tag.img(src: avatar_url, class: css_class, alt: alt,
title: title, width: width, height: height,
data: { behavior: "tooltip-on-hover" })
end
|
[
"def",
"image_tag_avatar",
"(",
"size",
":",
"nil",
",",
"css_class",
":",
"nil",
",",
"alt",
":",
"\"Avatar\"",
",",
"title",
":",
"nil",
")",
"width",
",",
"height",
"=",
"parse_size",
"(",
"size",
":",
"size",
")",
"if",
"size",
"helpers",
".",
"tag",
".",
"img",
"(",
"src",
":",
"avatar_url",
",",
"class",
":",
"css_class",
",",
"alt",
":",
"alt",
",",
"title",
":",
"title",
",",
"width",
":",
"width",
",",
"height",
":",
"height",
",",
"data",
":",
"{",
"behavior",
":",
"\"tooltip-on-hover\"",
"}",
")",
"end"
] |
Creates an image tag for the persons avatar
@param size: nil [String]
@param css_class: nil [String]
@param alt: "Avatar" [String]
@param title: nil [String]
@return [String] An HTML image tag
|
[
"Creates",
"an",
"image",
"tag",
"for",
"the",
"persons",
"avatar"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/decorators/socializer/person_decorator.rb#L111-L117
|
20,631
|
socializer/socializer
|
app/decorators/socializer/person_decorator.rb
|
Socializer.PersonDecorator.link_to_avatar
|
def link_to_avatar
helpers.link_to(image_tag_avatar(title: model.display_name),
helpers.person_activities_path(person_id: model.id))
end
|
ruby
|
def link_to_avatar
helpers.link_to(image_tag_avatar(title: model.display_name),
helpers.person_activities_path(person_id: model.id))
end
|
[
"def",
"link_to_avatar",
"helpers",
".",
"link_to",
"(",
"image_tag_avatar",
"(",
"title",
":",
"model",
".",
"display_name",
")",
",",
"helpers",
".",
"person_activities_path",
"(",
"person_id",
":",
"model",
".",
"id",
")",
")",
"end"
] |
Creates a link to the persons profile with their avatar as the content
@return [String] An HTML a tag
|
[
"Creates",
"a",
"link",
"to",
"the",
"persons",
"profile",
"with",
"their",
"avatar",
"as",
"the",
"content"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/decorators/socializer/person_decorator.rb#L122-L125
|
20,632
|
socializer/socializer
|
app/decorators/socializer/person_decorator.rb
|
Socializer.PersonDecorator.toolbar_stream_links
|
def toolbar_stream_links
list = combine_circles_and_memberships
return if list.blank?
html = [toolbar_links(list[0..2])]
html << toolbar_dropdown(list[3..(list.size)])
helpers.safe_join(html)
end
|
ruby
|
def toolbar_stream_links
list = combine_circles_and_memberships
return if list.blank?
html = [toolbar_links(list[0..2])]
html << toolbar_dropdown(list[3..(list.size)])
helpers.safe_join(html)
end
|
[
"def",
"toolbar_stream_links",
"list",
"=",
"combine_circles_and_memberships",
"return",
"if",
"list",
".",
"blank?",
"html",
"=",
"[",
"toolbar_links",
"(",
"list",
"[",
"0",
"..",
"2",
"]",
")",
"]",
"html",
"<<",
"toolbar_dropdown",
"(",
"list",
"[",
"3",
"..",
"(",
"list",
".",
"size",
")",
"]",
")",
"helpers",
".",
"safe_join",
"(",
"html",
")",
"end"
] |
Builds the links for the shared toolbar
@return [String] the html needed to display the toolbar links
|
[
"Builds",
"the",
"links",
"for",
"the",
"shared",
"toolbar"
] |
f9c3ee2ca26ca837d9f328815997c2ddface25fc
|
https://github.com/socializer/socializer/blob/f9c3ee2ca26ca837d9f328815997c2ddface25fc/app/decorators/socializer/person_decorator.rb#L144-L152
|
20,633
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_contact
|
def get_contact(id, opts = {})
data, _status_code, _headers = get_contact_with_http_info(id, opts)
return data
end
|
ruby
|
def get_contact(id, opts = {})
data, _status_code, _headers = get_contact_with_http_info(id, opts)
return data
end
|
[
"def",
"get_contact",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_contact_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific student contact
@param id
@param [Hash] opts the optional parameters
@return [ContactResponse]
|
[
"Returns",
"a",
"specific",
"student",
"contact"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L28-L31
|
20,634
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_contacts_for_student
|
def get_contacts_for_student(id, opts = {})
data, _status_code, _headers = get_contacts_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_contacts_for_student(id, opts = {})
data, _status_code, _headers = get_contacts_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_contacts_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_contacts_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the contacts for a student
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [ContactsResponse]
|
[
"Returns",
"the",
"contacts",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L140-L143
|
20,635
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_course
|
def get_course(id, opts = {})
data, _status_code, _headers = get_course_with_http_info(id, opts)
return data
end
|
ruby
|
def get_course(id, opts = {})
data, _status_code, _headers = get_course_with_http_info(id, opts)
return data
end
|
[
"def",
"get_course",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_course_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific course
@param id
@param [Hash] opts the optional parameters
@return [CourseResponse]
|
[
"Returns",
"a",
"specific",
"course"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L199-L202
|
20,636
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_course_for_section
|
def get_course_for_section(id, opts = {})
data, _status_code, _headers = get_course_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_course_for_section(id, opts = {})
data, _status_code, _headers = get_course_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_course_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_course_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the course for a section
@param id
@param [Hash] opts the optional parameters
@return [CourseResponse]
|
[
"Returns",
"the",
"course",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L252-L255
|
20,637
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district
|
def get_district(id, opts = {})
data, _status_code, _headers = get_district_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district(id, opts = {})
data, _status_code, _headers = get_district_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific district
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"a",
"specific",
"district"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L361-L364
|
20,638
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_admin
|
def get_district_admin(id, opts = {})
data, _status_code, _headers = get_district_admin_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_admin(id, opts = {})
data, _status_code, _headers = get_district_admin_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_admin",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_admin_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific district admin
@param id
@param [Hash] opts the optional parameters
@return [DistrictAdminResponse]
|
[
"Returns",
"a",
"specific",
"district",
"admin"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L414-L417
|
20,639
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_contact
|
def get_district_for_contact(id, opts = {})
data, _status_code, _headers = get_district_for_contact_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_contact(id, opts = {})
data, _status_code, _headers = get_district_for_contact_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_contact",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_contact_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a student contact
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"student",
"contact"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L523-L526
|
20,640
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_course
|
def get_district_for_course(id, opts = {})
data, _status_code, _headers = get_district_for_course_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_course(id, opts = {})
data, _status_code, _headers = get_district_for_course_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_course",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_course_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a course
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"course"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L576-L579
|
20,641
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_district_admin
|
def get_district_for_district_admin(id, opts = {})
data, _status_code, _headers = get_district_for_district_admin_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_district_admin(id, opts = {})
data, _status_code, _headers = get_district_for_district_admin_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_district_admin",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_district_admin_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a district admin
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"district",
"admin"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L629-L632
|
20,642
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_school
|
def get_district_for_school(id, opts = {})
data, _status_code, _headers = get_district_for_school_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_school(id, opts = {})
data, _status_code, _headers = get_district_for_school_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_school",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_school_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a school
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"school"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L682-L685
|
20,643
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_school_admin
|
def get_district_for_school_admin(id, opts = {})
data, _status_code, _headers = get_district_for_school_admin_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_school_admin(id, opts = {})
data, _status_code, _headers = get_district_for_school_admin_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_school_admin",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_school_admin_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a school admin
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"school",
"admin"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L735-L738
|
20,644
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_section
|
def get_district_for_section(id, opts = {})
data, _status_code, _headers = get_district_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_section(id, opts = {})
data, _status_code, _headers = get_district_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a section
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L788-L791
|
20,645
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_student
|
def get_district_for_student(id, opts = {})
data, _status_code, _headers = get_district_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_student(id, opts = {})
data, _status_code, _headers = get_district_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a student
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L841-L844
|
20,646
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_teacher
|
def get_district_for_teacher(id, opts = {})
data, _status_code, _headers = get_district_for_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_teacher(id, opts = {})
data, _status_code, _headers = get_district_for_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a teacher
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"teacher"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L894-L897
|
20,647
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_district_for_term
|
def get_district_for_term(id, opts = {})
data, _status_code, _headers = get_district_for_term_with_http_info(id, opts)
return data
end
|
ruby
|
def get_district_for_term(id, opts = {})
data, _status_code, _headers = get_district_for_term_with_http_info(id, opts)
return data
end
|
[
"def",
"get_district_for_term",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_district_for_term_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the district for a term
@param id
@param [Hash] opts the optional parameters
@return [DistrictResponse]
|
[
"Returns",
"the",
"district",
"for",
"a",
"term"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L947-L950
|
20,648
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_school
|
def get_school(id, opts = {})
data, _status_code, _headers = get_school_with_http_info(id, opts)
return data
end
|
ruby
|
def get_school(id, opts = {})
data, _status_code, _headers = get_school_with_http_info(id, opts)
return data
end
|
[
"def",
"get_school",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_school_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific school
@param id
@param [Hash] opts the optional parameters
@return [SchoolResponse]
|
[
"Returns",
"a",
"specific",
"school"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1047-L1050
|
20,649
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_school_admin
|
def get_school_admin(id, opts = {})
data, _status_code, _headers = get_school_admin_with_http_info(id, opts)
return data
end
|
ruby
|
def get_school_admin(id, opts = {})
data, _status_code, _headers = get_school_admin_with_http_info(id, opts)
return data
end
|
[
"def",
"get_school_admin",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_school_admin_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific school admin
@param id
@param [Hash] opts the optional parameters
@return [SchoolAdminResponse]
|
[
"Returns",
"a",
"specific",
"school",
"admin"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1100-L1103
|
20,650
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_school_for_section
|
def get_school_for_section(id, opts = {})
data, _status_code, _headers = get_school_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_school_for_section(id, opts = {})
data, _status_code, _headers = get_school_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_school_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_school_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the school for a section
@param id
@param [Hash] opts the optional parameters
@return [SchoolResponse]
|
[
"Returns",
"the",
"school",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1209-L1212
|
20,651
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_school_for_student
|
def get_school_for_student(id, opts = {})
data, _status_code, _headers = get_school_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_school_for_student(id, opts = {})
data, _status_code, _headers = get_school_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_school_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_school_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the primary school for a student
@param id
@param [Hash] opts the optional parameters
@return [SchoolResponse]
|
[
"Returns",
"the",
"primary",
"school",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1262-L1265
|
20,652
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_school_for_teacher
|
def get_school_for_teacher(id, opts = {})
data, _status_code, _headers = get_school_for_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_school_for_teacher(id, opts = {})
data, _status_code, _headers = get_school_for_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_school_for_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_school_for_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Retrieves school info for a teacher.
@param id
@param [Hash] opts the optional parameters
@return [SchoolResponse]
|
[
"Retrieves",
"school",
"info",
"for",
"a",
"teacher",
"."
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1315-L1318
|
20,653
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_schools_for_school_admin
|
def get_schools_for_school_admin(id, opts = {})
data, _status_code, _headers = get_schools_for_school_admin_with_http_info(id, opts)
return data
end
|
ruby
|
def get_schools_for_school_admin(id, opts = {})
data, _status_code, _headers = get_schools_for_school_admin_with_http_info(id, opts)
return data
end
|
[
"def",
"get_schools_for_school_admin",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_schools_for_school_admin_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the schools for a school admin
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SchoolsResponse]
|
[
"Returns",
"the",
"schools",
"for",
"a",
"school",
"admin"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1427-L1430
|
20,654
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_schools_for_student
|
def get_schools_for_student(id, opts = {})
data, _status_code, _headers = get_schools_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_schools_for_student(id, opts = {})
data, _status_code, _headers = get_schools_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_schools_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_schools_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the schools for a student
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SchoolsResponse]
|
[
"Returns",
"the",
"schools",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1489-L1492
|
20,655
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_schools_for_teacher
|
def get_schools_for_teacher(id, opts = {})
data, _status_code, _headers = get_schools_for_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_schools_for_teacher(id, opts = {})
data, _status_code, _headers = get_schools_for_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_schools_for_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_schools_for_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the schools for a teacher
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SchoolsResponse]
|
[
"Returns",
"the",
"schools",
"for",
"a",
"teacher"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1551-L1554
|
20,656
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_section
|
def get_section(id, opts = {})
data, _status_code, _headers = get_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_section(id, opts = {})
data, _status_code, _headers = get_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific section
@param id
@param [Hash] opts the optional parameters
@return [SectionResponse]
|
[
"Returns",
"a",
"specific",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1610-L1613
|
20,657
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_sections_for_course
|
def get_sections_for_course(id, opts = {})
data, _status_code, _headers = get_sections_for_course_with_http_info(id, opts)
return data
end
|
ruby
|
def get_sections_for_course(id, opts = {})
data, _status_code, _headers = get_sections_for_course_with_http_info(id, opts)
return data
end
|
[
"def",
"get_sections_for_course",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_sections_for_course_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the sections for a Courses
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SectionsResponse]
|
[
"Returns",
"the",
"sections",
"for",
"a",
"Courses"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1722-L1725
|
20,658
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_sections_for_school
|
def get_sections_for_school(id, opts = {})
data, _status_code, _headers = get_sections_for_school_with_http_info(id, opts)
return data
end
|
ruby
|
def get_sections_for_school(id, opts = {})
data, _status_code, _headers = get_sections_for_school_with_http_info(id, opts)
return data
end
|
[
"def",
"get_sections_for_school",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_sections_for_school_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the sections for a school
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SectionsResponse]
|
[
"Returns",
"the",
"sections",
"for",
"a",
"school"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1784-L1787
|
20,659
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_sections_for_student
|
def get_sections_for_student(id, opts = {})
data, _status_code, _headers = get_sections_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_sections_for_student(id, opts = {})
data, _status_code, _headers = get_sections_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_sections_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_sections_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the sections for a student
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SectionsResponse]
|
[
"Returns",
"the",
"sections",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1846-L1849
|
20,660
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_sections_for_teacher
|
def get_sections_for_teacher(id, opts = {})
data, _status_code, _headers = get_sections_for_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_sections_for_teacher(id, opts = {})
data, _status_code, _headers = get_sections_for_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_sections_for_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_sections_for_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the sections for a teacher
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SectionsResponse]
|
[
"Returns",
"the",
"sections",
"for",
"a",
"teacher"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1908-L1911
|
20,661
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_sections_for_term
|
def get_sections_for_term(id, opts = {})
data, _status_code, _headers = get_sections_for_term_with_http_info(id, opts)
return data
end
|
ruby
|
def get_sections_for_term(id, opts = {})
data, _status_code, _headers = get_sections_for_term_with_http_info(id, opts)
return data
end
|
[
"def",
"get_sections_for_term",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_sections_for_term_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the sections for a term
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [SectionsResponse]
|
[
"Returns",
"the",
"sections",
"for",
"a",
"term"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L1970-L1973
|
20,662
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_student
|
def get_student(id, opts = {})
data, _status_code, _headers = get_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_student(id, opts = {})
data, _status_code, _headers = get_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific student
@param id
@param [Hash] opts the optional parameters
@return [StudentResponse]
|
[
"Returns",
"a",
"specific",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2029-L2032
|
20,663
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_students_for_contact
|
def get_students_for_contact(id, opts = {})
data, _status_code, _headers = get_students_for_contact_with_http_info(id, opts)
return data
end
|
ruby
|
def get_students_for_contact(id, opts = {})
data, _status_code, _headers = get_students_for_contact_with_http_info(id, opts)
return data
end
|
[
"def",
"get_students_for_contact",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_students_for_contact_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the students for a student contact
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [StudentsResponse]
|
[
"Returns",
"the",
"students",
"for",
"a",
"student",
"contact"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2141-L2144
|
20,664
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_students_for_school
|
def get_students_for_school(id, opts = {})
data, _status_code, _headers = get_students_for_school_with_http_info(id, opts)
return data
end
|
ruby
|
def get_students_for_school(id, opts = {})
data, _status_code, _headers = get_students_for_school_with_http_info(id, opts)
return data
end
|
[
"def",
"get_students_for_school",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_students_for_school_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the students for a school
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [StudentsResponse]
|
[
"Returns",
"the",
"students",
"for",
"a",
"school"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2203-L2206
|
20,665
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_students_for_section
|
def get_students_for_section(id, opts = {})
data, _status_code, _headers = get_students_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_students_for_section(id, opts = {})
data, _status_code, _headers = get_students_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_students_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_students_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the students for a section
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [StudentsResponse]
|
[
"Returns",
"the",
"students",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2265-L2268
|
20,666
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_students_for_teacher
|
def get_students_for_teacher(id, opts = {})
data, _status_code, _headers = get_students_for_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_students_for_teacher(id, opts = {})
data, _status_code, _headers = get_students_for_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_students_for_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_students_for_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the students for a teacher
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [StudentsResponse]
|
[
"Returns",
"the",
"students",
"for",
"a",
"teacher"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2327-L2330
|
20,667
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teacher
|
def get_teacher(id, opts = {})
data, _status_code, _headers = get_teacher_with_http_info(id, opts)
return data
end
|
ruby
|
def get_teacher(id, opts = {})
data, _status_code, _headers = get_teacher_with_http_info(id, opts)
return data
end
|
[
"def",
"get_teacher",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_teacher_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific teacher
@param id
@param [Hash] opts the optional parameters
@return [TeacherResponse]
|
[
"Returns",
"a",
"specific",
"teacher"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2386-L2389
|
20,668
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teacher_for_section
|
def get_teacher_for_section(id, opts = {})
data, _status_code, _headers = get_teacher_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_teacher_for_section(id, opts = {})
data, _status_code, _headers = get_teacher_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_teacher_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_teacher_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the primary teacher for a section
@param id
@param [Hash] opts the optional parameters
@return [TeacherResponse]
|
[
"Returns",
"the",
"primary",
"teacher",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2439-L2442
|
20,669
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teachers_with_http_info
|
def get_teachers_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: DataApi.get_teachers ..."
end
# resource path
local_var_path = "/teachers"
# query parameters
query_params = {}
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?
query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'TeachersResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DataApi#get_teachers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
ruby
|
def get_teachers_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: DataApi.get_teachers ..."
end
# resource path
local_var_path = "/teachers"
# query parameters
query_params = {}
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?
query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'TeachersResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DataApi#get_teachers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
[
"def",
"get_teachers_with_http_info",
"(",
"opts",
"=",
"{",
"}",
")",
"if",
"@api_client",
".",
"config",
".",
"debugging",
"@api_client",
".",
"config",
".",
"logger",
".",
"debug",
"\"Calling API: DataApi.get_teachers ...\"",
"end",
"# resource path",
"local_var_path",
"=",
"\"/teachers\"",
"# query parameters",
"query_params",
"=",
"{",
"}",
"query_params",
"[",
":'",
"'",
"]",
"=",
"opts",
"[",
":'",
"'",
"]",
"if",
"!",
"opts",
"[",
":'",
"'",
"]",
".",
"nil?",
"query_params",
"[",
":'",
"'",
"]",
"=",
"opts",
"[",
":'",
"'",
"]",
"if",
"!",
"opts",
"[",
":'",
"'",
"]",
".",
"nil?",
"query_params",
"[",
":'",
"'",
"]",
"=",
"opts",
"[",
":'",
"'",
"]",
"if",
"!",
"opts",
"[",
":'",
"'",
"]",
".",
"nil?",
"# header parameters",
"header_params",
"=",
"{",
"}",
"# HTTP header 'Accept' (if needed)",
"header_params",
"[",
"'Accept'",
"]",
"=",
"@api_client",
".",
"select_header_accept",
"(",
"[",
"'application/json'",
"]",
")",
"# form parameters",
"form_params",
"=",
"{",
"}",
"# http body (model)",
"post_body",
"=",
"nil",
"auth_names",
"=",
"[",
"'oauth'",
"]",
"data",
",",
"status_code",
",",
"headers",
"=",
"@api_client",
".",
"call_api",
"(",
":GET",
",",
"local_var_path",
",",
":header_params",
"=>",
"header_params",
",",
":query_params",
"=>",
"query_params",
",",
":form_params",
"=>",
"form_params",
",",
":body",
"=>",
"post_body",
",",
":auth_names",
"=>",
"auth_names",
",",
":return_type",
"=>",
"'TeachersResponse'",
")",
"if",
"@api_client",
".",
"config",
".",
"debugging",
"@api_client",
".",
"config",
".",
"logger",
".",
"debug",
"\"API called: DataApi#get_teachers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"",
"end",
"return",
"data",
",",
"status_code",
",",
"headers",
"end"
] |
Returns a list of teachers
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [Array<(TeachersResponse, Fixnum, Hash)>] TeachersResponse data, response status code and response headers
|
[
"Returns",
"a",
"list",
"of",
"teachers"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2506-L2541
|
20,670
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teachers_for_school
|
def get_teachers_for_school(id, opts = {})
data, _status_code, _headers = get_teachers_for_school_with_http_info(id, opts)
return data
end
|
ruby
|
def get_teachers_for_school(id, opts = {})
data, _status_code, _headers = get_teachers_for_school_with_http_info(id, opts)
return data
end
|
[
"def",
"get_teachers_for_school",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_teachers_for_school_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the teachers for a school
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [TeachersResponse]
|
[
"Returns",
"the",
"teachers",
"for",
"a",
"school"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2551-L2554
|
20,671
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teachers_for_section
|
def get_teachers_for_section(id, opts = {})
data, _status_code, _headers = get_teachers_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_teachers_for_section(id, opts = {})
data, _status_code, _headers = get_teachers_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_teachers_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_teachers_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the teachers for a section
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [TeachersResponse]
|
[
"Returns",
"the",
"teachers",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2613-L2616
|
20,672
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_teachers_for_student
|
def get_teachers_for_student(id, opts = {})
data, _status_code, _headers = get_teachers_for_student_with_http_info(id, opts)
return data
end
|
ruby
|
def get_teachers_for_student(id, opts = {})
data, _status_code, _headers = get_teachers_for_student_with_http_info(id, opts)
return data
end
|
[
"def",
"get_teachers_for_student",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_teachers_for_student_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the teachers for a student
@param id
@param [Hash] opts the optional parameters
@option opts [Integer] :limit
@option opts [String] :starting_after
@option opts [String] :ending_before
@return [TeachersResponse]
|
[
"Returns",
"the",
"teachers",
"for",
"a",
"student"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2675-L2678
|
20,673
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_term
|
def get_term(id, opts = {})
data, _status_code, _headers = get_term_with_http_info(id, opts)
return data
end
|
ruby
|
def get_term(id, opts = {})
data, _status_code, _headers = get_term_with_http_info(id, opts)
return data
end
|
[
"def",
"get_term",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_term_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns a specific term
@param id
@param [Hash] opts the optional parameters
@return [TermResponse]
|
[
"Returns",
"a",
"specific",
"term"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2734-L2737
|
20,674
|
Clever/clever-ruby
|
lib/clever-ruby/api/data_api.rb
|
Clever.DataApi.get_term_for_section
|
def get_term_for_section(id, opts = {})
data, _status_code, _headers = get_term_for_section_with_http_info(id, opts)
return data
end
|
ruby
|
def get_term_for_section(id, opts = {})
data, _status_code, _headers = get_term_for_section_with_http_info(id, opts)
return data
end
|
[
"def",
"get_term_for_section",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_term_for_section_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the term for a section
@param id
@param [Hash] opts the optional parameters
@return [TermResponse]
|
[
"Returns",
"the",
"term",
"for",
"a",
"section"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/data_api.rb#L2787-L2790
|
20,675
|
Clever/clever-ruby
|
lib/clever-ruby/api/events_api.rb
|
Clever.EventsApi.get_event
|
def get_event(id, opts = {})
data, _status_code, _headers = get_event_with_http_info(id, opts)
return data
end
|
ruby
|
def get_event(id, opts = {})
data, _status_code, _headers = get_event_with_http_info(id, opts)
return data
end
|
[
"def",
"get_event",
"(",
"id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_event_with_http_info",
"(",
"id",
",",
"opts",
")",
"return",
"data",
"end"
] |
Returns the specific event
@param id
@param [Hash] opts the optional parameters
@return [EventResponse]
|
[
"Returns",
"the",
"specific",
"event"
] |
f9f19496c33699c4adfdebfbc7f118e75007b9e2
|
https://github.com/Clever/clever-ruby/blob/f9f19496c33699c4adfdebfbc7f118e75007b9e2/lib/clever-ruby/api/events_api.rb#L28-L31
|
20,676
|
arthurnn/apn_sender
|
lib/apn/client.rb
|
APN.Client.setup_socket
|
def setup_socket
ctx = setup_certificate
APN.log(:debug, "Connecting to #{@host}:#{@port}...")
socket_tcp = TCPSocket.new(@host, @port)
OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|
s.sync = true
s.connect
end
end
|
ruby
|
def setup_socket
ctx = setup_certificate
APN.log(:debug, "Connecting to #{@host}:#{@port}...")
socket_tcp = TCPSocket.new(@host, @port)
OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|
s.sync = true
s.connect
end
end
|
[
"def",
"setup_socket",
"ctx",
"=",
"setup_certificate",
"APN",
".",
"log",
"(",
":debug",
",",
"\"Connecting to #{@host}:#{@port}...\"",
")",
"socket_tcp",
"=",
"TCPSocket",
".",
"new",
"(",
"@host",
",",
"@port",
")",
"OpenSSL",
"::",
"SSL",
"::",
"SSLSocket",
".",
"new",
"(",
"socket_tcp",
",",
"ctx",
")",
".",
"tap",
"do",
"|",
"s",
"|",
"s",
".",
"sync",
"=",
"true",
"s",
".",
"connect",
"end",
"end"
] |
Open socket to Apple's servers
|
[
"Open",
"socket",
"to",
"Apple",
"s",
"servers"
] |
ecb1539b61fc4022dadb91fc09c1786f476d1c36
|
https://github.com/arthurnn/apn_sender/blob/ecb1539b61fc4022dadb91fc09c1786f476d1c36/lib/apn/client.rb#L46-L56
|
20,677
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.dot
|
def dot(a, b)
a = NArray.asarray(a)
b = NArray.asarray(b)
case a.ndim
when 1
case b.ndim
when 1
func = blas_char(a, b) =~ /c|z/ ? :dotu : :dot
Blas.call(func, a, b)
else
if b.contiguous?
trans = 't'
else
if b.fortran_contiguous?
trans = 'n'
b = b.transpose
else
trans = 't'
b = b.dup
end
end
Blas.call(:gemv, b, a, trans:trans)
end
else
case b.ndim
when 1
if a.contiguous?
trans = 'n'
else
if a.fortran_contiguous?
trans = 't'
a = a.transpose
else
trans = 'n'
a = a.dup
end
end
Blas.call(:gemv, a, b, trans:trans)
else
if a.contiguous?
transa = 'n'
else
if a.fortran_contiguous?
transa = 't'
a = a.transpose
else
transa = 'n'
a = a.dup
end
end
if b.contiguous?
transb = 'n'
else
if b.fortran_contiguous?
transb='t'
b = b.transpose
else
transb='n'
b = b.dup
end
end
Blas.call(:gemm, a, b, transa:transa, transb:transb)
end
end
end
|
ruby
|
def dot(a, b)
a = NArray.asarray(a)
b = NArray.asarray(b)
case a.ndim
when 1
case b.ndim
when 1
func = blas_char(a, b) =~ /c|z/ ? :dotu : :dot
Blas.call(func, a, b)
else
if b.contiguous?
trans = 't'
else
if b.fortran_contiguous?
trans = 'n'
b = b.transpose
else
trans = 't'
b = b.dup
end
end
Blas.call(:gemv, b, a, trans:trans)
end
else
case b.ndim
when 1
if a.contiguous?
trans = 'n'
else
if a.fortran_contiguous?
trans = 't'
a = a.transpose
else
trans = 'n'
a = a.dup
end
end
Blas.call(:gemv, a, b, trans:trans)
else
if a.contiguous?
transa = 'n'
else
if a.fortran_contiguous?
transa = 't'
a = a.transpose
else
transa = 'n'
a = a.dup
end
end
if b.contiguous?
transb = 'n'
else
if b.fortran_contiguous?
transb='t'
b = b.transpose
else
transb='n'
b = b.dup
end
end
Blas.call(:gemm, a, b, transa:transa, transb:transb)
end
end
end
|
[
"def",
"dot",
"(",
"a",
",",
"b",
")",
"a",
"=",
"NArray",
".",
"asarray",
"(",
"a",
")",
"b",
"=",
"NArray",
".",
"asarray",
"(",
"b",
")",
"case",
"a",
".",
"ndim",
"when",
"1",
"case",
"b",
".",
"ndim",
"when",
"1",
"func",
"=",
"blas_char",
"(",
"a",
",",
"b",
")",
"=~",
"/",
"/",
"?",
":dotu",
":",
":dot",
"Blas",
".",
"call",
"(",
"func",
",",
"a",
",",
"b",
")",
"else",
"if",
"b",
".",
"contiguous?",
"trans",
"=",
"'t'",
"else",
"if",
"b",
".",
"fortran_contiguous?",
"trans",
"=",
"'n'",
"b",
"=",
"b",
".",
"transpose",
"else",
"trans",
"=",
"'t'",
"b",
"=",
"b",
".",
"dup",
"end",
"end",
"Blas",
".",
"call",
"(",
":gemv",
",",
"b",
",",
"a",
",",
"trans",
":",
"trans",
")",
"end",
"else",
"case",
"b",
".",
"ndim",
"when",
"1",
"if",
"a",
".",
"contiguous?",
"trans",
"=",
"'n'",
"else",
"if",
"a",
".",
"fortran_contiguous?",
"trans",
"=",
"'t'",
"a",
"=",
"a",
".",
"transpose",
"else",
"trans",
"=",
"'n'",
"a",
"=",
"a",
".",
"dup",
"end",
"end",
"Blas",
".",
"call",
"(",
":gemv",
",",
"a",
",",
"b",
",",
"trans",
":",
"trans",
")",
"else",
"if",
"a",
".",
"contiguous?",
"transa",
"=",
"'n'",
"else",
"if",
"a",
".",
"fortran_contiguous?",
"transa",
"=",
"'t'",
"a",
"=",
"a",
".",
"transpose",
"else",
"transa",
"=",
"'n'",
"a",
"=",
"a",
".",
"dup",
"end",
"end",
"if",
"b",
".",
"contiguous?",
"transb",
"=",
"'n'",
"else",
"if",
"b",
".",
"fortran_contiguous?",
"transb",
"=",
"'t'",
"b",
"=",
"b",
".",
"transpose",
"else",
"transb",
"=",
"'n'",
"b",
"=",
"b",
".",
"dup",
"end",
"end",
"Blas",
".",
"call",
"(",
":gemm",
",",
"a",
",",
"b",
",",
"transa",
":",
"transa",
",",
"transb",
":",
"transb",
")",
"end",
"end",
"end"
] |
module methods
Matrix and vector products
Dot product.
@param a [Numo::NArray] matrix or vector (>= 1-dimensinal NArray)
@param b [Numo::NArray] matrix or vector (>= 1-dimensinal NArray)
@return [Numo::NArray] result of dot product
|
[
"module",
"methods",
"Matrix",
"and",
"vector",
"products",
"Dot",
"product",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L82-L146
|
20,678
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.matrix_power
|
def matrix_power(a, n)
a = NArray.asarray(a)
m,k = a.shape[-2..-1]
unless m==k
raise NArray::ShapeError, "input must be a square array"
end
unless Integer===n
raise ArgumentError, "exponent must be an integer"
end
if n == 0
return a.class.eye(m)
elsif n < 0
a = inv(a)
n = n.abs
end
if n <= 3
r = a
(n-1).times do
r = matmul(r,a)
end
else
while (n & 1) == 0
a = matmul(a,a)
n >>= 1
end
r = a
while n != 0
a = matmul(a,a)
n >>= 1
if (n & 1) != 0
r = matmul(r,a)
end
end
end
r
end
|
ruby
|
def matrix_power(a, n)
a = NArray.asarray(a)
m,k = a.shape[-2..-1]
unless m==k
raise NArray::ShapeError, "input must be a square array"
end
unless Integer===n
raise ArgumentError, "exponent must be an integer"
end
if n == 0
return a.class.eye(m)
elsif n < 0
a = inv(a)
n = n.abs
end
if n <= 3
r = a
(n-1).times do
r = matmul(r,a)
end
else
while (n & 1) == 0
a = matmul(a,a)
n >>= 1
end
r = a
while n != 0
a = matmul(a,a)
n >>= 1
if (n & 1) != 0
r = matmul(r,a)
end
end
end
r
end
|
[
"def",
"matrix_power",
"(",
"a",
",",
"n",
")",
"a",
"=",
"NArray",
".",
"asarray",
"(",
"a",
")",
"m",
",",
"k",
"=",
"a",
".",
"shape",
"[",
"-",
"2",
"..",
"-",
"1",
"]",
"unless",
"m",
"==",
"k",
"raise",
"NArray",
"::",
"ShapeError",
",",
"\"input must be a square array\"",
"end",
"unless",
"Integer",
"===",
"n",
"raise",
"ArgumentError",
",",
"\"exponent must be an integer\"",
"end",
"if",
"n",
"==",
"0",
"return",
"a",
".",
"class",
".",
"eye",
"(",
"m",
")",
"elsif",
"n",
"<",
"0",
"a",
"=",
"inv",
"(",
"a",
")",
"n",
"=",
"n",
".",
"abs",
"end",
"if",
"n",
"<=",
"3",
"r",
"=",
"a",
"(",
"n",
"-",
"1",
")",
".",
"times",
"do",
"r",
"=",
"matmul",
"(",
"r",
",",
"a",
")",
"end",
"else",
"while",
"(",
"n",
"&",
"1",
")",
"==",
"0",
"a",
"=",
"matmul",
"(",
"a",
",",
"a",
")",
"n",
">>=",
"1",
"end",
"r",
"=",
"a",
"while",
"n",
"!=",
"0",
"a",
"=",
"matmul",
"(",
"a",
",",
"a",
")",
"n",
">>=",
"1",
"if",
"(",
"n",
"&",
"1",
")",
"!=",
"0",
"r",
"=",
"matmul",
"(",
"r",
",",
"a",
")",
"end",
"end",
"end",
"r",
"end"
] |
Compute a square matrix `a` to the power `n`.
* If n > 0: return `a**n`.
* If n == 0: return identity matrix.
* If n < 0: return `(a*\*-1)*\*n.abs`.
@param a [Numo::NArray] square matrix (>= 2-dimensinal NArray).
@param n [Integer] the exponent.
@example
i = Numo::DFloat[[0, 1], [-1, 0]]
=> Numo::DFloat#shape=[2,2]
[[0, 1],
[-1, 0]]
Numo::Linalg.matrix_power(i,3)
=> Numo::DFloat#shape=[2,2]
[[0, -1],
[1, 0]]
Numo::Linalg.matrix_power(i,0)
=> Numo::DFloat#shape=[2,2]
[[1, 0],
[0, 1]]
Numo::Linalg.matrix_power(i,-3)
=> Numo::DFloat#shape=[2,2]
[[0, 1],
[-1, 0]]
q = Numo::DFloat.zeros(4,4)
q[0..1,0..1] = -i
q[2..3,2..3] = i
q
=> Numo::DFloat#shape=[4,4]
[[-0, -1, 0, 0],
[1, -0, 0, 0],
[0, 0, 0, 1],
[0, 0, -1, 0]]
Numo::Linalg.matrix_power(q,2)
=> Numo::DFloat#shape=[4,4]
[[-1, 0, 0, 0],
[0, -1, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, -1]]
|
[
"Compute",
"a",
"square",
"matrix",
"a",
"to",
"the",
"power",
"n",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L198-L233
|
20,679
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.svdvals
|
def svdvals(a, driver:'svd')
case driver.to_s
when /^(ge)?sdd$/i, "turbo"
Lapack.call(:gesdd, a, jobz:'N')[0]
when /^(ge)?svd$/i
Lapack.call(:gesvd, a, jobu:'N', jobvt:'N')[0]
else
raise ArgumentError, "invalid driver: #{driver}"
end
end
|
ruby
|
def svdvals(a, driver:'svd')
case driver.to_s
when /^(ge)?sdd$/i, "turbo"
Lapack.call(:gesdd, a, jobz:'N')[0]
when /^(ge)?svd$/i
Lapack.call(:gesvd, a, jobu:'N', jobvt:'N')[0]
else
raise ArgumentError, "invalid driver: #{driver}"
end
end
|
[
"def",
"svdvals",
"(",
"a",
",",
"driver",
":",
"'svd'",
")",
"case",
"driver",
".",
"to_s",
"when",
"/",
"/i",
",",
"\"turbo\"",
"Lapack",
".",
"call",
"(",
":gesdd",
",",
"a",
",",
"jobz",
":",
"'N'",
")",
"[",
"0",
"]",
"when",
"/",
"/i",
"Lapack",
".",
"call",
"(",
":gesvd",
",",
"a",
",",
"jobu",
":",
"'N'",
",",
"jobvt",
":",
"'N'",
")",
"[",
"0",
"]",
"else",
"raise",
"ArgumentError",
",",
"\"invalid driver: #{driver}\"",
"end",
"end"
] |
Computes the Singular Values of a M-by-N matrix A.
The SVD is written
A = U * SIGMA * transpose(V)
where SIGMA is an M-by-N matrix which is zero except for its
min(m,n) diagonal elements. The diagonal elements of SIGMA
are the singular values of A; they are real and non-negative, and
are returned in descending order.
@param a [Numo::NArray] m-by-n matrix A (>= 2-dimensinal NArray)
@param driver [String or Symbol] choose LAPACK solver from 'svd',
'sdd'. (optional, default='svd')
@return [Numo::NArray] returns SIGMA (singular values).
|
[
"Computes",
"the",
"Singular",
"Values",
"of",
"a",
"M",
"-",
"by",
"-",
"N",
"matrix",
"A",
".",
"The",
"SVD",
"is",
"written"
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L332-L341
|
20,680
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.orth
|
def orth(a, rcond: -1)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
s, u, = svd(a)
tol = s.max * (rcond.nil? || rcond < 0 ? a.class::EPSILON * a.shape.max : rcond)
k = (s > tol).count
u[true, 0...k]
end
|
ruby
|
def orth(a, rcond: -1)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
s, u, = svd(a)
tol = s.max * (rcond.nil? || rcond < 0 ? a.class::EPSILON * a.shape.max : rcond)
k = (s > tol).count
u[true, 0...k]
end
|
[
"def",
"orth",
"(",
"a",
",",
"rcond",
":",
"-",
"1",
")",
"raise",
"NArray",
"::",
"ShapeError",
",",
"'2-d array is required'",
"if",
"a",
".",
"ndim",
"<",
"2",
"s",
",",
"u",
",",
"=",
"svd",
"(",
"a",
")",
"tol",
"=",
"s",
".",
"max",
"*",
"(",
"rcond",
".",
"nil?",
"||",
"rcond",
"<",
"0",
"?",
"a",
".",
"class",
"::",
"EPSILON",
"*",
"a",
".",
"shape",
".",
"max",
":",
"rcond",
")",
"k",
"=",
"(",
"s",
">",
"tol",
")",
".",
"count",
"u",
"[",
"true",
",",
"0",
"...",
"k",
"]",
"end"
] |
Computes an orthonormal basis for the range of matrix A.
@param a [Numo::NArray] m-by-n matrix A (>= 2-dimensional NArray).
@param rcond [Float] (optional)
rcond is used to determine the effective rank of A.
Singular values `s[i] <= rcond * s.max` are treated as zero.
If rcond < 0, machine precision is used instead.
@return [Numo::NArray] The orthonormal basis for the range of matrix A.
|
[
"Computes",
"an",
"orthonormal",
"basis",
"for",
"the",
"range",
"of",
"matrix",
"A",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L352-L358
|
20,681
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.null_space
|
def null_space(a, rcond: -1)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
s, _u, vh = svd(a)
tol = s.max * (rcond.nil? || rcond < 0 ? a.class::EPSILON * a.shape.max : rcond)
k = (s > tol).count
return a.class.new if k == vh.shape[0]
r = vh[k..-1, true].transpose.dup
blas_char(vh) =~ /c|z/ ? r.conj : r
end
|
ruby
|
def null_space(a, rcond: -1)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
s, _u, vh = svd(a)
tol = s.max * (rcond.nil? || rcond < 0 ? a.class::EPSILON * a.shape.max : rcond)
k = (s > tol).count
return a.class.new if k == vh.shape[0]
r = vh[k..-1, true].transpose.dup
blas_char(vh) =~ /c|z/ ? r.conj : r
end
|
[
"def",
"null_space",
"(",
"a",
",",
"rcond",
":",
"-",
"1",
")",
"raise",
"NArray",
"::",
"ShapeError",
",",
"'2-d array is required'",
"if",
"a",
".",
"ndim",
"<",
"2",
"s",
",",
"_u",
",",
"vh",
"=",
"svd",
"(",
"a",
")",
"tol",
"=",
"s",
".",
"max",
"*",
"(",
"rcond",
".",
"nil?",
"||",
"rcond",
"<",
"0",
"?",
"a",
".",
"class",
"::",
"EPSILON",
"*",
"a",
".",
"shape",
".",
"max",
":",
"rcond",
")",
"k",
"=",
"(",
"s",
">",
"tol",
")",
".",
"count",
"return",
"a",
".",
"class",
".",
"new",
"if",
"k",
"==",
"vh",
".",
"shape",
"[",
"0",
"]",
"r",
"=",
"vh",
"[",
"k",
"..",
"-",
"1",
",",
"true",
"]",
".",
"transpose",
".",
"dup",
"blas_char",
"(",
"vh",
")",
"=~",
"/",
"/",
"?",
"r",
".",
"conj",
":",
"r",
"end"
] |
Computes an orthonormal basis for the null space of matrix A.
@param a [Numo::NArray] m-by-n matrix A (>= 2-dimensional NArray).
@param rcond [Float] (optional)
rcond is used to determine the effective rank of A.
Singular values `s[i] <= rcond * s.max` are treated as zero.
If rcond < 0, machine precision is used instead.
@return [Numo::NArray] The orthonormal basis for the null space of matrix A.
|
[
"Computes",
"an",
"orthonormal",
"basis",
"for",
"the",
"null",
"space",
"of",
"matrix",
"A",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L369-L377
|
20,682
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.lu
|
def lu(a, permute_l: false)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
m, n = a.shape
k = [m, n].min
lu, ip = lu_fact(a)
l = lu.tril.tap { |mat| mat[mat.diag_indices(0)] = 1.0 }[true, 0...k]
u = lu.triu[0...k, 0...n]
p = Numo::DFloat.eye(m).tap do |mat|
ip.to_a.each_with_index { |i, j| mat[true, [i - 1, j]] = mat[true, [j, i - 1]].dup }
end
permute_l ? [p.dot(l), u] : [p, l, u]
end
|
ruby
|
def lu(a, permute_l: false)
raise NArray::ShapeError, '2-d array is required' if a.ndim < 2
m, n = a.shape
k = [m, n].min
lu, ip = lu_fact(a)
l = lu.tril.tap { |mat| mat[mat.diag_indices(0)] = 1.0 }[true, 0...k]
u = lu.triu[0...k, 0...n]
p = Numo::DFloat.eye(m).tap do |mat|
ip.to_a.each_with_index { |i, j| mat[true, [i - 1, j]] = mat[true, [j, i - 1]].dup }
end
permute_l ? [p.dot(l), u] : [p, l, u]
end
|
[
"def",
"lu",
"(",
"a",
",",
"permute_l",
":",
"false",
")",
"raise",
"NArray",
"::",
"ShapeError",
",",
"'2-d array is required'",
"if",
"a",
".",
"ndim",
"<",
"2",
"m",
",",
"n",
"=",
"a",
".",
"shape",
"k",
"=",
"[",
"m",
",",
"n",
"]",
".",
"min",
"lu",
",",
"ip",
"=",
"lu_fact",
"(",
"a",
")",
"l",
"=",
"lu",
".",
"tril",
".",
"tap",
"{",
"|",
"mat",
"|",
"mat",
"[",
"mat",
".",
"diag_indices",
"(",
"0",
")",
"]",
"=",
"1.0",
"}",
"[",
"true",
",",
"0",
"...",
"k",
"]",
"u",
"=",
"lu",
".",
"triu",
"[",
"0",
"...",
"k",
",",
"0",
"...",
"n",
"]",
"p",
"=",
"Numo",
"::",
"DFloat",
".",
"eye",
"(",
"m",
")",
".",
"tap",
"do",
"|",
"mat",
"|",
"ip",
".",
"to_a",
".",
"each_with_index",
"{",
"|",
"i",
",",
"j",
"|",
"mat",
"[",
"true",
",",
"[",
"i",
"-",
"1",
",",
"j",
"]",
"]",
"=",
"mat",
"[",
"true",
",",
"[",
"j",
",",
"i",
"-",
"1",
"]",
"]",
".",
"dup",
"}",
"end",
"permute_l",
"?",
"[",
"p",
".",
"dot",
"(",
"l",
")",
",",
"u",
"]",
":",
"[",
"p",
",",
"l",
",",
"u",
"]",
"end"
] |
Computes an LU factorization of a M-by-N matrix A
using partial pivoting with row interchanges.
The factorization has the form
A = P * L * U
where P is a permutation matrix, L is lower triangular with unit
diagonal elements (lower trapezoidal if m > n), and U is upper
triangular (upper trapezoidal if m < n).
@param a [Numo::NArray] m-by-n matrix A (>= 2-dimensinal NArray)
@param permute_l [Bool] (optional) If true, perform the matrix product of P and L.
@return [[p,l,u]] if permute_l == false
@return [[pl,u]] if permute_l == true
- **p** [Numo::NArray] -- The permutation matrix P.
- **l** [Numo::NArray] -- The factor L.
- **u** [Numo::NArray] -- The factor U.
|
[
"Computes",
"an",
"LU",
"factorization",
"of",
"a",
"M",
"-",
"by",
"-",
"N",
"matrix",
"A",
"using",
"partial",
"pivoting",
"with",
"row",
"interchanges",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L399-L410
|
20,683
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.lu_solve
|
def lu_solve(lu, ipiv, b, trans:"N")
Lapack.call(:getrs, lu, ipiv, b, trans:trans)[0]
end
|
ruby
|
def lu_solve(lu, ipiv, b, trans:"N")
Lapack.call(:getrs, lu, ipiv, b, trans:trans)[0]
end
|
[
"def",
"lu_solve",
"(",
"lu",
",",
"ipiv",
",",
"b",
",",
"trans",
":",
"\"N\"",
")",
"Lapack",
".",
"call",
"(",
":getrs",
",",
"lu",
",",
"ipiv",
",",
"b",
",",
"trans",
":",
"trans",
")",
"[",
"0",
"]",
"end"
] |
Solves a system of linear equations
A * X = B or A**T * X = B
with a N-by-N matrix A using the LU factorization computed by
Numo::Linalg.lu_fact
@param lu [Numo::NArray] matrix containing the factors L and U
from the factorization `A = P*L*U` as computed by
Numo::Linalg.lu_fact.
@param ipiv [Numo::NArray] The pivot indices from
Numo::Linalg.lu_fact; for 1<=i<=N, row i of the matrix was
interchanged with row IPIV(i).
@param b [Numo::NArray] the right hand side matrix B.
@param trans [String or Symbol]
Specifies the form of the system of equations:
- If 'N': `A * X = B` (No transpose).
- If 'T': `A*\*T* X = B` (Transpose).
- If 'C': `A*\*T* X = B` (Conjugate transpose = Transpose).
@return [Numo::NArray] the solution matrix X.
|
[
"Solves",
"a",
"system",
"of",
"linear",
"equations"
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L476-L478
|
20,684
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.eigvals
|
def eigvals(a)
jobvl, jobvr = 'N','N'
case blas_char(a)
when /c|z/
w, = Lapack.call(:geev, a, jobvl:jobvl, jobvr:jobvr)
else
wr, wi, = Lapack.call(:geev, a, jobvl:jobvl, jobvr:jobvr)
w = wr + wi * Complex::I
end
w
end
|
ruby
|
def eigvals(a)
jobvl, jobvr = 'N','N'
case blas_char(a)
when /c|z/
w, = Lapack.call(:geev, a, jobvl:jobvl, jobvr:jobvr)
else
wr, wi, = Lapack.call(:geev, a, jobvl:jobvl, jobvr:jobvr)
w = wr + wi * Complex::I
end
w
end
|
[
"def",
"eigvals",
"(",
"a",
")",
"jobvl",
",",
"jobvr",
"=",
"'N'",
",",
"'N'",
"case",
"blas_char",
"(",
"a",
")",
"when",
"/",
"/",
"w",
",",
"=",
"Lapack",
".",
"call",
"(",
":geev",
",",
"a",
",",
"jobvl",
":",
"jobvl",
",",
"jobvr",
":",
"jobvr",
")",
"else",
"wr",
",",
"wi",
",",
"=",
"Lapack",
".",
"call",
"(",
":geev",
",",
"a",
",",
"jobvl",
":",
"jobvl",
",",
"jobvr",
":",
"jobvr",
")",
"w",
"=",
"wr",
"+",
"wi",
"*",
"Complex",
"::",
"I",
"end",
"w",
"end"
] |
Computes the eigenvalues only for a square nonsymmetric matrix A.
@param a [Numo::NArray] square nonsymmetric matrix (>= 2-dimensinal NArray)
@return [Numo::NArray] eigenvalues
|
[
"Computes",
"the",
"eigenvalues",
"only",
"for",
"a",
"square",
"nonsymmetric",
"matrix",
"A",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L682-L692
|
20,685
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.cond
|
def cond(a,ord=nil)
if ord.nil?
s = svdvals(a)
s[false, 0]/s[false, -1]
else
norm(a, ord, axis:[-2,-1]) * norm(inv(a), ord, axis:[-2,-1])
end
end
|
ruby
|
def cond(a,ord=nil)
if ord.nil?
s = svdvals(a)
s[false, 0]/s[false, -1]
else
norm(a, ord, axis:[-2,-1]) * norm(inv(a), ord, axis:[-2,-1])
end
end
|
[
"def",
"cond",
"(",
"a",
",",
"ord",
"=",
"nil",
")",
"if",
"ord",
".",
"nil?",
"s",
"=",
"svdvals",
"(",
"a",
")",
"s",
"[",
"false",
",",
"0",
"]",
"/",
"s",
"[",
"false",
",",
"-",
"1",
"]",
"else",
"norm",
"(",
"a",
",",
"ord",
",",
"axis",
":",
"[",
"-",
"2",
",",
"-",
"1",
"]",
")",
"*",
"norm",
"(",
"inv",
"(",
"a",
")",
",",
"ord",
",",
"axis",
":",
"[",
"-",
"2",
",",
"-",
"1",
"]",
")",
"end",
"end"
] |
Compute the condition number of a matrix
using the norm with one of the following order.
| ord | matrix norm |
| ----- | ---------------------- |
| nil | 2-norm using SVD |
| 'fro' | Frobenius norm |
| 'inf' | x.abs.sum(axis:-1).max |
| 1 | x.abs.sum(axis:-2).max |
| 2 | 2-norm (max sing_vals) |
@param a [Numo::NArray] matrix or vector (>= 1-dimensinal NArray)
@param ord [String or Symbol] Order of the norm.
@return [Numo::NArray] cond result
@example
a = Numo::DFloat[[1, 0, -1], [0, 1, 0], [1, 0, 1]]
=> Numo::DFloat#shape=[3,3]
[[1, 0, -1],
[0, 1, 0],
[1, 0, 1]]
LA = Numo::Linalg
LA.cond(a)
=> 1.4142135623730951
LA.cond(a, 'fro')
=> 3.1622776601683795
LA.cond(a, 'inf')
=> 2.0
LA.cond(a, '-inf')
=> 1.0
LA.cond(a, 1)
=> 2.0
LA.cond(a, -1)
=> 1.0
LA.cond(a, 2)
=> 1.4142135623730951
LA.cond(a, -2)
=> 0.7071067811865475
(LA.svdvals(a)).min*(LA.svdvals(LA.inv(a))).min
=> 0.7071067811865475
|
[
"Compute",
"the",
"condition",
"number",
"of",
"a",
"matrix",
"using",
"the",
"norm",
"with",
"one",
"of",
"the",
"following",
"order",
"."
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L882-L889
|
20,686
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.det
|
def det(a)
lu, piv, = Lapack.call(:getrf, a)
idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
m = piv.eq(idx).count_false(axis:-1) % 2
sign = m * -2 + 1
lu.diagonal.prod(axis:-1) * sign
end
|
ruby
|
def det(a)
lu, piv, = Lapack.call(:getrf, a)
idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
m = piv.eq(idx).count_false(axis:-1) % 2
sign = m * -2 + 1
lu.diagonal.prod(axis:-1) * sign
end
|
[
"def",
"det",
"(",
"a",
")",
"lu",
",",
"piv",
",",
"=",
"Lapack",
".",
"call",
"(",
":getrf",
",",
"a",
")",
"idx",
"=",
"piv",
".",
"new_narray",
".",
"store",
"(",
"piv",
".",
"class",
".",
"new",
"(",
"piv",
".",
"shape",
"[",
"-",
"1",
"]",
")",
".",
"seq",
"(",
"1",
")",
")",
"m",
"=",
"piv",
".",
"eq",
"(",
"idx",
")",
".",
"count_false",
"(",
"axis",
":",
"-",
"1",
")",
"%",
"2",
"sign",
"=",
"m",
"*",
"-",
"2",
"+",
"1",
"lu",
".",
"diagonal",
".",
"prod",
"(",
"axis",
":",
"-",
"1",
")",
"*",
"sign",
"end"
] |
Determinant of a matrix
@param a [Numo::NArray] matrix (>= 2-dimensional NArray)
@return [Float or Complex or Numo::NArray]
|
[
"Determinant",
"of",
"a",
"matrix"
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L896-L902
|
20,687
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.slogdet
|
def slogdet(a)
lu, piv, = Lapack.call(:getrf, a)
idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
m = piv.eq(idx).count_false(axis:-1) % 2
sign = m * -2 + 1
lud = lu.diagonal
if (lud.eq 0).any?
return 0, (-Float::INFINITY)
end
lud_abs = lud.abs
sign *= (lud/lud_abs).prod
[sign, NMath.log(lud_abs).sum(axis:-1)]
end
|
ruby
|
def slogdet(a)
lu, piv, = Lapack.call(:getrf, a)
idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))
m = piv.eq(idx).count_false(axis:-1) % 2
sign = m * -2 + 1
lud = lu.diagonal
if (lud.eq 0).any?
return 0, (-Float::INFINITY)
end
lud_abs = lud.abs
sign *= (lud/lud_abs).prod
[sign, NMath.log(lud_abs).sum(axis:-1)]
end
|
[
"def",
"slogdet",
"(",
"a",
")",
"lu",
",",
"piv",
",",
"=",
"Lapack",
".",
"call",
"(",
":getrf",
",",
"a",
")",
"idx",
"=",
"piv",
".",
"new_narray",
".",
"store",
"(",
"piv",
".",
"class",
".",
"new",
"(",
"piv",
".",
"shape",
"[",
"-",
"1",
"]",
")",
".",
"seq",
"(",
"1",
")",
")",
"m",
"=",
"piv",
".",
"eq",
"(",
"idx",
")",
".",
"count_false",
"(",
"axis",
":",
"-",
"1",
")",
"%",
"2",
"sign",
"=",
"m",
"*",
"-",
"2",
"+",
"1",
"lud",
"=",
"lu",
".",
"diagonal",
"if",
"(",
"lud",
".",
"eq",
"0",
")",
".",
"any?",
"return",
"0",
",",
"(",
"-",
"Float",
"::",
"INFINITY",
")",
"end",
"lud_abs",
"=",
"lud",
".",
"abs",
"sign",
"*=",
"(",
"lud",
"/",
"lud_abs",
")",
".",
"prod",
"[",
"sign",
",",
"NMath",
".",
"log",
"(",
"lud_abs",
")",
".",
"sum",
"(",
"axis",
":",
"-",
"1",
")",
"]",
"end"
] |
Natural logarithm of the determinant of a matrix
@param a [Numo::NArray] matrix (>= 2-dimensional NArray)
@return [[sign,logdet]]
- **sign** -- A number representing the sign of the determinant.
- **logdet** -- The natural log of the absolute value of the determinant.
|
[
"Natural",
"logarithm",
"of",
"the",
"determinant",
"of",
"a",
"matrix"
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L911-L924
|
20,688
|
ruby-numo/numo-linalg
|
lib/numo/linalg/function.rb
|
Numo.Linalg.inv
|
def inv(a, driver:"getrf", uplo:'U')
case driver
when /(ge|sy|he|po)sv$/
d = $1
b = a.new_zeros.eye
solve(a, b, driver:d, uplo:uplo)
when /(ge|sy|he)tr[fi]$/
d = $1
lu, piv = lu_fact(a)
lu_inv(lu, piv)
when /potr[fi]$/
lu = cho_fact(a, uplo:uplo)
cho_inv(lu, uplo:uplo)
else
raise ArgumentError, "invalid driver: #{driver}"
end
end
|
ruby
|
def inv(a, driver:"getrf", uplo:'U')
case driver
when /(ge|sy|he|po)sv$/
d = $1
b = a.new_zeros.eye
solve(a, b, driver:d, uplo:uplo)
when /(ge|sy|he)tr[fi]$/
d = $1
lu, piv = lu_fact(a)
lu_inv(lu, piv)
when /potr[fi]$/
lu = cho_fact(a, uplo:uplo)
cho_inv(lu, uplo:uplo)
else
raise ArgumentError, "invalid driver: #{driver}"
end
end
|
[
"def",
"inv",
"(",
"a",
",",
"driver",
":",
"\"getrf\"",
",",
"uplo",
":",
"'U'",
")",
"case",
"driver",
"when",
"/",
"/",
"d",
"=",
"$1",
"b",
"=",
"a",
".",
"new_zeros",
".",
"eye",
"solve",
"(",
"a",
",",
"b",
",",
"driver",
":",
"d",
",",
"uplo",
":",
"uplo",
")",
"when",
"/",
"/",
"d",
"=",
"$1",
"lu",
",",
"piv",
"=",
"lu_fact",
"(",
"a",
")",
"lu_inv",
"(",
"lu",
",",
"piv",
")",
"when",
"/",
"/",
"lu",
"=",
"cho_fact",
"(",
"a",
",",
"uplo",
":",
"uplo",
")",
"cho_inv",
"(",
"lu",
",",
"uplo",
":",
"uplo",
")",
"else",
"raise",
"ArgumentError",
",",
"\"invalid driver: #{driver}\"",
"end",
"end"
] |
Inverse matrix from square matrix `a`
@param a [Numo::NArray] n-by-n square matrix (>= 2-dimensinal NArray)
@param driver [String or Symbol] choose LAPACK diriver
('ge'|'sy'|'he'|'po') + ("sv"|"trf")
(optional, default='getrf')
@param uplo [String or Symbol] optional, default='U'. Access upper
or ('U') lower ('L') triangle. (omitted when driver:"ge")
@return [Numo::NArray] The inverse matrix.
@example
Numo::Linalg.inv(a,driver:'getrf')
=> Numo::DFloat#shape=[2,2]
[[-2, 1],
[1.5, -0.5]]
a.dot(Numo::Linalg.inv(a,driver:'getrf'))
=> Numo::DFloat#shape=[2,2]
[[1, 0],
[8.88178e-16, 1]]
|
[
"Inverse",
"matrix",
"from",
"square",
"matrix",
"a"
] |
bb0929aae0f3285a41d404040eda651833ffccef
|
https://github.com/ruby-numo/numo-linalg/blob/bb0929aae0f3285a41d404040eda651833ffccef/lib/numo/linalg/function.rb#L1000-L1016
|
20,689
|
google/autoparse
|
lib/autoparse/instance.rb
|
AutoParse.Instance.valid?
|
def valid?
unvalidated_fields = @data.keys.dup
for property_key, schema_class in self.class.properties
property_value = @data[property_key]
if !self.class.validate_property_value(
property_value, schema_class.data)
return false
end
if property_value == nil && schema_class.data['required'] != true
# Value was omitted, but not required. Still valid. Skip dependency
# checks.
next
end
# Verify property dependencies
property_dependencies = self.class.property_dependencies[property_key]
case property_dependencies
when String, Array
property_dependencies = [property_dependencies].flatten
for dependency_key in property_dependencies
dependency_value = @data[dependency_key]
return false if dependency_value == nil
end
when Class
if property_dependencies.ancestors.include?(Instance)
dependency_instance = property_dependencies.new(property_value)
return false unless dependency_instance.valid?
else
raise TypeError,
"Expected schema Class, got #{property_dependencies.class}."
end
end
end
if self.class.additional_properties_schema == nil
# No additional properties allowed
return false unless unvalidated_fields.empty?
elsif self.class.additional_properties_schema != EMPTY_SCHEMA
# Validate all remaining fields against this schema
for property_key in unvalidated_fields
property_value = @data[property_key]
if !self.class.additional_properties_schema.validate_property_value(
property_value, self.class.additional_properties_schema.data)
return false
end
end
end
if self.class.superclass && self.class.superclass != Instance &&
self.class.ancestors.first != Instance
# The spec actually only defined the 'extends' semantics as children
# must also validate aainst the parent.
return false unless self.class.superclass.new(@data).valid?
end
return true
end
|
ruby
|
def valid?
unvalidated_fields = @data.keys.dup
for property_key, schema_class in self.class.properties
property_value = @data[property_key]
if !self.class.validate_property_value(
property_value, schema_class.data)
return false
end
if property_value == nil && schema_class.data['required'] != true
# Value was omitted, but not required. Still valid. Skip dependency
# checks.
next
end
# Verify property dependencies
property_dependencies = self.class.property_dependencies[property_key]
case property_dependencies
when String, Array
property_dependencies = [property_dependencies].flatten
for dependency_key in property_dependencies
dependency_value = @data[dependency_key]
return false if dependency_value == nil
end
when Class
if property_dependencies.ancestors.include?(Instance)
dependency_instance = property_dependencies.new(property_value)
return false unless dependency_instance.valid?
else
raise TypeError,
"Expected schema Class, got #{property_dependencies.class}."
end
end
end
if self.class.additional_properties_schema == nil
# No additional properties allowed
return false unless unvalidated_fields.empty?
elsif self.class.additional_properties_schema != EMPTY_SCHEMA
# Validate all remaining fields against this schema
for property_key in unvalidated_fields
property_value = @data[property_key]
if !self.class.additional_properties_schema.validate_property_value(
property_value, self.class.additional_properties_schema.data)
return false
end
end
end
if self.class.superclass && self.class.superclass != Instance &&
self.class.ancestors.first != Instance
# The spec actually only defined the 'extends' semantics as children
# must also validate aainst the parent.
return false unless self.class.superclass.new(@data).valid?
end
return true
end
|
[
"def",
"valid?",
"unvalidated_fields",
"=",
"@data",
".",
"keys",
".",
"dup",
"for",
"property_key",
",",
"schema_class",
"in",
"self",
".",
"class",
".",
"properties",
"property_value",
"=",
"@data",
"[",
"property_key",
"]",
"if",
"!",
"self",
".",
"class",
".",
"validate_property_value",
"(",
"property_value",
",",
"schema_class",
".",
"data",
")",
"return",
"false",
"end",
"if",
"property_value",
"==",
"nil",
"&&",
"schema_class",
".",
"data",
"[",
"'required'",
"]",
"!=",
"true",
"# Value was omitted, but not required. Still valid. Skip dependency",
"# checks.",
"next",
"end",
"# Verify property dependencies",
"property_dependencies",
"=",
"self",
".",
"class",
".",
"property_dependencies",
"[",
"property_key",
"]",
"case",
"property_dependencies",
"when",
"String",
",",
"Array",
"property_dependencies",
"=",
"[",
"property_dependencies",
"]",
".",
"flatten",
"for",
"dependency_key",
"in",
"property_dependencies",
"dependency_value",
"=",
"@data",
"[",
"dependency_key",
"]",
"return",
"false",
"if",
"dependency_value",
"==",
"nil",
"end",
"when",
"Class",
"if",
"property_dependencies",
".",
"ancestors",
".",
"include?",
"(",
"Instance",
")",
"dependency_instance",
"=",
"property_dependencies",
".",
"new",
"(",
"property_value",
")",
"return",
"false",
"unless",
"dependency_instance",
".",
"valid?",
"else",
"raise",
"TypeError",
",",
"\"Expected schema Class, got #{property_dependencies.class}.\"",
"end",
"end",
"end",
"if",
"self",
".",
"class",
".",
"additional_properties_schema",
"==",
"nil",
"# No additional properties allowed",
"return",
"false",
"unless",
"unvalidated_fields",
".",
"empty?",
"elsif",
"self",
".",
"class",
".",
"additional_properties_schema",
"!=",
"EMPTY_SCHEMA",
"# Validate all remaining fields against this schema",
"for",
"property_key",
"in",
"unvalidated_fields",
"property_value",
"=",
"@data",
"[",
"property_key",
"]",
"if",
"!",
"self",
".",
"class",
".",
"additional_properties_schema",
".",
"validate_property_value",
"(",
"property_value",
",",
"self",
".",
"class",
".",
"additional_properties_schema",
".",
"data",
")",
"return",
"false",
"end",
"end",
"end",
"if",
"self",
".",
"class",
".",
"superclass",
"&&",
"self",
".",
"class",
".",
"superclass",
"!=",
"Instance",
"&&",
"self",
".",
"class",
".",
"ancestors",
".",
"first",
"!=",
"Instance",
"# The spec actually only defined the 'extends' semantics as children",
"# must also validate aainst the parent.",
"return",
"false",
"unless",
"self",
".",
"class",
".",
"superclass",
".",
"new",
"(",
"@data",
")",
".",
"valid?",
"end",
"return",
"true",
"end"
] |
Validates the parsed data against the schema.
|
[
"Validates",
"the",
"parsed",
"data",
"against",
"the",
"schema",
"."
] |
c710936d68b30840c9feea01f9d89038944b4ec9
|
https://github.com/google/autoparse/blob/c710936d68b30840c9feea01f9d89038944b4ec9/lib/autoparse/instance.rb#L394-L447
|
20,690
|
zachinglis/crummy
|
lib/crummy/action_view.rb
|
Crummy.ViewMethods.render_crumbs
|
def render_crumbs(options = {})
raise ArgumentError, "Renderer and block given" if options.has_key?(:renderer) && block_given?
return yield(crumbs, options) if block_given?
@_renderer ||= if options.has_key?(:renderer)
options.delete(:renderer)
else
require 'crummy/standard_renderer'
Crummy::StandardRenderer.new
end
@_renderer.render_crumbs(crumbs, options)
end
|
ruby
|
def render_crumbs(options = {})
raise ArgumentError, "Renderer and block given" if options.has_key?(:renderer) && block_given?
return yield(crumbs, options) if block_given?
@_renderer ||= if options.has_key?(:renderer)
options.delete(:renderer)
else
require 'crummy/standard_renderer'
Crummy::StandardRenderer.new
end
@_renderer.render_crumbs(crumbs, options)
end
|
[
"def",
"render_crumbs",
"(",
"options",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"\"Renderer and block given\"",
"if",
"options",
".",
"has_key?",
"(",
":renderer",
")",
"&&",
"block_given?",
"return",
"yield",
"(",
"crumbs",
",",
"options",
")",
"if",
"block_given?",
"@_renderer",
"||=",
"if",
"options",
".",
"has_key?",
"(",
":renderer",
")",
"options",
".",
"delete",
"(",
":renderer",
")",
"else",
"require",
"'crummy/standard_renderer'",
"Crummy",
"::",
"StandardRenderer",
".",
"new",
"end",
"@_renderer",
".",
"render_crumbs",
"(",
"crumbs",
",",
"options",
")",
"end"
] |
Render the list of crumbs using renderer
|
[
"Render",
"the",
"list",
"of",
"crumbs",
"using",
"renderer"
] |
915b93a3e98f9162170ccbcaa9fba714f60ca870
|
https://github.com/zachinglis/crummy/blob/915b93a3e98f9162170ccbcaa9fba714f60ca870/lib/crummy/action_view.rb#L15-L27
|
20,691
|
erector/erector
|
lib/erector/convenience.rb
|
Erector.Convenience.javascript
|
def javascript(value = nil, attributes = {})
if value.is_a?(Hash)
attributes = value
value = nil
elsif block_given? && value
raise ArgumentError, "You can't pass both a block and a value to javascript -- please choose one."
end
script(attributes.merge(:type => "text/javascript")) do
# Shouldn't this be a "cdata" HtmlPart?
# (maybe, but the syntax is specific to javascript; it isn't
# really a generic XML CDATA section. Specifically,
# ]]> within value is not treated as ending the
# CDATA section by Firefox2 when parsing text/html,
# although I guess we could refuse to generate ]]>
# there, for the benefit of XML/XHTML parsers).
output << raw("\n// <![CDATA[\n")
if block_given?
yield
else
output << raw(value)
end
output << raw("\n// ]]>")
output.append_newline # this forces a newline even if we're not in pretty mode
end
output << raw("\n")
end
|
ruby
|
def javascript(value = nil, attributes = {})
if value.is_a?(Hash)
attributes = value
value = nil
elsif block_given? && value
raise ArgumentError, "You can't pass both a block and a value to javascript -- please choose one."
end
script(attributes.merge(:type => "text/javascript")) do
# Shouldn't this be a "cdata" HtmlPart?
# (maybe, but the syntax is specific to javascript; it isn't
# really a generic XML CDATA section. Specifically,
# ]]> within value is not treated as ending the
# CDATA section by Firefox2 when parsing text/html,
# although I guess we could refuse to generate ]]>
# there, for the benefit of XML/XHTML parsers).
output << raw("\n// <![CDATA[\n")
if block_given?
yield
else
output << raw(value)
end
output << raw("\n// ]]>")
output.append_newline # this forces a newline even if we're not in pretty mode
end
output << raw("\n")
end
|
[
"def",
"javascript",
"(",
"value",
"=",
"nil",
",",
"attributes",
"=",
"{",
"}",
")",
"if",
"value",
".",
"is_a?",
"(",
"Hash",
")",
"attributes",
"=",
"value",
"value",
"=",
"nil",
"elsif",
"block_given?",
"&&",
"value",
"raise",
"ArgumentError",
",",
"\"You can't pass both a block and a value to javascript -- please choose one.\"",
"end",
"script",
"(",
"attributes",
".",
"merge",
"(",
":type",
"=>",
"\"text/javascript\"",
")",
")",
"do",
"# Shouldn't this be a \"cdata\" HtmlPart?",
"# (maybe, but the syntax is specific to javascript; it isn't",
"# really a generic XML CDATA section. Specifically,",
"# ]]> within value is not treated as ending the",
"# CDATA section by Firefox2 when parsing text/html,",
"# although I guess we could refuse to generate ]]>",
"# there, for the benefit of XML/XHTML parsers).",
"output",
"<<",
"raw",
"(",
"\"\\n// <![CDATA[\\n\"",
")",
"if",
"block_given?",
"yield",
"else",
"output",
"<<",
"raw",
"(",
"value",
")",
"end",
"output",
"<<",
"raw",
"(",
"\"\\n// ]]>\"",
")",
"output",
".",
"append_newline",
"# this forces a newline even if we're not in pretty mode",
"end",
"output",
"<<",
"raw",
"(",
"\"\\n\"",
")",
"end"
] |
Emits a javascript block inside a +script+ tag, wrapped in CDATA
doohickeys like all the cool JS kids do.
|
[
"Emits",
"a",
"javascript",
"block",
"inside",
"a",
"+",
"script",
"+",
"tag",
"wrapped",
"in",
"CDATA",
"doohickeys",
"like",
"all",
"the",
"cool",
"JS",
"kids",
"do",
"."
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/convenience.rb#L62-L89
|
20,692
|
kolosek/finance_math
|
lib/finance_math/loan.rb
|
FinanceMath.Loan.pmt
|
def pmt(options = {})
future_value = options.fetch(:future_value, 0)
type = options.fetch(:type, 0)
((@amount * interest(@monthly_rate, @duration) - future_value ) / ((1.0 + @monthly_rate * type) * fvifa(@monthly_rate, duration)))
end
|
ruby
|
def pmt(options = {})
future_value = options.fetch(:future_value, 0)
type = options.fetch(:type, 0)
((@amount * interest(@monthly_rate, @duration) - future_value ) / ((1.0 + @monthly_rate * type) * fvifa(@monthly_rate, duration)))
end
|
[
"def",
"pmt",
"(",
"options",
"=",
"{",
"}",
")",
"future_value",
"=",
"options",
".",
"fetch",
"(",
":future_value",
",",
"0",
")",
"type",
"=",
"options",
".",
"fetch",
"(",
":type",
",",
"0",
")",
"(",
"(",
"@amount",
"*",
"interest",
"(",
"@monthly_rate",
",",
"@duration",
")",
"-",
"future_value",
")",
"/",
"(",
"(",
"1.0",
"+",
"@monthly_rate",
"*",
"type",
")",
"*",
"fvifa",
"(",
"@monthly_rate",
",",
"duration",
")",
")",
")",
"end"
] |
create a new Loan instance
@return [Loan]
@param [Numeric] decimal value of the interest rate
@param [Integer] Duration of the loan period
@param [Float] Loan amount
@param [Float] structure fee - fee for the market in percentages
@param [Float] currency protection - Protection for currency changes - usually 3%, default to 0%
@example create a 10.5% Nominal rate
@see http://en.wikipedia.org/wiki/Nominal_interest_rate
@api public
|
[
"create",
"a",
"new",
"Loan",
"instance"
] |
850f774bb7ac80ceb0d6a17c2f2fb8066ef02dfd
|
https://github.com/kolosek/finance_math/blob/850f774bb7ac80ceb0d6a17c2f2fb8066ef02dfd/lib/finance_math/loan.rb#L54-L58
|
20,693
|
erector/erector
|
lib/erector/jquery.rb
|
Erector.JQuery.jquery
|
def jquery(*args)
event = if args.first.is_a? Symbol
args.shift
else
:ready
end
txt = args.shift
attributes = args.shift || {}
javascript attributes do
rawtext "\n"
rawtext "jQuery(document).#{event}(function($){\n"
rawtext txt
rawtext "\n});"
end
end
|
ruby
|
def jquery(*args)
event = if args.first.is_a? Symbol
args.shift
else
:ready
end
txt = args.shift
attributes = args.shift || {}
javascript attributes do
rawtext "\n"
rawtext "jQuery(document).#{event}(function($){\n"
rawtext txt
rawtext "\n});"
end
end
|
[
"def",
"jquery",
"(",
"*",
"args",
")",
"event",
"=",
"if",
"args",
".",
"first",
".",
"is_a?",
"Symbol",
"args",
".",
"shift",
"else",
":ready",
"end",
"txt",
"=",
"args",
".",
"shift",
"attributes",
"=",
"args",
".",
"shift",
"||",
"{",
"}",
"javascript",
"attributes",
"do",
"rawtext",
"\"\\n\"",
"rawtext",
"\"jQuery(document).#{event}(function($){\\n\"",
"rawtext",
"txt",
"rawtext",
"\"\\n});\"",
"end",
"end"
] |
Emits a jQuery script, inside its own script tag, that is to be run on document ready or load.
Usage (from inside a widget method):
jquery "alert('hi')" :: a jquery ready handler
jquery "alert('hi')", :id => 'foo' :: a jquery ready handler, with attributes in the script tag
jquery :load, "alert('hi')" :: a jquery load handler
|
[
"Emits",
"a",
"jQuery",
"script",
"inside",
"its",
"own",
"script",
"tag",
"that",
"is",
"to",
"be",
"run",
"on",
"document",
"ready",
"or",
"load",
"."
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/jquery.rb#L10-L25
|
20,694
|
erector/erector
|
lib/erector/abstract_widget.rb
|
Erector.AbstractWidget.capture_content
|
def capture_content
original, @_output = output, Output.new
yield
original.widgets.concat(output.widgets) # todo: test!!!
output.to_s
ensure
@_output = original
end
|
ruby
|
def capture_content
original, @_output = output, Output.new
yield
original.widgets.concat(output.widgets) # todo: test!!!
output.to_s
ensure
@_output = original
end
|
[
"def",
"capture_content",
"original",
",",
"@_output",
"=",
"output",
",",
"Output",
".",
"new",
"yield",
"original",
".",
"widgets",
".",
"concat",
"(",
"output",
".",
"widgets",
")",
"# todo: test!!!",
"output",
".",
"to_s",
"ensure",
"@_output",
"=",
"original",
"end"
] |
Creates a whole new output string, executes the block, then converts the
output string to a string and returns it as raw text. If at all possible
you should avoid this method since it hurts performance, and use
+widget+ instead.
|
[
"Creates",
"a",
"whole",
"new",
"output",
"string",
"executes",
"the",
"block",
"then",
"converts",
"the",
"output",
"string",
"to",
"a",
"string",
"and",
"returns",
"it",
"as",
"raw",
"text",
".",
"If",
"at",
"all",
"possible",
"you",
"should",
"avoid",
"this",
"method",
"since",
"it",
"hurts",
"performance",
"and",
"use",
"+",
"widget",
"+",
"instead",
"."
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/abstract_widget.rb#L176-L183
|
20,695
|
erector/erector
|
lib/erector/abstract_widget.rb
|
Erector.AbstractWidget._emit_via
|
def _emit_via(parent, options = {}, &block)
_emit(options.merge(:parent => parent,
:output => parent.output,
:helpers => parent.helpers), &block)
end
|
ruby
|
def _emit_via(parent, options = {}, &block)
_emit(options.merge(:parent => parent,
:output => parent.output,
:helpers => parent.helpers), &block)
end
|
[
"def",
"_emit_via",
"(",
"parent",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"_emit",
"(",
"options",
".",
"merge",
"(",
":parent",
"=>",
"parent",
",",
":output",
"=>",
"parent",
".",
"output",
",",
":helpers",
"=>",
"parent",
".",
"helpers",
")",
",",
"block",
")",
"end"
] |
same as _emit, but using a parent widget's output stream and helpers
|
[
"same",
"as",
"_emit",
"but",
"using",
"a",
"parent",
"widget",
"s",
"output",
"stream",
"and",
"helpers"
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/abstract_widget.rb#L210-L214
|
20,696
|
erector/erector
|
lib/erector/rails3.rb
|
Erector.Rails.render
|
def render(*args, &block)
captured = helpers.capture do
helpers.concat(helpers.render(*args, &block))
helpers.output_buffer.to_s
end
rawtext(captured)
end
|
ruby
|
def render(*args, &block)
captured = helpers.capture do
helpers.concat(helpers.render(*args, &block))
helpers.output_buffer.to_s
end
rawtext(captured)
end
|
[
"def",
"render",
"(",
"*",
"args",
",",
"&",
"block",
")",
"captured",
"=",
"helpers",
".",
"capture",
"do",
"helpers",
".",
"concat",
"(",
"helpers",
".",
"render",
"(",
"args",
",",
"block",
")",
")",
"helpers",
".",
"output_buffer",
".",
"to_s",
"end",
"rawtext",
"(",
"captured",
")",
"end"
] |
Wrap Rails' render method, to capture output from partials etc.
|
[
"Wrap",
"Rails",
"render",
"method",
"to",
"capture",
"output",
"from",
"partials",
"etc",
"."
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/rails3.rb#L115-L121
|
20,697
|
erector/erector
|
lib/erector/rails3.rb
|
Erector.Rails.content_for
|
def content_for(*args,&block)
if block
helpers.content_for(*args,&block)
else
rawtext(helpers.content_for(*args))
''
end
end
|
ruby
|
def content_for(*args,&block)
if block
helpers.content_for(*args,&block)
else
rawtext(helpers.content_for(*args))
''
end
end
|
[
"def",
"content_for",
"(",
"*",
"args",
",",
"&",
"block",
")",
"if",
"block",
"helpers",
".",
"content_for",
"(",
"args",
",",
"block",
")",
"else",
"rawtext",
"(",
"helpers",
".",
"content_for",
"(",
"args",
")",
")",
"''",
"end",
"end"
] |
Rails content_for is output if and only if no block given
|
[
"Rails",
"content_for",
"is",
"output",
"if",
"and",
"only",
"if",
"no",
"block",
"given"
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/rails3.rb#L124-L131
|
20,698
|
erector/erector
|
lib/erector/text.rb
|
Erector.Text.character
|
def character(code_point_or_name)
if code_point_or_name.is_a?(Symbol)
require "erector/unicode"
found = Erector::CHARACTERS[code_point_or_name]
if found.nil?
raise "Unrecognized character #{code_point_or_name}"
end
raw("&#x#{sprintf '%x', found};")
elsif code_point_or_name.is_a?(Integer)
raw("&#x#{sprintf '%x', code_point_or_name};")
else
raise "Unrecognized argument to character: #{code_point_or_name}"
end
end
|
ruby
|
def character(code_point_or_name)
if code_point_or_name.is_a?(Symbol)
require "erector/unicode"
found = Erector::CHARACTERS[code_point_or_name]
if found.nil?
raise "Unrecognized character #{code_point_or_name}"
end
raw("&#x#{sprintf '%x', found};")
elsif code_point_or_name.is_a?(Integer)
raw("&#x#{sprintf '%x', code_point_or_name};")
else
raise "Unrecognized argument to character: #{code_point_or_name}"
end
end
|
[
"def",
"character",
"(",
"code_point_or_name",
")",
"if",
"code_point_or_name",
".",
"is_a?",
"(",
"Symbol",
")",
"require",
"\"erector/unicode\"",
"found",
"=",
"Erector",
"::",
"CHARACTERS",
"[",
"code_point_or_name",
"]",
"if",
"found",
".",
"nil?",
"raise",
"\"Unrecognized character #{code_point_or_name}\"",
"end",
"raw",
"(",
"\"&#x#{sprintf '%x', found};\"",
")",
"elsif",
"code_point_or_name",
".",
"is_a?",
"(",
"Integer",
")",
"raw",
"(",
"\"&#x#{sprintf '%x', code_point_or_name};\"",
")",
"else",
"raise",
"\"Unrecognized argument to character: #{code_point_or_name}\"",
"end",
"end"
] |
Return a character given its unicode code point or unicode name.
|
[
"Return",
"a",
"character",
"given",
"its",
"unicode",
"code",
"point",
"or",
"unicode",
"name",
"."
] |
59754211101b2c50a4c9daa8e64a64e6edc9e976
|
https://github.com/erector/erector/blob/59754211101b2c50a4c9daa8e64a64e6edc9e976/lib/erector/text.rb#L107-L120
|
20,699
|
hcatlin/make_resourceful
|
lib/resourceful/response.rb
|
Resourceful.Response.method_missing
|
def method_missing(name, &block)
@formats.push([name, block || proc {}]) unless @formats.any? {|n,b| n == name}
end
|
ruby
|
def method_missing(name, &block)
@formats.push([name, block || proc {}]) unless @formats.any? {|n,b| n == name}
end
|
[
"def",
"method_missing",
"(",
"name",
",",
"&",
"block",
")",
"@formats",
".",
"push",
"(",
"[",
"name",
",",
"block",
"||",
"proc",
"{",
"}",
"]",
")",
"unless",
"@formats",
".",
"any?",
"{",
"|",
"n",
",",
"b",
"|",
"n",
"==",
"name",
"}",
"end"
] |
Returns a new Response with no format data.
Used to dispatch the individual format methods.
|
[
"Returns",
"a",
"new",
"Response",
"with",
"no",
"format",
"data",
".",
"Used",
"to",
"dispatch",
"the",
"individual",
"format",
"methods",
"."
] |
138455b3650917ffdf31dfee4ef9d4aff3f47b06
|
https://github.com/hcatlin/make_resourceful/blob/138455b3650917ffdf31dfee4ef9d4aff3f47b06/lib/resourceful/response.rb#L29-L31
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.