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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,500 | cbeer/fcrepo_wrapper | lib/fcrepo_wrapper/instance.rb | FcrepoWrapper.Instance.status | def status
return true unless config.managed?
return false if pid.nil?
begin
Process.getpgid(pid)
rescue Errno::ESRCH
return false
end
begin
TCPSocket.new(host, port).close
Net::HTTP.start(host, port) do |http|
http.request(Net::HTTP::Get.... | ruby | def status
return true unless config.managed?
return false if pid.nil?
begin
Process.getpgid(pid)
rescue Errno::ESRCH
return false
end
begin
TCPSocket.new(host, port).close
Net::HTTP.start(host, port) do |http|
http.request(Net::HTTP::Get.... | [
"def",
"status",
"return",
"true",
"unless",
"config",
".",
"managed?",
"return",
"false",
"if",
"pid",
".",
"nil?",
"begin",
"Process",
".",
"getpgid",
"(",
"pid",
")",
"rescue",
"Errno",
"::",
"ESRCH",
"return",
"false",
"end",
"begin",
"TCPSocket",
".",... | Check the status of a managed fcrepo service | [
"Check",
"the",
"status",
"of",
"a",
"managed",
"fcrepo",
"service"
] | 6b91a72e1c91848364a30b73b6e6e4b9b2d21296 | https://github.com/cbeer/fcrepo_wrapper/blob/6b91a72e1c91848364a30b73b6e6e4b9b2d21296/lib/fcrepo_wrapper/instance.rb#L95-L116 |
23,501 | cbeer/fcrepo_wrapper | lib/fcrepo_wrapper/instance.rb | FcrepoWrapper.Instance.clean! | def clean!
stop
remove_instance_dir!
FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)
FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir
md5.clean!
FileUtils.remove_entry(config.version_file) if File.exists? config.... | ruby | def clean!
stop
remove_instance_dir!
FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)
FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir
md5.clean!
FileUtils.remove_entry(config.version_file) if File.exists? config.... | [
"def",
"clean!",
"stop",
"remove_instance_dir!",
"FileUtils",
".",
"remove_entry",
"(",
"config",
".",
"download_path",
")",
"if",
"File",
".",
"exists?",
"(",
"config",
".",
"download_path",
")",
"FileUtils",
".",
"remove_entry",
"(",
"config",
".",
"tmp_save_d... | Clean up any files fcrepo_wrapper may have downloaded | [
"Clean",
"up",
"any",
"files",
"fcrepo_wrapper",
"may",
"have",
"downloaded"
] | 6b91a72e1c91848364a30b73b6e6e4b9b2d21296 | https://github.com/cbeer/fcrepo_wrapper/blob/6b91a72e1c91848364a30b73b6e6e4b9b2d21296/lib/fcrepo_wrapper/instance.rb#L154-L161 |
23,502 | cbeer/fcrepo_wrapper | lib/fcrepo_wrapper/instance.rb | FcrepoWrapper.Instance.remove_instance_dir! | def remove_instance_dir!
FileUtils.remove_entry(config.instance_dir, true) if File.exists? config.instance_dir
end | ruby | def remove_instance_dir!
FileUtils.remove_entry(config.instance_dir, true) if File.exists? config.instance_dir
end | [
"def",
"remove_instance_dir!",
"FileUtils",
".",
"remove_entry",
"(",
"config",
".",
"instance_dir",
",",
"true",
")",
"if",
"File",
".",
"exists?",
"config",
".",
"instance_dir",
"end"
] | Clean up any files in the fcrepo instance dir | [
"Clean",
"up",
"any",
"files",
"in",
"the",
"fcrepo",
"instance",
"dir"
] | 6b91a72e1c91848364a30b73b6e6e4b9b2d21296 | https://github.com/cbeer/fcrepo_wrapper/blob/6b91a72e1c91848364a30b73b6e6e4b9b2d21296/lib/fcrepo_wrapper/instance.rb#L165-L167 |
23,503 | cbeer/fcrepo_wrapper | lib/fcrepo_wrapper/instance.rb | FcrepoWrapper.Instance.extract | def extract
return config.instance_dir if extracted?
jar_file = download
FileUtils.mkdir_p config.instance_dir
FileUtils.cp jar_file, config.binary_path
self.extracted_version = config.version
config.instance_dir
end | ruby | def extract
return config.instance_dir if extracted?
jar_file = download
FileUtils.mkdir_p config.instance_dir
FileUtils.cp jar_file, config.binary_path
self.extracted_version = config.version
config.instance_dir
end | [
"def",
"extract",
"return",
"config",
".",
"instance_dir",
"if",
"extracted?",
"jar_file",
"=",
"download",
"FileUtils",
".",
"mkdir_p",
"config",
".",
"instance_dir",
"FileUtils",
".",
"cp",
"jar_file",
",",
"config",
".",
"binary_path",
"self",
".",
"extracted... | extract a copy of fcrepo to instance_dir
Does noting if fcrepo already exists at instance_dir
@return [String] instance_dir Directory where fcrepo has been installed | [
"extract",
"a",
"copy",
"of",
"fcrepo",
"to",
"instance_dir",
"Does",
"noting",
"if",
"fcrepo",
"already",
"exists",
"at",
"instance_dir"
] | 6b91a72e1c91848364a30b73b6e6e4b9b2d21296 | https://github.com/cbeer/fcrepo_wrapper/blob/6b91a72e1c91848364a30b73b6e6e4b9b2d21296/lib/fcrepo_wrapper/instance.rb#L182-L192 |
23,504 | emonti/rbkb | lib/rbkb/cli.rb | Rbkb::Cli.Executable.exit | def exit(ret)
@exit_status = ret
if defined? Rbkb::Cli::TESTING
throw(((ret==0)? :exit_zero : :exit_err), ret)
else
Kernel.exit(ret)
end
end | ruby | def exit(ret)
@exit_status = ret
if defined? Rbkb::Cli::TESTING
throw(((ret==0)? :exit_zero : :exit_err), ret)
else
Kernel.exit(ret)
end
end | [
"def",
"exit",
"(",
"ret",
")",
"@exit_status",
"=",
"ret",
"if",
"defined?",
"Rbkb",
"::",
"Cli",
"::",
"TESTING",
"throw",
"(",
"(",
"(",
"ret",
"==",
"0",
")",
"?",
":exit_zero",
":",
":exit_err",
")",
",",
"ret",
")",
"else",
"Kernel",
".",
"ex... | Instantiates a new Executable object.
The 'param' argument is a named value hash. The following keys are
significant:
:argv - An array of cli arguments (default ARGV)
:opts - executable/function options for use when running 'go'
:stdout, - IO redirection (mostly for unit tests)
:stderr,
:stdin
The... | [
"Instantiates",
"a",
"new",
"Executable",
"object",
"."
] | a6d35c0fd785bae135034502b1d07ed626aebde5 | https://github.com/emonti/rbkb/blob/a6d35c0fd785bae135034502b1d07ed626aebde5/lib/rbkb/cli.rb#L48-L55 |
23,505 | emonti/rbkb | lib/rbkb/cli.rb | Rbkb::Cli.Executable.add_range_opts | def add_range_opts(fkey, lkey)
@oparse.on("-r", "--range=START[:END]",
"Start and optional end range") do |r|
raise "-x and -r are mutually exclusive" if @parser_got_range
@parser_got_range=true
unless /^(-?[0-9]+)(?::(-?[0-9]+))?$/.match(r)
raise "invalid ran... | ruby | def add_range_opts(fkey, lkey)
@oparse.on("-r", "--range=START[:END]",
"Start and optional end range") do |r|
raise "-x and -r are mutually exclusive" if @parser_got_range
@parser_got_range=true
unless /^(-?[0-9]+)(?::(-?[0-9]+))?$/.match(r)
raise "invalid ran... | [
"def",
"add_range_opts",
"(",
"fkey",
",",
"lkey",
")",
"@oparse",
".",
"on",
"(",
"\"-r\"",
",",
"\"--range=START[:END]\"",
",",
"\"Start and optional end range\"",
")",
"do",
"|",
"r",
"|",
"raise",
"\"-x and -r are mutually exclusive\"",
"if",
"@parser_got_range",
... | Implements numeric and hex range options via '-r' and '-x'
Takes two arguments which are the @opts hash key names for
first and last parameters.
(Used commonly throughout several executables) | [
"Implements",
"numeric",
"and",
"hex",
"range",
"options",
"via",
"-",
"r",
"and",
"-",
"x"
] | a6d35c0fd785bae135034502b1d07ed626aebde5 | https://github.com/emonti/rbkb/blob/a6d35c0fd785bae135034502b1d07ed626aebde5/lib/rbkb/cli.rb#L148-L189 |
23,506 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.create_transaction | def create_transaction(payment_method, transaction)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateTransactionResponse)
end
begin
case payment_method
when Enums::Payme... | ruby | def create_transaction(payment_method, transaction)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateTransactionResponse)
end
begin
case payment_method
when Enums::Payme... | [
"def",
"create_transaction",
"(",
"payment_method",
",",
"transaction",
")",
"unless",
"get_valid?",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
... | Creates a transaction either using an authorisation, the responsive shared
page, transparent redirect, or direct as the source of funds
@param [Enums::PaymentMethod] payment_method Describes where the card details will be coming from for this transaction (Direct, Responsive Shared, Transparent Redirect etc)
@param ... | [
"Creates",
"a",
"transaction",
"either",
"using",
"an",
"authorisation",
"the",
"responsive",
"shared",
"page",
"transparent",
"redirect",
"or",
"direct",
"as",
"the",
"source",
"of",
"funds"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L48-L99 |
23,507 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.query_transaction_by_filter | def query_transaction_by_filter(filter)
index_of_value = filter.calculate_index_of_value
if index_of_value.nil?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('Invalid transaction filter'), QueryTransactionResponse)
end
case index_of_value
when Enums::T... | ruby | def query_transaction_by_filter(filter)
index_of_value = filter.calculate_index_of_value
if index_of_value.nil?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('Invalid transaction filter'), QueryTransactionResponse)
end
case index_of_value
when Enums::T... | [
"def",
"query_transaction_by_filter",
"(",
"filter",
")",
"index_of_value",
"=",
"filter",
".",
"calculate_index_of_value",
"if",
"index_of_value",
".",
"nil?",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
... | Query a transaction by one of four properties transaction id, access
code, invoice number, invoice reference
@param [Enums::TransactionFilter] filter Filter definition for searching
@return [QueryTransactionResponse] | [
"Query",
"a",
"transaction",
"by",
"one",
"of",
"four",
"properties",
"transaction",
"id",
"access",
"code",
"invoice",
"number",
"invoice",
"reference"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L122-L140 |
23,508 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.refund | def refund(refund)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), RefundResponse)
end
begin
url = @web_url + Constants::TRANSACTION_METHOD
request = Message::RefundProcess:... | ruby | def refund(refund)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), RefundResponse)
end
begin
url = @web_url + Constants::TRANSACTION_METHOD
request = Message::RefundProcess:... | [
"def",
"refund",
"(",
"refund",
")",
"unless",
"@is_valid",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
",",
"RefundResponse",
")",
"end",
"b... | Refunds all or part of a transaction
@param [Models::Refund] refund contains information to refund
@return [RefundResponse] | [
"Refunds",
"all",
"or",
"part",
"of",
"a",
"transaction"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L146-L161 |
23,509 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.create_customer | def create_customer(payment_method, customer)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateCustomerResponse)
end
begin
case payment_method
when Enums::PaymentMethod:... | ruby | def create_customer(payment_method, customer)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateCustomerResponse)
end
begin
case payment_method
when Enums::PaymentMethod:... | [
"def",
"create_customer",
"(",
"payment_method",
",",
"customer",
")",
"unless",
"get_valid?",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
",",
... | Creates a token customer to store card details in the secure eWAY Vault
for charging later
@param [Enums::PaymentMethod] payment_method Describes where the card details will be coming from for this transaction (Direct, Responsive Shared, Transparent Redirect etc).
@param [Models::Customer] customer The customer's d... | [
"Creates",
"a",
"token",
"customer",
"to",
"store",
"card",
"details",
"in",
"the",
"secure",
"eWAY",
"Vault",
"for",
"charging",
"later"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L189-L220 |
23,510 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.update_customer | def update_customer(payment_method, customer)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateCustomerResponse)
end
begin
case payment_method
when Enums::PaymentMethod:... | ruby | def update_customer(payment_method, customer)
unless get_valid?
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), CreateCustomerResponse)
end
begin
case payment_method
when Enums::PaymentMethod:... | [
"def",
"update_customer",
"(",
"payment_method",
",",
"customer",
")",
"unless",
"get_valid?",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
",",
... | Updates an existing token customer for the merchant in their eWAY account.
@param [Enums::PaymentMethod] payment_method Describes where the card details will be coming from for this transaction (Direct, Responsive Shared, Transparent Redirect etc).
@param [Models::Customer] customer The customer's details
@return [... | [
"Updates",
"an",
"existing",
"token",
"customer",
"for",
"the",
"merchant",
"in",
"their",
"eWAY",
"account",
"."
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L227-L257 |
23,511 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.query_customer | def query_customer(token_customer_id)
@logger.debug('Query customer with id:' + token_customer_id.to_s) if @logger
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
end
... | ruby | def query_customer(token_customer_id)
@logger.debug('Query customer with id:' + token_customer_id.to_s) if @logger
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
end
... | [
"def",
"query_customer",
"(",
"token_customer_id",
")",
"@logger",
".",
"debug",
"(",
"'Query customer with id:'",
"+",
"token_customer_id",
".",
"to_s",
")",
"if",
"@logger",
"unless",
"@is_valid",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"A... | Returns the details of a Token Customer. This includes the masked card information
for displaying in a UI
@param [Integer] token_customer_id eWAY Token Customer ID to look up.
@return [QueryCustomerResponse] | [
"Returns",
"the",
"details",
"of",
"a",
"Token",
"Customer",
".",
"This",
"includes",
"the",
"masked",
"card",
"information",
"for",
"displaying",
"in",
"a",
"UI"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L264-L280 |
23,512 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.settlement_search | def settlement_search(search_request)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
end
begin
request = Message::TransactionProcess::SettlementSearchMsgProce... | ruby | def settlement_search(search_request)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
end
begin
request = Message::TransactionProcess::SettlementSearchMsgProce... | [
"def",
"settlement_search",
"(",
"search_request",
")",
"unless",
"@is_valid",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
",",
"QueryCustomerRespo... | Performs a search of settlements
@param [SettlementSearch]
@return [SettlementSearchResponse] | [
"Performs",
"a",
"search",
"of",
"settlements"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L286-L302 |
23,513 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.query_transaction_with_path | def query_transaction_with_path(request, request_path)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryTransactionResponse)
end
begin
if request.nil? || request == ''
u... | ruby | def query_transaction_with_path(request, request_path)
unless @is_valid
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryTransactionResponse)
end
begin
if request.nil? || request == ''
u... | [
"def",
"query_transaction_with_path",
"(",
"request",
",",
"request_path",
")",
"unless",
"@is_valid",
"return",
"make_response_with_exception",
"(",
"Exceptions",
"::",
"APIKeyInvalidException",
".",
"new",
"(",
"'API key, password or Rapid endpoint missing or invalid'",
")",
... | Perform a transaction query with the given path
@param [String] request the transaction identifier to query
@param [String] request_path the path to use for the query
@return [QueryTransactionResponse] | [
"Perform",
"a",
"transaction",
"query",
"with",
"the",
"given",
"path"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L334-L352 |
23,514 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.validate_api_param | def validate_api_param
set_valid(true)
if @api_key.nil? || @api_key.empty? || @password.nil? || @password.empty?
add_error_code(Constants::API_KEY_INVALID_ERROR_CODE)
set_valid(false)
end
if @rapid_endpoint.nil? || @rapid_endpoint.empty?
add_error_code(Constants::LIBRARY_... | ruby | def validate_api_param
set_valid(true)
if @api_key.nil? || @api_key.empty? || @password.nil? || @password.empty?
add_error_code(Constants::API_KEY_INVALID_ERROR_CODE)
set_valid(false)
end
if @rapid_endpoint.nil? || @rapid_endpoint.empty?
add_error_code(Constants::LIBRARY_... | [
"def",
"validate_api_param",
"set_valid",
"(",
"true",
")",
"if",
"@api_key",
".",
"nil?",
"||",
"@api_key",
".",
"empty?",
"||",
"@password",
".",
"nil?",
"||",
"@password",
".",
"empty?",
"add_error_code",
"(",
"Constants",
"::",
"API_KEY_INVALID_ERROR_CODE",
... | Validates the Rapid API key, password and endpoint | [
"Validates",
"the",
"Rapid",
"API",
"key",
"password",
"and",
"endpoint"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L375-L401 |
23,515 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.parser_endpoint_to_web_url | def parser_endpoint_to_web_url
# @type [String]
prop_name = nil
if Constants::RAPID_ENDPOINT_PRODUCTION.casecmp(@rapid_endpoint).zero?
prop_name = Constants::GLOBAL_RAPID_PRODUCTION_REST_URL_PARAM
elsif Constants::RAPID_ENDPOINT_SANDBOX.casecmp(@rapid_endpoint).zero?
prop_name = ... | ruby | def parser_endpoint_to_web_url
# @type [String]
prop_name = nil
if Constants::RAPID_ENDPOINT_PRODUCTION.casecmp(@rapid_endpoint).zero?
prop_name = Constants::GLOBAL_RAPID_PRODUCTION_REST_URL_PARAM
elsif Constants::RAPID_ENDPOINT_SANDBOX.casecmp(@rapid_endpoint).zero?
prop_name = ... | [
"def",
"parser_endpoint_to_web_url",
"# @type [String]",
"prop_name",
"=",
"nil",
"if",
"Constants",
"::",
"RAPID_ENDPOINT_PRODUCTION",
".",
"casecmp",
"(",
"@rapid_endpoint",
")",
".",
"zero?",
"prop_name",
"=",
"Constants",
"::",
"GLOBAL_RAPID_PRODUCTION_REST_URL_PARAM",
... | Converts an endpoint string to a URL | [
"Converts",
"an",
"endpoint",
"string",
"to",
"a",
"URL"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L404-L426 |
23,516 | eWAYPayment/eway-rapid-ruby | lib/eway_rapid/rapid_client.rb | EwayRapid.RapidClient.verify_endpoint_url | def verify_endpoint_url(web_url)
begin
resource = RestClient::Resource.new web_url
resource.get
rescue RestClient::Exception => e
if e.http_code == 404
set_valid(false)
end
end
end | ruby | def verify_endpoint_url(web_url)
begin
resource = RestClient::Resource.new web_url
resource.get
rescue RestClient::Exception => e
if e.http_code == 404
set_valid(false)
end
end
end | [
"def",
"verify_endpoint_url",
"(",
"web_url",
")",
"begin",
"resource",
"=",
"RestClient",
"::",
"Resource",
".",
"new",
"web_url",
"resource",
".",
"get",
"rescue",
"RestClient",
"::",
"Exception",
"=>",
"e",
"if",
"e",
".",
"http_code",
"==",
"404",
"set_v... | Checks the Rapid endpoint url
@param [String] web_url | [
"Checks",
"the",
"Rapid",
"endpoint",
"url"
] | 49b0e3845e442dff58466c06cef01b5f8f037990 | https://github.com/eWAYPayment/eway-rapid-ruby/blob/49b0e3845e442dff58466c06cef01b5f8f037990/lib/eway_rapid/rapid_client.rb#L431-L440 |
23,517 | wepay/Ruby-SDK | lib/wepay.rb | WePay.Client.call | def call(call, access_token = false, params = {}, risk_token = false, client_ip = false)
path = call.start_with?('/') ? call : call.prepend('/')
url = URI.parse(api_endpoint + path)
call = Net::HTTP::Post.new(url.path, {
'Content-Type' => 'application/json',
'User-Agent' => 'WePay ... | ruby | def call(call, access_token = false, params = {}, risk_token = false, client_ip = false)
path = call.start_with?('/') ? call : call.prepend('/')
url = URI.parse(api_endpoint + path)
call = Net::HTTP::Post.new(url.path, {
'Content-Type' => 'application/json',
'User-Agent' => 'WePay ... | [
"def",
"call",
"(",
"call",
",",
"access_token",
"=",
"false",
",",
"params",
"=",
"{",
"}",
",",
"risk_token",
"=",
"false",
",",
"client_ip",
"=",
"false",
")",
"path",
"=",
"call",
".",
"start_with?",
"(",
"'/'",
")",
"?",
"call",
":",
"call",
"... | Execute a call to the WePay API. | [
"Execute",
"a",
"call",
"to",
"the",
"WePay",
"API",
"."
] | ebb6d27ac6eeb00362c2fe044709317f3d7162d8 | https://github.com/wepay/Ruby-SDK/blob/ebb6d27ac6eeb00362c2fe044709317f3d7162d8/lib/wepay.rb#L59-L78 |
23,518 | wepay/Ruby-SDK | lib/wepay.rb | WePay.Client.make_request | def make_request(call, url)
request = Net::HTTP.new(url.host, url.port)
request.read_timeout = 30
request.use_ssl = true
response = request.start { |http| http.request(call) }
JSON.parse(response.body)
end | ruby | def make_request(call, url)
request = Net::HTTP.new(url.host, url.port)
request.read_timeout = 30
request.use_ssl = true
response = request.start { |http| http.request(call) }
JSON.parse(response.body)
end | [
"def",
"make_request",
"(",
"call",
",",
"url",
")",
"request",
"=",
"Net",
"::",
"HTTP",
".",
"new",
"(",
"url",
".",
"host",
",",
"url",
".",
"port",
")",
"request",
".",
"read_timeout",
"=",
"30",
"request",
".",
"use_ssl",
"=",
"true",
"response"... | Make the HTTP request to the endpoint. | [
"Make",
"the",
"HTTP",
"request",
"to",
"the",
"endpoint",
"."
] | ebb6d27ac6eeb00362c2fe044709317f3d7162d8 | https://github.com/wepay/Ruby-SDK/blob/ebb6d27ac6eeb00362c2fe044709317f3d7162d8/lib/wepay.rb#L119-L126 |
23,519 | terry90/rails_api_benchmark | lib/rails_api_benchmark.rb | RailsApiBenchmark.Configuration.all | def all
instance_variables.inject({}) do |h, v|
var = v.to_s.sub('@', '')
h.merge(var.to_sym => send(var))
end
end | ruby | def all
instance_variables.inject({}) do |h, v|
var = v.to_s.sub('@', '')
h.merge(var.to_sym => send(var))
end
end | [
"def",
"all",
"instance_variables",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"h",
",",
"v",
"|",
"var",
"=",
"v",
".",
"to_s",
".",
"sub",
"(",
"'@'",
",",
"''",
")",
"h",
".",
"merge",
"(",
"var",
".",
"to_sym",
"=>",
"send",
"(",
"var"... | Default values, INSANE. Must be refactored
Maybe create a yaml or json file to import for default values | [
"Default",
"values",
"INSANE",
".",
"Must",
"be",
"refactored",
"Maybe",
"create",
"a",
"yaml",
"or",
"json",
"file",
"to",
"import",
"for",
"default",
"values"
] | 2991765ff639b2efdf4aa1a56587247ed5ee22d0 | https://github.com/terry90/rails_api_benchmark/blob/2991765ff639b2efdf4aa1a56587247ed5ee22d0/lib/rails_api_benchmark.rb#L50-L55 |
23,520 | manorie/textoken | lib/textoken/searcher.rb | Textoken.Searcher.match_keys | def match_keys
values.each do |v|
Textoken.expression_err("#{v}: is not permitted.") unless yaml.key?(v)
add_regexps(yaml[v])
end
end | ruby | def match_keys
values.each do |v|
Textoken.expression_err("#{v}: is not permitted.") unless yaml.key?(v)
add_regexps(yaml[v])
end
end | [
"def",
"match_keys",
"values",
".",
"each",
"do",
"|",
"v",
"|",
"Textoken",
".",
"expression_err",
"(",
"\"#{v}: is not permitted.\"",
")",
"unless",
"yaml",
".",
"key?",
"(",
"v",
")",
"add_regexps",
"(",
"yaml",
"[",
"v",
"]",
")",
"end",
"end"
] | here we do check for option values user supplied
option values has to be declared at option_values.yml | [
"here",
"we",
"do",
"check",
"for",
"option",
"values",
"user",
"supplied",
"option",
"values",
"has",
"to",
"be",
"declared",
"at",
"option_values",
".",
"yml"
] | e66b0c34217e8c3cfab70f1d4e6abf26f876555f | https://github.com/manorie/textoken/blob/e66b0c34217e8c3cfab70f1d4e6abf26f876555f/lib/textoken/searcher.rb#L34-L39 |
23,521 | ekosz/Plex-Ruby | lib/plex-ruby/season.rb | Plex.Season.episode | def episode(number)
episodes.detect { |epi| epi.index.to_i == number.to_i }
end | ruby | def episode(number)
episodes.detect { |epi| epi.index.to_i == number.to_i }
end | [
"def",
"episode",
"(",
"number",
")",
"episodes",
".",
"detect",
"{",
"|",
"epi",
"|",
"epi",
".",
"index",
".",
"to_i",
"==",
"number",
".",
"to_i",
"}",
"end"
] | Select a particular episode
@param [Fixnum, String] episode index number
@return [Episode] episode with the index of number | [
"Select",
"a",
"particular",
"episode"
] | 981dd175d674c74cad7ea8daf8b52c266c12df29 | https://github.com/ekosz/Plex-Ruby/blob/981dd175d674c74cad7ea8daf8b52c266c12df29/lib/plex-ruby/season.rb#L42-L44 |
23,522 | petethepig/marmot | lib/marmot/client.rb | Marmot.Client.convert | def convert input_io, options={}
@exception = nil
#1
iam "Retrieving cookies... ", false do
response = self.class.get '/tools/webfont-generator'
@cookies = (response.headers.get_fields("Set-Cookie") || []).join(";")
fail "Failed to retrieve cookies" if @cookies.empty?
... | ruby | def convert input_io, options={}
@exception = nil
#1
iam "Retrieving cookies... ", false do
response = self.class.get '/tools/webfont-generator'
@cookies = (response.headers.get_fields("Set-Cookie") || []).join(";")
fail "Failed to retrieve cookies" if @cookies.empty?
... | [
"def",
"convert",
"input_io",
",",
"options",
"=",
"{",
"}",
"@exception",
"=",
"nil",
"#1",
"iam",
"\"Retrieving cookies... \"",
",",
"false",
"do",
"response",
"=",
"self",
".",
"class",
".",
"get",
"'/tools/webfont-generator'",
"@cookies",
"=",
"(",
"respon... | Convert a font file to a webfont kit
@param [String] input_io Input IO. Examples: File.new("font.ttf"), STDOUT
@param [Hash] options Options
@option options
[String] :output_io
Output IO
Default is a File with the name like "webfontkit-20130312-200144.zip"
@option options
[Hash] :custom_option... | [
"Convert",
"a",
"font",
"file",
"to",
"a",
"webfont",
"kit"
] | dd4877fbe1eb40cbbfe49b3a2d2f143aa6db2c58 | https://github.com/petethepig/marmot/blob/dd4877fbe1eb40cbbfe49b3a2d2f143aa6db2c58/lib/marmot/client.rb#L137-L207 |
23,523 | ekosz/Plex-Ruby | lib/plex-ruby/client.rb | Plex.Client.play_media | def play_media(key, user_agent = nil, http_cookies = nil, view_offset = nil)
if !key.is_a?(String) && key.respond_to?(:key)
key = key.key
end
url = player_url+'/application/playMedia?'
url += "path=#{CGI::escape(server.url+key)}"
url += "&key=#{CGI::escape(key)}"
url += "&u... | ruby | def play_media(key, user_agent = nil, http_cookies = nil, view_offset = nil)
if !key.is_a?(String) && key.respond_to?(:key)
key = key.key
end
url = player_url+'/application/playMedia?'
url += "path=#{CGI::escape(server.url+key)}"
url += "&key=#{CGI::escape(key)}"
url += "&u... | [
"def",
"play_media",
"(",
"key",
",",
"user_agent",
"=",
"nil",
",",
"http_cookies",
"=",
"nil",
",",
"view_offset",
"=",
"nil",
")",
"if",
"!",
"key",
".",
"is_a?",
"(",
"String",
")",
"&&",
"key",
".",
"respond_to?",
"(",
":key",
")",
"key",
"=",
... | Plays a video that is in the library
@param [String, Object] the key of the video that we want to play. Or an
Object that responds to :key (see Episode#key) (see Movie#key)
@param [String] no clue what this does, its the Plex Remote Command API though
@param [String] no clue what this does, its the Plex Remote ... | [
"Plays",
"a",
"video",
"that",
"is",
"in",
"the",
"library"
] | 981dd175d674c74cad7ea8daf8b52c266c12df29 | https://github.com/ekosz/Plex-Ruby/blob/981dd175d674c74cad7ea8daf8b52c266c12df29/lib/plex-ruby/client.rb#L64-L78 |
23,524 | ekosz/Plex-Ruby | lib/plex-ruby/client.rb | Plex.Client.screenshot | def screenshot(width, height, quality)
url = player_url+'/application/screenshot?'
url += "width=#{width}"
url += "&height=#{height}"
url += "&quality=#{quality}"
ping url
end | ruby | def screenshot(width, height, quality)
url = player_url+'/application/screenshot?'
url += "width=#{width}"
url += "&height=#{height}"
url += "&quality=#{quality}"
ping url
end | [
"def",
"screenshot",
"(",
"width",
",",
"height",
",",
"quality",
")",
"url",
"=",
"player_url",
"+",
"'/application/screenshot?'",
"url",
"+=",
"\"width=#{width}\"",
"url",
"+=",
"\"&height=#{height}\"",
"url",
"+=",
"\"&quality=#{quality}\"",
"ping",
"url",
"end"
... | Take a screenshot of whats on the Plex Client
@param [String, Fixnum] width of the screenshot
@param [String, Fixnum] height of the screenshot
@param [String, Fixnum] quality of the screenshot
@return [True, nil] true if it worked, nil if something went wrong check
the console for the error message | [
"Take",
"a",
"screenshot",
"of",
"whats",
"on",
"the",
"Plex",
"Client"
] | 981dd175d674c74cad7ea8daf8b52c266c12df29 | https://github.com/ekosz/Plex-Ruby/blob/981dd175d674c74cad7ea8daf8b52c266c12df29/lib/plex-ruby/client.rb#L87-L94 |
23,525 | ekosz/Plex-Ruby | lib/plex-ruby/show.rb | Plex.Show.season | def season(number)
seasons.detect { |sea| sea.index.to_i == number.to_i }
end | ruby | def season(number)
seasons.detect { |sea| sea.index.to_i == number.to_i }
end | [
"def",
"season",
"(",
"number",
")",
"seasons",
".",
"detect",
"{",
"|",
"sea",
"|",
"sea",
".",
"index",
".",
"to_i",
"==",
"number",
".",
"to_i",
"}",
"end"
] | Select a particular season
@param [Fixnum, String] season index number
@return [Season] season with the index of number | [
"Select",
"a",
"particular",
"season"
] | 981dd175d674c74cad7ea8daf8b52c266c12df29 | https://github.com/ekosz/Plex-Ruby/blob/981dd175d674c74cad7ea8daf8b52c266c12df29/lib/plex-ruby/show.rb#L42-L44 |
23,526 | ekosz/Plex-Ruby | lib/plex-ruby/show.rb | Plex.Show.first_season | def first_season
seasons.inject { |a, b| a.index.to_i < b.index.to_i && a.index.to_i > 0 ? a : b }
end | ruby | def first_season
seasons.inject { |a, b| a.index.to_i < b.index.to_i && a.index.to_i > 0 ? a : b }
end | [
"def",
"first_season",
"seasons",
".",
"inject",
"{",
"|",
"a",
",",
"b",
"|",
"a",
".",
"index",
".",
"to_i",
"<",
"b",
".",
"index",
".",
"to_i",
"&&",
"a",
".",
"index",
".",
"to_i",
">",
"0",
"?",
"a",
":",
"b",
"}",
"end"
] | Selects the first season of this show that is on the Plex Server
Does not select season 0
@return [Season] season with the lowest index (but not 0) | [
"Selects",
"the",
"first",
"season",
"of",
"this",
"show",
"that",
"is",
"on",
"the",
"Plex",
"Server",
"Does",
"not",
"select",
"season",
"0"
] | 981dd175d674c74cad7ea8daf8b52c266c12df29 | https://github.com/ekosz/Plex-Ruby/blob/981dd175d674c74cad7ea8daf8b52c266c12df29/lib/plex-ruby/show.rb#L59-L61 |
23,527 | manorie/textoken | lib/textoken/base.rb | Textoken.Base.tokens | def tokens
options.collection.each do |option|
if @findings.nil?
@findings = option.tokenize(self)
else
@findings &= option.tokenize(self)
end
end
Tokenizer.new(self).tokens
end | ruby | def tokens
options.collection.each do |option|
if @findings.nil?
@findings = option.tokenize(self)
else
@findings &= option.tokenize(self)
end
end
Tokenizer.new(self).tokens
end | [
"def",
"tokens",
"options",
".",
"collection",
".",
"each",
"do",
"|",
"option",
"|",
"if",
"@findings",
".",
"nil?",
"@findings",
"=",
"option",
".",
"tokenize",
"(",
"self",
")",
"else",
"@findings",
"&=",
"option",
".",
"tokenize",
"(",
"self",
")",
... | we do take intersection array of results
returning from multiple options | [
"we",
"do",
"take",
"intersection",
"array",
"of",
"results",
"returning",
"from",
"multiple",
"options"
] | e66b0c34217e8c3cfab70f1d4e6abf26f876555f | https://github.com/manorie/textoken/blob/e66b0c34217e8c3cfab70f1d4e6abf26f876555f/lib/textoken/base.rb#L15-L25 |
23,528 | veny/orientdb4r | lib/orientdb4r/rest/client.rb | Orientdb4r.RestClient.gremlin | def gremlin(gremlin)
raise ArgumentError, 'gremlin query is blank' if blank? gremlin
response = call_server(:method => :post, :uri => "command/#{@database}/gremlin/#{CGI::escape(gremlin)}")
entries = process_response(response) do
raise NotFoundError, 'record not found' if response.body =~ /ORe... | ruby | def gremlin(gremlin)
raise ArgumentError, 'gremlin query is blank' if blank? gremlin
response = call_server(:method => :post, :uri => "command/#{@database}/gremlin/#{CGI::escape(gremlin)}")
entries = process_response(response) do
raise NotFoundError, 'record not found' if response.body =~ /ORe... | [
"def",
"gremlin",
"(",
"gremlin",
")",
"raise",
"ArgumentError",
",",
"'gremlin query is blank'",
"if",
"blank?",
"gremlin",
"response",
"=",
"call_server",
"(",
":method",
"=>",
":post",
",",
":uri",
"=>",
"\"command/#{@database}/gremlin/#{CGI::escape(gremlin)}\"",
")"... | Executes a Gremlin command against the database. | [
"Executes",
"a",
"Gremlin",
"command",
"against",
"the",
"database",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/client.rb#L300-L311 |
23,529 | veny/orientdb4r | lib/orientdb4r/rest/client.rb | Orientdb4r.RestClient.process_response | def process_response(response)
raise ArgumentError, 'response is null' if response.nil?
if block_given?
yield
end
# return code
if 401 == response.code
raise UnauthorizedError, compose_error_message(response)
elsif 500 == response.code
rai... | ruby | def process_response(response)
raise ArgumentError, 'response is null' if response.nil?
if block_given?
yield
end
# return code
if 401 == response.code
raise UnauthorizedError, compose_error_message(response)
elsif 500 == response.code
rai... | [
"def",
"process_response",
"(",
"response",
")",
"raise",
"ArgumentError",
",",
"'response is null'",
"if",
"response",
".",
"nil?",
"if",
"block_given?",
"yield",
"end",
"# return code",
"if",
"401",
"==",
"response",
".",
"code",
"raise",
"UnauthorizedError",
",... | Processes a HTTP response. | [
"Processes",
"a",
"HTTP",
"response",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/client.rb#L417-L450 |
23,530 | veny/orientdb4r | lib/orientdb4r/rest/client.rb | Orientdb4r.RestClient.compose_error_message | def compose_error_message(http_response, max_len=200)
msg = http_response.body.gsub("\n", ' ')
msg = "#{msg[0..max_len]} ..." if msg.size > max_len
msg
end | ruby | def compose_error_message(http_response, max_len=200)
msg = http_response.body.gsub("\n", ' ')
msg = "#{msg[0..max_len]} ..." if msg.size > max_len
msg
end | [
"def",
"compose_error_message",
"(",
"http_response",
",",
"max_len",
"=",
"200",
")",
"msg",
"=",
"http_response",
".",
"body",
".",
"gsub",
"(",
"\"\\n\"",
",",
"' '",
")",
"msg",
"=",
"\"#{msg[0..max_len]} ...\"",
"if",
"msg",
".",
"size",
">",
"max_len",... | Composes message of an error raised if the HTTP response doesn't
correspond with expectation. | [
"Composes",
"message",
"of",
"an",
"error",
"raised",
"if",
"the",
"HTTP",
"response",
"doesn",
"t",
"correspond",
"with",
"expectation",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/client.rb#L456-L460 |
23,531 | blambeau/wlang | lib/wlang/dialect.rb | WLang.Dialect.dialects_for | def dialects_for(symbols)
info = self.class.tag_dispatching_name(symbols, "_diatag")
raise ArgumentError, "No tag for #{symbols}" unless respond_to?(info)
send(info)
end | ruby | def dialects_for(symbols)
info = self.class.tag_dispatching_name(symbols, "_diatag")
raise ArgumentError, "No tag for #{symbols}" unless respond_to?(info)
send(info)
end | [
"def",
"dialects_for",
"(",
"symbols",
")",
"info",
"=",
"self",
".",
"class",
".",
"tag_dispatching_name",
"(",
"symbols",
",",
"\"_diatag\"",
")",
"raise",
"ArgumentError",
",",
"\"No tag for #{symbols}\"",
"unless",
"respond_to?",
"(",
"info",
")",
"send",
"(... | Returns the dialects used to parse the blocks associated with `symbols`, as
previously installed by `define_tag_method`. | [
"Returns",
"the",
"dialects",
"used",
"to",
"parse",
"the",
"blocks",
"associated",
"with",
"symbols",
"as",
"previously",
"installed",
"by",
"define_tag_method",
"."
] | 6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051 | https://github.com/blambeau/wlang/blob/6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051/lib/wlang/dialect.rb#L120-L124 |
23,532 | blambeau/wlang | lib/wlang/dialect.rb | WLang.Dialect.render | def render(fn, scope = nil, buffer = "")
if scope.nil?
case fn
when String then buffer << fn
when Proc then fn.call(self, buffer)
when Template then fn.call(@scope, buffer)
when TiltTemplate then buffer << fn.render(@scope)
else
... | ruby | def render(fn, scope = nil, buffer = "")
if scope.nil?
case fn
when String then buffer << fn
when Proc then fn.call(self, buffer)
when Template then fn.call(@scope, buffer)
when TiltTemplate then buffer << fn.render(@scope)
else
... | [
"def",
"render",
"(",
"fn",
",",
"scope",
"=",
"nil",
",",
"buffer",
"=",
"\"\"",
")",
"if",
"scope",
".",
"nil?",
"case",
"fn",
"when",
"String",
"then",
"buffer",
"<<",
"fn",
"when",
"Proc",
"then",
"fn",
".",
"call",
"(",
"self",
",",
"buffer",
... | rendering
Renders `fn` to a `buffer`, optionally extending the current scope.
`fn` can either be a String (immediately pushed on the buffer), a Proc (taken as a
tag block to render further), or a Template (taken as a partial to render in the
current scope).
Is `scope` is specified, the current scope is first bra... | [
"rendering",
"Renders",
"fn",
"to",
"a",
"buffer",
"optionally",
"extending",
"the",
"current",
"scope",
"."
] | 6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051 | https://github.com/blambeau/wlang/blob/6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051/lib/wlang/dialect.rb#L139-L153 |
23,533 | blambeau/wlang | lib/wlang/dialect.rb | WLang.Dialect.evaluate | def evaluate(expr, *default, &bl)
case expr
when Symbol, String
catch(:fail) do
return scope.evaluate(expr, self, *default, &bl)
end
raise NameError, "Unable to find `#{expr}` on #{scope}"
else
evaluate(render(expr), *default, &bl)
end
end | ruby | def evaluate(expr, *default, &bl)
case expr
when Symbol, String
catch(:fail) do
return scope.evaluate(expr, self, *default, &bl)
end
raise NameError, "Unable to find `#{expr}` on #{scope}"
else
evaluate(render(expr), *default, &bl)
end
end | [
"def",
"evaluate",
"(",
"expr",
",",
"*",
"default",
",",
"&",
"bl",
")",
"case",
"expr",
"when",
"Symbol",
",",
"String",
"catch",
"(",
":fail",
")",
"do",
"return",
"scope",
".",
"evaluate",
"(",
"expr",
",",
"self",
",",
"default",
",",
"bl",
")... | Evaluates `expr` in the current scope. `expr` can be either
* a Symbol or a String, taken as a dot expression to evaluate
* a Proc or a Template, first rendered and then evaluated
Evaluation is delegated to the scope (@see Scope#evaluate) and the result returned
by this method. | [
"Evaluates",
"expr",
"in",
"the",
"current",
"scope",
".",
"expr",
"can",
"be",
"either"
] | 6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051 | https://github.com/blambeau/wlang/blob/6e45f0c2ae2c8ff27accfab42e4af8ce6d1ff051/lib/wlang/dialect.rb#L183-L193 |
23,534 | tongueroo/forger | lib/forger/network.rb | Forger.Network.security_group_id | def security_group_id
resp = ec2.describe_security_groups(filters: [
{name: "vpc-id", values: [vpc_id]},
{name: "group-name", values: ["default"]}
])
resp.security_groups.first.group_id
end | ruby | def security_group_id
resp = ec2.describe_security_groups(filters: [
{name: "vpc-id", values: [vpc_id]},
{name: "group-name", values: ["default"]}
])
resp.security_groups.first.group_id
end | [
"def",
"security_group_id",
"resp",
"=",
"ec2",
".",
"describe_security_groups",
"(",
"filters",
":",
"[",
"{",
"name",
":",
"\"vpc-id\"",
",",
"values",
":",
"[",
"vpc_id",
"]",
"}",
",",
"{",
"name",
":",
"\"group-name\"",
",",
"values",
":",
"[",
"\"d... | default security group | [
"default",
"security",
"group"
] | 4146215b144bfd40874dfd0db3ad33ab0cc5f7a9 | https://github.com/tongueroo/forger/blob/4146215b144bfd40874dfd0db3ad33ab0cc5f7a9/lib/forger/network.rb#L39-L45 |
23,535 | bdurand/sunspot_index_queue | lib/sunspot/index_queue.rb | Sunspot.IndexQueue.process | def process
count = 0
loop do
entries = Entry.next_batch!(self)
if entries.nil? || entries.empty?
break if Entry.ready_count(self) == 0
else
batch = Batch.new(self, entries)
if defined?(@batch_handler) && @batch_handler
@batch_handler.call(ba... | ruby | def process
count = 0
loop do
entries = Entry.next_batch!(self)
if entries.nil? || entries.empty?
break if Entry.ready_count(self) == 0
else
batch = Batch.new(self, entries)
if defined?(@batch_handler) && @batch_handler
@batch_handler.call(ba... | [
"def",
"process",
"count",
"=",
"0",
"loop",
"do",
"entries",
"=",
"Entry",
".",
"next_batch!",
"(",
"self",
")",
"if",
"entries",
".",
"nil?",
"||",
"entries",
".",
"empty?",
"break",
"if",
"Entry",
".",
"ready_count",
"(",
"self",
")",
"==",
"0",
"... | Process the queue. Exits when there are no more entries to process at the current time.
Returns the number of entries processed.
If any errors are encountered while processing the queue, they will be logged with the errors so they can
be fixed and tried again later. However, if Solr is refusing connections, the pro... | [
"Process",
"the",
"queue",
".",
"Exits",
"when",
"there",
"are",
"no",
"more",
"entries",
"to",
"process",
"at",
"the",
"current",
"time",
".",
"Returns",
"the",
"number",
"of",
"entries",
"processed",
"."
] | 11c2846d0f0f6164de3fdde5202089823e7b9d78 | https://github.com/bdurand/sunspot_index_queue/blob/11c2846d0f0f6164de3fdde5202089823e7b9d78/lib/sunspot/index_queue.rb#L138-L155 |
23,536 | veny/orientdb4r | lib/orientdb4r/rest/model.rb | Orientdb4r.HashExtension.get_mandatory_attribute | def get_mandatory_attribute(name)
key = name.to_s
raise ::ArgumentError, "unknown attribute, name=#{key}" unless self.include? key
self[key]
end | ruby | def get_mandatory_attribute(name)
key = name.to_s
raise ::ArgumentError, "unknown attribute, name=#{key}" unless self.include? key
self[key]
end | [
"def",
"get_mandatory_attribute",
"(",
"name",
")",
"key",
"=",
"name",
".",
"to_s",
"raise",
"::",
"ArgumentError",
",",
"\"unknown attribute, name=#{key}\"",
"unless",
"self",
".",
"include?",
"key",
"self",
"[",
"key",
"]",
"end"
] | Gets an attribute value that has to be presented. | [
"Gets",
"an",
"attribute",
"value",
"that",
"has",
"to",
"be",
"presented",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/model.rb#L10-L14 |
23,537 | veny/orientdb4r | lib/orientdb4r/rest/model.rb | Orientdb4r.OClass.property | def property(name)
raise ArgumentError, 'no properties defined on class' if properties.nil?
props = properties.select { |i| i['name'] == name.to_s }
raise ::ArgumentError, "unknown property, name=#{name}" if props.empty?
raise ::ArgumentError, "too many properties found, name=#{name}" if props.s... | ruby | def property(name)
raise ArgumentError, 'no properties defined on class' if properties.nil?
props = properties.select { |i| i['name'] == name.to_s }
raise ::ArgumentError, "unknown property, name=#{name}" if props.empty?
raise ::ArgumentError, "too many properties found, name=#{name}" if props.s... | [
"def",
"property",
"(",
"name",
")",
"raise",
"ArgumentError",
",",
"'no properties defined on class'",
"if",
"properties",
".",
"nil?",
"props",
"=",
"properties",
".",
"select",
"{",
"|",
"i",
"|",
"i",
"[",
"'name'",
"]",
"==",
"name",
".",
"to_s",
"}",... | Gets a property with the given name. | [
"Gets",
"a",
"property",
"with",
"the",
"given",
"name",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/model.rb#L38-L44 |
23,538 | veny/orientdb4r | lib/orientdb4r/utils.rb | Orientdb4r.Utils.blank? | def blank?(str)
str.nil? or (str.is_a? String and str.strip.empty?)
end | ruby | def blank?(str)
str.nil? or (str.is_a? String and str.strip.empty?)
end | [
"def",
"blank?",
"(",
"str",
")",
"str",
".",
"nil?",
"or",
"(",
"str",
".",
"is_a?",
"String",
"and",
"str",
".",
"strip",
".",
"empty?",
")",
"end"
] | Checks if a given string is either 'nil' or empty string. | [
"Checks",
"if",
"a",
"given",
"string",
"is",
"either",
"nil",
"or",
"empty",
"string",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/utils.rb#L39-L41 |
23,539 | tongueroo/forger | lib/forger/template/context.rb | Forger::Template.Context.load_custom_helpers | def load_custom_helpers
Dir.glob("#{Forger.root}/app/helpers/**/*_helper.rb").each do |path|
filename = path.sub(%r{.*/},'').sub('.rb','')
module_name = filename.classify
# Prepend a period so require works FORGER_ROOT is set to a relative path
# without a period.
#
... | ruby | def load_custom_helpers
Dir.glob("#{Forger.root}/app/helpers/**/*_helper.rb").each do |path|
filename = path.sub(%r{.*/},'').sub('.rb','')
module_name = filename.classify
# Prepend a period so require works FORGER_ROOT is set to a relative path
# without a period.
#
... | [
"def",
"load_custom_helpers",
"Dir",
".",
"glob",
"(",
"\"#{Forger.root}/app/helpers/**/*_helper.rb\"",
")",
".",
"each",
"do",
"|",
"path",
"|",
"filename",
"=",
"path",
".",
"sub",
"(",
"%r{",
"}",
",",
"''",
")",
".",
"sub",
"(",
"'.rb'",
",",
"''",
"... | Load custom helper methods from project | [
"Load",
"custom",
"helper",
"methods",
"from",
"project"
] | 4146215b144bfd40874dfd0db3ad33ab0cc5f7a9 | https://github.com/tongueroo/forger/blob/4146215b144bfd40874dfd0db3ad33ab0cc5f7a9/lib/forger/template/context.rb#L16-L30 |
23,540 | XOlator/wayback_gem | lib/wayback/base.rb | Wayback.Base.attrs | def attrs
@attrs.inject({}) do |attrs, (key, value)|
attrs.merge!(key => respond_to?(key) ? send(key) : value)
end
end | ruby | def attrs
@attrs.inject({}) do |attrs, (key, value)|
attrs.merge!(key => respond_to?(key) ? send(key) : value)
end
end | [
"def",
"attrs",
"@attrs",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"attrs",
",",
"(",
"key",
",",
"value",
")",
"|",
"attrs",
".",
"merge!",
"(",
"key",
"=>",
"respond_to?",
"(",
"key",
")",
"?",
"send",
"(",
"key",
")",
":",
"value",
")",... | Retrieve the attributes of an object
@return [Hash] | [
"Retrieve",
"the",
"attributes",
"of",
"an",
"object"
] | 1f4cdf3e8d023f34abffbce7ff46bc11b2ab8073 | https://github.com/XOlator/wayback_gem/blob/1f4cdf3e8d023f34abffbce7ff46bc11b2ab8073/lib/wayback/base.rb#L95-L99 |
23,541 | veny/orientdb4r | lib/orientdb4r/client.rb | Orientdb4r.Client.database_exists? | def database_exists?(options)
rslt = true
begin
get_database options
rescue OrientdbError
rslt = false
end
rslt
end | ruby | def database_exists?(options)
rslt = true
begin
get_database options
rescue OrientdbError
rslt = false
end
rslt
end | [
"def",
"database_exists?",
"(",
"options",
")",
"rslt",
"=",
"true",
"begin",
"get_database",
"options",
"rescue",
"OrientdbError",
"rslt",
"=",
"false",
"end",
"rslt",
"end"
] | Checks existence of a given database.
Client has not to be connected to see databases suitable to connect. | [
"Checks",
"existence",
"of",
"a",
"given",
"database",
".",
"Client",
"has",
"not",
"to",
"be",
"connected",
"to",
"see",
"databases",
"suitable",
"to",
"connect",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/client.rb#L92-L100 |
23,542 | veny/orientdb4r | lib/orientdb4r/client.rb | Orientdb4r.Client.class_exists? | def class_exists?(name)
rslt = true
begin
get_class name
rescue OrientdbError => e
raise e if e.is_a? ConnectionError and e.message == 'not connected' # workaround for AOP2 (unable to decorate already existing methods)
rslt = false
end
rslt
end | ruby | def class_exists?(name)
rslt = true
begin
get_class name
rescue OrientdbError => e
raise e if e.is_a? ConnectionError and e.message == 'not connected' # workaround for AOP2 (unable to decorate already existing methods)
rslt = false
end
rslt
end | [
"def",
"class_exists?",
"(",
"name",
")",
"rslt",
"=",
"true",
"begin",
"get_class",
"name",
"rescue",
"OrientdbError",
"=>",
"e",
"raise",
"e",
"if",
"e",
".",
"is_a?",
"ConnectionError",
"and",
"e",
".",
"message",
"==",
"'not connected'",
"# workaround for ... | Checks existence of a given class. | [
"Checks",
"existence",
"of",
"a",
"given",
"class",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/client.rb#L208-L217 |
23,543 | veny/orientdb4r | lib/orientdb4r/client.rb | Orientdb4r.Client.drop_class | def drop_class(name, options={})
raise ArgumentError, 'class name is blank' if blank?(name)
# :mode=>:strict forbids to drop a class that is a super class for other one
opt_pattern = { :mode => :nil }
verify_options(options, opt_pattern)
if :strict == options[:mode]
response = get... | ruby | def drop_class(name, options={})
raise ArgumentError, 'class name is blank' if blank?(name)
# :mode=>:strict forbids to drop a class that is a super class for other one
opt_pattern = { :mode => :nil }
verify_options(options, opt_pattern)
if :strict == options[:mode]
response = get... | [
"def",
"drop_class",
"(",
"name",
",",
"options",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'class name is blank'",
"if",
"blank?",
"(",
"name",
")",
"# :mode=>:strict forbids to drop a class that is a super class for other one",
"opt_pattern",
"=",
"{",
":mod... | Removes a class from the schema. | [
"Removes",
"a",
"class",
"from",
"the",
"schema",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/client.rb#L222-L237 |
23,544 | veny/orientdb4r | lib/orientdb4r/client.rb | Orientdb4r.Client.create_property | def create_property(clazz, property, type, options={})
raise ArgumentError, "class name is blank" if blank?(clazz)
raise ArgumentError, "property name is blank" if blank?(property)
opt_pattern = {
:mandatory => :optional , :notnull => :optional, :min => :optional, :max => :optional,
:r... | ruby | def create_property(clazz, property, type, options={})
raise ArgumentError, "class name is blank" if blank?(clazz)
raise ArgumentError, "property name is blank" if blank?(property)
opt_pattern = {
:mandatory => :optional , :notnull => :optional, :min => :optional, :max => :optional,
:r... | [
"def",
"create_property",
"(",
"clazz",
",",
"property",
",",
"type",
",",
"options",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"\"class name is blank\"",
"if",
"blank?",
"(",
"clazz",
")",
"raise",
"ArgumentError",
",",
"\"property name is blank\"",
"i... | Creates a new property in the schema.
You need to create the class before. | [
"Creates",
"a",
"new",
"property",
"in",
"the",
"schema",
".",
"You",
"need",
"to",
"create",
"the",
"class",
"before",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/client.rb#L243-L267 |
23,545 | veny/orientdb4r | lib/orientdb4r/client.rb | Orientdb4r.Client.time_around | def time_around(&block)
start = Time.now
rslt = block.call
query_log("#{aop_context[:class].name}##{aop_context[:method]}", "elapsed time = #{Time.now - start} [s]")
rslt
end | ruby | def time_around(&block)
start = Time.now
rslt = block.call
query_log("#{aop_context[:class].name}##{aop_context[:method]}", "elapsed time = #{Time.now - start} [s]")
rslt
end | [
"def",
"time_around",
"(",
"&",
"block",
")",
"start",
"=",
"Time",
".",
"now",
"rslt",
"=",
"block",
".",
"call",
"query_log",
"(",
"\"#{aop_context[:class].name}##{aop_context[:method]}\"",
",",
"\"elapsed time = #{Time.now - start} [s]\"",
")",
"rslt",
"end"
] | Around advice to meassure and print the method time. | [
"Around",
"advice",
"to",
"meassure",
"and",
"print",
"the",
"method",
"time",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/client.rb#L350-L355 |
23,546 | fromAtoB/awesome_xml | lib/awesome_xml/class_methods.rb | AwesomeXML.ClassMethods.constant_node | def constant_node(name, value, options = {})
attr_reader name.to_sym
define_method("parse_#{name}".to_sym) do
instance_variable_set("@#{name}", value)
end
register(name, options[:private])
end | ruby | def constant_node(name, value, options = {})
attr_reader name.to_sym
define_method("parse_#{name}".to_sym) do
instance_variable_set("@#{name}", value)
end
register(name, options[:private])
end | [
"def",
"constant_node",
"(",
"name",
",",
"value",
",",
"options",
"=",
"{",
"}",
")",
"attr_reader",
"name",
".",
"to_sym",
"define_method",
"(",
"\"parse_#{name}\"",
".",
"to_sym",
")",
"do",
"instance_variable_set",
"(",
"\"@#{name}\"",
",",
"value",
")",
... | Defines a method on your class returning a constant. | [
"Defines",
"a",
"method",
"on",
"your",
"class",
"returning",
"a",
"constant",
"."
] | 4011f0553cd0a62579f5ef4eae6d9ce64142aff0 | https://github.com/fromAtoB/awesome_xml/blob/4011f0553cd0a62579f5ef4eae6d9ce64142aff0/lib/awesome_xml/class_methods.rb#L31-L37 |
23,547 | fromAtoB/awesome_xml | lib/awesome_xml/class_methods.rb | AwesomeXML.ClassMethods.node | def node(name, type, options = {}, &block)
attr_reader name.to_sym
options[:local_context] = @local_context
xpath = NodeXPath.new(name, options).xpath
define_method("parse_#{name}".to_sym) do
evaluate_args = [xpath, AwesomeXML::Type.for(type, self.class.name), options]
instance_v... | ruby | def node(name, type, options = {}, &block)
attr_reader name.to_sym
options[:local_context] = @local_context
xpath = NodeXPath.new(name, options).xpath
define_method("parse_#{name}".to_sym) do
evaluate_args = [xpath, AwesomeXML::Type.for(type, self.class.name), options]
instance_v... | [
"def",
"node",
"(",
"name",
",",
"type",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"attr_reader",
"name",
".",
"to_sym",
"options",
"[",
":local_context",
"]",
"=",
"@local_context",
"xpath",
"=",
"NodeXPath",
".",
"new",
"(",
"name",
",",... | Defines a method on your class returning a parsed value | [
"Defines",
"a",
"method",
"on",
"your",
"class",
"returning",
"a",
"parsed",
"value"
] | 4011f0553cd0a62579f5ef4eae6d9ce64142aff0 | https://github.com/fromAtoB/awesome_xml/blob/4011f0553cd0a62579f5ef4eae6d9ce64142aff0/lib/awesome_xml/class_methods.rb#L47-L59 |
23,548 | davidesantangelo/webinspector | lib/web_inspector/inspector.rb | WebInspector.Inspector.validate_url_domain | def validate_url_domain(u)
# Enforce a few bare standards before proceeding
u = "#{u}"
u = "/" if u.empty?
begin
# Look for evidence of a host. If this is a relative link
# like '/contact', add the page host.
domained_url = @host + u unless (u.split("/").first || "").mat... | ruby | def validate_url_domain(u)
# Enforce a few bare standards before proceeding
u = "#{u}"
u = "/" if u.empty?
begin
# Look for evidence of a host. If this is a relative link
# like '/contact', add the page host.
domained_url = @host + u unless (u.split("/").first || "").mat... | [
"def",
"validate_url_domain",
"(",
"u",
")",
"# Enforce a few bare standards before proceeding",
"u",
"=",
"\"#{u}\"",
"u",
"=",
"\"/\"",
"if",
"u",
".",
"empty?",
"begin",
"# Look for evidence of a host. If this is a relative link",
"# like '/contact', add the page host.",
"do... | Normalize and validate the URLs on the page for comparison | [
"Normalize",
"and",
"validate",
"the",
"URLs",
"on",
"the",
"page",
"for",
"comparison"
] | 430f4e74d7a4977736b99fd0989c5acfd3a57b1d | https://github.com/davidesantangelo/webinspector/blob/430f4e74d7a4977736b99fd0989c5acfd3a57b1d/lib/web_inspector/inspector.rb#L79-L104 |
23,549 | Antondomashnev/danger-missed_localizable_strings | lib/missed_localizable_strings/plugin.rb | Danger.DangerMissedLocalizableStrings.check_localizable_omissions | def check_localizable_omissions
localizable_files = not_deleted_localizable_files
keys_by_file = extract_keys_from_files(localizable_files)
entries = localizable_strings_missed_entries(keys_by_file)
print_missed_entries entries unless entries.empty?
end | ruby | def check_localizable_omissions
localizable_files = not_deleted_localizable_files
keys_by_file = extract_keys_from_files(localizable_files)
entries = localizable_strings_missed_entries(keys_by_file)
print_missed_entries entries unless entries.empty?
end | [
"def",
"check_localizable_omissions",
"localizable_files",
"=",
"not_deleted_localizable_files",
"keys_by_file",
"=",
"extract_keys_from_files",
"(",
"localizable_files",
")",
"entries",
"=",
"localizable_strings_missed_entries",
"(",
"keys_by_file",
")",
"print_missed_entries",
... | Checks whether there are any missed entries in
all Localizable.strings from PR's changeset
files and prints out any found entries.
@return [void] | [
"Checks",
"whether",
"there",
"are",
"any",
"missed",
"entries",
"in",
"all",
"Localizable",
".",
"strings",
"from",
"PR",
"s",
"changeset",
"files",
"and",
"prints",
"out",
"any",
"found",
"entries",
"."
] | 5f149ff97616a3bce53522842685e29571075b97 | https://github.com/Antondomashnev/danger-missed_localizable_strings/blob/5f149ff97616a3bce53522842685e29571075b97/lib/missed_localizable_strings/plugin.rb#L24-L29 |
23,550 | Antondomashnev/danger-missed_localizable_strings | lib/missed_localizable_strings/plugin.rb | Danger.DangerMissedLocalizableStrings.extract_keys_from_files | def extract_keys_from_files(localizable_files)
keys_from_file = {}
localizable_files.each do |file|
lines = File.readlines(file)
# Grab just the keys, we don't need the translation
keys = lines.map { |e| e.split("=").first }
# Filter newlines and comments
keys = keys... | ruby | def extract_keys_from_files(localizable_files)
keys_from_file = {}
localizable_files.each do |file|
lines = File.readlines(file)
# Grab just the keys, we don't need the translation
keys = lines.map { |e| e.split("=").first }
# Filter newlines and comments
keys = keys... | [
"def",
"extract_keys_from_files",
"(",
"localizable_files",
")",
"keys_from_file",
"=",
"{",
"}",
"localizable_files",
".",
"each",
"do",
"|",
"file",
"|",
"lines",
"=",
"File",
".",
"readlines",
"(",
"file",
")",
"# Grab just the keys, we don't need the translation",... | A hash with keyes - Localizable.strings file and
values - modified keys from file | [
"A",
"hash",
"with",
"keyes",
"-",
"Localizable",
".",
"strings",
"file",
"and",
"values",
"-",
"modified",
"keys",
"from",
"file"
] | 5f149ff97616a3bce53522842685e29571075b97 | https://github.com/Antondomashnev/danger-missed_localizable_strings/blob/5f149ff97616a3bce53522842685e29571075b97/lib/missed_localizable_strings/plugin.rb#L82-L96 |
23,551 | caseyscarborough/omdbapi | lib/omdbapi/client.rb | OMDB.Client.title | def title(title, options = {})
options.merge!(title: title)
params = build_params(options)
get '/', params
end | ruby | def title(title, options = {})
options.merge!(title: title)
params = build_params(options)
get '/', params
end | [
"def",
"title",
"(",
"title",
",",
"options",
"=",
"{",
"}",
")",
"options",
".",
"merge!",
"(",
"title",
":",
"title",
")",
"params",
"=",
"build_params",
"(",
"options",
")",
"get",
"'/'",
",",
"params",
"end"
] | Retrieves a movie or show based on its title.
@param title [String] The title of the movie or show.
@param options [Hash] Options for the title, plot or year.
@option options [Integer] :year The year of the movie.
@option options [String] :plot 'short' (default), 'full'
@option options [Integer] :season The seaso... | [
"Retrieves",
"a",
"movie",
"or",
"show",
"based",
"on",
"its",
"title",
"."
] | 3061e8edc8aed5ed1f278b1162b1461fb53893be | https://github.com/caseyscarborough/omdbapi/blob/3061e8edc8aed5ed1f278b1162b1461fb53893be/lib/omdbapi/client.rb#L23-L27 |
23,552 | caseyscarborough/omdbapi | lib/omdbapi/client.rb | OMDB.Client.id | def id(imdb_id, options = {})
options.merge!(id: imdb_id)
params = build_params(options)
get '/', params
end | ruby | def id(imdb_id, options = {})
options.merge!(id: imdb_id)
params = build_params(options)
get '/', params
end | [
"def",
"id",
"(",
"imdb_id",
",",
"options",
"=",
"{",
"}",
")",
"options",
".",
"merge!",
"(",
"id",
":",
"imdb_id",
")",
"params",
"=",
"build_params",
"(",
"options",
")",
"get",
"'/'",
",",
"params",
"end"
] | Retrieves a movie or show based on its IMDb ID.
@param imdb_id [String] The IMDb ID of the movie or show.
@option options [Boolean] :tomatoes Include Rotten Tomatoes ratings.
@return [Hash]
@example
OMDB.id('tt0944947') | [
"Retrieves",
"a",
"movie",
"or",
"show",
"based",
"on",
"its",
"IMDb",
"ID",
"."
] | 3061e8edc8aed5ed1f278b1162b1461fb53893be | https://github.com/caseyscarborough/omdbapi/blob/3061e8edc8aed5ed1f278b1162b1461fb53893be/lib/omdbapi/client.rb#L36-L40 |
23,553 | caseyscarborough/omdbapi | lib/omdbapi/client.rb | OMDB.Client.search | def search(title)
results = get '/', { s: title }
if results[:search]
# Return the title if there is only one result, otherwise return the seach results
search = results.search
search.size == 1 ? title(search[0].title) : search
else
results
end
end | ruby | def search(title)
results = get '/', { s: title }
if results[:search]
# Return the title if there is only one result, otherwise return the seach results
search = results.search
search.size == 1 ? title(search[0].title) : search
else
results
end
end | [
"def",
"search",
"(",
"title",
")",
"results",
"=",
"get",
"'/'",
",",
"{",
"s",
":",
"title",
"}",
"if",
"results",
"[",
":search",
"]",
"# Return the title if there is only one result, otherwise return the seach results",
"search",
"=",
"results",
".",
"search",
... | Search for a movie by its title.
@param title [String] The title of the movie or show to search for.
@return [Array, Hash]
@example
OMDB.find('Star Wars') | [
"Search",
"for",
"a",
"movie",
"by",
"its",
"title",
"."
] | 3061e8edc8aed5ed1f278b1162b1461fb53893be | https://github.com/caseyscarborough/omdbapi/blob/3061e8edc8aed5ed1f278b1162b1461fb53893be/lib/omdbapi/client.rb#L48-L57 |
23,554 | caseyscarborough/omdbapi | lib/omdbapi/client.rb | OMDB.Client.convert_hash_keys | def convert_hash_keys(value)
case value
when Array
value.map { |v| convert_hash_keys(v) }
when Hash
Hash[value.map { |k, v| [k.to_snake_case.to_sym, convert_hash_keys(v)] }]
else
value
end
end | ruby | def convert_hash_keys(value)
case value
when Array
value.map { |v| convert_hash_keys(v) }
when Hash
Hash[value.map { |k, v| [k.to_snake_case.to_sym, convert_hash_keys(v)] }]
else
value
end
end | [
"def",
"convert_hash_keys",
"(",
"value",
")",
"case",
"value",
"when",
"Array",
"value",
".",
"map",
"{",
"|",
"v",
"|",
"convert_hash_keys",
"(",
"v",
")",
"}",
"when",
"Hash",
"Hash",
"[",
"value",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"[",
... | Performs a method on all hash keys.
@param value [Array, Hash, Object]
@return [Array, Hash, Object] | [
"Performs",
"a",
"method",
"on",
"all",
"hash",
"keys",
"."
] | 3061e8edc8aed5ed1f278b1162b1461fb53893be | https://github.com/caseyscarborough/omdbapi/blob/3061e8edc8aed5ed1f278b1162b1461fb53893be/lib/omdbapi/client.rb#L67-L76 |
23,555 | caseyscarborough/omdbapi | lib/omdbapi/client.rb | OMDB.Client.build_params | def build_params(options)
params = {}
params[:t] = options[:title] if options[:title]
params[:i] = options[:id] if options[:id]
params[:y] = options[:year] if options[:year]
params[:plot] = options[:plot] if options[:plot]
params[:season] = options[:season] if options[:se... | ruby | def build_params(options)
params = {}
params[:t] = options[:title] if options[:title]
params[:i] = options[:id] if options[:id]
params[:y] = options[:year] if options[:year]
params[:plot] = options[:plot] if options[:plot]
params[:season] = options[:season] if options[:se... | [
"def",
"build_params",
"(",
"options",
")",
"params",
"=",
"{",
"}",
"params",
"[",
":t",
"]",
"=",
"options",
"[",
":title",
"]",
"if",
"options",
"[",
":title",
"]",
"params",
"[",
":i",
"]",
"=",
"options",
"[",
":id",
"]",
"if",
"options",
"[",... | Build parameters for a request.
@param options [Hash] The optional parameters.
@return [Hash] | [
"Build",
"parameters",
"for",
"a",
"request",
"."
] | 3061e8edc8aed5ed1f278b1162b1461fb53893be | https://github.com/caseyscarborough/omdbapi/blob/3061e8edc8aed5ed1f278b1162b1461fb53893be/lib/omdbapi/client.rb#L82-L93 |
23,556 | veny/orientdb4r | lib/orientdb4r/rest/restclient_node.rb | Orientdb4r.RestClientNode.transform_error2_response | def transform_error2_response(error)
response = ["#{error.message}: #{error.http_body}", error.http_code]
def response.body
self[0]
end
def response.code
self[1]
end
response
end | ruby | def transform_error2_response(error)
response = ["#{error.message}: #{error.http_body}", error.http_code]
def response.body
self[0]
end
def response.code
self[1]
end
response
end | [
"def",
"transform_error2_response",
"(",
"error",
")",
"response",
"=",
"[",
"\"#{error.message}: #{error.http_body}\"",
",",
"error",
".",
"http_code",
"]",
"def",
"response",
".",
"body",
"self",
"[",
"0",
"]",
"end",
"def",
"response",
".",
"code",
"self",
... | Fakes an error thrown by the library into a response object with methods
'code' and 'body'. | [
"Fakes",
"an",
"error",
"thrown",
"by",
"the",
"library",
"into",
"a",
"response",
"object",
"with",
"methods",
"code",
"and",
"body",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/restclient_node.rb#L64-L73 |
23,557 | veny/orientdb4r | lib/orientdb4r/rest/excon_node.rb | Orientdb4r.ExconNode.connection | def connection
return @connection unless @connection.nil?
options = {}
options[:proxy] = proxy unless proxy.nil?
options[:scheme], options[:host], options[:port]=url.scan(/(.*):\/\/(.*):([0-9]*)/).first
@connection ||= Excon::Connection.new(options)
#:read_timeout => se... | ruby | def connection
return @connection unless @connection.nil?
options = {}
options[:proxy] = proxy unless proxy.nil?
options[:scheme], options[:host], options[:port]=url.scan(/(.*):\/\/(.*):([0-9]*)/).first
@connection ||= Excon::Connection.new(options)
#:read_timeout => se... | [
"def",
"connection",
"return",
"@connection",
"unless",
"@connection",
".",
"nil?",
"options",
"=",
"{",
"}",
"options",
"[",
":proxy",
"]",
"=",
"proxy",
"unless",
"proxy",
".",
"nil?",
"options",
"[",
":scheme",
"]",
",",
"options",
"[",
":host",
"]",
... | Gets Excon connection. | [
"Gets",
"Excon",
"connection",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/excon_node.rb#L83-L94 |
23,558 | veny/orientdb4r | lib/orientdb4r/rest/excon_node.rb | Orientdb4r.ExconNode.headers | def headers(options)
rslt = {'Authorization' => basic_auth_header(options[:user], options[:password])}
rslt['Cookie'] = "#{SESSION_COOKIE_NAME}=#{session_id}" if !session_id.nil? and !options[:no_session]
rslt['Content-Type'] = options[:content_type] if options.include? :content_type
rsl... | ruby | def headers(options)
rslt = {'Authorization' => basic_auth_header(options[:user], options[:password])}
rslt['Cookie'] = "#{SESSION_COOKIE_NAME}=#{session_id}" if !session_id.nil? and !options[:no_session]
rslt['Content-Type'] = options[:content_type] if options.include? :content_type
rsl... | [
"def",
"headers",
"(",
"options",
")",
"rslt",
"=",
"{",
"'Authorization'",
"=>",
"basic_auth_header",
"(",
"options",
"[",
":user",
"]",
",",
"options",
"[",
":password",
"]",
")",
"}",
"rslt",
"[",
"'Cookie'",
"]",
"=",
"\"#{SESSION_COOKIE_NAME}=#{session_id... | Get request headers prepared with session ID and Basic Auth. | [
"Get",
"request",
"headers",
"prepared",
"with",
"session",
"ID",
"and",
"Basic",
"Auth",
"."
] | d02d0d27e6ed19c5c5ff377a642355f617c785d7 | https://github.com/veny/orientdb4r/blob/d02d0d27e6ed19c5c5ff377a642355f617c785d7/lib/orientdb4r/rest/excon_node.rb#L98-L104 |
23,559 | OSC/ood_appkit | lib/ood_appkit/configuration.rb | OodAppkit.Configuration.set_default_configuration | def set_default_configuration
ActiveSupport::Deprecation.warn("The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.") if ENV['RAILS_DATAROOT']
self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT']
self.dataroot ||= "~/#{ENV['OOD_POR... | ruby | def set_default_configuration
ActiveSupport::Deprecation.warn("The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.") if ENV['RAILS_DATAROOT']
self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT']
self.dataroot ||= "~/#{ENV['OOD_POR... | [
"def",
"set_default_configuration",
"ActiveSupport",
"::",
"Deprecation",
".",
"warn",
"(",
"\"The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.\"",
")",
"if",
"ENV",
"[",
"'RAILS_DATAROOT'",
"]",
"self",
".",
"datar... | Sets the default configuration for this object.
@return [void] | [
"Sets",
"the",
"default",
"configuration",
"for",
"this",
"object",
"."
] | ea1435d4bbff47cd1786f84096f415441089a7f5 | https://github.com/OSC/ood_appkit/blob/ea1435d4bbff47cd1786f84096f415441089a7f5/lib/ood_appkit/configuration.rb#L68-L123 |
23,560 | OSC/ood_appkit | lib/ood_appkit/configuration.rb | OodAppkit.Configuration.parse_clusters | def parse_clusters(config)
OodCore::Clusters.load_file(config || '/etc/ood/config/clusters.d')
rescue OodCore::ConfigurationNotFound
OodCore::Clusters.new([])
end | ruby | def parse_clusters(config)
OodCore::Clusters.load_file(config || '/etc/ood/config/clusters.d')
rescue OodCore::ConfigurationNotFound
OodCore::Clusters.new([])
end | [
"def",
"parse_clusters",
"(",
"config",
")",
"OodCore",
"::",
"Clusters",
".",
"load_file",
"(",
"config",
"||",
"'/etc/ood/config/clusters.d'",
")",
"rescue",
"OodCore",
"::",
"ConfigurationNotFound",
"OodCore",
"::",
"Clusters",
".",
"new",
"(",
"[",
"]",
")",... | Read in cluster config and parse it | [
"Read",
"in",
"cluster",
"config",
"and",
"parse",
"it"
] | ea1435d4bbff47cd1786f84096f415441089a7f5 | https://github.com/OSC/ood_appkit/blob/ea1435d4bbff47cd1786f84096f415441089a7f5/lib/ood_appkit/configuration.rb#L127-L131 |
23,561 | limarka/pandoc_abnt | lib/pandoc_abnt/quadro_filter.rb | PandocAbnt.QuadroFilter.convert_to_latex | def convert_to_latex(node)
latex_code = nil
Open3.popen3("pandoc -f json -t latex --wrap=none") {|stdin, stdout, stderr, wait_thr|
stdin.write(node.to_json)
stdin.close # stdin, stdout and stderr should be closed explicitly in this form.
latex_code = stdout.read
pid = wait_... | ruby | def convert_to_latex(node)
latex_code = nil
Open3.popen3("pandoc -f json -t latex --wrap=none") {|stdin, stdout, stderr, wait_thr|
stdin.write(node.to_json)
stdin.close # stdin, stdout and stderr should be closed explicitly in this form.
latex_code = stdout.read
pid = wait_... | [
"def",
"convert_to_latex",
"(",
"node",
")",
"latex_code",
"=",
"nil",
"Open3",
".",
"popen3",
"(",
"\"pandoc -f json -t latex --wrap=none\"",
")",
"{",
"|",
"stdin",
",",
"stdout",
",",
"stderr",
",",
"wait_thr",
"|",
"stdin",
".",
"write",
"(",
"node",
"."... | Converte node para latex | [
"Converte",
"node",
"para",
"latex"
] | fe623465b4956db6cddfe6cffffa0cd8ed445a18 | https://github.com/limarka/pandoc_abnt/blob/fe623465b4956db6cddfe6cffffa0cd8ed445a18/lib/pandoc_abnt/quadro_filter.rb#L108-L119 |
23,562 | mguymon/naether | src/main/ruby/naether/maven.rb | Naether.Maven.dependencies | def dependencies( scopes = nil)
if scopes
unless scopes.is_a? Array
scopes = [scopes]
end
end
if Naether.platform == 'java'
if scopes.nil?
deps = @project.getDependenciesNotation()
else
deps = @project.getDependenciesNotation( s... | ruby | def dependencies( scopes = nil)
if scopes
unless scopes.is_a? Array
scopes = [scopes]
end
end
if Naether.platform == 'java'
if scopes.nil?
deps = @project.getDependenciesNotation()
else
deps = @project.getDependenciesNotation( s... | [
"def",
"dependencies",
"(",
"scopes",
"=",
"nil",
")",
"if",
"scopes",
"unless",
"scopes",
".",
"is_a?",
"Array",
"scopes",
"=",
"[",
"scopes",
"]",
"end",
"end",
"if",
"Naether",
".",
"platform",
"==",
"'java'",
"if",
"scopes",
".",
"nil?",
"deps",
"=... | Get dependences for Project as notations
@param [Array<String>] scopes valid options are compile,test,runtime | [
"Get",
"dependences",
"for",
"Project",
"as",
"notations"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/maven.rb#L71-L95 |
23,563 | mguymon/naether | src/main/ruby/naether/maven.rb | Naether.Maven.invoke | def invoke( *opts )
#defaults
config = {
# Checks ENV for maven home, otherwise defaults /usr/share/maven
# XXX: Reuse Eng.getMavenHome?
:maven_home => ENV['maven.home'] || ENV['MAVEN_HOME'] || '/usr/share/maven',
:local_repo => File.expand_path('~/.m2/repository')
}
... | ruby | def invoke( *opts )
#defaults
config = {
# Checks ENV for maven home, otherwise defaults /usr/share/maven
# XXX: Reuse Eng.getMavenHome?
:maven_home => ENV['maven.home'] || ENV['MAVEN_HOME'] || '/usr/share/maven',
:local_repo => File.expand_path('~/.m2/repository')
}
... | [
"def",
"invoke",
"(",
"*",
"opts",
")",
"#defaults",
"config",
"=",
"{",
"# Checks ENV for maven home, otherwise defaults /usr/share/maven",
"# XXX: Reuse Eng.getMavenHome?",
":maven_home",
"=>",
"ENV",
"[",
"'maven.home'",
"]",
"||",
"ENV",
"[",
"'MAVEN_HOME'",
"]",
"|... | Invoke a Maven goal
@params [Array] Goals names | [
"Invoke",
"a",
"Maven",
"goal"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/maven.rb#L152-L176 |
23,564 | abenari/rbovirt | lib/rbovirt.rb | OVIRT.Client.api_version | def api_version
return @api_version unless @api_version.nil?
xml = http_get("/")/'/api/product_info/version'
major = (xml/'version').first[:major]
minor = (xml/'version').first[:minor]
build = (xml/'version').first[:build]
revision = (xml/'version').first[:revision]
@api_versio... | ruby | def api_version
return @api_version unless @api_version.nil?
xml = http_get("/")/'/api/product_info/version'
major = (xml/'version').first[:major]
minor = (xml/'version').first[:minor]
build = (xml/'version').first[:build]
revision = (xml/'version').first[:revision]
@api_versio... | [
"def",
"api_version",
"return",
"@api_version",
"unless",
"@api_version",
".",
"nil?",
"xml",
"=",
"http_get",
"(",
"\"/\"",
")",
"/",
"'/api/product_info/version'",
"major",
"=",
"(",
"xml",
"/",
"'version'",
")",
".",
"first",
"[",
":major",
"]",
"minor",
... | Construct a new ovirt client class.
mandatory parameters
username, password, api_entrypoint - for example 'me@internal', 'secret', 'https://example.com/api'
optional parameters
datacenter_id, cluster_id and filtered_api can be sent in this order for backward
compatibility, or as a hash in the 4th parameter.... | [
"Construct",
"a",
"new",
"ovirt",
"client",
"class",
".",
"mandatory",
"parameters",
"username",
"password",
"api_entrypoint",
"-",
"for",
"example",
"me"
] | e88ffd2ef7470c164a34dd4229cbb8f5a7257265 | https://github.com/abenari/rbovirt/blob/e88ffd2ef7470c164a34dd4229cbb8f5a7257265/lib/rbovirt.rb#L86-L94 |
23,565 | south37/rucc | lib/rucc/gen.rb | Rucc.Gen.emit_builtin_reg_class | def emit_builtin_reg_class(node)
arg = node.args[0]
Util.assert!{ arg.ty.kind == Kind::PTR }
ty = arg.ty.ptr
if ty.kind == Kind::STRUCT
emit("mov $2, #eax")
elsif Type.is_flotype(ty)
emit("mov $1, #eax")
else
emit("mov $0, #eax")
end
end | ruby | def emit_builtin_reg_class(node)
arg = node.args[0]
Util.assert!{ arg.ty.kind == Kind::PTR }
ty = arg.ty.ptr
if ty.kind == Kind::STRUCT
emit("mov $2, #eax")
elsif Type.is_flotype(ty)
emit("mov $1, #eax")
else
emit("mov $0, #eax")
end
end | [
"def",
"emit_builtin_reg_class",
"(",
"node",
")",
"arg",
"=",
"node",
".",
"args",
"[",
"0",
"]",
"Util",
".",
"assert!",
"{",
"arg",
".",
"ty",
".",
"kind",
"==",
"Kind",
"::",
"PTR",
"}",
"ty",
"=",
"arg",
".",
"ty",
".",
"ptr",
"if",
"ty",
... | Set the register class for parameter passing to RAX.
0 is INTEGER, 1 is SSE, 2 is MEMORY.
@param [Node] node | [
"Set",
"the",
"register",
"class",
"for",
"parameter",
"passing",
"to",
"RAX",
".",
"0",
"is",
"INTEGER",
"1",
"is",
"SSE",
"2",
"is",
"MEMORY",
"."
] | 11743d10eb2fcf0834b4f4a34bb5b8a109b32558 | https://github.com/south37/rucc/blob/11743d10eb2fcf0834b4f4a34bb5b8a109b32558/lib/rucc/gen.rb#L1240-L1251 |
23,566 | BookingSync/synced | lib/synced/model.rb | Synced.Model.synced | def synced(strategy: :updated_since, **options)
options.assert_valid_keys(:associations, :data_key, :fields, :globalized_attributes,
:id_key, :include, :initial_sync_since, :local_attributes, :mapper, :only_updated,
:remove, :auto_paginate, :transaction_per_page, :delegate_attributes, :query_param... | ruby | def synced(strategy: :updated_since, **options)
options.assert_valid_keys(:associations, :data_key, :fields, :globalized_attributes,
:id_key, :include, :initial_sync_since, :local_attributes, :mapper, :only_updated,
:remove, :auto_paginate, :transaction_per_page, :delegate_attributes, :query_param... | [
"def",
"synced",
"(",
"strategy",
":",
":updated_since",
",",
"**",
"options",
")",
"options",
".",
"assert_valid_keys",
"(",
":associations",
",",
":data_key",
",",
":fields",
",",
":globalized_attributes",
",",
":id_key",
",",
":include",
",",
":initial_sync_sin... | Enables synced for ActiveRecord model.
@param options [Hash] Configuration options for synced. They are inherited
by subclasses, but can be overwritten in the subclass.
@option options [Symbol] strategy: synchronization strategy, one of :full, :updated_since, :check.
Defaults to :updated_since
@option options... | [
"Enables",
"synced",
"for",
"ActiveRecord",
"model",
"."
] | 4a79eee67497c7b7954b0a8dd6ac832fa06c112b | https://github.com/BookingSync/synced/blob/4a79eee67497c7b7954b0a8dd6ac832fa06c112b/lib/synced/model.rb#L49-L84 |
23,567 | BookingSync/synced | lib/synced/model.rb | Synced.Model.synchronize | def synchronize(scope: scope_from_relation, strategy: synced_strategy, **options)
options.assert_valid_keys(:api, :fields, :include, :remote, :remove, :query_params, :association_sync, :auto_paginate, :transaction_per_page)
options[:remove] = synced_remove unless options.has_key?(:remove)
options[:in... | ruby | def synchronize(scope: scope_from_relation, strategy: synced_strategy, **options)
options.assert_valid_keys(:api, :fields, :include, :remote, :remove, :query_params, :association_sync, :auto_paginate, :transaction_per_page)
options[:remove] = synced_remove unless options.has_key?(:remove)
options[:in... | [
"def",
"synchronize",
"(",
"scope",
":",
"scope_from_relation",
",",
"strategy",
":",
"synced_strategy",
",",
"**",
"options",
")",
"options",
".",
"assert_valid_keys",
"(",
":api",
",",
":fields",
",",
":include",
",",
":remote",
",",
":remove",
",",
":query_... | Performs synchronization of given remote objects to local database.
@param remote [Array] - Remote objects to be synchronized with local db. If
it's nil then synchronizer will make request on it's own.
@param model_class [Class] - ActiveRecord model class to which remote objects
will be synchronized.
@param s... | [
"Performs",
"synchronization",
"of",
"given",
"remote",
"objects",
"to",
"local",
"database",
"."
] | 4a79eee67497c7b7954b0a8dd6ac832fa06c112b | https://github.com/BookingSync/synced/blob/4a79eee67497c7b7954b0a8dd6ac832fa06c112b/lib/synced/model.rb#L120-L146 |
23,568 | BookingSync/synced | lib/synced/model.rb | Synced.Model.reset_synced | def reset_synced(scope: scope_from_relation)
options = {
scope: scope,
strategy: synced_strategy,
only_updated: synced_only_updated,
initial_sync_since: synced_initial_sync_since,
timestamp_strategy: synced_timestamp_strategy,
... | ruby | def reset_synced(scope: scope_from_relation)
options = {
scope: scope,
strategy: synced_strategy,
only_updated: synced_only_updated,
initial_sync_since: synced_initial_sync_since,
timestamp_strategy: synced_timestamp_strategy,
... | [
"def",
"reset_synced",
"(",
"scope",
":",
"scope_from_relation",
")",
"options",
"=",
"{",
"scope",
":",
"scope",
",",
"strategy",
":",
"synced_strategy",
",",
"only_updated",
":",
"synced_only_updated",
",",
"initial_sync_since",
":",
"synced_initial_sync_since",
"... | Reset last sync timestamp for given scope, this forces synced to sync
all the records on the next sync. Useful for cases when you add
a new column to be synced and you use updated since strategy for faster
synchronization. | [
"Reset",
"last",
"sync",
"timestamp",
"for",
"given",
"scope",
"this",
"forces",
"synced",
"to",
"sync",
"all",
"the",
"records",
"on",
"the",
"next",
"sync",
".",
"Useful",
"for",
"cases",
"when",
"you",
"add",
"a",
"new",
"column",
"to",
"be",
"synced"... | 4a79eee67497c7b7954b0a8dd6ac832fa06c112b | https://github.com/BookingSync/synced/blob/4a79eee67497c7b7954b0a8dd6ac832fa06c112b/lib/synced/model.rb#L152-L162 |
23,569 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.add_remote_repository | def add_remote_repository( url, username = nil, password = nil )
if username
@resolver.addRemoteRepositoryByUrl( url, username, password )
else
@resolver.addRemoteRepositoryByUrl( url )
end
end | ruby | def add_remote_repository( url, username = nil, password = nil )
if username
@resolver.addRemoteRepositoryByUrl( url, username, password )
else
@resolver.addRemoteRepositoryByUrl( url )
end
end | [
"def",
"add_remote_repository",
"(",
"url",
",",
"username",
"=",
"nil",
",",
"password",
"=",
"nil",
")",
"if",
"username",
"@resolver",
".",
"addRemoteRepositoryByUrl",
"(",
"url",
",",
"username",
",",
"password",
")",
"else",
"@resolver",
".",
"addRemoteRe... | Add remote repository
@param [String] url of remote repo
@param [String] username optional
@param [String] password optioanl | [
"Add",
"remote",
"repository"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L46-L52 |
23,570 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.build_artifacts= | def build_artifacts=( artifacts )
@resolver.clearBuildArtifacts()
unless artifacts.is_a? Array
artifacts = [artifacts]
end
artifacts.each do |artifact|
# Hash of notation => path or notation => { :path =>, :pom => }
if artifact.is_a? Hash
notation, opts = art... | ruby | def build_artifacts=( artifacts )
@resolver.clearBuildArtifacts()
unless artifacts.is_a? Array
artifacts = [artifacts]
end
artifacts.each do |artifact|
# Hash of notation => path or notation => { :path =>, :pom => }
if artifact.is_a? Hash
notation, opts = art... | [
"def",
"build_artifacts",
"=",
"(",
"artifacts",
")",
"@resolver",
".",
"clearBuildArtifacts",
"(",
")",
"unless",
"artifacts",
".",
"is_a?",
"Array",
"artifacts",
"=",
"[",
"artifacts",
"]",
"end",
"artifacts",
".",
"each",
"do",
"|",
"artifact",
"|",
"# Ha... | Set local Build Artifacts, that will be used in the Dependency Resolution
@param [Array<Hash>] artifacts of Hashs with { notation => path } or { notation => { :path => path, :pom => pom_path } | [
"Set",
"local",
"Build",
"Artifacts",
"that",
"will",
"be",
"used",
"in",
"the",
"Dependency",
"Resolution"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L98-L121 |
23,571 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.add_pom_dependencies | def add_pom_dependencies( pom_path, scopes=['compile'] )
if Naether.platform == 'java'
@resolver.addDependencies( pom_path, scopes )
else
list = Naether::Java.convert_to_java_list( scopes )
@resolver._invoke( 'addDependencies', 'Ljava.lang.String;Ljava.util.List;', pom_path, list )
... | ruby | def add_pom_dependencies( pom_path, scopes=['compile'] )
if Naether.platform == 'java'
@resolver.addDependencies( pom_path, scopes )
else
list = Naether::Java.convert_to_java_list( scopes )
@resolver._invoke( 'addDependencies', 'Ljava.lang.String;Ljava.util.List;', pom_path, list )
... | [
"def",
"add_pom_dependencies",
"(",
"pom_path",
",",
"scopes",
"=",
"[",
"'compile'",
"]",
")",
"if",
"Naether",
".",
"platform",
"==",
"'java'",
"@resolver",
".",
"addDependencies",
"(",
"pom_path",
",",
"scopes",
")",
"else",
"list",
"=",
"Naether",
"::",
... | Add dependencies from a Maven POM
@param [String] pom_path
@param [Array<String>] scopes valid options are compile,test,runtime | [
"Add",
"dependencies",
"from",
"a",
"Maven",
"POM"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L145-L152 |
23,572 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.dependencies= | def dependencies=(dependencies)
@resolver.clearDependencies()
unless dependencies.is_a? Array
dependencies = [dependencies]
end
dependencies.each do |dependent|
# Hash of notation => scope
if dependent.is_a? Hash
key = dependent.keys.first
# Add pom... | ruby | def dependencies=(dependencies)
@resolver.clearDependencies()
unless dependencies.is_a? Array
dependencies = [dependencies]
end
dependencies.each do |dependent|
# Hash of notation => scope
if dependent.is_a? Hash
key = dependent.keys.first
# Add pom... | [
"def",
"dependencies",
"=",
"(",
"dependencies",
")",
"@resolver",
".",
"clearDependencies",
"(",
")",
"unless",
"dependencies",
".",
"is_a?",
"Array",
"dependencies",
"=",
"[",
"dependencies",
"]",
"end",
"dependencies",
".",
"each",
"do",
"|",
"dependent",
"... | Set the dependencies
The dependencies param takes an [Array] of mixed dependencies:
* [String] Artifact notation, such as groupId:artifactId:version, e.g. 'junit:junit:4.7'
* [Hash] of a single artifaction notation => scope - { 'junit:junit:4.7' => 'test' }
* [String] path to a local pom - 'lib/pom.xml'
* [Ha... | [
"Set",
"the",
"dependencies"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L176-L220 |
23,573 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.dependencies_graph | def dependencies_graph(nodes=nil)
nodes = @resolver.getDependenciesGraph() unless nodes
graph = {}
if Naether.platform == 'java'
nodes.each do |k,v|
deps = dependencies_graph(v)
graph[k] = Naether::Java.convert_to_ruby_hash( deps )
end
else
iterator =... | ruby | def dependencies_graph(nodes=nil)
nodes = @resolver.getDependenciesGraph() unless nodes
graph = {}
if Naether.platform == 'java'
nodes.each do |k,v|
deps = dependencies_graph(v)
graph[k] = Naether::Java.convert_to_ruby_hash( deps )
end
else
iterator =... | [
"def",
"dependencies_graph",
"(",
"nodes",
"=",
"nil",
")",
"nodes",
"=",
"@resolver",
".",
"getDependenciesGraph",
"(",
")",
"unless",
"nodes",
"graph",
"=",
"{",
"}",
"if",
"Naether",
".",
"platform",
"==",
"'java'",
"nodes",
".",
"each",
"do",
"|",
"k... | Dependencies as a Graph of nested Hashes
@return [Hash] | [
"Dependencies",
"as",
"a",
"Graph",
"of",
"nested",
"Hashes"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L254-L273 |
23,574 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.load_dependencies_to_classpath | def load_dependencies_to_classpath
jars = dependencies_classpath.split(File::PATH_SEPARATOR)
Naether::Java.load_jars(jars)
jars
end | ruby | def load_dependencies_to_classpath
jars = dependencies_classpath.split(File::PATH_SEPARATOR)
Naether::Java.load_jars(jars)
jars
end | [
"def",
"load_dependencies_to_classpath",
"jars",
"=",
"dependencies_classpath",
".",
"split",
"(",
"File",
"::",
"PATH_SEPARATOR",
")",
"Naether",
"::",
"Java",
".",
"load_jars",
"(",
"jars",
")",
"jars",
"end"
] | Load dependencies to Classpath
@return [Array] of loaded jars | [
"Load",
"dependencies",
"to",
"Classpath"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L278-L283 |
23,575 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.to_local_paths | def to_local_paths( notations )
if Naether.platform == 'java'
Naether::Java.convert_to_ruby_array(
Naether::Java.exec_static_method(
'com.tobedevoured.naether.util.Notation',
'getLocalPaths',
[local_repo_path, notations ],
['java.... | ruby | def to_local_paths( notations )
if Naether.platform == 'java'
Naether::Java.convert_to_ruby_array(
Naether::Java.exec_static_method(
'com.tobedevoured.naether.util.Notation',
'getLocalPaths',
[local_repo_path, notations ],
['java.... | [
"def",
"to_local_paths",
"(",
"notations",
")",
"if",
"Naether",
".",
"platform",
"==",
"'java'",
"Naether",
"::",
"Java",
".",
"convert_to_ruby_array",
"(",
"Naether",
"::",
"Java",
".",
"exec_static_method",
"(",
"'com.tobedevoured.naether.util.Notation'",
",",
"'... | Convert notations to local paths of artifacts
@param [Array<String>] notations
@return [Array<String>] of paths to artifacts
@see https://github.com/mguymon/naether/wiki/Notations | [
"Convert",
"notations",
"to",
"local",
"paths",
"of",
"artifacts"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L308-L325 |
23,576 | mguymon/naether | src/main/ruby/naether/runtime.rb | Naether.Runtime.deploy_artifact | def deploy_artifact( notation, file_path, url, opts = {} )
artifact = Naether::Java.create( "com.tobedevoured.naether.deploy.DeployArtifact" )
artifact.setRemoteRepo( url )
artifact.setNotation( notation )
artifact.setFilePath( file_path )
if opts[:pom_path]
artifact.setPomPath( o... | ruby | def deploy_artifact( notation, file_path, url, opts = {} )
artifact = Naether::Java.create( "com.tobedevoured.naether.deploy.DeployArtifact" )
artifact.setRemoteRepo( url )
artifact.setNotation( notation )
artifact.setFilePath( file_path )
if opts[:pom_path]
artifact.setPomPath( o... | [
"def",
"deploy_artifact",
"(",
"notation",
",",
"file_path",
",",
"url",
",",
"opts",
"=",
"{",
"}",
")",
"artifact",
"=",
"Naether",
"::",
"Java",
".",
"create",
"(",
"\"com.tobedevoured.naether.deploy.DeployArtifact\"",
")",
"artifact",
".",
"setRemoteRepo",
"... | Deploy artifact to remote repo url
@param [String] notation
@param [String] file_path to artifact to deploy
@param [String] url to deploy to
@param [Hash] opts
@option opts [String] :pom_path path to pom.xml
@option opts [String] :username for optional auth
@option opts [String] :password for optional auth
@op... | [
"Deploy",
"artifact",
"to",
"remote",
"repo",
"url"
] | 218d8fd36c0b8b6e16d66e5715975570b4560ec4 | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/ruby/naether/runtime.rb#L364-L382 |
23,577 | south37/rucc | lib/rucc/parser.rb | Rucc.Parser.read_int_sval | def read_int_sval(s)
s = s.downcase
if s.match(/^[+-]?0x/)
return s.to_i(16)
end
if s.match(/^[+-]?0b/)
return s.to_i(2)
end
if s.match(/^[+-]?0/)
return s.to_i(8)
end
s.to_i(10)
end | ruby | def read_int_sval(s)
s = s.downcase
if s.match(/^[+-]?0x/)
return s.to_i(16)
end
if s.match(/^[+-]?0b/)
return s.to_i(2)
end
if s.match(/^[+-]?0/)
return s.to_i(8)
end
s.to_i(10)
end | [
"def",
"read_int_sval",
"(",
"s",
")",
"s",
"=",
"s",
".",
"downcase",
"if",
"s",
".",
"match",
"(",
"/",
"/",
")",
"return",
"s",
".",
"to_i",
"(",
"16",
")",
"end",
"if",
"s",
".",
"match",
"(",
"/",
"/",
")",
"return",
"s",
".",
"to_i",
... | Max of long
@param [s]
@return [Integer] | [
"Max",
"of",
"long"
] | 11743d10eb2fcf0834b4f4a34bb5b8a109b32558 | https://github.com/south37/rucc/blob/11743d10eb2fcf0834b4f4a34bb5b8a109b32558/lib/rucc/parser.rb#L299-L311 |
23,578 | BookingSync/synced | lib/synced/attributes_as_hash.rb | Synced.AttributesAsHash.synced_attributes_as_hash | def synced_attributes_as_hash(attributes)
return attributes if attributes.is_a?(Hash)
Hash[Array.wrap(attributes).map { |name| [name, name] }]
end | ruby | def synced_attributes_as_hash(attributes)
return attributes if attributes.is_a?(Hash)
Hash[Array.wrap(attributes).map { |name| [name, name] }]
end | [
"def",
"synced_attributes_as_hash",
"(",
"attributes",
")",
"return",
"attributes",
"if",
"attributes",
".",
"is_a?",
"(",
"Hash",
")",
"Hash",
"[",
"Array",
".",
"wrap",
"(",
"attributes",
")",
".",
"map",
"{",
"|",
"name",
"|",
"[",
"name",
",",
"name"... | On a Hash returns the same Hash
On an Array returns a Hash with identical corresponding keys and values
Used for mapping local - remote attributes | [
"On",
"a",
"Hash",
"returns",
"the",
"same",
"Hash",
"On",
"an",
"Array",
"returns",
"a",
"Hash",
"with",
"identical",
"corresponding",
"keys",
"and",
"values",
"Used",
"for",
"mapping",
"local",
"-",
"remote",
"attributes"
] | 4a79eee67497c7b7954b0a8dd6ac832fa06c112b | https://github.com/BookingSync/synced/blob/4a79eee67497c7b7954b0a8dd6ac832fa06c112b/lib/synced/attributes_as_hash.rb#L6-L9 |
23,579 | south37/rucc | lib/rucc/engine.rb | Rucc.Engine.read_from_string | def read_from_string(buf)
@lexer.stream_stash([FileIO.new(StringIO.new(buf), "-")])
parse.each do |toplevel_ast|
@gen.emit_toplevel(toplevel_ast)
end
@lexer.stream_unstash
end | ruby | def read_from_string(buf)
@lexer.stream_stash([FileIO.new(StringIO.new(buf), "-")])
parse.each do |toplevel_ast|
@gen.emit_toplevel(toplevel_ast)
end
@lexer.stream_unstash
end | [
"def",
"read_from_string",
"(",
"buf",
")",
"@lexer",
".",
"stream_stash",
"(",
"[",
"FileIO",
".",
"new",
"(",
"StringIO",
".",
"new",
"(",
"buf",
")",
",",
"\"-\"",
")",
"]",
")",
"parse",
".",
"each",
"do",
"|",
"toplevel_ast",
"|",
"@gen",
".",
... | Reads from a string as if the string is a content of input file.
Convenient for evaluating small string snippet contaiing preprocessor macros.
@param [String] buf | [
"Reads",
"from",
"a",
"string",
"as",
"if",
"the",
"string",
"is",
"a",
"content",
"of",
"input",
"file",
".",
"Convenient",
"for",
"evaluating",
"small",
"string",
"snippet",
"contaiing",
"preprocessor",
"macros",
"."
] | 11743d10eb2fcf0834b4f4a34bb5b8a109b32558 | https://github.com/south37/rucc/blob/11743d10eb2fcf0834b4f4a34bb5b8a109b32558/lib/rucc/engine.rb#L130-L136 |
23,580 | infinitetoken/barcodes | lib/barcodes/exec.rb | Barcodes.Exec.run | def run
begin
unless self.symbology.nil?
unless self.options[:ascii]
Barcodes::Renderer::Pdf.new(Barcodes.create(self.symbology, self.options)).render(self.target)
else
Barcodes::Renderer::Ascii.new(Barcodes.create(self.symbology, self.options)).render(self.targ... | ruby | def run
begin
unless self.symbology.nil?
unless self.options[:ascii]
Barcodes::Renderer::Pdf.new(Barcodes.create(self.symbology, self.options)).render(self.target)
else
Barcodes::Renderer::Ascii.new(Barcodes.create(self.symbology, self.options)).render(self.targ... | [
"def",
"run",
"begin",
"unless",
"self",
".",
"symbology",
".",
"nil?",
"unless",
"self",
".",
"options",
"[",
":ascii",
"]",
"Barcodes",
"::",
"Renderer",
"::",
"Pdf",
".",
"new",
"(",
"Barcodes",
".",
"create",
"(",
"self",
".",
"symbology",
",",
"se... | Creates a new instance with given command line arguments and options
Runs the command and renders barcode | [
"Creates",
"a",
"new",
"instance",
"with",
"given",
"command",
"line",
"arguments",
"and",
"options",
"Runs",
"the",
"command",
"and",
"renders",
"barcode"
] | 76a0bda4f5afca246ef040ea96f92044366efc39 | https://github.com/infinitetoken/barcodes/blob/76a0bda4f5afca246ef040ea96f92044366efc39/lib/barcodes/exec.rb#L42-L54 |
23,581 | infinitetoken/barcodes | lib/barcodes/exec.rb | Barcodes.Exec._init_parser | def _init_parser
@parser ||= OptionParser.new do |opts|
opts.banner = "Usage: barcodes [OPTIONS] symbology target"
opts.separator ""
opts.on('-D', '--data [DATA]', 'The barcode data to encode (0123456789)') { |v| @options[:data] = v ||= '0123456789' }
opts... | ruby | def _init_parser
@parser ||= OptionParser.new do |opts|
opts.banner = "Usage: barcodes [OPTIONS] symbology target"
opts.separator ""
opts.on('-D', '--data [DATA]', 'The barcode data to encode (0123456789)') { |v| @options[:data] = v ||= '0123456789' }
opts... | [
"def",
"_init_parser",
"@parser",
"||=",
"OptionParser",
".",
"new",
"do",
"|",
"opts",
"|",
"opts",
".",
"banner",
"=",
"\"Usage: barcodes [OPTIONS] symbology target\"",
"opts",
".",
"separator",
"\"\"",
"opts",
".",
"on",
"(",
"'-D'",
",",
"'--data [DATA]'",
"... | Initializes the option parser instance | [
"Initializes",
"the",
"option",
"parser",
"instance"
] | 76a0bda4f5afca246ef040ea96f92044366efc39 | https://github.com/infinitetoken/barcodes/blob/76a0bda4f5afca246ef040ea96f92044366efc39/lib/barcodes/exec.rb#L59-L78 |
23,582 | infinitetoken/barcodes | lib/barcodes/exec.rb | Barcodes.Exec._parse! | def _parse!
begin
self.parser.parse!(self.argv)
rescue
puts self.parser.help
exit 1
end
@symbology = self.argv.shift
@target = self.argv.shift
end | ruby | def _parse!
begin
self.parser.parse!(self.argv)
rescue
puts self.parser.help
exit 1
end
@symbology = self.argv.shift
@target = self.argv.shift
end | [
"def",
"_parse!",
"begin",
"self",
".",
"parser",
".",
"parse!",
"(",
"self",
".",
"argv",
")",
"rescue",
"puts",
"self",
".",
"parser",
".",
"help",
"exit",
"1",
"end",
"@symbology",
"=",
"self",
".",
"argv",
".",
"shift",
"@target",
"=",
"self",
".... | Parses the command line arguments | [
"Parses",
"the",
"command",
"line",
"arguments"
] | 76a0bda4f5afca246ef040ea96f92044366efc39 | https://github.com/infinitetoken/barcodes/blob/76a0bda4f5afca246ef040ea96f92044366efc39/lib/barcodes/exec.rb#L81-L92 |
23,583 | ruby-ore/ore | lib/ore/cli.rb | Ore.CLI.list | def list
print_template = lambda { |path|
puts " #{File.basename(path)}"
}
say "Builtin templates:", :green
Config.builtin_templates(&print_template)
say "Installed templates:", :green
Config.installed_templates(&print_template)
end | ruby | def list
print_template = lambda { |path|
puts " #{File.basename(path)}"
}
say "Builtin templates:", :green
Config.builtin_templates(&print_template)
say "Installed templates:", :green
Config.installed_templates(&print_template)
end | [
"def",
"list",
"print_template",
"=",
"lambda",
"{",
"|",
"path",
"|",
"puts",
"\" #{File.basename(path)}\"",
"}",
"say",
"\"Builtin templates:\"",
",",
":green",
"Config",
".",
"builtin_templates",
"(",
"print_template",
")",
"say",
"\"Installed templates:\"",
",",
... | Lists builtin and installed templates. | [
"Lists",
"builtin",
"and",
"installed",
"templates",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/cli.rb#L24-L34 |
23,584 | ruby-ore/ore | lib/ore/cli.rb | Ore.CLI.remove | def remove(name)
name = File.basename(name)
path = File.join(Config::TEMPLATES_DIR,name)
unless File.exists?(path)
say "Unknown template: #{name}", :red
exit -1
end
FileUtils.rm_rf(path)
end | ruby | def remove(name)
name = File.basename(name)
path = File.join(Config::TEMPLATES_DIR,name)
unless File.exists?(path)
say "Unknown template: #{name}", :red
exit -1
end
FileUtils.rm_rf(path)
end | [
"def",
"remove",
"(",
"name",
")",
"name",
"=",
"File",
".",
"basename",
"(",
"name",
")",
"path",
"=",
"File",
".",
"join",
"(",
"Config",
"::",
"TEMPLATES_DIR",
",",
"name",
")",
"unless",
"File",
".",
"exists?",
"(",
"path",
")",
"say",
"\"Unknown... | Removes a previously installed template.
@param [String] name
The name of the template to remove. | [
"Removes",
"a",
"previously",
"installed",
"template",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/cli.rb#L82-L92 |
23,585 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.generate | def generate
self.destination_root = path
enable_templates!
initialize_variables!
extend Template::Helpers::MARKUP.fetch(@markup)
unless options.quiet?
say "Generating #{self.destination_root}", :green
end
generate_directories!
generate_files!
initialize... | ruby | def generate
self.destination_root = path
enable_templates!
initialize_variables!
extend Template::Helpers::MARKUP.fetch(@markup)
unless options.quiet?
say "Generating #{self.destination_root}", :green
end
generate_directories!
generate_files!
initialize... | [
"def",
"generate",
"self",
".",
"destination_root",
"=",
"path",
"enable_templates!",
"initialize_variables!",
"extend",
"Template",
"::",
"Helpers",
"::",
"MARKUP",
".",
"fetch",
"(",
"@markup",
")",
"unless",
"options",
".",
"quiet?",
"say",
"\"Generating #{self.d... | Generates a new project. | [
"Generates",
"a",
"new",
"project",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L90-L105 |
23,586 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.enable_template | def enable_template(name)
name = name.to_sym
return false if @enabled_templates.include?(name)
unless (template_dir = Template.templates[name])
say "Unknown template #{name}", :red
exit -1
end
new_template = Template::Directory.new(template_dir)
# mark the templat... | ruby | def enable_template(name)
name = name.to_sym
return false if @enabled_templates.include?(name)
unless (template_dir = Template.templates[name])
say "Unknown template #{name}", :red
exit -1
end
new_template = Template::Directory.new(template_dir)
# mark the templat... | [
"def",
"enable_template",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_sym",
"return",
"false",
"if",
"@enabled_templates",
".",
"include?",
"(",
"name",
")",
"unless",
"(",
"template_dir",
"=",
"Template",
".",
"templates",
"[",
"name",
"]",
")",
"say"... | Enables a template, adding it to the generator.
@param [Symbol, String] name
The name of the template to add.
@since 0.4.0 | [
"Enables",
"a",
"template",
"adding",
"it",
"to",
"the",
"generator",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L117-L144 |
23,587 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.disable_template | def disable_template(name)
name = name.to_sym
return false if @disabled_templates.include?(name)
if (template_dir = Template.templates[name])
source_paths.delete(template_dir)
@templates.delete_if { |template| template.path == template_dir }
@enabled_templates.delete(name)
... | ruby | def disable_template(name)
name = name.to_sym
return false if @disabled_templates.include?(name)
if (template_dir = Template.templates[name])
source_paths.delete(template_dir)
@templates.delete_if { |template| template.path == template_dir }
@enabled_templates.delete(name)
... | [
"def",
"disable_template",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_sym",
"return",
"false",
"if",
"@disabled_templates",
".",
"include?",
"(",
"name",
")",
"if",
"(",
"template_dir",
"=",
"Template",
".",
"templates",
"[",
"name",
"]",
")",
"source... | Disables a template in the generator.
@param [Symbol, String] name
The name of the template.
@since 0.4.0 | [
"Disables",
"a",
"template",
"in",
"the",
"generator",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L154-L168 |
23,588 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.enable_templates! | def enable_templates!
@templates = []
@enabled_templates = Set[]
@disabled_templates = Set[]
enable_template :gem
# enable the default templates first
Options::DEFAULT_TEMPLATES.each do |name|
if (Template.template?(name) && options[name])
enable_t... | ruby | def enable_templates!
@templates = []
@enabled_templates = Set[]
@disabled_templates = Set[]
enable_template :gem
# enable the default templates first
Options::DEFAULT_TEMPLATES.each do |name|
if (Template.template?(name) && options[name])
enable_t... | [
"def",
"enable_templates!",
"@templates",
"=",
"[",
"]",
"@enabled_templates",
"=",
"Set",
"[",
"]",
"@disabled_templates",
"=",
"Set",
"[",
"]",
"enable_template",
":gem",
"# enable the default templates first",
"Options",
"::",
"DEFAULT_TEMPLATES",
".",
"each",
"do"... | Enables templates. | [
"Enables",
"templates",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L173-L201 |
23,589 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.initialize_variables! | def initialize_variables!
@root = destination_root
@project_dir = File.basename(@root)
@name = (options.name || @project_dir)
@scm = if File.directory?(File.join(@root,'.git')) then :git
elsif File.directory?(File.join(@root,'.hg')) then :hg
elsif Fil... | ruby | def initialize_variables!
@root = destination_root
@project_dir = File.basename(@root)
@name = (options.name || @project_dir)
@scm = if File.directory?(File.join(@root,'.git')) then :git
elsif File.directory?(File.join(@root,'.hg')) then :hg
elsif Fil... | [
"def",
"initialize_variables!",
"@root",
"=",
"destination_root",
"@project_dir",
"=",
"File",
".",
"basename",
"(",
"@root",
")",
"@name",
"=",
"(",
"options",
".",
"name",
"||",
"@project_dir",
")",
"@scm",
"=",
"if",
"File",
".",
"directory?",
"(",
"File"... | Initializes variables for the templates. | [
"Initializes",
"variables",
"for",
"the",
"templates",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L206-L299 |
23,590 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.generate_files! | def generate_files!
# iterate through the templates in reverse, so files in the templates
# loaded last override the previously templates.
@templates.reverse_each do |template|
# copy in the static files first
template.each_file(@markup) do |dest,file|
generate_file dest, fil... | ruby | def generate_files!
# iterate through the templates in reverse, so files in the templates
# loaded last override the previously templates.
@templates.reverse_each do |template|
# copy in the static files first
template.each_file(@markup) do |dest,file|
generate_file dest, fil... | [
"def",
"generate_files!",
"# iterate through the templates in reverse, so files in the templates",
"# loaded last override the previously templates.",
"@templates",
".",
"reverse_each",
"do",
"|",
"template",
"|",
"# copy in the static files first",
"template",
".",
"each_file",
"(",
... | Copies static files and renders templates in the template directories. | [
"Copies",
"static",
"files",
"and",
"renders",
"templates",
"in",
"the",
"template",
"directories",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L315-L337 |
23,591 | ruby-ore/ore | lib/ore/generator.rb | Ore.Generator.initialize_scm! | def initialize_scm!
in_root do
case @scm
when :git
unless File.directory?('.git')
run 'git init'
run 'git add .'
run 'git commit -m "Initial commit."'
end
when :hg
unless File.directory?('.hg')
run 'hg init'
... | ruby | def initialize_scm!
in_root do
case @scm
when :git
unless File.directory?('.git')
run 'git init'
run 'git add .'
run 'git commit -m "Initial commit."'
end
when :hg
unless File.directory?('.hg')
run 'hg init'
... | [
"def",
"initialize_scm!",
"in_root",
"do",
"case",
"@scm",
"when",
":git",
"unless",
"File",
".",
"directory?",
"(",
"'.git'",
")",
"run",
"'git init'",
"run",
"'git add .'",
"run",
"'git commit -m \"Initial commit.\"'",
"end",
"when",
":hg",
"unless",
"File",
"."... | Initializes the project repository and commits all files.
@since 0.10.0 | [
"Initializes",
"the",
"project",
"repository",
"and",
"commits",
"all",
"files",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/generator.rb#L344-L368 |
23,592 | octopress/deploy | lib/octopress-deploy.rb | Octopress.Deploy.init_config | def init_config(options={})
options = options.to_symbol_keys
if !options[:method]
abort "Please provide a deployment method. e.g. #{METHODS.keys}"
end
@options = DEFAULT_OPTIONS.deep_merge(options)
write_config
check_gitignore
end | ruby | def init_config(options={})
options = options.to_symbol_keys
if !options[:method]
abort "Please provide a deployment method. e.g. #{METHODS.keys}"
end
@options = DEFAULT_OPTIONS.deep_merge(options)
write_config
check_gitignore
end | [
"def",
"init_config",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"to_symbol_keys",
"if",
"!",
"options",
"[",
":method",
"]",
"abort",
"\"Please provide a deployment method. e.g. #{METHODS.keys}\"",
"end",
"@options",
"=",
"DEFAULT_OPTIONS",
... | Create a config file | [
"Create",
"a",
"config",
"file"
] | 662485f5ba8f66e0cbfe4a3ee1f2844dee4c6d59 | https://github.com/octopress/deploy/blob/662485f5ba8f66e0cbfe4a3ee1f2844dee4c6d59/lib/octopress-deploy.rb#L92-L102 |
23,593 | maetl/calyx | lib/calyx/grammar.rb | Calyx.Grammar.generate_result | def generate_result(*args)
start_symbol, rules_map = map_default_args(*args)
Result.new(@registry.evaluate(start_symbol, rules_map))
end | ruby | def generate_result(*args)
start_symbol, rules_map = map_default_args(*args)
Result.new(@registry.evaluate(start_symbol, rules_map))
end | [
"def",
"generate_result",
"(",
"*",
"args",
")",
"start_symbol",
",",
"rules_map",
"=",
"map_default_args",
"(",
"args",
")",
"Result",
".",
"new",
"(",
"@registry",
".",
"evaluate",
"(",
"start_symbol",
",",
"rules_map",
")",
")",
"end"
] | Produces a generated result from evaluating the grammar.
@see Calyx::Result
@overload generate_result(start_symbol)
@param [Symbol] start_symbol
@overload generate_result(rules_map)
@param [Hash] rules_map
@overload generate_result(start_symbol, rules_map)
@param [Symbol] start_symbol
@param [Hash] rul... | [
"Produces",
"a",
"generated",
"result",
"from",
"evaluating",
"the",
"grammar",
"."
] | 5011cd4b948792bdfd22ae1d3eaac9ff529e3861 | https://github.com/maetl/calyx/blob/5011cd4b948792bdfd22ae1d3eaac9ff529e3861/lib/calyx/grammar.rb#L175-L179 |
23,594 | cloudfoundry-attic/vcap-services-base | lib/base/job/snapshot.rb | VCAP::Services::Base::AsyncJob.Snapshot.service_snapshots | def service_snapshots(service_id)
return unless service_id
res = client.hgetall(redis_key(service_id))
res.values.map{|v| Yajl::Parser.parse(v)}
end | ruby | def service_snapshots(service_id)
return unless service_id
res = client.hgetall(redis_key(service_id))
res.values.map{|v| Yajl::Parser.parse(v)}
end | [
"def",
"service_snapshots",
"(",
"service_id",
")",
"return",
"unless",
"service_id",
"res",
"=",
"client",
".",
"hgetall",
"(",
"redis_key",
"(",
"service_id",
")",
")",
"res",
".",
"values",
".",
"map",
"{",
"|",
"v",
"|",
"Yajl",
"::",
"Parser",
".",
... | Get all snapshots related to a service instance | [
"Get",
"all",
"snapshots",
"related",
"to",
"a",
"service",
"instance"
] | bde81300391cb27e1c531148d15bde696ebf4da0 | https://github.com/cloudfoundry-attic/vcap-services-base/blob/bde81300391cb27e1c531148d15bde696ebf4da0/lib/base/job/snapshot.rb#L38-L42 |
23,595 | cloudfoundry-attic/vcap-services-base | lib/base/job/snapshot.rb | VCAP::Services::Base::AsyncJob.Snapshot.snapshot_details | def snapshot_details(service_id, snapshot_id)
return unless service_id && snapshot_id
res = client.hget(redis_key(service_id), snapshot_id)
raise ServiceError.new(ServiceError::NOT_FOUND, "snapshot #{snapshot_id}") unless res
Yajl::Parser.parse(res)
end | ruby | def snapshot_details(service_id, snapshot_id)
return unless service_id && snapshot_id
res = client.hget(redis_key(service_id), snapshot_id)
raise ServiceError.new(ServiceError::NOT_FOUND, "snapshot #{snapshot_id}") unless res
Yajl::Parser.parse(res)
end | [
"def",
"snapshot_details",
"(",
"service_id",
",",
"snapshot_id",
")",
"return",
"unless",
"service_id",
"&&",
"snapshot_id",
"res",
"=",
"client",
".",
"hget",
"(",
"redis_key",
"(",
"service_id",
")",
",",
"snapshot_id",
")",
"raise",
"ServiceError",
".",
"n... | Get detail information for a single snapshot | [
"Get",
"detail",
"information",
"for",
"a",
"single",
"snapshot"
] | bde81300391cb27e1c531148d15bde696ebf4da0 | https://github.com/cloudfoundry-attic/vcap-services-base/blob/bde81300391cb27e1c531148d15bde696ebf4da0/lib/base/job/snapshot.rb#L53-L58 |
23,596 | cloudfoundry-attic/vcap-services-base | lib/base/job/snapshot.rb | VCAP::Services::Base::AsyncJob.Snapshot.filter_keys | def filter_keys(snapshot)
return unless snapshot.is_a? Hash
snapshot.select {|k,v| FILTER_KEYS.include? k.to_s}
end | ruby | def filter_keys(snapshot)
return unless snapshot.is_a? Hash
snapshot.select {|k,v| FILTER_KEYS.include? k.to_s}
end | [
"def",
"filter_keys",
"(",
"snapshot",
")",
"return",
"unless",
"snapshot",
".",
"is_a?",
"Hash",
"snapshot",
".",
"select",
"{",
"|",
"k",
",",
"v",
"|",
"FILTER_KEYS",
".",
"include?",
"k",
".",
"to_s",
"}",
"end"
] | filter internal keys of a given snapshot object, return a new snapshot object in canonical format | [
"filter",
"internal",
"keys",
"of",
"a",
"given",
"snapshot",
"object",
"return",
"a",
"new",
"snapshot",
"object",
"in",
"canonical",
"format"
] | bde81300391cb27e1c531148d15bde696ebf4da0 | https://github.com/cloudfoundry-attic/vcap-services-base/blob/bde81300391cb27e1c531148d15bde696ebf4da0/lib/base/job/snapshot.rb#L61-L64 |
23,597 | ruby-ore/ore | lib/ore/actions.rb | Ore.Actions.generate_dir | def generate_dir(dest)
return if @generated_dirs.has_key?(dest)
path = interpolate(dest)
empty_directory path
@generated_dirs[dest] = path
return path
end | ruby | def generate_dir(dest)
return if @generated_dirs.has_key?(dest)
path = interpolate(dest)
empty_directory path
@generated_dirs[dest] = path
return path
end | [
"def",
"generate_dir",
"(",
"dest",
")",
"return",
"if",
"@generated_dirs",
".",
"has_key?",
"(",
"dest",
")",
"path",
"=",
"interpolate",
"(",
"dest",
")",
"empty_directory",
"path",
"@generated_dirs",
"[",
"dest",
"]",
"=",
"path",
"return",
"path",
"end"
... | Generates an empty directory.
@param [String] dest
The uninterpolated destination path.
@return [String]
The destination path of the directory.
@since 0.7.1 | [
"Generates",
"an",
"empty",
"directory",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/actions.rb#L38-L46 |
23,598 | ruby-ore/ore | lib/ore/actions.rb | Ore.Actions.generate_file | def generate_file(dest,file,options={})
return if @generated_files.has_key?(dest)
path = interpolate(dest)
if options[:template]
@current_template_dir = File.dirname(dest)
template file, path
@current_template_dir = nil
else
copy_file file, path
end
... | ruby | def generate_file(dest,file,options={})
return if @generated_files.has_key?(dest)
path = interpolate(dest)
if options[:template]
@current_template_dir = File.dirname(dest)
template file, path
@current_template_dir = nil
else
copy_file file, path
end
... | [
"def",
"generate_file",
"(",
"dest",
",",
"file",
",",
"options",
"=",
"{",
"}",
")",
"return",
"if",
"@generated_files",
".",
"has_key?",
"(",
"dest",
")",
"path",
"=",
"interpolate",
"(",
"dest",
")",
"if",
"options",
"[",
":template",
"]",
"@current_t... | Generates a file.
@param [String] dest
The uninterpolated destination path.
@param [String] file
The source file or template.
@param [Hash] options
Additional options.
@option options [Boolean] :template
Specifies that the file is a template, and should be rendered.
@return [String]
The destina... | [
"Generates",
"a",
"file",
"."
] | 585c98027771fd118041e90bb38295983d67166c | https://github.com/ruby-ore/ore/blob/585c98027771fd118041e90bb38295983d67166c/lib/ore/actions.rb#L68-L83 |
23,599 | instructure/moodle2cc | lib/moodle2cc/moodle2converter/migrator.rb | Moodle2CC::Moodle2Converter.Migrator.convert_assessments | def convert_assessments(quizzes, choices, feedbacks, questionnaires)
assessment_converter = Moodle2CC::Moodle2Converter::AssessmentConverter.new
assessments = []
assessments += quizzes.map { |quiz| assessment_converter.convert_quiz(quiz) }
assessments += choices.map { |choice| assessment_convert... | ruby | def convert_assessments(quizzes, choices, feedbacks, questionnaires)
assessment_converter = Moodle2CC::Moodle2Converter::AssessmentConverter.new
assessments = []
assessments += quizzes.map { |quiz| assessment_converter.convert_quiz(quiz) }
assessments += choices.map { |choice| assessment_convert... | [
"def",
"convert_assessments",
"(",
"quizzes",
",",
"choices",
",",
"feedbacks",
",",
"questionnaires",
")",
"assessment_converter",
"=",
"Moodle2CC",
"::",
"Moodle2Converter",
"::",
"AssessmentConverter",
".",
"new",
"assessments",
"=",
"[",
"]",
"assessments",
"+="... | convert quizzes to assessments | [
"convert",
"quizzes",
"to",
"assessments"
] | cdb1666a76b22e87e8853d4045e31439244cce4b | https://github.com/instructure/moodle2cc/blob/cdb1666a76b22e87e8853d4045e31439244cce4b/lib/moodle2cc/moodle2converter/migrator.rb#L114-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.