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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,700 | fulldecent/structured-acceptance-test | implementations/ruby/lib/finding.rb | StatModule.Finding.categories= | def categories=(categories)
raise TypeException unless categories.is_a?(Array)
categories.each { |item|
raise TypeException unless Category.all.include?(item)
raise DuplicateElementException if @categories.include?(item)
@categories.push(item)
}
end | ruby | def categories=(categories)
raise TypeException unless categories.is_a?(Array)
categories.each { |item|
raise TypeException unless Category.all.include?(item)
raise DuplicateElementException if @categories.include?(item)
@categories.push(item)
}
end | [
"def",
"categories",
"=",
"(",
"categories",
")",
"raise",
"TypeException",
"unless",
"categories",
".",
"is_a?",
"(",
"Array",
")",
"categories",
".",
"each",
"{",
"|",
"item",
"|",
"raise",
"TypeException",
"unless",
"Category",
".",
"all",
".",
"include?"... | Set array of categories
Params:
+categories+:: array of StatModule::Category | [
"Set",
"array",
"of",
"categories"
] | 9766f4863a8bcfdf6ac50a7aa36cce0314481118 | https://github.com/fulldecent/structured-acceptance-test/blob/9766f4863a8bcfdf6ac50a7aa36cce0314481118/implementations/ruby/lib/finding.rb#L92-L99 |
5,701 | fulldecent/structured-acceptance-test | implementations/ruby/lib/finding.rb | StatModule.Finding.print | def print(formatted = false)
result = "#{rule}, #{description}"
if formatted
if failure
result = "#{FORMATTING_BALL} #{result}".colorize(:red)
else
result = "#{FORMATTING_WARNING} #{result}".colorize(:yellow)
end
end
result += "\n#{location.print}" unl... | ruby | def print(formatted = false)
result = "#{rule}, #{description}"
if formatted
if failure
result = "#{FORMATTING_BALL} #{result}".colorize(:red)
else
result = "#{FORMATTING_WARNING} #{result}".colorize(:yellow)
end
end
result += "\n#{location.print}" unl... | [
"def",
"print",
"(",
"formatted",
"=",
"false",
")",
"result",
"=",
"\"#{rule}, #{description}\"",
"if",
"formatted",
"if",
"failure",
"result",
"=",
"\"#{FORMATTING_BALL} #{result}\"",
".",
"colorize",
"(",
":red",
")",
"else",
"result",
"=",
"\"#{FORMATTING_WARNIN... | Get formatted information about findings
Params:
+formatted+:: indicate weather print boring or pretty colorful finding | [
"Get",
"formatted",
"information",
"about",
"findings"
] | 9766f4863a8bcfdf6ac50a7aa36cce0314481118 | https://github.com/fulldecent/structured-acceptance-test/blob/9766f4863a8bcfdf6ac50a7aa36cce0314481118/implementations/ruby/lib/finding.rb#L181-L193 |
5,702 | dennmart/wanikani-gem | lib/wanikani/critical_items.rb | Wanikani.CriticalItems.critical_items | def critical_items(percentage = 75)
raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
response = api_response("critical-items", percentage)
return response["requested_information"]
end | ruby | def critical_items(percentage = 75)
raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
response = api_response("critical-items", percentage)
return response["requested_information"]
end | [
"def",
"critical_items",
"(",
"percentage",
"=",
"75",
")",
"raise",
"ArgumentError",
",",
"\"Percentage must be an Integer between 0 and 100\"",
"if",
"!",
"percentage",
".",
"between?",
"(",
"0",
",",
"100",
")",
"response",
"=",
"api_response",
"(",
"\"critical-i... | Gets the user's current items under 'Critical Items'.
@param percentage [Integer] the maximum percentage of correctness.
@return [Array<Hash>] critical items and their related information. | [
"Gets",
"the",
"user",
"s",
"current",
"items",
"under",
"Critical",
"Items",
"."
] | 70f9e4289f758c9663c0ee4d1172acb711487df9 | https://github.com/dennmart/wanikani-gem/blob/70f9e4289f758c9663c0ee4d1172acb711487df9/lib/wanikani/critical_items.rb#L8-L12 |
5,703 | rocky/rbx-trepanning | app/method.rb | Trepanning.Method.find_method_with_line | def find_method_with_line(cm, line)
unless cm.kind_of?(Rubinius::CompiledMethod)
return nil
end
lines = lines_of_method(cm)
return cm if lines.member?(line)
scope = cm.scope
return nil unless scope and scope.current_script
cm = scope.current_script.compiled_code
... | ruby | def find_method_with_line(cm, line)
unless cm.kind_of?(Rubinius::CompiledMethod)
return nil
end
lines = lines_of_method(cm)
return cm if lines.member?(line)
scope = cm.scope
return nil unless scope and scope.current_script
cm = scope.current_script.compiled_code
... | [
"def",
"find_method_with_line",
"(",
"cm",
",",
"line",
")",
"unless",
"cm",
".",
"kind_of?",
"(",
"Rubinius",
"::",
"CompiledMethod",
")",
"return",
"nil",
"end",
"lines",
"=",
"lines_of_method",
"(",
"cm",
")",
"return",
"cm",
"if",
"lines",
".",
"member... | Returns a CompiledMethod for the specified line. We search the
current method +meth+ and then up the parent scope. If we hit
the top and we can't find +line+ that way, then we
reverse the search from the top and search down. This will add
all siblings of ancestors of +meth+. | [
"Returns",
"a",
"CompiledMethod",
"for",
"the",
"specified",
"line",
".",
"We",
"search",
"the",
"current",
"method",
"+",
"meth",
"+",
"and",
"then",
"up",
"the",
"parent",
"scope",
".",
"If",
"we",
"hit",
"the",
"top",
"and",
"we",
"can",
"t",
"find"... | 192e5d3b8236f0c1094f7ba3a6b5d2c42ed43fc1 | https://github.com/rocky/rbx-trepanning/blob/192e5d3b8236f0c1094f7ba3a6b5d2c42ed43fc1/app/method.rb#L78-L103 |
5,704 | cyberarm/rewrite-gameoverseer | lib/gameoverseer/channels/channel_manager.rb | GameOverseer.ChannelManager.register_channel | def register_channel(channel, service)
_channel = channel.downcase
unless @channels[_channel]
@channels[_channel] = service
GameOverseer::Console.log("ChannelManager> mapped '#{_channel}' to '#{service.class}'.")
else
raise "Could not map channel '#{_channel}' because '#{@chann... | ruby | def register_channel(channel, service)
_channel = channel.downcase
unless @channels[_channel]
@channels[_channel] = service
GameOverseer::Console.log("ChannelManager> mapped '#{_channel}' to '#{service.class}'.")
else
raise "Could not map channel '#{_channel}' because '#{@chann... | [
"def",
"register_channel",
"(",
"channel",
",",
"service",
")",
"_channel",
"=",
"channel",
".",
"downcase",
"unless",
"@channels",
"[",
"_channel",
"]",
"@channels",
"[",
"_channel",
"]",
"=",
"service",
"GameOverseer",
"::",
"Console",
".",
"log",
"(",
"\"... | Enables a service to subscribe to a channel
@param channel [String]
@param service [Service] | [
"Enables",
"a",
"service",
"to",
"subscribe",
"to",
"a",
"channel"
] | 279ba63868ad11aa2c937fc6c2544049f05d4bca | https://github.com/cyberarm/rewrite-gameoverseer/blob/279ba63868ad11aa2c937fc6c2544049f05d4bca/lib/gameoverseer/channels/channel_manager.rb#L18-L26 |
5,705 | nysa/ruby-opencnam | lib/opencnam/client.rb | Opencnam.Client.phone | def phone(phone_number, options = {})
# Build query string
options = {
:account_sid => account_sid,
:auth_token => auth_token,
:format => 'text',
}.merge(options)
options[:format] = options[:format].to_s.strip.downcase
# Check for supported format
unless %w(t... | ruby | def phone(phone_number, options = {})
# Build query string
options = {
:account_sid => account_sid,
:auth_token => auth_token,
:format => 'text',
}.merge(options)
options[:format] = options[:format].to_s.strip.downcase
# Check for supported format
unless %w(t... | [
"def",
"phone",
"(",
"phone_number",
",",
"options",
"=",
"{",
"}",
")",
"# Build query string",
"options",
"=",
"{",
":account_sid",
"=>",
"account_sid",
",",
":auth_token",
"=>",
"auth_token",
",",
":format",
"=>",
"'text'",
",",
"}",
".",
"merge",
"(",
... | Look up a phone number and return the caller's name.
@param [String] phone_number The phone number to look up
@param [Hash] options Described below
@option options [String] :account_sid Specify a different OpenCNAM
account_sid
@option options [String] :auth_token Specify a different OpenCNAM
auth_token
@opt... | [
"Look",
"up",
"a",
"phone",
"number",
"and",
"return",
"the",
"caller",
"s",
"name",
"."
] | 7c9e62f6efc59466ab307977bc04070d19c4cadf | https://github.com/nysa/ruby-opencnam/blob/7c9e62f6efc59466ab307977bc04070d19c4cadf/lib/opencnam/client.rb#L51-L76 |
5,706 | betterplace/spell_number | lib/spell_number/speller.rb | SpellNumber.Speller.two_digit_number | def two_digit_number(number, combined = false)
words = combined ? simple_number_to_words_combined(number) : simple_number_to_words(number)
return words if(words != 'not_found')
rest = number % 10
format = "spell_number.formats.tens.#{rest == 0 ? 'no_rest' : 'rest'}"
first_digit = si... | ruby | def two_digit_number(number, combined = false)
words = combined ? simple_number_to_words_combined(number) : simple_number_to_words(number)
return words if(words != 'not_found')
rest = number % 10
format = "spell_number.formats.tens.#{rest == 0 ? 'no_rest' : 'rest'}"
first_digit = si... | [
"def",
"two_digit_number",
"(",
"number",
",",
"combined",
"=",
"false",
")",
"words",
"=",
"combined",
"?",
"simple_number_to_words_combined",
"(",
"number",
")",
":",
"simple_number_to_words",
"(",
"number",
")",
"return",
"words",
"if",
"(",
"words",
"!=",
... | Transforms a two-digit number from 0 to 99 | [
"Transforms",
"a",
"two",
"-",
"digit",
"number",
"from",
"0",
"to",
"99"
] | 3dbe6208f365ae5bd848392d1fda134874425c8c | https://github.com/betterplace/spell_number/blob/3dbe6208f365ae5bd848392d1fda134874425c8c/lib/spell_number/speller.rb#L54-L63 |
5,707 | betterplace/spell_number | lib/spell_number/speller.rb | SpellNumber.Speller.simple_number_to_words_combined | def simple_number_to_words_combined(number)
words = I18n.t("spell_number.numbers.number_#{number}_combined", :locale => @options[:locale], :default => 'not_found')
words = simple_number_to_words(number) if(words == 'not_found')
words
end | ruby | def simple_number_to_words_combined(number)
words = I18n.t("spell_number.numbers.number_#{number}_combined", :locale => @options[:locale], :default => 'not_found')
words = simple_number_to_words(number) if(words == 'not_found')
words
end | [
"def",
"simple_number_to_words_combined",
"(",
"number",
")",
"words",
"=",
"I18n",
".",
"t",
"(",
"\"spell_number.numbers.number_#{number}_combined\"",
",",
":locale",
"=>",
"@options",
"[",
":locale",
"]",
",",
":default",
"=>",
"'not_found'",
")",
"words",
"=",
... | Returns the "combined" number if it exists in the file, otherwise it will return the
simple_number_to_words | [
"Returns",
"the",
"combined",
"number",
"if",
"it",
"exists",
"in",
"the",
"file",
"otherwise",
"it",
"will",
"return",
"the",
"simple_number_to_words"
] | 3dbe6208f365ae5bd848392d1fda134874425c8c | https://github.com/betterplace/spell_number/blob/3dbe6208f365ae5bd848392d1fda134874425c8c/lib/spell_number/speller.rb#L67-L71 |
5,708 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.combine_pdfs | def combine_pdfs(combine_pdfs_data, opts = {})
data, _status_code, _headers = combine_pdfs_with_http_info(combine_pdfs_data, opts)
data
end | ruby | def combine_pdfs(combine_pdfs_data, opts = {})
data, _status_code, _headers = combine_pdfs_with_http_info(combine_pdfs_data, opts)
data
end | [
"def",
"combine_pdfs",
"(",
"combine_pdfs_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"combine_pdfs_with_http_info",
"(",
"combine_pdfs_data",
",",
"opts",
")",
"data",
"end"
] | Merge submission PDFs, template PDFs, or custom files
@param combine_pdfs_data
@param [Hash] opts the optional parameters
@return [CreateCombinedSubmissionResponse] | [
"Merge",
"submission",
"PDFs",
"template",
"PDFs",
"or",
"custom",
"files"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L138-L141 |
5,709 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.combine_submissions | def combine_submissions(combined_submission_data, opts = {})
data, _status_code, _headers = combine_submissions_with_http_info(combined_submission_data, opts)
data
end | ruby | def combine_submissions(combined_submission_data, opts = {})
data, _status_code, _headers = combine_submissions_with_http_info(combined_submission_data, opts)
data
end | [
"def",
"combine_submissions",
"(",
"combined_submission_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"combine_submissions_with_http_info",
"(",
"combined_submission_data",
",",
"opts",
")",
"data",
"end"
] | Merge generated PDFs together
@param combined_submission_data
@param [Hash] opts the optional parameters
@return [CreateCombinedSubmissionResponse] | [
"Merge",
"generated",
"PDFs",
"together"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L191-L194 |
5,710 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.create_custom_file_from_upload | def create_custom_file_from_upload(create_custom_file_data, opts = {})
data, _status_code, _headers = create_custom_file_from_upload_with_http_info(create_custom_file_data, opts)
data
end | ruby | def create_custom_file_from_upload(create_custom_file_data, opts = {})
data, _status_code, _headers = create_custom_file_from_upload_with_http_info(create_custom_file_data, opts)
data
end | [
"def",
"create_custom_file_from_upload",
"(",
"create_custom_file_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_custom_file_from_upload_with_http_info",
"(",
"create_custom_file_data",
",",
"opts",
")",
"data",
"end"
... | Create a new custom file from a cached presign upload
@param create_custom_file_data
@param [Hash] opts the optional parameters
@return [CreateCustomFileResponse] | [
"Create",
"a",
"new",
"custom",
"file",
"from",
"a",
"cached",
"presign",
"upload"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L244-L247 |
5,711 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.create_data_request_token | def create_data_request_token(data_request_id, opts = {})
data, _status_code, _headers = create_data_request_token_with_http_info(data_request_id, opts)
data
end | ruby | def create_data_request_token(data_request_id, opts = {})
data, _status_code, _headers = create_data_request_token_with_http_info(data_request_id, opts)
data
end | [
"def",
"create_data_request_token",
"(",
"data_request_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_data_request_token_with_http_info",
"(",
"data_request_id",
",",
"opts",
")",
"data",
"end"
] | Creates a new data request token for form authentication
@param data_request_id
@param [Hash] opts the optional parameters
@return [CreateSubmissionDataRequestTokenResponse] | [
"Creates",
"a",
"new",
"data",
"request",
"token",
"for",
"form",
"authentication"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L297-L300 |
5,712 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.create_template_from_upload | def create_template_from_upload(create_template_data, opts = {})
data, _status_code, _headers = create_template_from_upload_with_http_info(create_template_data, opts)
data
end | ruby | def create_template_from_upload(create_template_data, opts = {})
data, _status_code, _headers = create_template_from_upload_with_http_info(create_template_data, opts)
data
end | [
"def",
"create_template_from_upload",
"(",
"create_template_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_template_from_upload_with_http_info",
"(",
"create_template_data",
",",
"opts",
")",
"data",
"end"
] | Create a new PDF template from a cached presign upload
@param create_template_data
@param [Hash] opts the optional parameters
@return [PendingTemplate] | [
"Create",
"a",
"new",
"PDF",
"template",
"from",
"a",
"cached",
"presign",
"upload"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L409-L412 |
5,713 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.expire_combined_submission | def expire_combined_submission(combined_submission_id, opts = {})
data, _status_code, _headers = expire_combined_submission_with_http_info(combined_submission_id, opts)
data
end | ruby | def expire_combined_submission(combined_submission_id, opts = {})
data, _status_code, _headers = expire_combined_submission_with_http_info(combined_submission_id, opts)
data
end | [
"def",
"expire_combined_submission",
"(",
"combined_submission_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"expire_combined_submission_with_http_info",
"(",
"combined_submission_id",
",",
"opts",
")",
"data",
"end"
] | Expire a combined submission
@param combined_submission_id
@param [Hash] opts the optional parameters
@return [CombinedSubmission] | [
"Expire",
"a",
"combined",
"submission"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L462-L465 |
5,714 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.expire_submission | def expire_submission(submission_id, opts = {})
data, _status_code, _headers = expire_submission_with_http_info(submission_id, opts)
data
end | ruby | def expire_submission(submission_id, opts = {})
data, _status_code, _headers = expire_submission_with_http_info(submission_id, opts)
data
end | [
"def",
"expire_submission",
"(",
"submission_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"expire_submission_with_http_info",
"(",
"submission_id",
",",
"opts",
")",
"data",
"end"
] | Expire a PDF submission
@param submission_id
@param [Hash] opts the optional parameters
@return [Submission] | [
"Expire",
"a",
"PDF",
"submission"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L513-L516 |
5,715 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.generate_pdf | def generate_pdf(template_id, submission_data, opts = {})
data, _status_code, _headers = generate_pdf_with_http_info(template_id, submission_data, opts)
data
end | ruby | def generate_pdf(template_id, submission_data, opts = {})
data, _status_code, _headers = generate_pdf_with_http_info(template_id, submission_data, opts)
data
end | [
"def",
"generate_pdf",
"(",
"template_id",
",",
"submission_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"generate_pdf_with_http_info",
"(",
"template_id",
",",
"submission_data",
",",
"opts",
")",
"data",
"end"
] | Generates a new PDF
@param template_id
@param submission_data
@param [Hash] opts the optional parameters
@return [CreateSubmissionResponse] | [
"Generates",
"a",
"new",
"PDF"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L565-L568 |
5,716 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.get_data_request | def get_data_request(data_request_id, opts = {})
data, _status_code, _headers = get_data_request_with_http_info(data_request_id, opts)
data
end | ruby | def get_data_request(data_request_id, opts = {})
data, _status_code, _headers = get_data_request_with_http_info(data_request_id, opts)
data
end | [
"def",
"get_data_request",
"(",
"data_request_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_data_request_with_http_info",
"(",
"data_request_id",
",",
"opts",
")",
"data",
"end"
] | Look up a submission data request
@param data_request_id
@param [Hash] opts the optional parameters
@return [SubmissionDataRequest] | [
"Look",
"up",
"a",
"submission",
"data",
"request"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L674-L677 |
5,717 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.get_submission | def get_submission(submission_id, opts = {})
data, _status_code, _headers = get_submission_with_http_info(submission_id, opts)
data
end | ruby | def get_submission(submission_id, opts = {})
data, _status_code, _headers = get_submission_with_http_info(submission_id, opts)
data
end | [
"def",
"get_submission",
"(",
"submission_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_submission_with_http_info",
"(",
"submission_id",
",",
"opts",
")",
"data",
"end"
] | Check the status of a PDF
@param submission_id
@param [Hash] opts the optional parameters
@option opts [BOOLEAN] :include_data
@return [Submission] | [
"Check",
"the",
"status",
"of",
"a",
"PDF"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L771-L774 |
5,718 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.get_submission_batch | def get_submission_batch(submission_batch_id, opts = {})
data, _status_code, _headers = get_submission_batch_with_http_info(submission_batch_id, opts)
data
end | ruby | def get_submission_batch(submission_batch_id, opts = {})
data, _status_code, _headers = get_submission_batch_with_http_info(submission_batch_id, opts)
data
end | [
"def",
"get_submission_batch",
"(",
"submission_batch_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_submission_batch_with_http_info",
"(",
"submission_batch_id",
",",
"opts",
")",
"data",
"end"
] | Check the status of a submission batch job
@param submission_batch_id
@param [Hash] opts the optional parameters
@option opts [BOOLEAN] :include_submissions
@return [SubmissionBatch] | [
"Check",
"the",
"status",
"of",
"a",
"submission",
"batch",
"job"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L825-L828 |
5,719 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.get_template | def get_template(template_id, opts = {})
data, _status_code, _headers = get_template_with_http_info(template_id, opts)
data
end | ruby | def get_template(template_id, opts = {})
data, _status_code, _headers = get_template_with_http_info(template_id, opts)
data
end | [
"def",
"get_template",
"(",
"template_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_template_with_http_info",
"(",
"template_id",
",",
"opts",
")",
"data",
"end"
] | Check the status of an uploaded template
@param template_id
@param [Hash] opts the optional parameters
@return [Template] | [
"Check",
"the",
"status",
"of",
"an",
"uploaded",
"template"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L878-L881 |
5,720 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.get_template_schema | def get_template_schema(template_id, opts = {})
data, _status_code, _headers = get_template_schema_with_http_info(template_id, opts)
data
end | ruby | def get_template_schema(template_id, opts = {})
data, _status_code, _headers = get_template_schema_with_http_info(template_id, opts)
data
end | [
"def",
"get_template_schema",
"(",
"template_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_template_schema_with_http_info",
"(",
"template_id",
",",
"opts",
")",
"data",
"end"
] | Fetch the JSON schema for a template
@param template_id
@param [Hash] opts the optional parameters
@return [Hash<String, Object>] | [
"Fetch",
"the",
"JSON",
"schema",
"for",
"a",
"template"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L929-L932 |
5,721 | FormAPI/formapi-ruby | lib/form_api/api/pdf_api.rb | FormAPI.PDFApi.update_data_request | def update_data_request(data_request_id, update_submission_data_request_data, opts = {})
data, _status_code, _headers = update_data_request_with_http_info(data_request_id, update_submission_data_request_data, opts)
data
end | ruby | def update_data_request(data_request_id, update_submission_data_request_data, opts = {})
data, _status_code, _headers = update_data_request_with_http_info(data_request_id, update_submission_data_request_data, opts)
data
end | [
"def",
"update_data_request",
"(",
"data_request_id",
",",
"update_submission_data_request_data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_data_request_with_http_info",
"(",
"data_request_id",
",",
"update_submission_data... | Update a submission data request
@param data_request_id
@param update_submission_data_request_data
@param [Hash] opts the optional parameters
@return [UpdateDataRequestResponse] | [
"Update",
"a",
"submission",
"data",
"request"
] | 247859d884def43e365b7110b77104245ea8033c | https://github.com/FormAPI/formapi-ruby/blob/247859d884def43e365b7110b77104245ea8033c/lib/form_api/api/pdf_api.rb#L1089-L1092 |
5,722 | grzlus/acts_as_nested_interval | lib/acts_as_nested_interval/instance_methods.rb | ActsAsNestedInterval.InstanceMethods.next_root_lft | def next_root_lft
last_root = nested_interval_scope.roots.order( rgtp: :desc, rgtq: :desc ).first
raise Exception.new("Only one root allowed") if last_root.present? && !self.class.nested_interval.multiple_roots?
last_root.try(:right) || 0.to_r
end | ruby | def next_root_lft
last_root = nested_interval_scope.roots.order( rgtp: :desc, rgtq: :desc ).first
raise Exception.new("Only one root allowed") if last_root.present? && !self.class.nested_interval.multiple_roots?
last_root.try(:right) || 0.to_r
end | [
"def",
"next_root_lft",
"last_root",
"=",
"nested_interval_scope",
".",
"roots",
".",
"order",
"(",
"rgtp",
":",
":desc",
",",
"rgtq",
":",
":desc",
")",
".",
"first",
"raise",
"Exception",
".",
"new",
"(",
"\"Only one root allowed\"",
")",
"if",
"last_root",
... | Returns left end of interval for next root. | [
"Returns",
"left",
"end",
"of",
"interval",
"for",
"next",
"root",
"."
] | 9a588bf515570e4a1e1311dc58dc5eea8bfffd8e | https://github.com/grzlus/acts_as_nested_interval/blob/9a588bf515570e4a1e1311dc58dc5eea8bfffd8e/lib/acts_as_nested_interval/instance_methods.rb#L39-L43 |
5,723 | mudbugmedia/fusebox | lib/fusebox/request.rb | Fusebox.Request.report | def report (opts = {})
default_options = {
:user => 'all',
:group_subaccount => true,
:report_type => 'basic'
}
opts.reverse_merge! default_options
post 'report', opts, "report_#{opts[:report_type]}".to_sym
end | ruby | def report (opts = {})
default_options = {
:user => 'all',
:group_subaccount => true,
:report_type => 'basic'
}
opts.reverse_merge! default_options
post 'report', opts, "report_#{opts[:report_type]}".to_sym
end | [
"def",
"report",
"(",
"opts",
"=",
"{",
"}",
")",
"default_options",
"=",
"{",
":user",
"=>",
"'all'",
",",
":group_subaccount",
"=>",
"true",
",",
":report_type",
"=>",
"'basic'",
"}",
"opts",
".",
"reverse_merge!",
"default_options",
"post",
"'report'",
",... | This request will provide information about one or more accounts under your platform in CSV format
@see https://www.fusemail.com/support/api-documentation/requests#report report API documentation
@param [Array] opts
@option opts [String] :user ('all') The username you wish to query for information; you may also ente... | [
"This",
"request",
"will",
"provide",
"information",
"about",
"one",
"or",
"more",
"accounts",
"under",
"your",
"platform",
"in",
"CSV",
"format"
] | 2c691495b180380552947ce67477b51c14676eee | https://github.com/mudbugmedia/fusebox/blob/2c691495b180380552947ce67477b51c14676eee/lib/fusebox/request.rb#L277-L286 |
5,724 | mudbugmedia/fusebox | lib/fusebox/request.rb | Fusebox.Request.load_auth_from_yaml | def load_auth_from_yaml
self.class.auth_yaml_paths.map { |path| File.expand_path(path) }.select { |path| File.exist?(path) }.each do |path|
auth = YAML.load(File.read(path))
@username = auth['username']
@password = auth['password']
return if @username && @password
end
... | ruby | def load_auth_from_yaml
self.class.auth_yaml_paths.map { |path| File.expand_path(path) }.select { |path| File.exist?(path) }.each do |path|
auth = YAML.load(File.read(path))
@username = auth['username']
@password = auth['password']
return if @username && @password
end
... | [
"def",
"load_auth_from_yaml",
"self",
".",
"class",
".",
"auth_yaml_paths",
".",
"map",
"{",
"|",
"path",
"|",
"File",
".",
"expand_path",
"(",
"path",
")",
"}",
".",
"select",
"{",
"|",
"path",
"|",
"File",
".",
"exist?",
"(",
"path",
")",
"}",
".",... | Load the platform authentication informaiton from a YAML file
@see Request.auth_yaml_paths | [
"Load",
"the",
"platform",
"authentication",
"informaiton",
"from",
"a",
"YAML",
"file"
] | 2c691495b180380552947ce67477b51c14676eee | https://github.com/mudbugmedia/fusebox/blob/2c691495b180380552947ce67477b51c14676eee/lib/fusebox/request.rb#L329-L338 |
5,725 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.download_manifest_only | def download_manifest_only
FastlaneCore::UI.message('download_manifest_only...')
rsa_key = load_rsa_key(rsa_keypath)
success = true
if !rsa_key.nil?
FastlaneCore::UI.message('Logging in with RSA key for download...')
Net::SSH.start(host, user, key_data: rsa_key, keys_only: true) ... | ruby | def download_manifest_only
FastlaneCore::UI.message('download_manifest_only...')
rsa_key = load_rsa_key(rsa_keypath)
success = true
if !rsa_key.nil?
FastlaneCore::UI.message('Logging in with RSA key for download...')
Net::SSH.start(host, user, key_data: rsa_key, keys_only: true) ... | [
"def",
"download_manifest_only",
"FastlaneCore",
"::",
"UI",
".",
"message",
"(",
"'download_manifest_only...'",
")",
"rsa_key",
"=",
"load_rsa_key",
"(",
"rsa_keypath",
")",
"success",
"=",
"true",
"if",
"!",
"rsa_key",
".",
"nil?",
"FastlaneCore",
"::",
"UI",
... | Download metadata only
rubocop:disable Metrics/AbcSize
rubocop:disable Metrics/MethodLength | [
"Download",
"metadata",
"only"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L92-L110 |
5,726 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.check_ipa | def check_ipa(local_ipa_path)
if File.exist?(local_ipa_path)
FastlaneCore::UI.important('IPA found at ' + local_ipa_path)
return true
else
FastlaneCore::UI.verbose('IPA at given path does not exist yet.')
return false
end
end | ruby | def check_ipa(local_ipa_path)
if File.exist?(local_ipa_path)
FastlaneCore::UI.important('IPA found at ' + local_ipa_path)
return true
else
FastlaneCore::UI.verbose('IPA at given path does not exist yet.')
return false
end
end | [
"def",
"check_ipa",
"(",
"local_ipa_path",
")",
"if",
"File",
".",
"exist?",
"(",
"local_ipa_path",
")",
"FastlaneCore",
"::",
"UI",
".",
"important",
"(",
"'IPA found at '",
"+",
"local_ipa_path",
")",
"return",
"true",
"else",
"FastlaneCore",
"::",
"UI",
"."... | Check IPA existence locally
@param local_ipa_path | [
"Check",
"IPA",
"existence",
"locally"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L147-L155 |
5,727 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.download_manifest | def download_manifest(sftp)
FastlaneCore::UI.message('Checking remote Manifest')
json = nil
remote_manifest_path = remote_manifest_path(appcode)
begin
sftp.stat!(remote_manifest_path) do |response|
if response.ok?
FastlaneCore::UI.success('Loading remote manifest:')... | ruby | def download_manifest(sftp)
FastlaneCore::UI.message('Checking remote Manifest')
json = nil
remote_manifest_path = remote_manifest_path(appcode)
begin
sftp.stat!(remote_manifest_path) do |response|
if response.ok?
FastlaneCore::UI.success('Loading remote manifest:')... | [
"def",
"download_manifest",
"(",
"sftp",
")",
"FastlaneCore",
"::",
"UI",
".",
"message",
"(",
"'Checking remote Manifest'",
")",
"json",
"=",
"nil",
"remote_manifest_path",
"=",
"remote_manifest_path",
"(",
"appcode",
")",
"begin",
"sftp",
".",
"stat!",
"(",
"r... | Downloads remote manifest, self.appcode required by options.
@param sftp
@param [String] remote_path
@returns [JSON] json or nil | [
"Downloads",
"remote",
"manifest",
"self",
".",
"appcode",
"required",
"by",
"options",
"."
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L201-L217 |
5,728 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.upload_ipa | def upload_ipa(sftp, local_ipa_path, remote_ipa_path)
msg = "[Uploading IPA] #{local_ipa_path} to #{remote_ipa_path}"
FastlaneCore::UI.message(msg)
result = sftp.upload!(local_ipa_path, remote_ipa_path) do |event, _uploader, *_args|
case event
when :open then
putc '.'
... | ruby | def upload_ipa(sftp, local_ipa_path, remote_ipa_path)
msg = "[Uploading IPA] #{local_ipa_path} to #{remote_ipa_path}"
FastlaneCore::UI.message(msg)
result = sftp.upload!(local_ipa_path, remote_ipa_path) do |event, _uploader, *_args|
case event
when :open then
putc '.'
... | [
"def",
"upload_ipa",
"(",
"sftp",
",",
"local_ipa_path",
",",
"remote_ipa_path",
")",
"msg",
"=",
"\"[Uploading IPA] #{local_ipa_path} to #{remote_ipa_path}\"",
"FastlaneCore",
"::",
"UI",
".",
"message",
"(",
"msg",
")",
"result",
"=",
"sftp",
".",
"upload!",
"(",
... | Upload current IPA
@param sftp
@param [String] local_ipa_path
@param [String] remote_ipa_path | [
"Upload",
"current",
"IPA"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L224-L240 |
5,729 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.upload_manifest | def upload_manifest(sftp, local_path, remote_path)
msg = '[Uploading Manifest] ' + local_path + ' to ' + remote_path
FastlaneCore::UI.message(msg)
result = sftp.upload!(local_path, remote_path) do |event, _uploader, *_args|
case event
when :finish then
FastlaneCore::UI.succes... | ruby | def upload_manifest(sftp, local_path, remote_path)
msg = '[Uploading Manifest] ' + local_path + ' to ' + remote_path
FastlaneCore::UI.message(msg)
result = sftp.upload!(local_path, remote_path) do |event, _uploader, *_args|
case event
when :finish then
FastlaneCore::UI.succes... | [
"def",
"upload_manifest",
"(",
"sftp",
",",
"local_path",
",",
"remote_path",
")",
"msg",
"=",
"'[Uploading Manifest] '",
"+",
"local_path",
"+",
"' to '",
"+",
"remote_path",
"FastlaneCore",
"::",
"UI",
".",
"message",
"(",
"msg",
")",
"result",
"=",
"sftp",
... | Upload current manifest.json
@param sftp
@param [String] manifest_path
@param [String] remote_manifest_path | [
"Upload",
"current",
"manifest",
".",
"json"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L247-L256 |
5,730 | suculent/apprepo | lib/apprepo/uploader.rb | AppRepo.Uploader.load_rsa_key | def load_rsa_key(rsa_keypath)
File.open(rsa_keypath, 'r') do |file|
rsa_key = nil
rsa_key = [file.read]
if !rsa_key.nil?
FastlaneCore::UI.success('Successfully loaded RSA key...')
else
FastlaneCore::UI.user_error!('Failed to load RSA key...')
end
... | ruby | def load_rsa_key(rsa_keypath)
File.open(rsa_keypath, 'r') do |file|
rsa_key = nil
rsa_key = [file.read]
if !rsa_key.nil?
FastlaneCore::UI.success('Successfully loaded RSA key...')
else
FastlaneCore::UI.user_error!('Failed to load RSA key...')
end
... | [
"def",
"load_rsa_key",
"(",
"rsa_keypath",
")",
"File",
".",
"open",
"(",
"rsa_keypath",
",",
"'r'",
")",
"do",
"|",
"file",
"|",
"rsa_key",
"=",
"nil",
"rsa_key",
"=",
"[",
"file",
".",
"read",
"]",
"if",
"!",
"rsa_key",
".",
"nil?",
"FastlaneCore",
... | Private methods - Local Operations | [
"Private",
"methods",
"-",
"Local",
"Operations"
] | 91583c7e8eb45490c088155174f9dfc2cac7812d | https://github.com/suculent/apprepo/blob/91583c7e8eb45490c088155174f9dfc2cac7812d/lib/apprepo/uploader.rb#L284-L295 |
5,731 | ivanzotov/constructor | pages/app/models/constructor_pages/field.rb | ConstructorPages.Field.check_code_name | def check_code_name(code_name)
[code_name.pluralize, code_name.singularize].each {|name|
%w{self_and_ancestors descendants}.each {|m|
return false if template.send(m).map(&:code_name).include?(name)}}
true
end | ruby | def check_code_name(code_name)
[code_name.pluralize, code_name.singularize].each {|name|
%w{self_and_ancestors descendants}.each {|m|
return false if template.send(m).map(&:code_name).include?(name)}}
true
end | [
"def",
"check_code_name",
"(",
"code_name",
")",
"[",
"code_name",
".",
"pluralize",
",",
"code_name",
".",
"singularize",
"]",
".",
"each",
"{",
"|",
"name",
"|",
"%w{",
"self_and_ancestors",
"descendants",
"}",
".",
"each",
"{",
"|",
"m",
"|",
"return",
... | Check if there is code_name in template branch | [
"Check",
"if",
"there",
"is",
"code_name",
"in",
"template",
"branch"
] | 1d52fb5b642200a6993f5a630e6934bccbcbf4e8 | https://github.com/ivanzotov/constructor/blob/1d52fb5b642200a6993f5a630e6934bccbcbf4e8/pages/app/models/constructor_pages/field.rb#L52-L57 |
5,732 | fulldecent/structured-acceptance-test | implementations/ruby/lib/location.rb | StatModule.Location.print | def print
result = "in #{path}"
if !begin_line.nil? && !end_line.nil?
if begin_line != end_line
if !begin_column.nil? && !end_column.nil?
result += ", line #{begin_line}:#{begin_column} to line #{end_line}:#{end_column}"
elsif !begin_column.nil? && end_column.nil?
... | ruby | def print
result = "in #{path}"
if !begin_line.nil? && !end_line.nil?
if begin_line != end_line
if !begin_column.nil? && !end_column.nil?
result += ", line #{begin_line}:#{begin_column} to line #{end_line}:#{end_column}"
elsif !begin_column.nil? && end_column.nil?
... | [
"def",
"print",
"result",
"=",
"\"in #{path}\"",
"if",
"!",
"begin_line",
".",
"nil?",
"&&",
"!",
"end_line",
".",
"nil?",
"if",
"begin_line",
"!=",
"end_line",
"if",
"!",
"begin_column",
".",
"nil?",
"&&",
"!",
"end_column",
".",
"nil?",
"result",
"+=",
... | Get formatted information about location | [
"Get",
"formatted",
"information",
"about",
"location"
] | 9766f4863a8bcfdf6ac50a7aa36cce0314481118 | https://github.com/fulldecent/structured-acceptance-test/blob/9766f4863a8bcfdf6ac50a7aa36cce0314481118/implementations/ruby/lib/location.rb#L103-L126 |
5,733 | dennmart/wanikani-gem | lib/wanikani/level.rb | Wanikani.Level.level_items_list | def level_items_list(type, levels)
levels = levels.join(',') if levels.is_a?(Array)
response = api_response(type, levels)
# The vocabulary API call without specifying levels returns a Hash instead
# of an Array, so this is a hacky way of dealing with it.
if response["requested_information... | ruby | def level_items_list(type, levels)
levels = levels.join(',') if levels.is_a?(Array)
response = api_response(type, levels)
# The vocabulary API call without specifying levels returns a Hash instead
# of an Array, so this is a hacky way of dealing with it.
if response["requested_information... | [
"def",
"level_items_list",
"(",
"type",
",",
"levels",
")",
"levels",
"=",
"levels",
".",
"join",
"(",
"','",
")",
"if",
"levels",
".",
"is_a?",
"(",
"Array",
")",
"response",
"=",
"api_response",
"(",
"type",
",",
"levels",
")",
"# The vocabulary API call... | Fetches the specified item type list from WaniKani's API
@param type [String] The type of item to fetch.
@param levels [Integer, Array<Integer>] a specific level or array of
levels to fetch items for.
@return [Hash] list of items of the specified type and levels. | [
"Fetches",
"the",
"specified",
"item",
"type",
"list",
"from",
"WaniKani",
"s",
"API"
] | 70f9e4289f758c9663c0ee4d1172acb711487df9 | https://github.com/dennmart/wanikani-gem/blob/70f9e4289f758c9663c0ee4d1172acb711487df9/lib/wanikani/level.rb#L55-L66 |
5,734 | futurechimp/octopus | lib/octopus/grabbers/generic_http.rb | Grabbers.GenericHttp.check_expired_resources | def check_expired_resources
net_resources = ::NetResource.expired
net_resources.each do |resource|
http = EM::HttpRequest.new(resource.url).get
http.callback{ |response|
resource.set_next_update
if resource_changed?(resource, response)
resource.body = respons... | ruby | def check_expired_resources
net_resources = ::NetResource.expired
net_resources.each do |resource|
http = EM::HttpRequest.new(resource.url).get
http.callback{ |response|
resource.set_next_update
if resource_changed?(resource, response)
resource.body = respons... | [
"def",
"check_expired_resources",
"net_resources",
"=",
"::",
"NetResource",
".",
"expired",
"net_resources",
".",
"each",
"do",
"|",
"resource",
"|",
"http",
"=",
"EM",
"::",
"HttpRequest",
".",
"new",
"(",
"resource",
".",
"url",
")",
".",
"get",
"http",
... | Adds a periodic timer to the Eventmachine reactor loop and immediately
starts grabbing expired resources and checking them.
Gets all of the expired NetResources from the database and sends an HTTP
GET requests for each one. Subscribers to a NetResource will be notified
if it has changed since the last time it was... | [
"Adds",
"a",
"periodic",
"timer",
"to",
"the",
"Eventmachine",
"reactor",
"loop",
"and",
"immediately",
"starts",
"grabbing",
"expired",
"resources",
"and",
"checking",
"them",
"."
] | 2b9dca7894de7c37b02849bc9af2e28eb8d625fe | https://github.com/futurechimp/octopus/blob/2b9dca7894de7c37b02849bc9af2e28eb8d625fe/lib/octopus/grabbers/generic_http.rb#L20-L38 |
5,735 | futurechimp/octopus | lib/octopus/grabbers/generic_http.rb | Grabbers.GenericHttp.notify_subscribers | def notify_subscribers(resource)
resource.subscriptions.each do |subscription|
http = EM::HttpRequest.new(subscription.url).post(:body => {:data => resource.body})
http.callback{ |response|
puts "POSTed updated data for #{resource.url}, #{resource.body.length} characters"
}
... | ruby | def notify_subscribers(resource)
resource.subscriptions.each do |subscription|
http = EM::HttpRequest.new(subscription.url).post(:body => {:data => resource.body})
http.callback{ |response|
puts "POSTed updated data for #{resource.url}, #{resource.body.length} characters"
}
... | [
"def",
"notify_subscribers",
"(",
"resource",
")",
"resource",
".",
"subscriptions",
".",
"each",
"do",
"|",
"subscription",
"|",
"http",
"=",
"EM",
"::",
"HttpRequest",
".",
"new",
"(",
"subscription",
".",
"url",
")",
".",
"post",
"(",
":body",
"=>",
"... | Notifies each of a NetResource's subscribers that the resource has changed
by doing an HTTP POST request to the subscriber's callback url.
The POST body contains a key called "data" which contains the feed value. | [
"Notifies",
"each",
"of",
"a",
"NetResource",
"s",
"subscribers",
"that",
"the",
"resource",
"has",
"changed",
"by",
"doing",
"an",
"HTTP",
"POST",
"request",
"to",
"the",
"subscriber",
"s",
"callback",
"url",
"."
] | 2b9dca7894de7c37b02849bc9af2e28eb8d625fe | https://github.com/futurechimp/octopus/blob/2b9dca7894de7c37b02849bc9af2e28eb8d625fe/lib/octopus/grabbers/generic_http.rb#L45-L56 |
5,736 | futurechimp/octopus | lib/octopus/grabbers/generic_http.rb | Grabbers.GenericHttp.resource_changed? | def resource_changed?(resource, response)
changed = false
puts "checking for changes on #{resource.url}"
puts "response.response.hash: #{response.response.hash}"
puts "resource.last_modified_hash: #{resource.last_modified_hash}"
if response.response.hash != resource.last_modified_hash
... | ruby | def resource_changed?(resource, response)
changed = false
puts "checking for changes on #{resource.url}"
puts "response.response.hash: #{response.response.hash}"
puts "resource.last_modified_hash: #{resource.last_modified_hash}"
if response.response.hash != resource.last_modified_hash
... | [
"def",
"resource_changed?",
"(",
"resource",
",",
"response",
")",
"changed",
"=",
"false",
"puts",
"\"checking for changes on #{resource.url}\"",
"puts",
"\"response.response.hash: #{response.response.hash}\"",
"puts",
"\"resource.last_modified_hash: #{resource.last_modified_hash}\"",... | Determines whether a resource has changed by comparing its saved hash
value with the hash value of the response content. | [
"Determines",
"whether",
"a",
"resource",
"has",
"changed",
"by",
"comparing",
"its",
"saved",
"hash",
"value",
"with",
"the",
"hash",
"value",
"of",
"the",
"response",
"content",
"."
] | 2b9dca7894de7c37b02849bc9af2e28eb8d625fe | https://github.com/futurechimp/octopus/blob/2b9dca7894de7c37b02849bc9af2e28eb8d625fe/lib/octopus/grabbers/generic_http.rb#L61-L70 |
5,737 | futurechimp/octopus | lib/octopus/grabbers/generic_http.rb | Grabbers.GenericHttp.update_changed_resource | def update_changed_resource(resource, response)
resource.last_modified_hash = response.response.hash
resource.last_updated = Time.now
resource.body = response.response
resource.save
end | ruby | def update_changed_resource(resource, response)
resource.last_modified_hash = response.response.hash
resource.last_updated = Time.now
resource.body = response.response
resource.save
end | [
"def",
"update_changed_resource",
"(",
"resource",
",",
"response",
")",
"resource",
".",
"last_modified_hash",
"=",
"response",
".",
"response",
".",
"hash",
"resource",
".",
"last_updated",
"=",
"Time",
".",
"now",
"resource",
".",
"body",
"=",
"response",
"... | Updates the resource's fields when the resource has changed. The
last_modified_hash is set to the hash value of the response body, the
response body itself is saved so that it can be sent to consumers during
notifications, and the resource's last_updated time is set to the current
time. | [
"Updates",
"the",
"resource",
"s",
"fields",
"when",
"the",
"resource",
"has",
"changed",
".",
"The",
"last_modified_hash",
"is",
"set",
"to",
"the",
"hash",
"value",
"of",
"the",
"response",
"body",
"the",
"response",
"body",
"itself",
"is",
"saved",
"so",
... | 2b9dca7894de7c37b02849bc9af2e28eb8d625fe | https://github.com/futurechimp/octopus/blob/2b9dca7894de7c37b02849bc9af2e28eb8d625fe/lib/octopus/grabbers/generic_http.rb#L78-L83 |
5,738 | Falkor/falkorlib | lib/falkorlib/config.rb | FalkorLib.Config.default | def default
res = FalkorLib::Config::DEFAULTS.clone
$LOADED_FEATURES.each do |path|
res[:git] = FalkorLib::Config::Git::DEFAULTS if path.include?('lib/falkorlib/git.rb')
res[:gitflow] = FalkorLib::Config::GitFlow::DEFAULTS if path.include?('lib/falkorlib/git.rb')
... | ruby | def default
res = FalkorLib::Config::DEFAULTS.clone
$LOADED_FEATURES.each do |path|
res[:git] = FalkorLib::Config::Git::DEFAULTS if path.include?('lib/falkorlib/git.rb')
res[:gitflow] = FalkorLib::Config::GitFlow::DEFAULTS if path.include?('lib/falkorlib/git.rb')
... | [
"def",
"default",
"res",
"=",
"FalkorLib",
"::",
"Config",
"::",
"DEFAULTS",
".",
"clone",
"$LOADED_FEATURES",
".",
"each",
"do",
"|",
"path",
"|",
"res",
"[",
":git",
"]",
"=",
"FalkorLib",
"::",
"Config",
"::",
"Git",
"::",
"DEFAULTS",
"if",
"path",
... | Build the default configuration hash, to be used to initiate the default.
The hash is built depending on the loaded files. | [
"Build",
"the",
"default",
"configuration",
"hash",
"to",
"be",
"used",
"to",
"initiate",
"the",
"default",
".",
"The",
"hash",
"is",
"built",
"depending",
"on",
"the",
"loaded",
"files",
"."
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/config.rb#L83-L102 |
5,739 | Falkor/falkorlib | lib/falkorlib/config.rb | FalkorLib.Config.config_file | def config_file(dir = Dir.pwd, type = :local, options = {})
path = normalized_path(dir)
path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
raise FalkorLib::Error, "Wrong FalkorLib configuration type" unless FalkorLib.config[:config_files].keys.include?( type.to_sym)
(options[:file... | ruby | def config_file(dir = Dir.pwd, type = :local, options = {})
path = normalized_path(dir)
path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
raise FalkorLib::Error, "Wrong FalkorLib configuration type" unless FalkorLib.config[:config_files].keys.include?( type.to_sym)
(options[:file... | [
"def",
"config_file",
"(",
"dir",
"=",
"Dir",
".",
"pwd",
",",
"type",
"=",
":local",
",",
"options",
"=",
"{",
"}",
")",
"path",
"=",
"normalized_path",
"(",
"dir",
")",
"path",
"=",
"FalkorLib",
"::",
"Git",
".",
"rootdir",
"(",
"path",
")",
"if"... | get
get_or_save
wrapper for get and save operations | [
"get",
"get_or_save",
"wrapper",
"for",
"get",
"and",
"save",
"operations"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/config.rb#L119-L124 |
5,740 | ktemkin/ruby-ise | lib/ise/project_navigator.rb | ISE.ProjectNavigator.most_recent_project_path | def most_recent_project_path
#Re-load the preference file, so we have the most recent project.
@preferences = PreferenceFile.load
#And retrieve the first project in the recent projects list.
project = preference(RecentProjectsPath).split(', ').first
#If the project exists, return it; ot... | ruby | def most_recent_project_path
#Re-load the preference file, so we have the most recent project.
@preferences = PreferenceFile.load
#And retrieve the first project in the recent projects list.
project = preference(RecentProjectsPath).split(', ').first
#If the project exists, return it; ot... | [
"def",
"most_recent_project_path",
"#Re-load the preference file, so we have the most recent project.",
"@preferences",
"=",
"PreferenceFile",
".",
"load",
"#And retrieve the first project in the recent projects list.",
"project",
"=",
"preference",
"(",
"RecentProjectsPath",
")",
".",... | Returns most recently open project. If Project Navigator has a project open,
that project will be used. This function re-loads the preferences file upon each call,
to ensure we don't have stale data.
TODO: When more than one ISE version is loaded, parse _all_ of the recent projects,
and then return the project wit... | [
"Returns",
"most",
"recently",
"open",
"project",
".",
"If",
"Project",
"Navigator",
"has",
"a",
"project",
"open",
"that",
"project",
"will",
"be",
"used",
".",
"This",
"function",
"re",
"-",
"loads",
"the",
"preferences",
"file",
"upon",
"each",
"call",
... | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/project_navigator.rb#L62-L73 |
5,741 | bachya/cliutils | lib/cliutils/configurator.rb | CLIUtils.Configurator.ingest_prefs | def ingest_prefs(prefs)
fail 'Invaid Prefs class' unless prefs.kind_of?(Prefs)
prefs.prompts.each do |p|
section_sym = p.config_section.to_sym
add_section(section_sym) unless @data.key?(section_sym)
@data[section_sym].merge!(p.config_key.to_sym => p.answer)
end
end | ruby | def ingest_prefs(prefs)
fail 'Invaid Prefs class' unless prefs.kind_of?(Prefs)
prefs.prompts.each do |p|
section_sym = p.config_section.to_sym
add_section(section_sym) unless @data.key?(section_sym)
@data[section_sym].merge!(p.config_key.to_sym => p.answer)
end
end | [
"def",
"ingest_prefs",
"(",
"prefs",
")",
"fail",
"'Invaid Prefs class'",
"unless",
"prefs",
".",
"kind_of?",
"(",
"Prefs",
")",
"prefs",
".",
"prompts",
".",
"each",
"do",
"|",
"p",
"|",
"section_sym",
"=",
"p",
".",
"config_section",
".",
"to_sym",
"add_... | Ingests a Prefs class and adds its answers to the
configuration data.
@param [Prefs] prefs The Prefs class to examine
@return [void] | [
"Ingests",
"a",
"Prefs",
"class",
"and",
"adds",
"its",
"answers",
"to",
"the",
"configuration",
"data",
"."
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/configurator.rb#L101-L108 |
5,742 | bachya/cliutils | lib/cliutils/configurator.rb | CLIUtils.Configurator.method_missing | def method_missing(name, *args, &block)
if name[-1,1] == '='
@data[name[0..-2].to_sym] = args[0]
else
@data[name.to_sym] ||= {}
end
end | ruby | def method_missing(name, *args, &block)
if name[-1,1] == '='
@data[name[0..-2].to_sym] = args[0]
else
@data[name.to_sym] ||= {}
end
end | [
"def",
"method_missing",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"name",
"[",
"-",
"1",
",",
"1",
"]",
"==",
"'='",
"@data",
"[",
"name",
"[",
"0",
"..",
"-",
"2",
"]",
".",
"to_sym",
"]",
"=",
"args",
"[",
"0",
"]",
"e... | Hook that fires when a non-existent method is called.
Allows this module to return data from the config
Hash when given a method name that matches a key.
@param [<String, Symbol>] name The name of the method
@param [Array] args The arguments
@yield if a block is passed
@return [Hash] The hash with the method's na... | [
"Hook",
"that",
"fires",
"when",
"a",
"non",
"-",
"existent",
"method",
"is",
"called",
".",
"Allows",
"this",
"module",
"to",
"return",
"data",
"from",
"the",
"config",
"Hash",
"when",
"given",
"a",
"method",
"name",
"that",
"matches",
"a",
"key",
"."
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/configurator.rb#L117-L123 |
5,743 | eprothro/cassie | lib/cassie/schema/version_loader.rb | Cassie::Schema.VersionLoader.load | def load
return false unless filename
require filename
begin
# ensure the migration class is now defined
version.migration_class_name.constantize
if version.migration.is_a?(Cassie::Schema::Migration)
version
else
false
end
rescue NameE... | ruby | def load
return false unless filename
require filename
begin
# ensure the migration class is now defined
version.migration_class_name.constantize
if version.migration.is_a?(Cassie::Schema::Migration)
version
else
false
end
rescue NameE... | [
"def",
"load",
"return",
"false",
"unless",
"filename",
"require",
"filename",
"begin",
"# ensure the migration class is now defined",
"version",
".",
"migration_class_name",
".",
"constantize",
"if",
"version",
".",
"migration",
".",
"is_a?",
"(",
"Cassie",
"::",
"Sc... | Requires the ruby file, thus loading the Migration class into the ObjectSpace.
@return [Version, Boolean] The Version object if successful. In other words, if
object representing the version returns a Cassie::Schema::Migration object.
Otherwise returns false.
@raise [NameError] if the migration class could no... | [
"Requires",
"the",
"ruby",
"file",
"thus",
"loading",
"the",
"Migration",
"class",
"into",
"the",
"ObjectSpace",
"."
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/schema/version_loader.rb#L14-L29 |
5,744 | govdelivery/govdelivery-tms-ruby | lib/govdelivery/tms/instance_resource.rb | GovDelivery::TMS::InstanceResource.ClassMethods.nullable_attributes | def nullable_attributes(*attrs)
@nullable_attributes ||= []
if attrs.any?
@nullable_attributes.map!(&:to_sym).concat(attrs).uniq! if attrs.any?
end
@nullable_attributes
end | ruby | def nullable_attributes(*attrs)
@nullable_attributes ||= []
if attrs.any?
@nullable_attributes.map!(&:to_sym).concat(attrs).uniq! if attrs.any?
end
@nullable_attributes
end | [
"def",
"nullable_attributes",
"(",
"*",
"attrs",
")",
"@nullable_attributes",
"||=",
"[",
"]",
"if",
"attrs",
".",
"any?",
"@nullable_attributes",
".",
"map!",
"(",
":to_sym",
")",
".",
"concat",
"(",
"attrs",
")",
".",
"uniq!",
"if",
"attrs",
".",
"any?",... | Nullable attributes are sent as null in the request | [
"Nullable",
"attributes",
"are",
"sent",
"as",
"null",
"in",
"the",
"request"
] | 073d6a451222cda3cddf29b6ac246af353f82335 | https://github.com/govdelivery/govdelivery-tms-ruby/blob/073d6a451222cda3cddf29b6ac246af353f82335/lib/govdelivery/tms/instance_resource.rb#L50-L56 |
5,745 | flori/bullshit | lib/bullshit.rb | Bullshit.ModuleFunctions.array_window | def array_window(array, window_size)
window_size < 1 and raise ArgumentError, "window_size = #{window_size} < 1"
window_size = window_size.to_i
window_size += 1 if window_size % 2 == 0
radius = window_size / 2
array.each_index do |i|
ws = window_size
from = i - radius
... | ruby | def array_window(array, window_size)
window_size < 1 and raise ArgumentError, "window_size = #{window_size} < 1"
window_size = window_size.to_i
window_size += 1 if window_size % 2 == 0
radius = window_size / 2
array.each_index do |i|
ws = window_size
from = i - radius
... | [
"def",
"array_window",
"(",
"array",
",",
"window_size",
")",
"window_size",
"<",
"1",
"and",
"raise",
"ArgumentError",
",",
"\"window_size = #{window_size} < 1\"",
"window_size",
"=",
"window_size",
".",
"to_i",
"window_size",
"+=",
"1",
"if",
"window_size",
"%",
... | Let a window of size +window_size+ slide over the array +array+ and yield
to the window array. | [
"Let",
"a",
"window",
"of",
"size",
"+",
"window_size",
"+",
"slide",
"over",
"the",
"array",
"+",
"array",
"+",
"and",
"yield",
"to",
"the",
"window",
"array",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L33-L59 |
5,746 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.<< | def <<(times)
r = times.shift
@repeat += 1 if @times[:repeat].last != r
@times[:repeat] << r
TIMES.zip(times) { |t, time| @times[t] << time.to_f }
self
end | ruby | def <<(times)
r = times.shift
@repeat += 1 if @times[:repeat].last != r
@times[:repeat] << r
TIMES.zip(times) { |t, time| @times[t] << time.to_f }
self
end | [
"def",
"<<",
"(",
"times",
")",
"r",
"=",
"times",
".",
"shift",
"@repeat",
"+=",
"1",
"if",
"@times",
"[",
":repeat",
"]",
".",
"last",
"!=",
"r",
"@times",
"[",
":repeat",
"]",
"<<",
"r",
"TIMES",
".",
"zip",
"(",
"times",
")",
"{",
"|",
"t",... | Add the array +times+ to this clock's time measurements. +times+ consists
of the time measurements in float values in order of TIMES. | [
"Add",
"the",
"array",
"+",
"times",
"+",
"to",
"this",
"clock",
"s",
"time",
"measurements",
".",
"+",
"times",
"+",
"consists",
"of",
"the",
"time",
"measurements",
"in",
"float",
"values",
"in",
"order",
"of",
"TIMES",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L172-L178 |
5,747 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.analysis | def analysis
@analysis ||= Hash.new do |h, time|
time = time.to_sym
times = @times[time]
h[time] = MoreMath::Sequence.new(times)
end
end | ruby | def analysis
@analysis ||= Hash.new do |h, time|
time = time.to_sym
times = @times[time]
h[time] = MoreMath::Sequence.new(times)
end
end | [
"def",
"analysis",
"@analysis",
"||=",
"Hash",
".",
"new",
"do",
"|",
"h",
",",
"time",
"|",
"time",
"=",
"time",
".",
"to_sym",
"times",
"=",
"@times",
"[",
"time",
"]",
"h",
"[",
"time",
"]",
"=",
"MoreMath",
"::",
"Sequence",
".",
"new",
"(",
... | Returns a Hash of Sequence object for all of TIMES's time keys. | [
"Returns",
"a",
"Hash",
"of",
"Sequence",
"object",
"for",
"all",
"of",
"TIMES",
"s",
"time",
"keys",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L181-L187 |
5,748 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.cover? | def cover?(other)
time = self.case.compare_time.to_sym
analysis[time].cover?(other.analysis[time], self.case.covering.alpha_level.abs)
end | ruby | def cover?(other)
time = self.case.compare_time.to_sym
analysis[time].cover?(other.analysis[time], self.case.covering.alpha_level.abs)
end | [
"def",
"cover?",
"(",
"other",
")",
"time",
"=",
"self",
".",
"case",
".",
"compare_time",
".",
"to_sym",
"analysis",
"[",
"time",
"]",
".",
"cover?",
"(",
"other",
".",
"analysis",
"[",
"time",
"]",
",",
"self",
".",
"case",
".",
"covering",
".",
... | Return true, if other's mean value is indistinguishable from this
object's mean after filtering out the noise from the measurements with a
Welch's t-Test. This mean's that differences in the mean of both clocks
might not inidicate a real performance difference and may be caused by
chance. | [
"Return",
"true",
"if",
"other",
"s",
"mean",
"value",
"is",
"indistinguishable",
"from",
"this",
"object",
"s",
"mean",
"after",
"filtering",
"out",
"the",
"noise",
"from",
"the",
"measurements",
"with",
"a",
"Welch",
"s",
"t",
"-",
"Test",
".",
"This",
... | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L194-L197 |
5,749 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.to_a | def to_a
if @repeat >= 1
(::Bullshit::Clock::ALL_COLUMNS).map do |t|
analysis[t].elements
end.transpose
else
[]
end
end | ruby | def to_a
if @repeat >= 1
(::Bullshit::Clock::ALL_COLUMNS).map do |t|
analysis[t].elements
end.transpose
else
[]
end
end | [
"def",
"to_a",
"if",
"@repeat",
">=",
"1",
"(",
"::",
"Bullshit",
"::",
"Clock",
"::",
"ALL_COLUMNS",
")",
".",
"map",
"do",
"|",
"t",
"|",
"analysis",
"[",
"t",
"]",
".",
"elements",
"end",
".",
"transpose",
"else",
"[",
"]",
"end",
"end"
] | Returns the measurements as an array of arrays. | [
"Returns",
"the",
"measurements",
"as",
"an",
"array",
"of",
"arrays",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L205-L213 |
5,750 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.take_time | def take_time
@time, times = Time.now, Process.times
user_time = times.utime + times.cutime # user time of this process and its children
system_time = times.stime + times.cstime # system time of this process and its children
total_time = user_time + system_time # total time of this proc... | ruby | def take_time
@time, times = Time.now, Process.times
user_time = times.utime + times.cutime # user time of this process and its children
system_time = times.stime + times.cstime # system time of this process and its children
total_time = user_time + system_time # total time of this proc... | [
"def",
"take_time",
"@time",
",",
"times",
"=",
"Time",
".",
"now",
",",
"Process",
".",
"times",
"user_time",
"=",
"times",
".",
"utime",
"+",
"times",
".",
"cutime",
"# user time of this process and its children",
"system_time",
"=",
"times",
".",
"stime",
"... | Takes the times an returns an array, consisting of the times in the order
of enumerated in the TIMES constant. | [
"Takes",
"the",
"times",
"an",
"returns",
"an",
"array",
"consisting",
"of",
"the",
"times",
"in",
"the",
"order",
"of",
"enumerated",
"in",
"the",
"TIMES",
"constant",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L217-L223 |
5,751 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.measure | def measure
before = take_time
yield
after = take_time
@repeat += 1
@times[:repeat] << @repeat
@times[:scatter] << @scatter
bs = self.case.batch_size.abs
if bs and bs > 1
TIMES.each_with_index { |t, i| @times[t] << (after[i] - before[i]) / bs }
else
... | ruby | def measure
before = take_time
yield
after = take_time
@repeat += 1
@times[:repeat] << @repeat
@times[:scatter] << @scatter
bs = self.case.batch_size.abs
if bs and bs > 1
TIMES.each_with_index { |t, i| @times[t] << (after[i] - before[i]) / bs }
else
... | [
"def",
"measure",
"before",
"=",
"take_time",
"yield",
"after",
"=",
"take_time",
"@repeat",
"+=",
"1",
"@times",
"[",
":repeat",
"]",
"<<",
"@repeat",
"@times",
"[",
":scatter",
"]",
"<<",
"@scatter",
"bs",
"=",
"self",
".",
"case",
".",
"batch_size",
"... | Take a single measurement. This method should be called with the code to
benchmark in a block. | [
"Take",
"a",
"single",
"measurement",
".",
"This",
"method",
"should",
"be",
"called",
"with",
"the",
"code",
"to",
"benchmark",
"in",
"a",
"block",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L232-L246 |
5,752 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.detect_autocorrelation | def detect_autocorrelation(time)
analysis[time.to_sym].detect_autocorrelation(
self.case.autocorrelation.max_lags.to_i,
self.case.autocorrelation.alpha_level.abs)
end | ruby | def detect_autocorrelation(time)
analysis[time.to_sym].detect_autocorrelation(
self.case.autocorrelation.max_lags.to_i,
self.case.autocorrelation.alpha_level.abs)
end | [
"def",
"detect_autocorrelation",
"(",
"time",
")",
"analysis",
"[",
"time",
".",
"to_sym",
"]",
".",
"detect_autocorrelation",
"(",
"self",
".",
"case",
".",
"autocorrelation",
".",
"max_lags",
".",
"to_i",
",",
"self",
".",
"case",
".",
"autocorrelation",
"... | Returns the q value for the Ljung-Box statistic of this +time+'s
analysis.detect_autocorrelation method. | [
"Returns",
"the",
"q",
"value",
"for",
"the",
"Ljung",
"-",
"Box",
"statistic",
"of",
"this",
"+",
"time",
"+",
"s",
"analysis",
".",
"detect_autocorrelation",
"method",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L282-L286 |
5,753 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.autocorrelation_plot | def autocorrelation_plot(time)
r = autocorrelation time
start = @times[:repeat].first
ende = (start + r.size)
(start...ende).to_a.zip(r)
end | ruby | def autocorrelation_plot(time)
r = autocorrelation time
start = @times[:repeat].first
ende = (start + r.size)
(start...ende).to_a.zip(r)
end | [
"def",
"autocorrelation_plot",
"(",
"time",
")",
"r",
"=",
"autocorrelation",
"time",
"start",
"=",
"@times",
"[",
":repeat",
"]",
".",
"first",
"ende",
"=",
"(",
"start",
"+",
"r",
".",
"size",
")",
"(",
"start",
"...",
"ende",
")",
".",
"to_a",
"."... | Returns the arrays for the autocorrelation plot, the first array for the
numbers of lag measured, the second for the autocorrelation value. | [
"Returns",
"the",
"arrays",
"for",
"the",
"autocorrelation",
"plot",
"the",
"first",
"array",
"for",
"the",
"numbers",
"of",
"lag",
"measured",
"the",
"second",
"for",
"the",
"autocorrelation",
"value",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L365-L370 |
5,754 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.truncate_data | def truncate_data(offset)
for t in ALL_COLUMNS
times = @times[t]
@times[t] = @times[t][offset, times.size]
@repeat = @times[t].size
end
@analysis = nil
self
end | ruby | def truncate_data(offset)
for t in ALL_COLUMNS
times = @times[t]
@times[t] = @times[t][offset, times.size]
@repeat = @times[t].size
end
@analysis = nil
self
end | [
"def",
"truncate_data",
"(",
"offset",
")",
"for",
"t",
"in",
"ALL_COLUMNS",
"times",
"=",
"@times",
"[",
"t",
"]",
"@times",
"[",
"t",
"]",
"=",
"@times",
"[",
"t",
"]",
"[",
"offset",
",",
"times",
".",
"size",
"]",
"@repeat",
"=",
"@times",
"[",... | Truncate the measurements stored in this clock starting from the integer
+offset+. | [
"Truncate",
"the",
"measurements",
"stored",
"in",
"this",
"clock",
"starting",
"from",
"the",
"integer",
"+",
"offset",
"+",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L379-L387 |
5,755 | flori/bullshit | lib/bullshit.rb | Bullshit.Clock.find_truncation_offset | def find_truncation_offset
truncation = self.case.truncate_data
slope_angle = self.case.truncate_data.slope_angle.abs
time = self.case.compare_time.to_sym
ms = analysis[time].elements.reverse
offset = ms.size - 1
@slopes = []
ModuleFunctions.array_window(ms, truncation.window_s... | ruby | def find_truncation_offset
truncation = self.case.truncate_data
slope_angle = self.case.truncate_data.slope_angle.abs
time = self.case.compare_time.to_sym
ms = analysis[time].elements.reverse
offset = ms.size - 1
@slopes = []
ModuleFunctions.array_window(ms, truncation.window_s... | [
"def",
"find_truncation_offset",
"truncation",
"=",
"self",
".",
"case",
".",
"truncate_data",
"slope_angle",
"=",
"self",
".",
"case",
".",
"truncate_data",
".",
"slope_angle",
".",
"abs",
"time",
"=",
"self",
".",
"case",
".",
"compare_time",
".",
"to_sym",
... | Find an offset from the start of the measurements in this clock to
truncate the initial data until a stable state has been reached and
return it as an integer. | [
"Find",
"an",
"offset",
"from",
"the",
"start",
"of",
"the",
"measurements",
"in",
"this",
"clock",
"to",
"truncate",
"the",
"initial",
"data",
"until",
"a",
"stable",
"state",
"has",
"been",
"reached",
"and",
"return",
"it",
"as",
"an",
"integer",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L392-L407 |
5,756 | flori/bullshit | lib/bullshit.rb | Bullshit.CaseMethod.load | def load(fp = file_path)
self.clock = self.case.class.clock.new self
$DEBUG and warn "Loading '#{fp}' into clock."
File.open(fp, 'r') do |f|
f.each do |line|
line.chomp!
line =~ /^\s*#/ and next
clock << line.split(/\t/)
end
end
self
rescue... | ruby | def load(fp = file_path)
self.clock = self.case.class.clock.new self
$DEBUG and warn "Loading '#{fp}' into clock."
File.open(fp, 'r') do |f|
f.each do |line|
line.chomp!
line =~ /^\s*#/ and next
clock << line.split(/\t/)
end
end
self
rescue... | [
"def",
"load",
"(",
"fp",
"=",
"file_path",
")",
"self",
".",
"clock",
"=",
"self",
".",
"case",
".",
"class",
".",
"clock",
".",
"new",
"self",
"$DEBUG",
"and",
"warn",
"\"Loading '#{fp}' into clock.\"",
"File",
".",
"open",
"(",
"fp",
",",
"'r'",
")"... | Load the data of file +fp+ into this clock. | [
"Load",
"the",
"data",
"of",
"file",
"+",
"fp",
"+",
"into",
"this",
"clock",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L481-L493 |
5,757 | flori/bullshit | lib/bullshit.rb | Bullshit.Case.longest_name | def longest_name
bmethods.empty? and return 0
bmethods.map { |x| x.short_name.size }.max
end | ruby | def longest_name
bmethods.empty? and return 0
bmethods.map { |x| x.short_name.size }.max
end | [
"def",
"longest_name",
"bmethods",
".",
"empty?",
"and",
"return",
"0",
"bmethods",
".",
"map",
"{",
"|",
"x",
"|",
"x",
".",
"short_name",
".",
"size",
"}",
".",
"max",
"end"
] | Return the length of the longest_name of all these methods' names. | [
"Return",
"the",
"length",
"of",
"the",
"longest_name",
"of",
"all",
"these",
"methods",
"names",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L745-L748 |
5,758 | flori/bullshit | lib/bullshit.rb | Bullshit.Case.pre_run | def pre_run(bc_method)
setup_name = bc_method.setup_name
if respond_to? setup_name
$DEBUG and warn "Calling #{setup_name}."
__send__(setup_name)
end
self.class.output.puts "#{bc_method.long_name}:"
end | ruby | def pre_run(bc_method)
setup_name = bc_method.setup_name
if respond_to? setup_name
$DEBUG and warn "Calling #{setup_name}."
__send__(setup_name)
end
self.class.output.puts "#{bc_method.long_name}:"
end | [
"def",
"pre_run",
"(",
"bc_method",
")",
"setup_name",
"=",
"bc_method",
".",
"setup_name",
"if",
"respond_to?",
"setup_name",
"$DEBUG",
"and",
"warn",
"\"Calling #{setup_name}.\"",
"__send__",
"(",
"setup_name",
")",
"end",
"self",
".",
"class",
".",
"output",
... | Output before +bc_method+ is run. | [
"Output",
"before",
"+",
"bc_method",
"+",
"is",
"run",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L885-L892 |
5,759 | flori/bullshit | lib/bullshit.rb | Bullshit.Case.run_method | def run_method(bc_method)
pre_run bc_method
clock = self.class.clock.__send__(self.class.clock_method, bc_method) do
__send__(bc_method.name)
end
bc_method.clock = clock
post_run bc_method
clock
end | ruby | def run_method(bc_method)
pre_run bc_method
clock = self.class.clock.__send__(self.class.clock_method, bc_method) do
__send__(bc_method.name)
end
bc_method.clock = clock
post_run bc_method
clock
end | [
"def",
"run_method",
"(",
"bc_method",
")",
"pre_run",
"bc_method",
"clock",
"=",
"self",
".",
"class",
".",
"clock",
".",
"__send__",
"(",
"self",
".",
"class",
".",
"clock_method",
",",
"bc_method",
")",
"do",
"__send__",
"(",
"bc_method",
".",
"name",
... | Run only pre_run and post_run methods. Yield to the block, if one was
given. | [
"Run",
"only",
"pre_run",
"and",
"post_run",
"methods",
".",
"Yield",
"to",
"the",
"block",
"if",
"one",
"was",
"given",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L896-L904 |
5,760 | flori/bullshit | lib/bullshit.rb | Bullshit.Case.post_run | def post_run(bc_method)
teardown_name = bc_method.teardown_name
if respond_to? teardown_name
$DEBUG and warn "Calling #{teardown_name}."
__send__(bc_method.teardown_name)
end
end | ruby | def post_run(bc_method)
teardown_name = bc_method.teardown_name
if respond_to? teardown_name
$DEBUG and warn "Calling #{teardown_name}."
__send__(bc_method.teardown_name)
end
end | [
"def",
"post_run",
"(",
"bc_method",
")",
"teardown_name",
"=",
"bc_method",
".",
"teardown_name",
"if",
"respond_to?",
"teardown_name",
"$DEBUG",
"and",
"warn",
"\"Calling #{teardown_name}.\"",
"__send__",
"(",
"bc_method",
".",
"teardown_name",
")",
"end",
"end"
] | Output after +bc_method+ is run. | [
"Output",
"after",
"+",
"bc_method",
"+",
"is",
"run",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L913-L919 |
5,761 | flori/bullshit | lib/bullshit.rb | Bullshit.Comparison.output_filename | def output_filename(name)
path = File.expand_path(name, output_dir)
output File.new(path, 'a+')
end | ruby | def output_filename(name)
path = File.expand_path(name, output_dir)
output File.new(path, 'a+')
end | [
"def",
"output_filename",
"(",
"name",
")",
"path",
"=",
"File",
".",
"expand_path",
"(",
"name",
",",
"output_dir",
")",
"output",
"File",
".",
"new",
"(",
"path",
",",
"'a+'",
")",
"end"
] | Output results to the file named +name+. | [
"Output",
"results",
"to",
"the",
"file",
"named",
"+",
"name",
"+",
"."
] | dc5d078bfb82d42bb6bafd9248972c20f52ae40c | https://github.com/flori/bullshit/blob/dc5d078bfb82d42bb6bafd9248972c20f52ae40c/lib/bullshit.rb#L1162-L1165 |
5,762 | SebastianSzturo/inaho | lib/inaho/dictionary.rb | Inaho.Dictionary.validate | def validate
errors = []
schema_path = File.expand_path("../../../vendor/AppleDictionarySchema.rng", __FILE__)
schema = Nokogiri::XML::RelaxNG(File.open(schema_path))
schema.validate(Nokogiri::XML(self.to_xml)).each do |error|
errors << error
end
if errors.size > 0
... | ruby | def validate
errors = []
schema_path = File.expand_path("../../../vendor/AppleDictionarySchema.rng", __FILE__)
schema = Nokogiri::XML::RelaxNG(File.open(schema_path))
schema.validate(Nokogiri::XML(self.to_xml)).each do |error|
errors << error
end
if errors.size > 0
... | [
"def",
"validate",
"errors",
"=",
"[",
"]",
"schema_path",
"=",
"File",
".",
"expand_path",
"(",
"\"../../../vendor/AppleDictionarySchema.rng\"",
",",
"__FILE__",
")",
"schema",
"=",
"Nokogiri",
"::",
"XML",
"::",
"RelaxNG",
"(",
"File",
".",
"open",
"(",
"sch... | Validate Dictionary xml with Apple's RelaxNG schema.
Returns true if xml is valid.
Returns List of Nokogiri::XML::SyntaxError objects if xml is not valid. | [
"Validate",
"Dictionary",
"xml",
"with",
"Apple",
"s",
"RelaxNG",
"schema",
"."
] | e3664bc59aa90197258d715a9032c18f82b84ebd | https://github.com/SebastianSzturo/inaho/blob/e3664bc59aa90197258d715a9032c18f82b84ebd/lib/inaho/dictionary.rb#L33-L47 |
5,763 | SebastianSzturo/inaho | lib/inaho/dictionary.rb | Inaho.Dictionary.to_xml | def to_xml
xml = ""
xml << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
xml << "<d:dictionary xmlns=\"http://www.w3.org/1999/xhtml\" "
xml << "xmlns:d=\"http://www.apple.com/DTDs/DictionaryService-1.0.rng\">\n"
@entries.each do |entry|
next if entry.to_xml.nil?
xml << en... | ruby | def to_xml
xml = ""
xml << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
xml << "<d:dictionary xmlns=\"http://www.w3.org/1999/xhtml\" "
xml << "xmlns:d=\"http://www.apple.com/DTDs/DictionaryService-1.0.rng\">\n"
@entries.each do |entry|
next if entry.to_xml.nil?
xml << en... | [
"def",
"to_xml",
"xml",
"=",
"\"\"",
"xml",
"<<",
"\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"",
"xml",
"<<",
"\"<d:dictionary xmlns=\\\"http://www.w3.org/1999/xhtml\\\" \"",
"xml",
"<<",
"\"xmlns:d=\\\"http://www.apple.com/DTDs/DictionaryService-1.0.rng\\\">\\n\"",
"@entri... | Generates xml for Dictionary and Entry objects.
Returns String. | [
"Generates",
"xml",
"for",
"Dictionary",
"and",
"Entry",
"objects",
"."
] | e3664bc59aa90197258d715a9032c18f82b84ebd | https://github.com/SebastianSzturo/inaho/blob/e3664bc59aa90197258d715a9032c18f82b84ebd/lib/inaho/dictionary.rb#L52-L65 |
5,764 | wilddima/stribog | lib/stribog/create_hash.rb | Stribog.CreateHash.return_hash | def return_hash(final_vector)
case digest_length
when 512
create_digest(final_vector)
when 256
create_digest(vector_from_array(final_vector[0..31]))
else
raise ArgumentError,
"digest length must be equal to 256 or 512, not #{digest_length}"
end
end | ruby | def return_hash(final_vector)
case digest_length
when 512
create_digest(final_vector)
when 256
create_digest(vector_from_array(final_vector[0..31]))
else
raise ArgumentError,
"digest length must be equal to 256 or 512, not #{digest_length}"
end
end | [
"def",
"return_hash",
"(",
"final_vector",
")",
"case",
"digest_length",
"when",
"512",
"create_digest",
"(",
"final_vector",
")",
"when",
"256",
"create_digest",
"(",
"vector_from_array",
"(",
"final_vector",
"[",
"0",
"..",
"31",
"]",
")",
")",
"else",
"rais... | Method, which return digest, dependent on them length | [
"Method",
"which",
"return",
"digest",
"dependent",
"on",
"them",
"length"
] | 696e0d4f18f5c210a0fa9e20af49bbb55c29ad72 | https://github.com/wilddima/stribog/blob/696e0d4f18f5c210a0fa9e20af49bbb55c29ad72/lib/stribog/create_hash.rb#L58-L68 |
5,765 | robertwahler/repo_manager | lib/repo_manager/actions/base_action.rb | RepoManager.BaseAction.parse_options | def parse_options(parser_configuration = {})
raise_on_invalid_option = parser_configuration.has_key?(:raise_on_invalid_option) ? parser_configuration[:raise_on_invalid_option] : true
parse_base_options = parser_configuration.has_key?(:parse_base_options) ? parser_configuration[:parse_base_options] : true
... | ruby | def parse_options(parser_configuration = {})
raise_on_invalid_option = parser_configuration.has_key?(:raise_on_invalid_option) ? parser_configuration[:raise_on_invalid_option] : true
parse_base_options = parser_configuration.has_key?(:parse_base_options) ? parser_configuration[:parse_base_options] : true
... | [
"def",
"parse_options",
"(",
"parser_configuration",
"=",
"{",
"}",
")",
"raise_on_invalid_option",
"=",
"parser_configuration",
".",
"has_key?",
"(",
":raise_on_invalid_option",
")",
"?",
"parser_configuration",
"[",
":raise_on_invalid_option",
"]",
":",
"true",
"parse... | Parse generic action options for all decendant actions
@return [OptionParser] for use by decendant actions | [
"Parse",
"generic",
"action",
"options",
"for",
"all",
"decendant",
"actions"
] | d945f1cb6ac48b5689b633fcc029fd77c6a02d09 | https://github.com/robertwahler/repo_manager/blob/d945f1cb6ac48b5689b633fcc029fd77c6a02d09/lib/repo_manager/actions/base_action.rb#L47-L136 |
5,766 | robertwahler/repo_manager | lib/repo_manager/actions/base_action.rb | RepoManager.BaseAction.asset_options | def asset_options
# include all base action options
result = options.deep_clone
# anything left on the command line should be filters as all options have
# been consumed, for pass through options, filters must be ignored by overwritting them
filters = args.dup
filters += result[:fil... | ruby | def asset_options
# include all base action options
result = options.deep_clone
# anything left on the command line should be filters as all options have
# been consumed, for pass through options, filters must be ignored by overwritting them
filters = args.dup
filters += result[:fil... | [
"def",
"asset_options",
"# include all base action options",
"result",
"=",
"options",
".",
"deep_clone",
"# anything left on the command line should be filters as all options have",
"# been consumed, for pass through options, filters must be ignored by overwritting them",
"filters",
"=",
"a... | asset options separated from assets to make it easier to override assets | [
"asset",
"options",
"separated",
"from",
"assets",
"to",
"make",
"it",
"easier",
"to",
"override",
"assets"
] | d945f1cb6ac48b5689b633fcc029fd77c6a02d09 | https://github.com/robertwahler/repo_manager/blob/d945f1cb6ac48b5689b633fcc029fd77c6a02d09/lib/repo_manager/actions/base_action.rb#L185-L206 |
5,767 | robertwahler/repo_manager | lib/repo_manager/actions/base_action.rb | RepoManager.BaseAction.render | def render(view_options=configuration)
logger.debug "rendering"
result = ""
if template
logger.debug "rendering with template : #{template}"
view = AppView.new(items, view_options)
view.template = template
result = view.render
else
items.each_with_index do... | ruby | def render(view_options=configuration)
logger.debug "rendering"
result = ""
if template
logger.debug "rendering with template : #{template}"
view = AppView.new(items, view_options)
view.template = template
result = view.render
else
items.each_with_index do... | [
"def",
"render",
"(",
"view_options",
"=",
"configuration",
")",
"logger",
".",
"debug",
"\"rendering\"",
"result",
"=",
"\"\"",
"if",
"template",
"logger",
".",
"debug",
"\"rendering with template : #{template}\"",
"view",
"=",
"AppView",
".",
"new",
"(",
"items"... | Render items result to a string
@return [String] suitable for displaying on STDOUT or writing to a file | [
"Render",
"items",
"result",
"to",
"a",
"string"
] | d945f1cb6ac48b5689b633fcc029fd77c6a02d09 | https://github.com/robertwahler/repo_manager/blob/d945f1cb6ac48b5689b633fcc029fd77c6a02d09/lib/repo_manager/actions/base_action.rb#L218-L238 |
5,768 | Yellowen/site_framework | lib/site_framework/middleware.rb | SiteFramework.Middleware.call | def call(env)
# Create a method called domain which will return the current domain
# name
Rails.application.send :define_singleton_method, 'domain_name' do
env['SERVER_NAME']
end
# Create `fetch_domain` method on `Rails.application`
# only if it didn't already define.
... | ruby | def call(env)
# Create a method called domain which will return the current domain
# name
Rails.application.send :define_singleton_method, 'domain_name' do
env['SERVER_NAME']
end
# Create `fetch_domain` method on `Rails.application`
# only if it didn't already define.
... | [
"def",
"call",
"(",
"env",
")",
"# Create a method called domain which will return the current domain",
"# name",
"Rails",
".",
"application",
".",
"send",
":define_singleton_method",
",",
"'domain_name'",
"do",
"env",
"[",
"'SERVER_NAME'",
"]",
"end",
"# Create `fetch_doma... | Middleware initializer method which gets the `app` from previous
middleware | [
"Middleware",
"initializer",
"method",
"which",
"gets",
"the",
"app",
"from",
"previous",
"middleware"
] | d4b1067c37c09c802aa4e1d5588ffdd3631f6395 | https://github.com/Yellowen/site_framework/blob/d4b1067c37c09c802aa4e1d5588ffdd3631f6395/lib/site_framework/middleware.rb#L13-L42 |
5,769 | janlelis/fresh | lib/ripl/fresh.rb | Ripl.Fresh.loop_eval | def loop_eval(input)
if input == ''
@command_mode = :system and return
end
case @command_mode
when :system # generate ruby code to execute the command
if !@result_storage
ruby_command_code = "_ = system '#{ input }'\n"
else
temp_file = "/tmp/ripl-fres... | ruby | def loop_eval(input)
if input == ''
@command_mode = :system and return
end
case @command_mode
when :system # generate ruby code to execute the command
if !@result_storage
ruby_command_code = "_ = system '#{ input }'\n"
else
temp_file = "/tmp/ripl-fres... | [
"def",
"loop_eval",
"(",
"input",
")",
"if",
"input",
"==",
"''",
"@command_mode",
"=",
":system",
"and",
"return",
"end",
"case",
"@command_mode",
"when",
":system",
"# generate ruby code to execute the command",
"if",
"!",
"@result_storage",
"ruby_command_code",
"="... | get result (depending on @command_mode) | [
"get",
"result",
"(",
"depending",
"on"
] | 5bd2417232cf035f28b8ee16c212da162f2770a5 | https://github.com/janlelis/fresh/blob/5bd2417232cf035f28b8ee16c212da162f2770a5/lib/ripl/fresh.rb#L60-L105 |
5,770 | fcheung/corefoundation | lib/corefoundation/data.rb | CF.Data.to_s | def to_s
ptr = CF.CFDataGetBytePtr(self)
if CF::String::HAS_ENCODING
ptr.read_string(CF.CFDataGetLength(self)).force_encoding(Encoding::ASCII_8BIT)
else
ptr.read_string(CF.CFDataGetLength(self))
end
end | ruby | def to_s
ptr = CF.CFDataGetBytePtr(self)
if CF::String::HAS_ENCODING
ptr.read_string(CF.CFDataGetLength(self)).force_encoding(Encoding::ASCII_8BIT)
else
ptr.read_string(CF.CFDataGetLength(self))
end
end | [
"def",
"to_s",
"ptr",
"=",
"CF",
".",
"CFDataGetBytePtr",
"(",
"self",
")",
"if",
"CF",
"::",
"String",
"::",
"HAS_ENCODING",
"ptr",
".",
"read_string",
"(",
"CF",
".",
"CFDataGetLength",
"(",
"self",
")",
")",
".",
"force_encoding",
"(",
"Encoding",
"::... | Creates a ruby string from the wrapped data. The encoding will always be ASCII_8BIT
@return [String] | [
"Creates",
"a",
"ruby",
"string",
"from",
"the",
"wrapped",
"data",
".",
"The",
"encoding",
"will",
"always",
"be",
"ASCII_8BIT"
] | a5c766359e74f873902d916e9fb051ec7fdedbb9 | https://github.com/fcheung/corefoundation/blob/a5c766359e74f873902d916e9fb051ec7fdedbb9/lib/corefoundation/data.rb#L24-L31 |
5,771 | rakeoe/rakeoe | lib/rakeoe/toolchain.rb | RakeOE.Toolchain.set_build_vars | def set_build_vars
warning_flags = ' -W -Wall'
if 'release' == @config.release
optimization_flags = " #{@config.optimization_release} -DRELEASE"
else
optimization_flags = " #{@config.optimization_dbg} -g"
end
# we could make these also arrays of source directories ...
@settings['APP... | ruby | def set_build_vars
warning_flags = ' -W -Wall'
if 'release' == @config.release
optimization_flags = " #{@config.optimization_release} -DRELEASE"
else
optimization_flags = " #{@config.optimization_dbg} -g"
end
# we could make these also arrays of source directories ...
@settings['APP... | [
"def",
"set_build_vars",
"warning_flags",
"=",
"' -W -Wall'",
"if",
"'release'",
"==",
"@config",
".",
"release",
"optimization_flags",
"=",
"\" #{@config.optimization_release} -DRELEASE\"",
"else",
"optimization_flags",
"=",
"\" #{@config.optimization_dbg} -g\"",
"end",
"# we ... | Set common build variables | [
"Set",
"common",
"build",
"variables"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/toolchain.rb#L188-L220 |
5,772 | rakeoe/rakeoe | lib/rakeoe/toolchain.rb | RakeOE.Toolchain.reduce_libs_to_bare_minimum | def reduce_libs_to_bare_minimum(libs)
rv = libs.clone
lib_entries = RakeOE::PrjFileCache.get_lib_entries(libs)
lib_entries.each_pair do |lib, entry|
rv.delete(lib) unless RakeOE::PrjFileCache.project_entry_buildable?(entry, @target)
end
rv
end | ruby | def reduce_libs_to_bare_minimum(libs)
rv = libs.clone
lib_entries = RakeOE::PrjFileCache.get_lib_entries(libs)
lib_entries.each_pair do |lib, entry|
rv.delete(lib) unless RakeOE::PrjFileCache.project_entry_buildable?(entry, @target)
end
rv
end | [
"def",
"reduce_libs_to_bare_minimum",
"(",
"libs",
")",
"rv",
"=",
"libs",
".",
"clone",
"lib_entries",
"=",
"RakeOE",
"::",
"PrjFileCache",
".",
"get_lib_entries",
"(",
"libs",
")",
"lib_entries",
".",
"each_pair",
"do",
"|",
"lib",
",",
"entry",
"|",
"rv",... | Reduces the given list of libraries to bare minimum, i.e.
the minimum needed for actual platform
@libs list of libraries
@return reduced list of libraries | [
"Reduces",
"the",
"given",
"list",
"of",
"libraries",
"to",
"bare",
"minimum",
"i",
".",
"e",
".",
"the",
"minimum",
"needed",
"for",
"actual",
"platform"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/toolchain.rb#L322-L329 |
5,773 | rakeoe/rakeoe | lib/rakeoe/toolchain.rb | RakeOE.Toolchain.libs_for_binary | def libs_for_binary(a_binary, visited=[])
return [] if visited.include?(a_binary)
visited << a_binary
pre = Rake::Task[a_binary].prerequisites
rv = []
pre.each do |p|
next if (File.extname(p) != '.a') && (File.extname(p) != '.so')
next if p =~ /\-app\.a/
rv << File.basename(p).gs... | ruby | def libs_for_binary(a_binary, visited=[])
return [] if visited.include?(a_binary)
visited << a_binary
pre = Rake::Task[a_binary].prerequisites
rv = []
pre.each do |p|
next if (File.extname(p) != '.a') && (File.extname(p) != '.so')
next if p =~ /\-app\.a/
rv << File.basename(p).gs... | [
"def",
"libs_for_binary",
"(",
"a_binary",
",",
"visited",
"=",
"[",
"]",
")",
"return",
"[",
"]",
"if",
"visited",
".",
"include?",
"(",
"a_binary",
")",
"visited",
"<<",
"a_binary",
"pre",
"=",
"Rake",
"::",
"Task",
"[",
"a_binary",
"]",
".",
"prereq... | Return array of library prerequisites for given file | [
"Return",
"array",
"of",
"library",
"prerequisites",
"for",
"given",
"file"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/toolchain.rb#L333-L348 |
5,774 | rakeoe/rakeoe | lib/rakeoe/toolchain.rb | RakeOE.Toolchain.obj | def obj(params = {})
extension = File.extname(params[:source])
object = params[:object]
source = params[:source]
incs = compiler_incs_for(params[:includes]) + " #{@settings['LIB_INC']}"
case
when cpp_source_extensions.include?(extension)
flags = @settings['CXXFLAGS'] + ' ' ... | ruby | def obj(params = {})
extension = File.extname(params[:source])
object = params[:object]
source = params[:source]
incs = compiler_incs_for(params[:includes]) + " #{@settings['LIB_INC']}"
case
when cpp_source_extensions.include?(extension)
flags = @settings['CXXFLAGS'] + ' ' ... | [
"def",
"obj",
"(",
"params",
"=",
"{",
"}",
")",
"extension",
"=",
"File",
".",
"extname",
"(",
"params",
"[",
":source",
"]",
")",
"object",
"=",
"params",
"[",
":object",
"]",
"source",
"=",
"params",
"[",
":source",
"]",
"incs",
"=",
"compiler_inc... | Creates compilation object
@param [Hash] params
@option params [String] :source source filename with path
@option params [String] :object object filename path
@option params [Hash] :settings project specific settings
@option params [Array] :includes include paths used | [
"Creates",
"compilation",
"object"
] | af7713fb238058509a34103829e37a62873c4ecb | https://github.com/rakeoe/rakeoe/blob/af7713fb238058509a34103829e37a62873c4ecb/lib/rakeoe/toolchain.rb#L403-L423 |
5,775 | fogonthedowns/rubychem | lib/rubychem/equation.rb | RubyChem.Equation.solve_equivalent_fractions | def solve_equivalent_fractions
last = 0
array = Array.new
@reduced_row_echelon_form.each do |x|
array = last.gcdlcm(x.last.denominator)
last = x.last.denominator
end
array.max
end | ruby | def solve_equivalent_fractions
last = 0
array = Array.new
@reduced_row_echelon_form.each do |x|
array = last.gcdlcm(x.last.denominator)
last = x.last.denominator
end
array.max
end | [
"def",
"solve_equivalent_fractions",
"last",
"=",
"0",
"array",
"=",
"Array",
".",
"new",
"@reduced_row_echelon_form",
".",
"each",
"do",
"|",
"x",
"|",
"array",
"=",
"last",
".",
"gcdlcm",
"(",
"x",
".",
"last",
".",
"denominator",
")",
"last",
"=",
"x"... | from the reduced row echelon form we are left with a set
of equivalent fractions to transform into a whole number
we do this by using the gcdlcm method | [
"from",
"the",
"reduced",
"row",
"echelon",
"form",
"we",
"are",
"left",
"with",
"a",
"set",
"of",
"equivalent",
"fractions",
"to",
"transform",
"into",
"a",
"whole",
"number",
"we",
"do",
"this",
"by",
"using",
"the",
"gcdlcm",
"method"
] | 7750e29465538b7c67f5a41a5cae6b7f74a7faac | https://github.com/fogonthedowns/rubychem/blob/7750e29465538b7c67f5a41a5cae6b7f74a7faac/lib/rubychem/equation.rb#L158-L166 |
5,776 | fogonthedowns/rubychem | lib/rubychem/equation.rb | RubyChem.Equation.apply_solved_equivalent_fractions_to_fraction | def apply_solved_equivalent_fractions_to_fraction
int = self.solve_equivalent_fractions
answer = []
@reduced_row_echelon_form.each do |row|
answer << row.last * int
end
answer << int
count = 0
@balanced = Hash.new
@left_system_of_equations.each do |x,v|
an... | ruby | def apply_solved_equivalent_fractions_to_fraction
int = self.solve_equivalent_fractions
answer = []
@reduced_row_echelon_form.each do |row|
answer << row.last * int
end
answer << int
count = 0
@balanced = Hash.new
@left_system_of_equations.each do |x,v|
an... | [
"def",
"apply_solved_equivalent_fractions_to_fraction",
"int",
"=",
"self",
".",
"solve_equivalent_fractions",
"answer",
"=",
"[",
"]",
"@reduced_row_echelon_form",
".",
"each",
"do",
"|",
"row",
"|",
"answer",
"<<",
"row",
".",
"last",
"*",
"int",
"end",
"answer"... | Now that we have the whole number from solve_equivalent_fractions
we must apply that to each of the fractions to solve for the
balanced equation | [
"Now",
"that",
"we",
"have",
"the",
"whole",
"number",
"from",
"solve_equivalent_fractions",
"we",
"must",
"apply",
"that",
"to",
"each",
"of",
"the",
"fractions",
"to",
"solve",
"for",
"the",
"balanced",
"equation"
] | 7750e29465538b7c67f5a41a5cae6b7f74a7faac | https://github.com/fogonthedowns/rubychem/blob/7750e29465538b7c67f5a41a5cae6b7f74a7faac/lib/rubychem/equation.rb#L172-L194 |
5,777 | fogonthedowns/rubychem | lib/rubychem/equation.rb | RubyChem.Equation.reduced_row_echelon_form | def reduced_row_echelon_form(ary)
lead = 0
rows = ary.size
cols = ary[0].size
rary = convert_to_rational(ary) # use rational arithmetic
catch :done do
rows.times do |r|
throw :done if cols <= lead
i = r
while rary[i][lead] == 0
i += 1
... | ruby | def reduced_row_echelon_form(ary)
lead = 0
rows = ary.size
cols = ary[0].size
rary = convert_to_rational(ary) # use rational arithmetic
catch :done do
rows.times do |r|
throw :done if cols <= lead
i = r
while rary[i][lead] == 0
i += 1
... | [
"def",
"reduced_row_echelon_form",
"(",
"ary",
")",
"lead",
"=",
"0",
"rows",
"=",
"ary",
".",
"size",
"cols",
"=",
"ary",
"[",
"0",
"]",
".",
"size",
"rary",
"=",
"convert_to_rational",
"(",
"ary",
")",
"# use rational arithmetic",
"catch",
":done",
"do",... | returns an 2-D array where each element is a Rational | [
"returns",
"an",
"2",
"-",
"D",
"array",
"where",
"each",
"element",
"is",
"a",
"Rational"
] | 7750e29465538b7c67f5a41a5cae6b7f74a7faac | https://github.com/fogonthedowns/rubychem/blob/7750e29465538b7c67f5a41a5cae6b7f74a7faac/lib/rubychem/equation.rb#L207-L239 |
5,778 | wvanbergen/http_status_exceptions | lib/http_status_exceptions.rb | HTTPStatus.ControllerAddition.http_status_exception | def http_status_exception(exception)
@exception = exception
render_options = {:template => exception.template, :status => exception.status}
render_options[:layout] = exception.template_layout if exception.template_layout
render(render_options)
rescue ActionView::MissingTemplate
head(ex... | ruby | def http_status_exception(exception)
@exception = exception
render_options = {:template => exception.template, :status => exception.status}
render_options[:layout] = exception.template_layout if exception.template_layout
render(render_options)
rescue ActionView::MissingTemplate
head(ex... | [
"def",
"http_status_exception",
"(",
"exception",
")",
"@exception",
"=",
"exception",
"render_options",
"=",
"{",
":template",
"=>",
"exception",
".",
"template",
",",
":status",
"=>",
"exception",
".",
"status",
"}",
"render_options",
"[",
":layout",
"]",
"=",... | The default handler for raised HTTP status exceptions. It will render a
template if available, or respond with an empty response with the HTTP
status corresponding to the exception.
You can override this method in your <tt>ApplicationController</tt> to
handle the exceptions yourself.
<tt>exception</tt>:: The HTT... | [
"The",
"default",
"handler",
"for",
"raised",
"HTTP",
"status",
"exceptions",
".",
"It",
"will",
"render",
"a",
"template",
"if",
"available",
"or",
"respond",
"with",
"an",
"empty",
"response",
"with",
"the",
"HTTP",
"status",
"corresponding",
"to",
"the",
... | 8b88105f4784d03cb16cb4d36efb161394d02a2d | https://github.com/wvanbergen/http_status_exceptions/blob/8b88105f4784d03cb16cb4d36efb161394d02a2d/lib/http_status_exceptions.rb#L138-L145 |
5,779 | rocky/rbx-trepanning | app/eventbuffer.rb | Trace.EventBuffer.append | def append(event, frame, arg)
item = EventStruct.new(event, arg, frame)
@pos = self.succ_pos
@marks.shift if @marks[0] == @pos
@buf[@pos] = item
@size += 1 unless @maxsize && @size == @maxsize
end | ruby | def append(event, frame, arg)
item = EventStruct.new(event, arg, frame)
@pos = self.succ_pos
@marks.shift if @marks[0] == @pos
@buf[@pos] = item
@size += 1 unless @maxsize && @size == @maxsize
end | [
"def",
"append",
"(",
"event",
",",
"frame",
",",
"arg",
")",
"item",
"=",
"EventStruct",
".",
"new",
"(",
"event",
",",
"arg",
",",
"frame",
")",
"@pos",
"=",
"self",
".",
"succ_pos",
"@marks",
".",
"shift",
"if",
"@marks",
"[",
"0",
"]",
"==",
... | Add a new event dropping off old events if that was declared
marks are also dropped if buffer has a limit. | [
"Add",
"a",
"new",
"event",
"dropping",
"off",
"old",
"events",
"if",
"that",
"was",
"declared",
"marks",
"are",
"also",
"dropped",
"if",
"buffer",
"has",
"a",
"limit",
"."
] | 192e5d3b8236f0c1094f7ba3a6b5d2c42ed43fc1 | https://github.com/rocky/rbx-trepanning/blob/192e5d3b8236f0c1094f7ba3a6b5d2c42ed43fc1/app/eventbuffer.rb#L25-L31 |
5,780 | ivanzotov/constructor | pages/app/models/constructor_pages/template.rb | ConstructorPages.Template.check_code_name | def check_code_name(cname)
[cname.pluralize, cname.singularize].each {|name|
return false if root.descendants.map{|t| t.code_name unless t.code_name == cname}.include?(name)}
true
end | ruby | def check_code_name(cname)
[cname.pluralize, cname.singularize].each {|name|
return false if root.descendants.map{|t| t.code_name unless t.code_name == cname}.include?(name)}
true
end | [
"def",
"check_code_name",
"(",
"cname",
")",
"[",
"cname",
".",
"pluralize",
",",
"cname",
".",
"singularize",
"]",
".",
"each",
"{",
"|",
"name",
"|",
"return",
"false",
"if",
"root",
".",
"descendants",
".",
"map",
"{",
"|",
"t",
"|",
"t",
".",
"... | Check if there is code_name in same branch | [
"Check",
"if",
"there",
"is",
"code_name",
"in",
"same",
"branch"
] | 1d52fb5b642200a6993f5a630e6934bccbcbf4e8 | https://github.com/ivanzotov/constructor/blob/1d52fb5b642200a6993f5a630e6934bccbcbf4e8/pages/app/models/constructor_pages/template.rb#L39-L43 |
5,781 | aelogica/express_templates | lib/express_templates/renderer.rb | ExpressTemplates.Renderer.render | def render context=nil, template_or_src=nil, &block
compiled_template = compile(template_or_src, &block)
context.instance_eval compiled_template
end | ruby | def render context=nil, template_or_src=nil, &block
compiled_template = compile(template_or_src, &block)
context.instance_eval compiled_template
end | [
"def",
"render",
"context",
"=",
"nil",
",",
"template_or_src",
"=",
"nil",
",",
"&",
"block",
"compiled_template",
"=",
"compile",
"(",
"template_or_src",
",",
"block",
")",
"context",
".",
"instance_eval",
"compiled_template",
"end"
] | render accepts source or block, evaluates the resulting string of ruby in the context provided | [
"render",
"accepts",
"source",
"or",
"block",
"evaluates",
"the",
"resulting",
"string",
"of",
"ruby",
"in",
"the",
"context",
"provided"
] | d5d447357e737c9220ca0025feb9e6f8f6249b5b | https://github.com/aelogica/express_templates/blob/d5d447357e737c9220ca0025feb9e6f8f6249b5b/lib/express_templates/renderer.rb#L4-L7 |
5,782 | robertwahler/repo_manager | lib/repo_manager/settings.rb | RepoManager.Settings.configure | def configure(options)
# config file default options
configuration = {
:options => {
:verbose => false,
:color => 'AUTO',
:short => false,
:unmodified => 'HIDE',
... | ruby | def configure(options)
# config file default options
configuration = {
:options => {
:verbose => false,
:color => 'AUTO',
:short => false,
:unmodified => 'HIDE',
... | [
"def",
"configure",
"(",
"options",
")",
"# config file default options",
"configuration",
"=",
"{",
":options",
"=>",
"{",
":verbose",
"=>",
"false",
",",
":color",
"=>",
"'AUTO'",
",",
":short",
"=>",
"false",
",",
":unmodified",
"=>",
"'HIDE'",
",",
":match... | read options from YAML config | [
"read",
"options",
"from",
"YAML",
"config"
] | d945f1cb6ac48b5689b633fcc029fd77c6a02d09 | https://github.com/robertwahler/repo_manager/blob/d945f1cb6ac48b5689b633fcc029fd77c6a02d09/lib/repo_manager/settings.rb#L38-L94 |
5,783 | eprothro/cassie | lib/cassie/statements/execution/batched_fetching.rb | Cassie::Statements::Execution.BatchedFetching.fetch_in_batches | def fetch_in_batches(opts={})
opts[:batch_size] ||= 1000
# spawn the new query as soon as the enumerable is created
# rather than waiting until the firt iteration is executed.
# The client could mutate the object between these moments,
# however we don't want to spawn twice if a block isn... | ruby | def fetch_in_batches(opts={})
opts[:batch_size] ||= 1000
# spawn the new query as soon as the enumerable is created
# rather than waiting until the firt iteration is executed.
# The client could mutate the object between these moments,
# however we don't want to spawn twice if a block isn... | [
"def",
"fetch_in_batches",
"(",
"opts",
"=",
"{",
"}",
")",
"opts",
"[",
":batch_size",
"]",
"||=",
"1000",
"# spawn the new query as soon as the enumerable is created",
"# rather than waiting until the firt iteration is executed.",
"# The client could mutate the object between these... | Yields each batch of records that was found by the options as an array.
If you do not provide a block to find_in_batches, it will return an Enumerator for chaining with other methods.
query.fetch_in_batches do |records|
puts "max score in group: #{records.max{ |a, b| a.score <=> b.score }}"
end
"max score ... | [
"Yields",
"each",
"batch",
"of",
"records",
"that",
"was",
"found",
"by",
"the",
"options",
"as",
"an",
"array",
"."
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/statements/execution/batched_fetching.rb#L50-L81 |
5,784 | tmobaird/GuideboxWrapper | lib/GuideboxWrapper/guidebox_movie.rb | GuideboxWrapper.GuideboxMovie.search_for | def search_for(name)
url = build_query(name)
url += '/fuzzy/web'
data = @client.query(url)
sleep(1)
data["results"]
end | ruby | def search_for(name)
url = build_query(name)
url += '/fuzzy/web'
data = @client.query(url)
sleep(1)
data["results"]
end | [
"def",
"search_for",
"(",
"name",
")",
"url",
"=",
"build_query",
"(",
"name",
")",
"url",
"+=",
"'/fuzzy/web'",
"data",
"=",
"@client",
".",
"query",
"(",
"url",
")",
"sleep",
"(",
"1",
")",
"data",
"[",
"\"results\"",
"]",
"end"
] | Search for show | [
"Search",
"for",
"show"
] | 431d541141c21620b640dcffee6cf23b3d5ca616 | https://github.com/tmobaird/GuideboxWrapper/blob/431d541141c21620b640dcffee6cf23b3d5ca616/lib/GuideboxWrapper/guidebox_movie.rb#L8-L14 |
5,785 | pwnieexpress/snapi | lib/snapi/argument.rb | Snapi.Argument.valid_input? | def valid_input?(input)
case @attributes[:type]
when :boolean
[true,false].include?(input)
when :enum
raise MissingValuesError unless @attributes[:values]
raise InvalidValuesError unless @attributes[:values].class == Array
@attributes[:values].include?(input)
when... | ruby | def valid_input?(input)
case @attributes[:type]
when :boolean
[true,false].include?(input)
when :enum
raise MissingValuesError unless @attributes[:values]
raise InvalidValuesError unless @attributes[:values].class == Array
@attributes[:values].include?(input)
when... | [
"def",
"valid_input?",
"(",
"input",
")",
"case",
"@attributes",
"[",
":type",
"]",
"when",
":boolean",
"[",
"true",
",",
"false",
"]",
".",
"include?",
"(",
"input",
")",
"when",
":enum",
"raise",
"MissingValuesError",
"unless",
"@attributes",
"[",
":values... | Check if a value provided will suffice for the way
this argument is defined.
@param input, Just about anything...
@returns Boolean. true if valid | [
"Check",
"if",
"a",
"value",
"provided",
"will",
"suffice",
"for",
"the",
"way",
"this",
"argument",
"is",
"defined",
"."
] | 3c2a6fe454721945e4e58b8b496d3c20ada55df7 | https://github.com/pwnieexpress/snapi/blob/3c2a6fe454721945e4e58b8b496d3c20ada55df7/lib/snapi/argument.rb#L139-L159 |
5,786 | eprothro/cassie | lib/cassie/statements/execution/fetching.rb | Cassie::Statements::Execution.Fetching.fetch | def fetch(args={})
args.each do |k, v|
setter = "#{k}="
send(setter, v) if respond_to? setter
end
execute
result
end | ruby | def fetch(args={})
args.each do |k, v|
setter = "#{k}="
send(setter, v) if respond_to? setter
end
execute
result
end | [
"def",
"fetch",
"(",
"args",
"=",
"{",
"}",
")",
"args",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"setter",
"=",
"\"#{k}=\"",
"send",
"(",
"setter",
",",
"v",
")",
"if",
"respond_to?",
"setter",
"end",
"execute",
"result",
"end"
] | Returns array of rows or empty array
query.fetch(id: 1)
=> [{id: 1, name: 'eprothro'}] | [
"Returns",
"array",
"of",
"rows",
"or",
"empty",
"array"
] | 63e71d12d3549882147e715e427a16fd8e0aa210 | https://github.com/eprothro/cassie/blob/63e71d12d3549882147e715e427a16fd8e0aa210/lib/cassie/statements/execution/fetching.rb#L19-L27 |
5,787 | fcheung/corefoundation | lib/corefoundation/base.rb | CF.Base.inspect | def inspect
cf = CF::String.new(CF.CFCopyDescription(self))
cf.to_s.tap {cf.release}
end | ruby | def inspect
cf = CF::String.new(CF.CFCopyDescription(self))
cf.to_s.tap {cf.release}
end | [
"def",
"inspect",
"cf",
"=",
"CF",
"::",
"String",
".",
"new",
"(",
"CF",
".",
"CFCopyDescription",
"(",
"self",
")",
")",
"cf",
".",
"to_s",
".",
"tap",
"{",
"cf",
".",
"release",
"}",
"end"
] | Returns a ruby string containing the output of CFCopyDescription for the wrapped object
@return [String] | [
"Returns",
"a",
"ruby",
"string",
"containing",
"the",
"output",
"of",
"CFCopyDescription",
"for",
"the",
"wrapped",
"object"
] | a5c766359e74f873902d916e9fb051ec7fdedbb9 | https://github.com/fcheung/corefoundation/blob/a5c766359e74f873902d916e9fb051ec7fdedbb9/lib/corefoundation/base.rb#L146-L149 |
5,788 | fcheung/corefoundation | lib/corefoundation/base.rb | CF.Base.equals? | def equals?(other)
if other.is_a?(CF::Base)
@ptr.address == other.to_ptr.address
else
false
end
end | ruby | def equals?(other)
if other.is_a?(CF::Base)
@ptr.address == other.to_ptr.address
else
false
end
end | [
"def",
"equals?",
"(",
"other",
")",
"if",
"other",
".",
"is_a?",
"(",
"CF",
"::",
"Base",
")",
"@ptr",
".",
"address",
"==",
"other",
".",
"to_ptr",
".",
"address",
"else",
"false",
"end",
"end"
] | Uses CFHash to return a hash code
@return [Integer]
eql? (and ==) are implemented using CFEqual
equals? is defined as returning true if the wrapped pointer is the same | [
"Uses",
"CFHash",
"to",
"return",
"a",
"hash",
"code"
] | a5c766359e74f873902d916e9fb051ec7fdedbb9 | https://github.com/fcheung/corefoundation/blob/a5c766359e74f873902d916e9fb051ec7fdedbb9/lib/corefoundation/base.rb#L172-L178 |
5,789 | bachya/cliutils | lib/cliutils/pretty_io.rb | CLIUtils.PrettyIO.color_chart | def color_chart
[0, 1, 4, 5, 7].each do |attr|
puts '----------------------------------------------------------------'
puts "ESC[#{attr};Foreground;Background"
30.upto(37) do |fg|
40.upto(47) do |bg|
print "\033[#{attr};#{fg};#{bg}m #{fg};#{bg} "
end
... | ruby | def color_chart
[0, 1, 4, 5, 7].each do |attr|
puts '----------------------------------------------------------------'
puts "ESC[#{attr};Foreground;Background"
30.upto(37) do |fg|
40.upto(47) do |bg|
print "\033[#{attr};#{fg};#{bg}m #{fg};#{bg} "
end
... | [
"def",
"color_chart",
"[",
"0",
",",
"1",
",",
"4",
",",
"5",
",",
"7",
"]",
".",
"each",
"do",
"|",
"attr",
"|",
"puts",
"'----------------------------------------------------------------'",
"puts",
"\"ESC[#{attr};Foreground;Background\"",
"30",
".",
"upto",
"(",... | Displays a chart of all the possible ANSI foreground
and background color combinations.
@return [void] | [
"Displays",
"a",
"chart",
"of",
"all",
"the",
"possible",
"ANSI",
"foreground",
"and",
"background",
"color",
"combinations",
"."
] | af5280bcadf7196922ab1bb7285787149cadbb9d | https://github.com/bachya/cliutils/blob/af5280bcadf7196922ab1bb7285787149cadbb9d/lib/cliutils/pretty_io.rb#L28-L39 |
5,790 | lml/lev | lib/lev/handler.rb | Lev.Handler.validate_paramified_params | def validate_paramified_params
self.class.paramify_methods.each do |method|
params = send(method)
transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?
end
end | ruby | def validate_paramified_params
self.class.paramify_methods.each do |method|
params = send(method)
transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?
end
end | [
"def",
"validate_paramified_params",
"self",
".",
"class",
".",
"paramify_methods",
".",
"each",
"do",
"|",
"method",
"|",
"params",
"=",
"send",
"(",
"method",
")",
"transfer_errors_from",
"(",
"params",
",",
"TermMapper",
".",
"scope",
"(",
"params",
".",
... | Helper method to validate paramified params and to transfer any errors
into the handler. | [
"Helper",
"method",
"to",
"validate",
"paramified",
"params",
"and",
"to",
"transfer",
"any",
"errors",
"into",
"the",
"handler",
"."
] | ce39ac122796974dafb24ee61428540dacf34371 | https://github.com/lml/lev/blob/ce39ac122796974dafb24ee61428540dacf34371/lib/lev/handler.rb#L222-L227 |
5,791 | GenieBelt/gb-dispatch | lib/gb_dispatch/queue.rb | GBDispatch.Queue.perform_after | def perform_after(time, block=nil)
task = Concurrent::ScheduledTask.new(time) do
block = ->(){ yield } unless block
self.async.perform_now block
end
task.execute
task
end | ruby | def perform_after(time, block=nil)
task = Concurrent::ScheduledTask.new(time) do
block = ->(){ yield } unless block
self.async.perform_now block
end
task.execute
task
end | [
"def",
"perform_after",
"(",
"time",
",",
"block",
"=",
"nil",
")",
"task",
"=",
"Concurrent",
"::",
"ScheduledTask",
".",
"new",
"(",
"time",
")",
"do",
"block",
"=",
"->",
"(",
")",
"{",
"yield",
"}",
"unless",
"block",
"self",
".",
"async",
".",
... | Perform block after given period
@param time [Fixnum]
@param block [Proc]
@yield if there is no block given it yield without param.
@return [Concurrent::ScheduledTask] | [
"Perform",
"block",
"after",
"given",
"period"
] | 6ee932de9b397b96c82271478db1bf5933449e94 | https://github.com/GenieBelt/gb-dispatch/blob/6ee932de9b397b96c82271478db1bf5933449e94/lib/gb_dispatch/queue.rb#L57-L64 |
5,792 | ktemkin/ruby-ise | lib/ise/preference_file.rb | ISE.PreferenceFile.set_by_path | def set_by_path(path, value, target=@ini)
#Split the path into its components.
keys = path.split('/')
#Traverse the path, creating any "folders" necessary along the way.
until keys.one?
target[keys.first] = {} unless target[keys.first].is_a?(Hash)
target = target[keys.shift]
... | ruby | def set_by_path(path, value, target=@ini)
#Split the path into its components.
keys = path.split('/')
#Traverse the path, creating any "folders" necessary along the way.
until keys.one?
target[keys.first] = {} unless target[keys.first].is_a?(Hash)
target = target[keys.shift]
... | [
"def",
"set_by_path",
"(",
"path",
",",
"value",
",",
"target",
"=",
"@ini",
")",
"#Split the path into its components.",
"keys",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"#Traverse the path, creating any \"folders\" necessary along the way.",
"until",
"keys",
".",
... | Sets the value of a key in a hash-of-hashes via a unix-style path.
path: The path to the target key, in a unix-style path structure. See example below.
value: The value to put into the key.
target: The hash to operate on. If target isn't provided, we work with the base INI.
Example:
set_by_path('foo/bar/tab',... | [
"Sets",
"the",
"value",
"of",
"a",
"key",
"in",
"a",
"hash",
"-",
"of",
"-",
"hashes",
"via",
"a",
"unix",
"-",
"style",
"path",
"."
] | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/preference_file.rb#L46-L60 |
5,793 | ktemkin/ruby-ise | lib/ise/preference_file.rb | ISE.PreferenceFile.get_by_path | def get_by_path(path, target=@ini)
#Split the path into its components...
keys = path.split('/')
#And traverse the hasn until we've fully navigated the path.
target = target[keys.shift] until keys.empty?
#Returns the final value.
target
end | ruby | def get_by_path(path, target=@ini)
#Split the path into its components...
keys = path.split('/')
#And traverse the hasn until we've fully navigated the path.
target = target[keys.shift] until keys.empty?
#Returns the final value.
target
end | [
"def",
"get_by_path",
"(",
"path",
",",
"target",
"=",
"@ini",
")",
"#Split the path into its components...",
"keys",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"#And traverse the hasn until we've fully navigated the path.",
"target",
"=",
"target",
"[",
"keys",
".",... | Gets the value of a key in a hash-of-hashes via a unix-style path.
path: The path to the target key, in a unix-style path structure. See example below.
target: The hash to operate on. If target isn't provided, we work with the base INI.
Example:
set_by_path('foo/bar/tab', 3, a) would set
a[foo][bar][tab] = ... | [
"Gets",
"the",
"value",
"of",
"a",
"key",
"in",
"a",
"hash",
"-",
"of",
"-",
"hashes",
"via",
"a",
"unix",
"-",
"style",
"path",
"."
] | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/preference_file.rb#L74-L85 |
5,794 | ktemkin/ruby-ise | lib/ise/preference_file.rb | ISE.PreferenceFile.process_property | def process_property(property, value)
value.chomp!
#If either the property or value are empty (or contain invalid whitespace),
#abort.
return if property.empty? and value.empty?
return if value.sub!(%r/\\\s*\z/, '')
#Strip any leading/trailing characters.
property.stri... | ruby | def process_property(property, value)
value.chomp!
#If either the property or value are empty (or contain invalid whitespace),
#abort.
return if property.empty? and value.empty?
return if value.sub!(%r/\\\s*\z/, '')
#Strip any leading/trailing characters.
property.stri... | [
"def",
"process_property",
"(",
"property",
",",
"value",
")",
"value",
".",
"chomp!",
"#If either the property or value are empty (or contain invalid whitespace),",
"#abort.",
"return",
"if",
"property",
".",
"empty?",
"and",
"value",
".",
"empty?",
"return",
"if",
"va... | Processes a given name-value pair, adding them
to the current INI database.
Code taken from the 'inifile' gem. | [
"Processes",
"a",
"given",
"name",
"-",
"value",
"pair",
"adding",
"them",
"to",
"the",
"current",
"INI",
"database",
"."
] | db34c9bac5f9986ee4d2750e314dac4b6f139a24 | https://github.com/ktemkin/ruby-ise/blob/db34c9bac5f9986ee4d2750e314dac4b6f139a24/lib/ise/preference_file.rb#L93-L119 |
5,795 | Falkor/falkorlib | lib/falkorlib/git/base.rb | FalkorLib.Git.init? | def init?(path = Dir.pwd)
begin
MiniGit.new(path)
rescue Exception
return false
end
true
end | ruby | def init?(path = Dir.pwd)
begin
MiniGit.new(path)
rescue Exception
return false
end
true
end | [
"def",
"init?",
"(",
"path",
"=",
"Dir",
".",
"pwd",
")",
"begin",
"MiniGit",
".",
"new",
"(",
"path",
")",
"rescue",
"Exception",
"return",
"false",
"end",
"true",
"end"
] | Check if a git directory has been initialized | [
"Check",
"if",
"a",
"git",
"directory",
"has",
"been",
"initialized"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/git/base.rb#L40-L47 |
5,796 | Falkor/falkorlib | lib/falkorlib/git/base.rb | FalkorLib.Git.commits? | def commits?(path)
res = false
Dir.chdir(path) do
_stdout, _stderr, exit_status = Open3.capture3( "git rev-parse HEAD" )
res = (exit_status.to_i.zero?)
end
res
end | ruby | def commits?(path)
res = false
Dir.chdir(path) do
_stdout, _stderr, exit_status = Open3.capture3( "git rev-parse HEAD" )
res = (exit_status.to_i.zero?)
end
res
end | [
"def",
"commits?",
"(",
"path",
")",
"res",
"=",
"false",
"Dir",
".",
"chdir",
"(",
"path",
")",
"do",
"_stdout",
",",
"_stderr",
",",
"exit_status",
"=",
"Open3",
".",
"capture3",
"(",
"\"git rev-parse HEAD\"",
")",
"res",
"=",
"(",
"exit_status",
".",
... | Check if the repositories already holds some commits | [
"Check",
"if",
"the",
"repositories",
"already",
"holds",
"some",
"commits"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/git/base.rb#L50-L57 |
5,797 | Falkor/falkorlib | lib/falkorlib/git/base.rb | FalkorLib.Git.command? | def command?(cmd)
cg = MiniGit::Capturing.new
cmd_list = cg.help :a => true
# typical run:
# usage: git [--version] [--help] [-C <path>] [-c name=value]
# [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
# [-p|--paginate|--no-pager] [--no-replace-... | ruby | def command?(cmd)
cg = MiniGit::Capturing.new
cmd_list = cg.help :a => true
# typical run:
# usage: git [--version] [--help] [-C <path>] [-c name=value]
# [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
# [-p|--paginate|--no-pager] [--no-replace-... | [
"def",
"command?",
"(",
"cmd",
")",
"cg",
"=",
"MiniGit",
"::",
"Capturing",
".",
"new",
"cmd_list",
"=",
"cg",
".",
"help",
":a",
"=>",
"true",
"# typical run:",
"# usage: git [--version] [--help] [-C <path>] [-c name=value]",
"# [--exec-path[=<path>]] [--html... | Check the availability of a given git command | [
"Check",
"the",
"availability",
"of",
"a",
"given",
"git",
"command"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/git/base.rb#L60-L86 |
5,798 | Falkor/falkorlib | lib/falkorlib/git/base.rb | FalkorLib.Git.init | def init(path = Dir.pwd, _options = {})
# FIXME: for travis test: ensure the global git configurations
# 'user.email' and 'user.name' are set
[ 'user.name', 'user.email' ].each do |userconf|
next unless MiniGit[userconf].nil?
warn "The Git global configuration '#{userconf}' is not set ... | ruby | def init(path = Dir.pwd, _options = {})
# FIXME: for travis test: ensure the global git configurations
# 'user.email' and 'user.name' are set
[ 'user.name', 'user.email' ].each do |userconf|
next unless MiniGit[userconf].nil?
warn "The Git global configuration '#{userconf}' is not set ... | [
"def",
"init",
"(",
"path",
"=",
"Dir",
".",
"pwd",
",",
"_options",
"=",
"{",
"}",
")",
"# FIXME: for travis test: ensure the global git configurations",
"# 'user.email' and 'user.name' are set",
"[",
"'user.name'",
",",
"'user.email'",
"]",
".",
"each",
"do",
"|",
... | Initialize a git repository | [
"Initialize",
"a",
"git",
"repository"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/git/base.rb#L91-L117 |
5,799 | Falkor/falkorlib | lib/falkorlib/git/base.rb | FalkorLib.Git.create_branch | def create_branch(branch, path = Dir.pwd)
#ap method(__method__).parameters.map { |arg| arg[1] }
g = MiniGit.new(path)
error "not yet any commit performed -- You shall do one" unless commits?(path)
g.branch branch.to_s
end | ruby | def create_branch(branch, path = Dir.pwd)
#ap method(__method__).parameters.map { |arg| arg[1] }
g = MiniGit.new(path)
error "not yet any commit performed -- You shall do one" unless commits?(path)
g.branch branch.to_s
end | [
"def",
"create_branch",
"(",
"branch",
",",
"path",
"=",
"Dir",
".",
"pwd",
")",
"#ap method(__method__).parameters.map { |arg| arg[1] }",
"g",
"=",
"MiniGit",
".",
"new",
"(",
"path",
")",
"error",
"\"not yet any commit performed -- You shall do one\"",
"unless",
"comm... | Create a new branch | [
"Create",
"a",
"new",
"branch"
] | 1a6d732e8fd5550efb7c98a87ee97fcd2e051858 | https://github.com/Falkor/falkorlib/blob/1a6d732e8fd5550efb7c98a87ee97fcd2e051858/lib/falkorlib/git/base.rb#L132-L137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.