query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Registers new query definition in the system with given queryName | def create_query_definition_with_http_info(query_name, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.create_query_definition ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def add_query(query)\n add_actions \"AddQuery(#{query})\"\n end",
"def alias_qu... | [
"0.7617805",
"0.7024626",
"0.6597297",
"0.64331007",
"0.60825783",
"0.6056614",
"0.60446227",
"0.6004409",
"0.5963793",
"0.58811414",
"0.58786076",
"0.57812816",
"0.57775253",
"0.57586247",
"0.5732265",
"0.5686912",
"0.56587934",
"0.55832976",
"0.5568638",
"0.55257726",
"0.55... | 0.5288041 | 50 |
Deletes existing query definition from the system with given queryName | def drop_query_definition(query_name, opts = {})
drop_query_definition_with_http_info(query_name, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_query(project_id, query_id)\n delete \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def delete_percolator_query(query_name)\n server.request(:delete, percolator_query_path(query_name))\n end",
"def delete_query(query)\n do_delete_query(query)\n end",
"def r... | [
"0.71859735",
"0.712277",
"0.6888088",
"0.6640369",
"0.6624815",
"0.6621205",
"0.6571545",
"0.65505934",
"0.6506232",
"0.6352799",
"0.6319997",
"0.62108415",
"0.6154649",
"0.6108359",
"0.61077636",
"0.61007375",
"0.6065895",
"0.6058859",
"0.6048962",
"0.6031496",
"0.6023679",... | 0.68846035 | 3 |
Deletes existing query definition from the system with given queryName | def drop_query_definition_with_http_info(query_name, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.drop_query_definition ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side_validatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_query(project_id, query_id)\n delete \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def delete_percolator_query(query_name)\n server.request(:delete, percolator_query_path(query_name))\n end",
"def delete_query(query)\n do_delete_query(query)\n end",
"def d... | [
"0.71859735",
"0.712277",
"0.6888088",
"0.68846035",
"0.6640369",
"0.6624815",
"0.6621205",
"0.65505934",
"0.6506232",
"0.6352799",
"0.6319997",
"0.62108415",
"0.6154649",
"0.6108359",
"0.61077636",
"0.61007375",
"0.6065895",
"0.6058859",
"0.6048962",
"0.6031496",
"0.6023679"... | 0.6571545 | 7 |
Retruns all custom queries defined in the system | def get_queries(opts = {})
data, _status_code, _headers = get_queries_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end",
"def queries\n @requested_queries.map { |key| Gquery.get(key) }.compact\n e... | [
"0.7454375",
"0.71555",
"0.69711924",
"0.6797424",
"0.6766234",
"0.6713893",
"0.66123575",
"0.63739824",
"0.6338998",
"0.6313369",
"0.6310469",
"0.63040304",
"0.6242687",
"0.6226933",
"0.62102723",
"0.6200628",
"0.6162009",
"0.61601615",
"0.6143442",
"0.61035734",
"0.60720694... | 0.0 | -1 |
Retruns all custom queries defined in the system | def get_queries_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.get_queries ..."
end
# resource path
local_var_path = "/server/queries/definitions"
# query parameters
query_params = {}
query_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end",
"def queries\n @requested_queries.map { |key| Gquery.get(key) }.compact\n e... | [
"0.745479",
"0.7155899",
"0.6972376",
"0.6798342",
"0.67660093",
"0.6713353",
"0.66123927",
"0.63746053",
"0.634009",
"0.6312674",
"0.6309223",
"0.6303415",
"0.6242964",
"0.6227311",
"0.6210663",
"0.6200759",
"0.6162114",
"0.61615574",
"0.6142815",
"0.6103811",
"0.6072565",
... | 0.5797192 | 58 |
Retrieves existing query definition from the system with given queryName | def get_query(query_name, opts = {})
data, _status_code, _headers = get_query_with_http_info(query_name, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def get_query(project_id, query_id)\n get \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def query_def; query.name; end",
"def query(query_definit... | [
"0.66628575",
"0.65281355",
"0.6429702",
"0.63281083",
"0.63104486",
"0.61567765",
"0.61082846",
"0.6092768",
"0.60154104",
"0.5922006",
"0.5921313",
"0.58581585",
"0.5837307",
"0.58369493",
"0.58274347",
"0.58019215",
"0.57840526",
"0.5724895",
"0.571168",
"0.5662145",
"0.56... | 0.5749111 | 17 |
Retrieves existing query definition from the system with given queryName | def get_query_with_http_info(query_name, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.get_query ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side_validation && query_name.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def get_query(project_id, query_id)\n get \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def query_def; query.name; end",
"def query(query_definit... | [
"0.66628575",
"0.65281355",
"0.6429702",
"0.63281083",
"0.63104486",
"0.61567765",
"0.61082846",
"0.6092768",
"0.60154104",
"0.5922006",
"0.58581585",
"0.5837307",
"0.58369493",
"0.58274347",
"0.58019215",
"0.57840526",
"0.5749111",
"0.5724895",
"0.571168",
"0.5662145",
"0.56... | 0.5921313 | 10 |
Replaces existing query definition or registers new if not exists in the system with given queryName | def replace_query_definition(query_name, body, opts = {})
data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_clien... | [
"0.69548666",
"0.63016075",
"0.6243595",
"0.62100554",
"0.6203586",
"0.5965975",
"0.57209253",
"0.5630554",
"0.56028265",
"0.55337507",
"0.5507554",
"0.5495231",
"0.5403918",
"0.53850263",
"0.53686833",
"0.5366283",
"0.5349502",
"0.53455186",
"0.53083247",
"0.5216415",
"0.517... | 0.6861961 | 1 |
Replaces existing query definition or registers new if not exists in the system with given queryName | def replace_query_definition_with_http_info(query_name, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.replace_query_definition ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def replace_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def register_percolator_query(query_name, optio... | [
"0.69555974",
"0.68629533",
"0.6301826",
"0.62108475",
"0.62038124",
"0.5967362",
"0.5720692",
"0.563147",
"0.5602558",
"0.55344576",
"0.55094355",
"0.54948694",
"0.54041487",
"0.53844845",
"0.5370923",
"0.53674084",
"0.53502744",
"0.53463554",
"0.5309969",
"0.5217485",
"0.51... | 0.62439895 | 3 |
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper. | def run_query(query_name, mapper, opts = {})
data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query_with_http_info(query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation &&... | [
"0.6294075",
"0.6183426",
"0.5896972",
"0.5798822",
"0.5685007",
"0.544019",
"0.5319355",
"0.5224888",
"0.52176267",
"0.5212605",
"0.5209801",
"0.5180315",
"0.5123208",
"0.50934714",
"0.5091659",
"0.5085034",
"0.5085034",
"0.50740755",
"0.50318015",
"0.50300777",
"0.5011104",... | 0.7422529 | 0 |
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper. | def run_query_with_http_info(query_name, mapper, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.run_query ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side_validation && query_name.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end",
"def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, op... | [
"0.7422529",
"0.6183426",
"0.5896972",
"0.5798822",
"0.5685007",
"0.544019",
"0.5319355",
"0.5224888",
"0.52176267",
"0.5212605",
"0.5209801",
"0.5180315",
"0.5123208",
"0.50934714",
"0.5091659",
"0.5085034",
"0.5085034",
"0.50740755",
"0.50318015",
"0.50300777",
"0.5011104",... | 0.6294075 | 1 |
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper. Query is additional altered by the filter spec and/or builder | def run_query_filtered(query_name, mapper, opts = {})
data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end",
"def run_query_filtered_with_http_info(query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug... | [
"0.7097004",
"0.6756369",
"0.63633746",
"0.5915124",
"0.5728005",
"0.5716912",
"0.57130307",
"0.54632163",
"0.53342247",
"0.5326167",
"0.5322422",
"0.5305781",
"0.52718717",
"0.52591634",
"0.52281404",
"0.5193519",
"0.51487064",
"0.5137025",
"0.5107997",
"0.51018876",
"0.5095... | 0.698791 | 1 |
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper. Query is additional altered by the filter spec and/or builder | def run_query_filtered_with_http_info(query_name, mapper, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.run_query_filtered ..."
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side_validat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end",
"def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, op... | [
"0.7095027",
"0.6986104",
"0.6362176",
"0.59127903",
"0.5726557",
"0.57155156",
"0.57119775",
"0.5462445",
"0.5332591",
"0.5323325",
"0.5321059",
"0.5304085",
"0.52705777",
"0.5258084",
"0.52253574",
"0.51913804",
"0.5147824",
"0.51346713",
"0.51061404",
"0.5100443",
"0.50929... | 0.6755226 | 2 |
Queries using query definition identified by queryName filtered by container. Maps the result to concrete objects based on provided mapper. Query is additional altered by the filter spec and/or builder | def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})
data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end",
"def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, op... | [
"0.6651049",
"0.6587441",
"0.64488375",
"0.60735524",
"0.56691295",
"0.55182827",
"0.5518116",
"0.54914814",
"0.54829395",
"0.5371914",
"0.5367875",
"0.53347963",
"0.52114004",
"0.52000856",
"0.51707476",
"0.51579905",
"0.5156919",
"0.51193696",
"0.5112228",
"0.5108427",
"0.5... | 0.56222135 | 5 |
Queries using query definition identified by queryName filtered by container. Maps the result to concrete objects based on provided mapper. Query is additional altered by the filter spec and/or builder | def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ..."
end
# verify the required parameter 'id' is set
if @api_cli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end",
"def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, op... | [
"0.66513664",
"0.6587442",
"0.64482677",
"0.6072803",
"0.5669075",
"0.5622368",
"0.5517886",
"0.5517126",
"0.54819125",
"0.5371464",
"0.53676987",
"0.5334596",
"0.5211745",
"0.52005094",
"0.51694584",
"0.5157365",
"0.5155449",
"0.5119481",
"0.5110725",
"0.5107837",
"0.5069206... | 0.54914474 | 8 |
Add these two objects and yield a third. | def +(other_money)
Money.new(amount +
other_money.convert_to(currency).amount,
self.currency)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two\n\tyield 1, 2\nend",
"def adding(a, b, &c)\n yield(a + b)\nend",
"def combine(one, two)\n\n tuples = []\n\n one.each do |o|\n two.each do |t|\n pair = [o, t]\n tuples << pair\n yield o, t if block_given?\n end\n end\n\n tuples\nend",
"def concat(other)\n other.each do |... | [
"0.6419345",
"0.6123062",
"0.6085998",
"0.6056902",
"0.5845345",
"0.5796114",
"0.57396996",
"0.5693645",
"0.5690218",
"0.5675686",
"0.5597299",
"0.5582901",
"0.5566491",
"0.55307674",
"0.5477754",
"0.54752856",
"0.54752856",
"0.54437256",
"0.5441547",
"0.5423397",
"0.54213667... | 0.0 | -1 |
Returns a link to the current account management option create or show | def account_link
return link_to I18n.t('user.show'), user_path(current_user) if current_user?
link_to I18n.t('navigation.sign_up'), new_user_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_overview\n ::Liquid::Drops::Url.new(admin_account_path, 'Overview', '')\n end",
"def admin_link\n admin_app_url(:host => CONSTANTS[:base_url_host], :offering => offering, :id => self)\n end",
"def my_account_menu_link\n $tracer.trace(__method__)\n return ToolTag.new(a.classNam... | [
"0.62164557",
"0.6179073",
"0.6126623",
"0.60785884",
"0.6069009",
"0.6066393",
"0.60123086",
"0.59928316",
"0.5979095",
"0.59702754",
"0.59482783",
"0.5910333",
"0.5909117",
"0.58749294",
"0.5813938",
"0.58120346",
"0.57899845",
"0.5786126",
"0.5779666",
"0.57669145",
"0.574... | 0.65996224 | 0 |
filename of the logger | def logger_filename=(filename)
$logger_filename = filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger_filename\n \"#{cm_cfg_path}/logs/configmonkey.log\"\n end",
"def log_file\n end",
"def log_file; end",
"def log_file_name\n @component_name\n end",
"def log\n \"#{self.dir}.log\"\n end",
"def log_filename\n log_file.nil? || log_file.empty? || log_file == '... | [
"0.7874035",
"0.7859813",
"0.7813772",
"0.7660888",
"0.75667536",
"0.7538536",
"0.738594",
"0.73797864",
"0.73403704",
"0.7336716",
"0.72891104",
"0.72824806",
"0.7260308",
"0.72505647",
"0.7186787",
"0.71802366",
"0.70936215",
"0.70715284",
"0.7063371",
"0.7061424",
"0.70140... | 0.77619 | 3 |
Pass many strings that will be include in the load path and require all ruby files in the specified dir | def load_paths=(dirs)
dirs.each do |dir|
directory = File.expand_path(dir)
$LOAD_PATH.unshift(directory) unless $LOAD_PATH.include?(directory)
Dir["#{directory}/*.rb"].each { |file| require file }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_all dir\n `ls #{dir}`.each_line do |file|\n require \"#{dir}/#{file.strip}\"\n end\nend",
"def load_files(path)\n Dir[path].each {|file| require file}\nend",
"def load_ruby_files(directory = '.')\n print \"Loading ruby files...\\n\\n\"\n files = `find #{directory} -type f -name '*.rb'`\n f... | [
"0.7451164",
"0.7288219",
"0.71746105",
"0.71646607",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.70494395",
"0.69871527",
"0.69836235",
"0.6956298",
"0.6879192",
... | 0.7348493 | 1 |
calls the first proc and passes its result into the second. | def compose(proc1, proc2)
Proc.new do |x|
proc2.call(proc1.call(x)) # parenthesis needed so proc1 calls first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_two_procs(a, b)\n a.call # .call is used to run the proc (block of code)\n b.call\nend",
"def test procArg1, procArg2\n\tProc.new do |arg|\n\t\tprocArg2.call(procArg1.call(arg))\n\tend\nend",
"def another_proc\n\tp = Proc.new {return}\n\tp.call\n\tputs \"After Proc\"\nend",
"def run_two_proc... | [
"0.7392421",
"0.7154779",
"0.7054263",
"0.70236444",
"0.68648887",
"0.68590903",
"0.67216325",
"0.6626658",
"0.65983397",
"0.65302837",
"0.65302837",
"0.65302837",
"0.65302837",
"0.6405589",
"0.6385908",
"0.63784355",
"0.63572395",
"0.6354808",
"0.6354808",
"0.6354808",
"0.62... | 0.64420307 | 13 |
Perform all cascading deletes, destroys, or nullifies. Will delegate to the appropriate strategy to perform the operation. | def cascade!
cascades.each do |name|
if !metadata || !metadata.versioned?
meta = relations[name]
strategy = meta.cascade_strategy
strategy.new(self, meta).cascade
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_cascade_on_associations\n # ensure all BQ data is cleaned up first\n self.delete_convention_data\n self.study_files.each do |file|\n DataArray.where(study_id: self.id, study_file_id: file.id).delete_all\n end\n Gene.where(study_id: self.id).delete_all\n CellMetadatum.where(study_i... | [
"0.6116815",
"0.59378946",
"0.5873705",
"0.57567203",
"0.5699463",
"0.56989133",
"0.56552595",
"0.5633039",
"0.5632568",
"0.556307",
"0.5531316",
"0.5526761",
"0.550779",
"0.5497159",
"0.549378",
"0.549378",
"0.5486672",
"0.54841965",
"0.5451491",
"0.5448562",
"0.5437481",
... | 0.65323555 | 0 |
The driver gets 80% of the trip cost after a fee of $1.65 is subtracted | def driver_earnings
before_fee = self.total_earnings
if before_fee == 0
return 0
end
after_fee = (before_fee - 165)
percentage = 0.8
driver_earnings = after_fee * percentage
return driver_earnings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_fee\n (total - net_rate).round(2)\n end",
"def fuel_cost\n ((amount * 100) / (mileage - predecessor.mileage)).round(1) if predecessor\n end",
"def cost\n deductible * RATE\n end",
"def calculate_pay(trip_cost)\n return trip_cost >= TRIP_FEE ? (trip_cost - TRIP_FEE) * 0.80 : 0.... | [
"0.73998296",
"0.71889657",
"0.71878946",
"0.7165877",
"0.70974797",
"0.70758295",
"0.70758295",
"0.7039365",
"0.70283157",
"0.70156354",
"0.69998825",
"0.6999457",
"0.69763273",
"0.6974576",
"0.69576335",
"0.69444287",
"0.6927529",
"0.6927529",
"0.6913864",
"0.6909032",
"0.6... | 0.0 | -1 |
set locale for interface translating from current admin user | def set_locale
I18n.locale = access_control.user.locale
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end",
"def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end",
"def set_locale\n # This requires a user model to work. I'm assuming there will be a \"current_user\" helper.\n # If we decide to use Devise, that will be def... | [
"0.8474383",
"0.8474383",
"0.8311592",
"0.83046657",
"0.82548475",
"0.82160515",
"0.81579983",
"0.809985",
"0.8067449",
"0.8052016",
"0.80170393",
"0.79396313",
"0.7939481",
"0.7905847",
"0.79028124",
"0.78879565",
"0.786118",
"0.78127116",
"0.78127116",
"0.7800808",
"0.77836... | 0.853465 | 0 |
Notify the user of the backup operation results. `status` indicates one of the following: `:success` : The backup completed successfully. : Notification will be sent if `on_success` was set to `true` `:warning` : The backup completed successfully, but warnings were logged : Notification will be sent, including a copy o... | def notify!(status)
name = case status
when :success then 'Success'
when :warning then 'Warning'
when :failure then 'Failure'
end
message = '[Backup::%s]' % name
send_message(message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify!(status)\n name, color = case status\n when :success then ['Success', success_color]\n when :warning then ['Warning', warning_color]\n when :failure then ['Failure', failure_color]\n end\n message = \"[Back... | [
"0.8278428",
"0.81858903",
"0.79002845",
"0.7889586",
"0.717568",
"0.66246635",
"0.65507144",
"0.6535309",
"0.62342924",
"0.5800433",
"0.57868993",
"0.57754713",
"0.5775124",
"0.57526803",
"0.57137644",
"0.56461227",
"0.56210566",
"0.5583124",
"0.5565201",
"0.5545352",
"0.552... | 0.8367057 | 0 |
get a class for each controller. This will be inserted as a class in the body tag. | def bodytag_class
a = controller.class.to_s.underscore.gsub(/_controller$/, '').gsub(/\//, '-')
"#{a}".gsub(/_/, '-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body_classes\n [controller.controller_name, controller.action_name].join(' ')\n end",
"def body_class\n \"#{controller_name} #{action_name}\"\n end",
"def body_css_class\n\t @body_css_classes ||= []\n\t view_css_class = [controller_path.split('/'), action_name, 'view'].flatten.join('-')\n... | [
"0.7761277",
"0.7461699",
"0.731144",
"0.7213907",
"0.7203787",
"0.71533483",
"0.7106747",
"0.7050118",
"0.7019383",
"0.70045877",
"0.6959391",
"0.6845656",
"0.6679478",
"0.6662756",
"0.6516676",
"0.6367624",
"0.63473815",
"0.6293238",
"0.6288641",
"0.6274847",
"0.62674886",
... | 0.7681636 | 1 |
clears the array of all artists so its empty def self.reset_all self.all.clear end returns number of artist instances def self.count self.all.count end adds to the song array and makes artist self | def add_song(song)
@songs << song
song.artist = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n # @@artists << self\n super\n @songs = []\n end",
"def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end",
"def all_artists\n (track_artists() + artist()).compact.uniq\n end",
"def in... | [
"0.7156489",
"0.7056374",
"0.6997177",
"0.69253683",
"0.69208205",
"0.67027515",
"0.6698445",
"0.66912967",
"0.66508996",
"0.6629528",
"0.66218245",
"0.6589372",
"0.6577754",
"0.65493786",
"0.64871424",
"0.64774626",
"0.64723754",
"0.64674103",
"0.6459421",
"0.6459421",
"0.64... | 0.0 | -1 |
adds multiple songs to songs array | def add_songs(songs)
songs.each { |song| add_song(song) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n @songs << song \n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def ... | [
"0.8082679",
"0.8008686",
"0.80005395",
"0.7871628",
"0.7871628",
"0.7871628",
"0.7871628",
"0.7871628",
"0.7871628",
"0.7850824",
"0.78131306",
"0.77819365",
"0.7774317",
"0.76450825",
"0.7640007",
"0.75483966",
"0.75409263",
"0.7539353",
"0.7487023",
"0.7481141",
"0.7453654... | 0.85997236 | 2 |
Selects messages from mailboxes then marking them with +flags+. If a block is given it is run after message marking. Unless :Noop was set, then it just prints out what it would do. Automatically called by IMAPClient::run | def run(message, flags)
log message
message_count = 0
mailboxes = find_mailboxes
mailboxes.each do |mailbox|
@mailbox = mailbox
@imap.select @mailbox
log "Selected #{@mailbox}"
messages = find_messages
next if messages.empty?
message_count += messages.length
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark(messages, flags)\n messages.each_slice(500) do |chunk|\n @imap.store chunk, '+FLAGS.SILENT', flags\n end\n log \"Marked messages with flags\"\n end",
"def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n... | [
"0.6881116",
"0.6369226",
"0.59382856",
"0.5781145",
"0.5588587",
"0.54510194",
"0.5292121",
"0.52253366",
"0.51770794",
"0.5174547",
"0.5079694",
"0.5017648",
"0.5015247",
"0.49903208",
"0.49552765",
"0.48115832",
"0.48081237",
"0.4769843",
"0.4767478",
"0.47563472",
"0.4742... | 0.77104336 | 0 |
Connects to IMAP server +host+ at +port+ using ssl if +ssl+ is true then logs in as +username+ with +password+. IMAPClient will really only work with PLAIN auth on SSL sockets, sorry. | def connect(host, port, ssl, username, password, auth = nil)
@imap = Net::IMAP.new host, port, ssl, nil, false
log "Connected to #{host}:#{port}"
if auth.nil? then
auth_caps = @imap.capability.select { |c| c =~ /^AUTH/ }
raise "Couldn't find a supported auth type" if auth_caps.empty?
auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(host = @options[:Host],\n port = @options[:Port],\n ssl = @options[:SSL],\n username = @options[:Username],\n password = @options[:Password],\n auth = @options[:Auth]) # :yields: Connection\n imap = Net::IMAP.new host, port, ssl, nil, ... | [
"0.7176973",
"0.6581311",
"0.6212626",
"0.61302316",
"0.61192966",
"0.6048977",
"0.59579426",
"0.581526",
"0.5681106",
"0.56092703",
"0.5598857",
"0.5585831",
"0.5579512",
"0.55578923",
"0.55496585",
"0.53788626",
"0.5363819",
"0.5352832",
"0.5330798",
"0.53194284",
"0.527399... | 0.78387976 | 0 |
Finds mailboxes with messages that were selected by the :Boxes option. | def find_mailboxes
mailboxes = @imap.list(@root, "*")
if mailboxes.nil? then
log "Found no mailboxes under #{@root.inspect}, you may have an incorrect root"
return []
end
mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }
mailboxes.map! { |mailbox| mailbox.name }
@box... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_messages\n mailbox = @boxes.find { |box| @mailbox =~ /#{box}/ } # TODO: needs more work\n raise unless mailbox\n age = @cleanse[mailbox]\n before_date = (Time.now - 86400 * age).imapdate\n\n search [\n 'NOT', 'NEW',\n 'NOT', 'FLAGGED',\n 'BEFORE', before_date\n ], 'read, u... | [
"0.6662977",
"0.6570647",
"0.63797665",
"0.63797665",
"0.6059594",
"0.6022075",
"0.5973881",
"0.5898137",
"0.5675762",
"0.56723934",
"0.5640915",
"0.555897",
"0.5546591",
"0.5534385",
"0.55053604",
"0.5480045",
"0.54285777",
"0.54090655",
"0.54038024",
"0.5403693",
"0.5381436... | 0.7471203 | 0 |
Searches for messages matching +query+ in the selected mailbox (see Net::IMAPselect). Logs 'Scanning for +message+' before searching. | def search(query, message)
log " Scanning for #{message}"
messages = @imap.search query
log " Found #{messages.length} messages"
return messages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(query, &block)\n mailbox(get_right_box :all).search(query, &block)\n end",
"def search_messages(options = {})\n raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?\n if block_given?\n Pagination::Cursor.new(self, :search_messages, opt... | [
"0.68250227",
"0.6796713",
"0.6754854",
"0.6514663",
"0.64533526",
"0.6420654",
"0.633213",
"0.61966133",
"0.6152992",
"0.61162645",
"0.6069581",
"0.6020681",
"0.59750456",
"0.59123677",
"0.5904718",
"0.58945495",
"0.5879902",
"0.5842571",
"0.5825787",
"0.57607925",
"0.575007... | 0.84486043 | 0 |
Marks +messages+ in the currently selected mailbox with +flags+ (see Net::IMAPstore). | def mark(messages, flags)
messages.each_slice(500) do |chunk|
@imap.store chunk, '+FLAGS.SILENT', flags
end
log "Marked messages with flags"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markMail(imap, folder)\n pp \"MARKED #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Seen])\n imap.expunge\nend",
"def run(message, flags)\n log message\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox... | [
"0.7403385",
"0.6985612",
"0.6520341",
"0.6278484",
"0.6079888",
"0.60192335",
"0.5938525",
"0.5929803",
"0.58774346",
"0.5876065",
"0.5719986",
"0.5640212",
"0.55904806",
"0.5582521",
"0.55778646",
"0.5565348",
"0.55587095",
"0.54969263",
"0.54630613",
"0.54630613",
"0.54388... | 0.7488953 | 0 |
from_address, to_address, subject, htmlBody, textBody | def sendWithStatus (parameters = {})
return $server.call("APIEmailService.sendEmailWithStatus", $api_key, parameters[:from], parameters[:to], parameters[:cc]||="", parameters[:bcc]||="",parameters[:subject], parameters[:text], parameters[:html])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_mailtext\n to = URI.decode_www_form_component(@to)\n head = ''\n body = ''\n @headers.each do |x|\n case x[0]\n when 'body'\n body = URI.decode_www_form_component(x[1])\n when 'to'\n to << ', ' + URI.decode_www_form_component(x[1])\n else\n ... | [
"0.6804704",
"0.6636342",
"0.65403074",
"0.6389122",
"0.63403755",
"0.62637204",
"0.62552553",
"0.62497425",
"0.6245839",
"0.62403935",
"0.62262183",
"0.6213947",
"0.6189636",
"0.61792547",
"0.61617196",
"0.61387056",
"0.6089187",
"0.6070136",
"0.6063946",
"0.6057002",
"0.604... | 0.0 | -1 |
Fetch the number of jobs executed. | def count
self.class.count(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_job_count\n\n @pending_jobs.size\n end",
"def njobs\n @njobs.to_i\n end",
"def njobs\n @pool.njobs\n end",
"def cron_job_count\n\n @cron_jobs.size\n end",
"def get_job_count(type='scanner')\n job_count = 0\n framework.jobs.each do |k, j|\n ... | [
"0.78005016",
"0.7780384",
"0.76967335",
"0.7480556",
"0.74067825",
"0.73835206",
"0.7334956",
"0.7324176",
"0.725459",
"0.7206978",
"0.7091343",
"0.7083196",
"0.7032747",
"0.7009626",
"0.6923794",
"0.6831941",
"0.68133354",
"0.6761348",
"0.67588305",
"0.675495",
"0.6743835",... | 0.0 | -1 |
Increment the count of jobs executed. | def increment
self.class.increment(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_perform_increment_jobs_processed(*)\n @registry.hincrby key, 'jobs_processed', 1\n end",
"def after_perform_job_stats_performed(*args)\n Resque.redis.incr(jobs_performed_key)\n end",
"def incr_count\n @count ||= 0\n @count += 1\n end",
"def increment_cou... | [
"0.77765244",
"0.7092795",
"0.697191",
"0.67156893",
"0.6712472",
"0.6695684",
"0.6619666",
"0.65405416",
"0.65357906",
"0.64304155",
"0.6377493",
"0.6367806",
"0.63585466",
"0.63034636",
"0.6255497",
"0.6234528",
"0.6204761",
"0.61613876",
"0.6154782",
"0.61543",
"0.6141873"... | 0.5914969 | 39 |
Check if rate limiting options were correctly specified on the worker. | def can_throttle?
[threshold, period].select(&:zero?).empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def rate_limit\n options[:rate_limit]\n end",
"def has_limit?\n !@options[:limit].blank?\n end",
"def should_be_limited?\n @options[:limit] == true or (@options[:limit].is_a?(Fixnum) and @options[:limit] > 0)\n end",
... | [
"0.7787718",
"0.6763194",
"0.67484146",
"0.6716461",
"0.65840083",
"0.65806717",
"0.65694207",
"0.65458375",
"0.6415484",
"0.6365219",
"0.6104319",
"0.6104319",
"0.6083913",
"0.6054671",
"0.60455745",
"0.60069895",
"0.59774965",
"0.59286076",
"0.59110296",
"0.58934224",
"0.58... | 0.60798067 | 13 |
Check if rate limit has exceeded the threshold. | def exceeded?
count >= threshold
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def limit_reached?\n end",
"def over_limit?\n connect\n redis.incr rate_limiter_key\n redis.get(rate_limiter_key).to_i > limit\n end",
"def rate_limited_exceeded?\n limit = get_json( \"#{ GITHUB_API_URL }/rate_limit\" )[ 'rate' ... | [
"0.84402245",
"0.7890889",
"0.77602637",
"0.75234616",
"0.7429077",
"0.7429077",
"0.7405816",
"0.7293817",
"0.7209378",
"0.71388525",
"0.7107552",
"0.7106154",
"0.708863",
"0.7048507",
"0.6996031",
"0.69412345",
"0.69113547",
"0.6910193",
"0.6804323",
"0.6783847",
"0.6769469"... | 0.7724291 | 3 |
Check if rate limit is within the threshold. | def within_bounds?
!exceeded?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"def over_rate_limit?\n window = 10.minutes.ago.to_i\n interval = 30.seconds.to_i\n \n return true if rate_limit.present? and rate_limit > Time.now.to_i\n if rate_limit.nil? or rate_limit < window\n self.rate_limit = window\n ... | [
"0.78974915",
"0.71591425",
"0.71591425",
"0.7112281",
"0.7081134",
"0.7078388",
"0.7029879",
"0.6932817",
"0.69009066",
"0.683426",
"0.6798573",
"0.6686474",
"0.6684501",
"0.6678876",
"0.66219014",
"0.66086584",
"0.65675175",
"0.6537815",
"0.65256757",
"0.6523335",
"0.652326... | 0.59870887 | 54 |
Reset the tracking of job executions. | def reset!
executions.reset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @processed_job_ids = Set.new\n end",
"def reset\n @jobexecution_dao.delete('je.job_execution_id': @queue.map(&:job_execution_id))\n @job_dao.delete(job_id: @jobs.map(&:id))\n @jobnet_dao.delete(jobnet_id: @jobnet.id)\n end",
"def reset!\n @... | [
"0.7736411",
"0.76488227",
"0.68267167",
"0.67323714",
"0.66934985",
"0.6565566",
"0.65603065",
"0.6537346",
"0.6529518",
"0.65283346",
"0.6514642",
"0.64965814",
"0.6493098",
"0.6465226",
"0.6426591",
"0.6360715",
"0.6337814",
"0.63360393",
"0.6306765",
"0.62928927",
"0.6292... | 0.8333738 | 0 |
Get the storage backend. | def executions
@storage_class.instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_storage_adapter\n @storage_adapter.new(storage_adapter_config)\n end",
"def primary_storage_adapter\n @storage_adapters.first\n end",
"def get_storage_class\n return @m_storage_class\n end",
"def storage_adapter\n @storage_adapter ||= begin\n all_adapte... | [
"0.77251726",
"0.7467138",
"0.74582994",
"0.72835785",
"0.7185753",
"0.7181476",
"0.71424586",
"0.71167505",
"0.70165443",
"0.6839726",
"0.680899",
"0.677398",
"0.6758894",
"0.6743909",
"0.6729429",
"0.65895617",
"0.6554104",
"0.65475094",
"0.6519284",
"0.6519284",
"0.6505222... | 0.0 | -1 |
Lookup storage class for a given options key | def lookup_storage(key)
{ memory: Storage::Memory, redis: Storage::Redis }[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_for_key(klass, key_name)\n DoesKeyValue.log(\"State: Querying options_for_key for class:#{klass.to_s} and key:#{key_name}\")\n key_def = (@keys[klass.to_s] || Array.new).find{|x| x[:name]==key_name.to_sym} || {}\n opts = key_def[:options]\n end",
"def find(key)\n new(key: key, ... | [
"0.63969314",
"0.621456",
"0.61016005",
"0.60994947",
"0.5915228",
"0.5910758",
"0.58958244",
"0.5893286",
"0.5882253",
"0.58746964",
"0.5823028",
"0.58201146",
"0.57835674",
"0.5744583",
"0.5729365",
"0.5724295",
"0.56828845",
"0.5619652",
"0.5593931",
"0.557526",
"0.5558869... | 0.7013423 | 0 |
The code should then output the number of times words are used. Example: If the words 'hi hi Hi hello 1 1' are input, the result should be: hi 2 Hi 1 hello 1 1 2 Test your solution by running 12_count_words | def count_words
array = []
hash = Hash.new(0)
input = gets.chomp
input.downcase!
array = input.split
array.each do |word|
hash[word] += 1
end
hash.each do |a,b|
puts "#{a} #{b}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_count(text)\n\tnew_text = text.split(\" \") #-->Use text.split to turn text into an array that breaks(splits) at each space.\n\t\n \tcounter = Hash.new(0) #-->Next create an empty hash for your results with count = Hash.new (0)\n\n \tnew_text.each {|word| counter[word] += 1} #-->Use a method that will tak... | [
"0.8201406",
"0.81520027",
"0.8064122",
"0.7935687",
"0.791195",
"0.7898201",
"0.78937227",
"0.7777258",
"0.77400357",
"0.7731667",
"0.7726287",
"0.771748",
"0.7697728",
"0.7670306",
"0.7669182",
"0.7657329",
"0.7656496",
"0.765543",
"0.76536214",
"0.7618576",
"0.76081055",
... | 0.7475898 | 47 |
=> "fiiiissshhhhhh" Sluggish Octo | def find_fish_lengths_1
longest = false
(0...Fish.length - 1).each do |i|
(0..Fish.length - 1).each do |i2|
Fish[i] = first_fish
Fish[i2] = next_fish
longest = Fish[i] if Fish[i].length > fish[i2].length
end
end
longest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obfuscate(s)\n\t\ts.tr(\"A-Ma-mN-Zn-z\",\"N-Zn-zA-Ma-m\")\n\tend",
"def smash(string)\n\tstring.gsub(/[^a-z]/i, '').chars.join ' '\nend",
"def croon(str)\n str.split('').join('-')\nend",
"def encode(string)\n string.split(' ').map do |word|\n word.chars.map { |char| MORSE[char] }.join('|')\n end.jo... | [
"0.6728253",
"0.6298912",
"0.6245189",
"0.6228383",
"0.62099504",
"0.6207818",
"0.6179081",
"0.61729705",
"0.61448526",
"0.61319184",
"0.6108028",
"0.6107043",
"0.6101838",
"0.60963017",
"0.60921645",
"0.60765827",
"0.60743266",
"0.60643315",
"0.60643315",
"0.60471946",
"0.60... | 0.0 | -1 |
Returns true if the system needs a reboot or is expected to reboot Note that we will silently miss any other platformspecific reboot notices besides Windows+Ubuntu. | def reboot_pending?
# don't break when used as a mixin in contexts without #node (e.g. specs).
if respond_to?(:node, true) && node.run_context.reboot_requested?
true
elsif platform?("windows")
# PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that canno... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reboot?\n !!@reboot\n end",
"def booted?\n IO.popen([\"systemctl\", \"is-system-running\"], &:read).chomp != \"offline\"\n end",
"def rebootable?\n return ((! self.phone_model.reboot_request_path.blank?) && (! self.ip_address.blank?))\n end",
"def rebootable?\n\t\treturn (\n\t\t\t(! s... | [
"0.8150368",
"0.7109402",
"0.68908954",
"0.6845607",
"0.6690215",
"0.6649649",
"0.65636176",
"0.6428496",
"0.6424352",
"0.6396949",
"0.63483363",
"0.6281973",
"0.6275097",
"0.62705183",
"0.6260348",
"0.6219535",
"0.6199073",
"0.6090886",
"0.60894275",
"0.60894275",
"0.606515"... | 0.7500692 | 1 |
method to check users first | def get_repos
if current_user.nil?
@repos = Repo.where(:user_id => nil)
else
@repos = current_user.repos
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check\n api.get_user\n end",
"def check_init\n\t\tu = User.find_by(jive_id: params[:user])\n\t\tif u and u.jive_id > 0\n\t\t\trespond({ status: 0, message: \"User exists\", user: u, client: u.client })\n\t\telsif u\n\t\t\tif u.jive_id > 0\n\t\t\t\trespond({ status: 1, error: \"User is not in DB.\" })... | [
"0.74737084",
"0.7144118",
"0.6981033",
"0.69686687",
"0.6930527",
"0.6929419",
"0.69018894",
"0.68967444",
"0.6889641",
"0.6842895",
"0.6815142",
"0.67737615",
"0.6733749",
"0.6717444",
"0.66556",
"0.66526216",
"0.6645576",
"0.66378266",
"0.6631399",
"0.66022944",
"0.6601779... | 0.0 | -1 |
GET /passwords/1 GET /passwords/1.xml | def show
@password = Password.find(params[:id])
@p_access = PasswordAccess.new(:password_id => @password.id, :accessable_id => current_user.id, :accessed_at => DateTime.now, :action => "Viewed" )
@p_access.save
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def new\n @password = Password.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @password }\n end\n end",
"def password\n respond_to do |format|\n format.h... | [
"0.6404301",
"0.6097045",
"0.5989257",
"0.5977957",
"0.5912757",
"0.5910776",
"0.58987737",
"0.5891278",
"0.58150804",
"0.5732096",
"0.5613698",
"0.54896134",
"0.54734707",
"0.5465326",
"0.5449223",
"0.5439373",
"0.5436181",
"0.5404465",
"0.54002494",
"0.53792757",
"0.5350510... | 0.53041553 | 23 |
GET /passwords/new GET /passwords/new.xml | def new
@password = Password.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @password }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def create\n @password = Password.new(params[:password])\n\n respond_to do |format|\n if @password.save\n flash[:notice] = 'Password was successfully creat... | [
"0.63894254",
"0.6375709",
"0.62597334",
"0.62486917",
"0.62158316",
"0.610603",
"0.60975397",
"0.6067552",
"0.605343",
"0.60152525",
"0.59730095",
"0.59646934",
"0.59501183",
"0.5931783",
"0.5927788",
"0.5913241",
"0.59007305",
"0.589568",
"0.58935827",
"0.5882246",
"0.58764... | 0.74518025 | 0 |
POST /passwords POST /passwords.xml | def create
@password = Password.new(params[:password])
respond_to do |format|
if @password.save
flash[:notice] = 'Password was successfully created.'
format.html { redirect_to(passwords_path) }
format.xml { render :xml => @password, :status => :created, :location => @password }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_new_password(name)\n values = {\n name: name\n }\n @client.make_request :post,\n auth_path('request_new_password'),\n values\n end",
"def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end",
"def ... | [
"0.6068599",
"0.60035115",
"0.59628624",
"0.59448034",
"0.5895309",
"0.58103323",
"0.5681038",
"0.56606483",
"0.5549036",
"0.5524086",
"0.55170894",
"0.5500321",
"0.5473855",
"0.54644096",
"0.54545057",
"0.5451959",
"0.5450218",
"0.54493296",
"0.5446402",
"0.54262924",
"0.539... | 0.6287117 | 0 |
PUT /passwords/1 PUT /passwords/1.xml | def update
@password = Password.find(params[:id])
respond_to do |format|
if @password.update_attributes(params[:password])
@p_access = PasswordAccess.new(:password_id => @password.id, :accessable_id => current_user.id, :accessed_at => DateTime.now, :action => "Updated" )
@p_access.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#... | [
"0.673721",
"0.66173697",
"0.66173697",
"0.62297577",
"0.62297577",
"0.61173165",
"0.5973855",
"0.5920471",
"0.5888723",
"0.5866186",
"0.5842179",
"0.5840315",
"0.5798947",
"0.5785435",
"0.5785435",
"0.5785435",
"0.5785435",
"0.5785435",
"0.5785435",
"0.5785435",
"0.57502383"... | 0.0 | -1 |
DELETE /passwords/1 DELETE /passwords/1.xml | def destroy
@password = Password.find(params[:id])
@password.destroy
respond_to do |format|
format.html { redirect_to(passwords_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @password.destroy\n respond_to do |format|\n format.html { redirect_to passwords_url }\n format.json { head :no_content }\n end\n end",
"def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) ... | [
"0.6295106",
"0.6156355",
"0.6050771",
"0.60501003",
"0.5976177",
"0.59415627",
"0.59317946",
"0.59114647",
"0.588971",
"0.5825659",
"0.5807702",
"0.58007574",
"0.57900715",
"0.5788657",
"0.57840097",
"0.5777547",
"0.5772481",
"0.576012",
"0.573782",
"0.57361627",
"0.57289445... | 0.67820287 | 0 |
Just word difference between the first and second half of a word Not really anagram | def word_diff
return -1 unless (@word.size % 2 == 0)
# initialize a hash with 26 lowercase alphabet character and set count for 0
word_hash = ('a'..'z').inject({}) {|h,c| h[c] = 0; h}
# Increment count for first word
len = @word.size / 2
@word[0..len-1].split("").each {|c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def second_anagram?(str_1, str_2)\n return false if str_1.length != str_2.length \n word_1 = str_1.chars\n word_2 = str_2.chars\n word_1.each_with_index do |char, idx| #\n idx_2 = word_2.find_index(char) \n if !idx_2.nil? #\n word_2.delete_at(idx_2) #m\n end\n end\n ... | [
"0.7132473",
"0.7126409",
"0.70953304",
"0.7094452",
"0.70440483",
"0.7004377",
"0.6986297",
"0.6976105",
"0.6944199",
"0.6922921",
"0.692022",
"0.6911876",
"0.6889321",
"0.68606746",
"0.6853448",
"0.6844758",
"0.68446684",
"0.68432665",
"0.6838505",
"0.6834373",
"0.68224996"... | 0.71271855 | 1 |
Register the known input types for such a processor. | def _RegisterInputTypes
@knownInputClasses.push(Rokuby::ProjectDescription)
@knownInputClasses.push(Rokuby::ProjectConfiguration)
@knownInputClasses.push(Rokuby::ProjectInstance)
@knownInputClasses.push(Rokuby::VsProjectDescription)
@knownInputClasses.push(Rokuby::VsProjectConfiguration)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _RegisterInputTypes\n @knownInputClasses.push(Rokuby::ProjectDescription)\n @knownInputClasses.push(Rokuby::ProjectConfiguration)\n @knownInputClasses.push(Rokuby::ProjectInstance)\n @knownInputClasses.push(Rokuby::GppProjectDescription)\n @knownInputClasses.push(Rokuby::GppProjectConf... | [
"0.7248186",
"0.70079464",
"0.61349016",
"0.608289",
"0.60565305",
"0.6026795",
"0.59526396",
"0.5814985",
"0.57171327",
"0.5573388",
"0.5551062",
"0.55263644",
"0.5521432",
"0.5451655",
"0.5423894",
"0.5418293",
"0.53842056",
"0.537881",
"0.5364725",
"0.5359885",
"0.53386736... | 0.72125626 | 1 |
Sort the processor inputs by their class type. | def _SortInputs
@inputs.each() do |input|
if(input.is_a?(Rokuby::ProjectInstance))
@projectInstance = input
elsif(input.is_a?(Rokuby::ProjectDescription))
@projectDescription = input
elsif(input.is_a?(Rokuby::ProjectConfiguration))
@projectConfigurations.push(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _SortInputs()\n @inputs.each() do |input|\n if(input.is_a?(Rokuby::ProjectInstance))\n @projectInstance = input\n elsif(input.is_a?(Rokuby::ProjectDescription))\n @projectDescription = input\n elsif(input.is_a?(Rokuby::ProjectConfiguration))\n @projectConfig... | [
"0.6628803",
"0.64709336",
"0.6179869",
"0.6051488",
"0.5699299",
"0.5618864",
"0.5580779",
"0.5507297",
"0.5507297",
"0.5502321",
"0.5485752",
"0.545048",
"0.5422761",
"0.54021055",
"0.53812546",
"0.53680146",
"0.5360166",
"0.5341489",
"0.531298",
"0.52939904",
"0.5290155",
... | 0.64605355 | 2 |
Time in years between BeginContract and Period.end | def years_of_service(period=nil)
# TODO: need a real general purpose date diff by year
# function since this is likely needed in multiple places.
return 0 if contract_start.nil?
period = Period.current if period.nil?
if (period.finish > contract_start)
tmp_date = period.finish
count = 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def years_count\n ((@end_date - @start_date).to_f / 365).to_f.round(1)\n end",
"def end_year\n Time.now.year - 90\n end",
"def get_begin_date\n get_end_date.prev_year\n end",
"def years ; Duration[self * 365 * 86400, :years] ; end",
"def calc_years_till\n (calc_months_till / 12.00).round(2... | [
"0.70306045",
"0.6943798",
"0.68555677",
"0.6761447",
"0.6695329",
"0.6685416",
"0.6632617",
"0.65798104",
"0.65458673",
"0.6501599",
"0.64775896",
"0.64306146",
"0.64249253",
"0.64143413",
"0.6328918",
"0.62815076",
"0.62363416",
"0.6224437",
"0.62092423",
"0.61848634",
"0.6... | 0.6997837 | 1 |
Find out average number of hours per month based on the number of hours expected to work per day | def hours_per_month
((hours_day * days_week_to_i()) * WEEKS_IN_YEAR ).fdiv(MONTHS_IN_YEAR)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_per_month(ary_work)\n nary = ary_work.group_by{ |t| \n t[:date] \n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[:time] \n }\n }.to_a.group_by { |e|\n e[0][0..6]\n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n ... | [
"0.68058556",
"0.65134025",
"0.64575714",
"0.64242923",
"0.6370657",
"0.62075764",
"0.60790074",
"0.60242295",
"0.6009189",
"0.5961018",
"0.59533054",
"0.5938097",
"0.59376955",
"0.5915987",
"0.5885641",
"0.5884477",
"0.5861767",
"0.5859352",
"0.5825722",
"0.5796761",
"0.5782... | 0.7283312 | 0 |
This has `floor()` since it is going into an integer field, and comparing for tests is easier this way. | def union_dues_amount
if (uniondues == true)
return ( find_base_wage() * SystemVariable.value(:union_dues) ).floor
else
return 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def floor() end",
"def int_if_whole\n whole? ? floor : self\n end",
"def floor()\n #This is a stub, used for indexing\n end",
"def is_i?\n self.to_f == self.to_f.floor\n end",
"def floor\n round :floor\n end",
"def get_real_floor(n)\n n <= 0 ? n : (n > 13 ? n - 2 : n - 1)\n... | [
"0.7255528",
"0.72333413",
"0.7035788",
"0.69273317",
"0.68750656",
"0.67283434",
"0.66177654",
"0.65688676",
"0.64811516",
"0.6477454",
"0.64462936",
"0.63731426",
"0.62181544",
"0.6154802",
"0.61179996",
"0.61144155",
"0.60919446",
"0.59918034",
"0.59846103",
"0.59532154",
... | 0.0 | -1 |
Write the given ast to a string and returns it | def to_s(ast)
@file = ''
process(ast)
@file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ast; end",
"def ast; end",
"def inspect\n self.ast.to_s\n end",
"def to_s\n PgQuery::Deparse.from ast\n end",
"def inspect; to_ast.inspect end",
"def dump_ast\n print_ast(@top_node, \"\")\n puts \"\"\n end",
"def to_s\n StringIO.open do |buffer| # FIXME in RDF::Statement\n ... | [
"0.6575975",
"0.6575975",
"0.65392905",
"0.65284336",
"0.6398587",
"0.6313835",
"0.629045",
"0.60831267",
"0.5995759",
"0.5972939",
"0.5971942",
"0.5971942",
"0.5916045",
"0.5868838",
"0.5868838",
"0.5849987",
"0.58491004",
"0.5847534",
"0.5841547",
"0.5839539",
"0.58279616",... | 0.7896145 | 0 |
allowed controllers and actions | def skip(controllers,actions)
@authorize_actions ||= {}
Array(controllers).each do |controller|
Array(actions).each do |action|
@authorize_actions [[controller.to_s,action.to_s]] = true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_controllers\n permissions.map{|permission| self.class.controller_name_from_permission(permission) }.compact\n end",
"def allow_all_actions(path)\n @allowed << { :controller => recognize_path(path)[:controller] }\n end",
"def allowed?\n true\n # AccessControl.allowed_contro... | [
"0.7380942",
"0.73360515",
"0.73083174",
"0.7238769",
"0.72176844",
"0.7095589",
"0.70884776",
"0.7086159",
"0.6982381",
"0.6916708",
"0.68623656",
"0.6855861",
"0.6779847",
"0.67345893",
"0.6712619",
"0.6700781",
"0.66937363",
"0.6676369",
"0.66665",
"0.66665",
"0.6655508",
... | 0.0 | -1 |
check actions against the data base | def authorized? (controller, action, resource = nil)
#only check if user has controller name present in database access array
if resource.nil && @authorized_actions[[controller.to_s,action.to_s]]
true
elsif has_rights_to?(controller)
evaluate?(controller, action, resource... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def check\n \n end",
"def check\n \n end",
"def checks; end",
"def available_action?(action_name); end",
"def determine_valid_act... | [
"0.64534366",
"0.6344579",
"0.6344579",
"0.62443626",
"0.62368023",
"0.62218964",
"0.61807346",
"0.6115768",
"0.60882264",
"0.607044",
"0.6030288",
"0.6017284",
"0.5983714",
"0.5963534",
"0.59585375",
"0.5907738",
"0.58368945",
"0.58228356",
"0.5811939",
"0.57839996",
"0.5782... | 0.0 | -1 |
GET /admin/account or GET /admin/accounts/.json | def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @account }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts\n get('/accounts')['accounts']\n end",
"def account\n get('account')\n end",
"def get_account\n as_json(get_results('/account'))\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def show\n authorize @accounts\n render json: @account\n end",
"de... | [
"0.7694129",
"0.7624846",
"0.76068217",
"0.7504925",
"0.74661034",
"0.74210656",
"0.72147924",
"0.71090424",
"0.7077803",
"0.7075103",
"0.7048264",
"0.7041467",
"0.7035852",
"0.70063543",
"0.70063543",
"0.70063543",
"0.70063543",
"0.70063543",
"0.69776946",
"0.6957094",
"0.69... | 0.7075133 | 9 |
PUT /admin/account or PUT /admin/account/.json | def update
params[:account].delete(:preferred_smtp_password) if params[:account][:preferred_smtp_password].blank?
respond_to do |format|
if @account.update_attributes(params[:account])
format.html { redirect_to dm_core.admin_account_url, notice: "Account was successfully updated." }
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize @account\n if @account.update(account_params)\n render json: { status: :ok, account: @account }\n else\n render json: {error: @account.errors, status: :unprocessable_entity }\n end\n end",
"def update\n account = current_organization.accounts.find(params[:id])\n ... | [
"0.7248221",
"0.71476406",
"0.70154774",
"0.6825291",
"0.6735371",
"0.67153966",
"0.66732424",
"0.665836",
"0.66364986",
"0.66288435",
"0.65987974",
"0.6589836",
"0.6589836",
"0.65849864",
"0.65678424",
"0.65674514",
"0.65584403",
"0.6557878",
"0.65493107",
"0.65360093",
"0.6... | 0.0 | -1 |
Set some values for the template based on the controller | def template_setup
content_for :content_title, "#{icons('font-user')} Account Management".html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_template\n end",
"def initialize(controller, options={})\n self.controller = controller\n self.template_format = self.class.default_template_format\n options.each_pair do |k,v|\n setter = \"#{k}=\"\n send setter, v if respond_to? setter\n end\n end",
"def index\n... | [
"0.68111324",
"0.6246606",
"0.59277403",
"0.5861301",
"0.580181",
"0.57943416",
"0.5767458",
"0.5760035",
"0.57574594",
"0.5720575",
"0.56712484",
"0.56525373",
"0.5649345",
"0.5640487",
"0.56082976",
"0.5584289",
"0.5584289",
"0.5572911",
"0.55645424",
"0.5550162",
"0.554219... | 0.0 | -1 |
Can't see a good way around this. rubocop:disable Metrics/CyclomaticComplexity | def healthchecks
write_test = Add.write_test
detect_infected = Scan.healthcheck_infected
clean_file = Scan.healthcheck_clean
service_status = if write_test && detect_infected && clean_file
'ok'
else
'failed'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def used?; end",
"def internship_passed; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def anchored; end",
"def internal?; end",
"def missing?; end",
"def implementation; end",
"def implement... | [
"0.693389",
"0.5654701",
"0.5612617",
"0.54977137",
"0.5495642",
"0.5489771",
"0.5489771",
"0.5489771",
"0.5489771",
"0.5483589",
"0.54794693",
"0.5475489",
"0.5468242",
"0.5468242",
"0.54595697",
"0.5430236",
"0.5410674",
"0.5377488",
"0.536832",
"0.5365179",
"0.5345739",
... | 0.0 | -1 |
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes. | def course_params
params.require(:course).permit(:name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) ... | [
"0.7021978",
"0.70116997",
"0.6842978",
"0.6810495",
"0.66930366",
"0.66890526",
"0.6683903",
"0.6669894",
"0.66346925",
"0.6619715",
"0.6616482",
"0.6603774",
"0.6591382",
"0.6575441",
"0.6571492",
"0.65322673",
"0.6526096",
"0.6522984",
"0.65179324",
"0.6509001",
"0.6472105... | 0.0 | -1 |
Search records are never modified | def readonly?; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search; end",
"def search\n\n end",
"def search \n\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n... | [
"0.66568226",
"0.6502651",
"0.64640445",
"0.6407725",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.6340703",
"0.63310254",
"0.6168554",
"0.61671877",
"0.61667126",
"0.60386676",
"0.60257727",
"0.601478... | 0.0 | -1 |
Our view doesn't have primary keys, so we need to be explicit about how to tell different search results apart; without this, we can't use :include to avoid n + 1 query problems | def hash; [searchable_id, searchable_type].hash; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n special_joins = {}\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = VirtualAssignment\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors... | [
"0.61486495",
"0.6118383",
"0.60725015",
"0.6040382",
"0.59594625",
"0.59472096",
"0.59238833",
"0.5909134",
"0.5888448",
"0.5861674",
"0.58246166",
"0.57910496",
"0.5770943",
"0.5770632",
"0.57703865",
"0.57703865",
"0.5757596",
"0.5751043",
"0.5750249",
"0.5706194",
"0.5699... | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return 'This measure is used to calibrate the BRICR baseline model.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def m... | [
"0.7710149",
"0.76145315",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.6987... | 0.6589568 | 73 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
# see if building name contains any template values
# Make argument for template
template = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('template', get_templates, true)
template.setDisplayName('Target Standard')
templ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73748195",
"0.73748195",
"0.73748195",
"0.7087363",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
"0.7008232",
... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
unless runner.validateUserArguments(arguments(model), user_arguments)
return false
end
template = runner.getStringArgumentValue("template",user_arguments)
bldg_type = runner.getS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
GET /district_students/new GET /district_students/new.xml | def new
@student = Student.new
@student.enrollments.build(:end_year => Date.today.year)
respond_to do |format|
format.html # new.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student... | [
"0.73664993",
"0.7276843",
"0.7276843",
"0.7276843",
"0.7276843",
"0.7199165",
"0.7067413",
"0.706249",
"0.7016041",
"0.6978014",
"0.69764805",
"0.69131494",
"0.68865955",
"0.6858879",
"0.68431187",
"0.68430656",
"0.67973715",
"0.6785154",
"0.67848337",
"0.6778102",
"0.677082... | 0.0 | -1 |
POST /district_students POST /district_students.xml | def create
@student = current_district.students.build(params[:student])
respond_to do |format|
if @student.save
flash[:notice] = "#{edit_obj_link(@student)} was successfully created.".html_safe
format.html { redirect_to(index_url_with_page) }
else
format.html { render :actio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @distr... | [
"0.6051043",
"0.6018945",
"0.60114187",
"0.6004729",
"0.5941816",
"0.59369403",
"0.5912328",
"0.5904994",
"0.58519346",
"0.5834753",
"0.5822872",
"0.5810953",
"0.58070296",
"0.57837105",
"0.5771113",
"0.5764161",
"0.5749433",
"0.5728385",
"0.57148653",
"0.5708956",
"0.5707696... | 0.62399054 | 0 |
PUT /district_students/1 PUT /district_students/1.xml | def update
@student = current_district.students.find(params[:id])
respond_to do |format|
if @student.update_attributes(params[:student])
flash[:notice] = "#{edit_obj_link(@student)} was successfully updated.".html_safe
format.html { redirect_to(index_url_with_page) }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:success] = t('student.updated')\n format.html { redirect_to(students_path) }\n format.xml { head :ok }\n else\n flash[:error] = t('def... | [
"0.65999484",
"0.65223414",
"0.6520604",
"0.6509181",
"0.64350975",
"0.64350975",
"0.64350975",
"0.6429083",
"0.6420107",
"0.64090484",
"0.63892967",
"0.63090265",
"0.629261",
"0.6217182",
"0.62101555",
"0.62056375",
"0.62056375",
"0.62040377",
"0.62040377",
"0.62040377",
"0.... | 0.6791229 | 0 |
DELETE /district_students/1 DELETE /district_students/1.xml | def destroy
@student = current_district.students.find(params[:id])
@student.remove_from_district
respond_to do |format|
format.html { redirect_to(index_url_with_page) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |forma... | [
"0.6762636",
"0.6709687",
"0.6709687",
"0.6709687",
"0.6709687",
"0.6709687",
"0.6709687",
"0.66818243",
"0.66232604",
"0.6581956",
"0.6573161",
"0.6565127",
"0.6514531",
"0.6474491",
"0.6458881",
"0.64343095",
"0.6402634",
"0.6394218",
"0.6387375",
"0.6381286",
"0.63591003",... | 0.67999524 | 0 |
POST /votes may or may not have authenticated user | def create
@vote = Vote.new(params[:vote])
if user_signed_in?
@vote.user_id = current_user.id
@vote.save
redirect_to root_path
else
@vote.user_id = nil # explicitly assign nil to prevent injection
@vote.save
redirect_to new_user_registration_path(vote_id: @vote.id, label:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_guest_vote\n user = current_or_guest_user\n if user.first_name == \"guest\"\n if session[:votes].nil?\n session[:votes] = [params[:post_id]]\n else\n session[:votes].push(params[:post_id])\n end\n end\n redirect_to '/posts'\n end",
"def session_vote?\n # over... | [
"0.7148622",
"0.7048222",
"0.7016303",
"0.6973211",
"0.6967024",
"0.6867814",
"0.68396235",
"0.68396235",
"0.67698383",
"0.6768515",
"0.674571",
"0.6739032",
"0.6733443",
"0.67115575",
"0.66917783",
"0.66782993",
"0.6666793",
"0.66431814",
"0.6612388",
"0.66005063",
"0.657738... | 0.6509507 | 26 |
GET /evactivities/1 GET /evactivities/1.xml | def show
@evactivity = Evactivity.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @evactivity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities\n get_call(\"1/activities.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def acti... | [
"0.7351188",
"0.71314645",
"0.71314645",
"0.70323646",
"0.68429315",
"0.68257695",
"0.67919326",
"0.6781799",
"0.67257005",
"0.66720337",
"0.6629581",
"0.65464664",
"0.64966106",
"0.64431894",
"0.6435166",
"0.63953954",
"0.6381463",
"0.63732475",
"0.63700044",
"0.6361985",
"0... | 0.7229046 | 1 |
GET /evactivities/new GET /evactivities/new.xml | def new
@evactivity = Evactivity.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @evactivity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render... | [
"0.7294365",
"0.7220735",
"0.72131544",
"0.72131544",
"0.72131544",
"0.7080277",
"0.7013646",
"0.70056605",
"0.69765407",
"0.6970709",
"0.6862098",
"0.68191683",
"0.67986685",
"0.67943275",
"0.67650473",
"0.6763463",
"0.6763463",
"0.67631245",
"0.67413443",
"0.673997",
"0.673... | 0.7709218 | 0 |
POST /evactivities POST /evactivities.xml | def create
@evactivity = Evactivity.new(params[:evactivity])
respond_to do |format|
if @evactivity.save
flash[:notice] = 'Evactivity was successfully created.'
format.html { redirect_to(@evactivity) }
format.xml { render :xml => @evactivity, :status => :created, :location => @eva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n ... | [
"0.6255689",
"0.6192436",
"0.583568",
"0.57947034",
"0.57549554",
"0.57491106",
"0.5717292",
"0.5702986",
"0.5659169",
"0.5613048",
"0.5596198",
"0.5586512",
"0.5584101",
"0.55823994",
"0.557413",
"0.5558271",
"0.5523054",
"0.55002034",
"0.549403",
"0.5492629",
"0.5470556",
... | 0.67209995 | 0 |
PUT /evactivities/1 PUT /evactivities/1.xml | def update
@evactivity = Evactivity.find(params[:id])
respond_to do |format|
if @evactivity.update_attributes(params[:evactivity])
flash[:notice] = 'Evactivity was successfully updated.'
format.html { redirect_to(@evactivity) }
format.xml { head :ok }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events... | [
"0.6354809",
"0.6318676",
"0.6265058",
"0.6138935",
"0.6098074",
"0.60712934",
"0.6053803",
"0.60464185",
"0.59564817",
"0.59441143",
"0.5938981",
"0.5910238",
"0.59061784",
"0.58936435",
"0.5810343",
"0.57765913",
"0.5744259",
"0.57358086",
"0.57329607",
"0.57205886",
"0.571... | 0.69408417 | 0 |
DELETE /evactivities/1 DELETE /evactivities/1.xml | def destroy
@evactivity = Evactivity.find(params[:id])
@evactivity.destroy
respond_to do |format|
format.html { redirect_to(evactivities_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\... | [
"0.67443377",
"0.67256325",
"0.66694117",
"0.66694117",
"0.66694117",
"0.66694117",
"0.6667618",
"0.6642356",
"0.6613488",
"0.65336293",
"0.6502838",
"0.6445771",
"0.6426351",
"0.63692576",
"0.63592935",
"0.635836",
"0.6348664",
"0.63441026",
"0.6334772",
"0.63179433",
"0.627... | 0.74623233 | 0 |
m ethod that puts "woof!" when called on an instance of Dog | def bark
puts "woof!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run #instance method, you chain it to an instance of a Dog\n # binding.pry\n puts \"#{@name} the #{@breed} is running fast as the wind\"\n end",
"def meow # Define a method that allows any instance of Cat to meow\n puts \"meow!\"\n end",
"def buy_dog(name)\n Dog.new(na... | [
"0.6989789",
"0.68963057",
"0.6743869",
"0.6682192",
"0.6644614",
"0.6644614",
"0.654958",
"0.6546487",
"0.64743114",
"0.6472049",
"0.64384043",
"0.6434797",
"0.64313674",
"0.63718796",
"0.6368267",
"0.63577056",
"0.634488",
"0.634488",
"0.633793",
"0.63212484",
"0.63076377",... | 0.59296244 | 41 |
GET /line_destinations GET /line_destinations.json | def index
@line_destinations = LineDestination.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end",
"def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n ... | [
"0.642937",
"0.6342397",
"0.6016483",
"0.59665376",
"0.5958714",
"0.5948643",
"0.59105057",
"0.59074074",
"0.58959484",
"0.5877479",
"0.58273005",
"0.5752508",
"0.5683408",
"0.56816554",
"0.5662989",
"0.558983",
"0.5580443",
"0.5572349",
"0.5561302",
"0.55530626",
"0.5514585"... | 0.7743551 | 0 |
GET /line_destinations/1 GET /line_destinations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @line_destinations = LineDestination.all\n end",
"def set_line_destination\n @line_destination = LineDestination.find(params[:id])\n end",
"def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataEx... | [
"0.7482887",
"0.6237068",
"0.61015904",
"0.60569936",
"0.5915729",
"0.58515656",
"0.58382905",
"0.5801815",
"0.5801815",
"0.5791896",
"0.5774213",
"0.5772538",
"0.57684726",
"0.5734102",
"0.5708481",
"0.570423",
"0.56997836",
"0.5693602",
"0.5682124",
"0.56441486",
"0.5550258... | 0.0 | -1 |
POST /line_destinations POST /line_destinations.json | def create
destination = Destination.find(params[:destination_id])
@line_destination = @plan.add_destination(destination.id)
respond_to do |format|
if @line_destination.save
format.html { redirect_to @line_destination.plan, notice: 'Line destination was successfully created.' }
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @line_destinations = LineDestination.all\n end",
"def line_destination_params\n params.require(:line_destination).permit(:destination_id, :plan_id)\n end",
"def set_line_destination\n @line_destination = LineDestination.find(params[:id])\n end",
"def create\n @destination =... | [
"0.6639006",
"0.6593108",
"0.6301531",
"0.6178634",
"0.59259605",
"0.5810589",
"0.5743956",
"0.57063353",
"0.56617916",
"0.5513739",
"0.5491601",
"0.54840004",
"0.5476672",
"0.54665875",
"0.54665685",
"0.54612404",
"0.5418316",
"0.5400803",
"0.53866494",
"0.53824914",
"0.5380... | 0.6773432 | 0 |
PATCH/PUT /line_destinations/1 PATCH/PUT /line_destinations/1.json | def update
respond_to do |format|
if @line_destination.update(line_destination_params)
format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' }
format.json { render :show, status: :ok, location: @line_destination }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n if @shipping_line.update_attributes(params[:shipping_line])\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully updated.' }\n format.json { head :no_content }\n ... | [
"0.6438662",
"0.63544863",
"0.6346638",
"0.6315294",
"0.6275322",
"0.6252122",
"0.61914515",
"0.6190539",
"0.6179571",
"0.6137683",
"0.60762715",
"0.60315263",
"0.6000197",
"0.59485865",
"0.59453785",
"0.5937492",
"0.5911243",
"0.5901368",
"0.5887122",
"0.58835125",
"0.588208... | 0.71718687 | 0 |
DELETE /line_destinations/1 DELETE /line_destinations/1.json | def destroy
@line_destination.destroy
respond_to do |format|
format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |... | [
"0.67035",
"0.6682395",
"0.66671354",
"0.65862906",
"0.6562961",
"0.6550406",
"0.65248895",
"0.64999706",
"0.6480687",
"0.64735466",
"0.6408842",
"0.64042133",
"0.64042133",
"0.640356",
"0.64025486",
"0.63977885",
"0.63977885",
"0.63977885",
"0.63977885",
"0.63644946",
"0.635... | 0.72329146 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_line_destination
@line_destination = LineDestination.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def line_destination_params
params.require(:line_destination).permit(:destination_id, :plan_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Checks if a particular block has been defined within the current block scope. Options: [+name+] The name of the block to check | def defined?(name)
!blocks[name].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defined?(name)\n !blocks[name.to_sym].nil?\n end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end",
"def get_block name\n name = name.to_sym\n block = @blocks.find {|b| b.... | [
"0.7929647",
"0.7727793",
"0.7575643",
"0.648453",
"0.6267494",
"0.6252901",
"0.6176375",
"0.61619455",
"0.61015606",
"0.6094068",
"0.58873636",
"0.5861491",
"0.58416367",
"0.578623",
"0.57466495",
"0.57462734",
"0.57136166",
"0.5701837",
"0.5625596",
"0.56244653",
"0.5624341... | 0.79147595 | 1 |
Define a block, unless a block by the same name is already defined. "1", :parameter2 => "2" do |options| %> and Options: [+name+] The name of the block being defined (either a string or a symbol or a Proc) [+options+] The default options for the block definition. Any or all of these options may be overridden by whomeve... | def define(name, options={}, &block)
collection = options.delete(:collection)
if collection
collection.each do |object|
define(call_with_params(name, object, options), options, &block)
end
else
self.define_block_container(name, options, &block)
end
nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n ... | [
"0.79023236",
"0.68490136",
"0.6795098",
"0.6732078",
"0.6394409",
"0.6391756",
"0.63572186",
"0.63399476",
"0.63368434",
"0.6305341",
"0.6289439",
"0.61833805",
"0.615229",
"0.6132293",
"0.6122384",
"0.6120324",
"0.59682924",
"0.5964644",
"0.5927705",
"0.5924114",
"0.5904602... | 0.7043358 | 1 |
Define a block, replacing an existing block by the same name if it is already defined. "1", :parameter2 => "2" do |options| %> and "3", :parameter4 => "4" do |options| %> and Options: [+name+] The name of the block being defined (either a string or a symbol) [+options+] The default options for the block definition. Any... | def replace(name, options={}, &block)
blocks[name] = nil
self.define_block_container(name, options, &block)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n ... | [
"0.79454064",
"0.7353004",
"0.69163525",
"0.6849697",
"0.6494416",
"0.64863276",
"0.6425665",
"0.63501716",
"0.6331145",
"0.6268368",
"0.6224345",
"0.6130625",
"0.6112668",
"0.6084813",
"0.6084784",
"0.6064092",
"0.60525364",
"0.593428",
"0.5914862",
"0.5860374",
"0.5850979",... | 0.7135202 | 2 |
Skip the rendering of a particular block when blocks.render is called for the a particular block name My output Options: [+name+] The name of the block to skip rendering for | def skip(name)
blocks[name] = nil
skipped_blocks[name] = true
self.define_block_container(name) do
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n # return ob_get_clean();\n end",
"def render_parent_block(name, context, blocks = {})\n # ob_start();\n display_parent_block(name, context, blocks)\n ... | [
"0.6153384",
"0.6086669",
"0.6039716",
"0.59651756",
"0.5871876",
"0.5795725",
"0.5795725",
"0.5789088",
"0.5735014",
"0.56427854",
"0.56366086",
"0.5627823",
"0.5627823",
"0.56263053",
"0.5623758",
"0.56109864",
"0.56109864",
"0.56101745",
"0.56096",
"0.56039566",
"0.5590809... | 0.74185246 | 0 |
Add a block to render before another block. This before block will be put into an array so that multiple before blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called. Any options specified to the before block will override any options specified in the bl... | def before(name, options={}, &block)
self.add_block_container_to_list("before_#{name.to_s}", options, &block)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end",
"def before(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"before proc should have an arity of 1 (Array: values)\"\n end \n @options[:before] = block\n... | [
"0.7220903",
"0.71276605",
"0.6682045",
"0.6654923",
"0.6637286",
"0.6603937",
"0.6568894",
"0.64873666",
"0.64247715",
"0.6413482",
"0.6413482",
"0.6394118",
"0.6378209",
"0.6295552",
"0.62211317",
"0.6186277",
"0.60403633",
"0.5953866",
"0.5946286",
"0.5883547",
"0.58593214... | 0.7241095 | 0 |
Add a block to render after another block. This after block will be put into an array so that multiple after blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called. Any options specified to the after block will override any options specified in the block ... | def after(name, options={}, &block)
self.add_block_container_to_list("after_#{name.to_s}", options, &block)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after(&block)\n @blocks << block\n end",
"def render_after_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"after\", *args)\n end",
"def after_each(&block)\n @after_each_blocks << block\n end",
"def after(&block)\n @after << block\n ... | [
"0.7319272",
"0.6946847",
"0.6595663",
"0.65939915",
"0.6538661",
"0.6490435",
"0.6461255",
"0.6358121",
"0.6338884",
"0.6295388",
"0.6295388",
"0.62704086",
"0.62017024",
"0.62017024",
"0.62017024",
"0.62017024",
"0.6073884",
"0.60102373",
"0.6002562",
"0.5883354",
"0.586635... | 0.7211461 | 1 |
Add a block to render around another block. This around block will be put into an array so that multiple around blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called, with the last declared around block being rendered as the outermost code, and the first... | def around(name, options={}, &block)
self.add_block_container_to_list("around_#{name.to_s}", options, &block)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after(&block)\n @blocks << block\n end",
"def render_before_or_after_blocks(name_or_container, before_or_after, *args)\n options = args.extract_options!\n\n block_options = {}\n if (name_or_container.is_a?(Blocks::Container))\n name = name_or_container.name.to_sym\n block... | [
"0.6547473",
"0.6404702",
"0.6208435",
"0.6163087",
"0.6052626",
"0.60484743",
"0.5930488",
"0.59015363",
"0.58985853",
"0.5874048",
"0.58688915",
"0.57699996",
"0.5756182",
"0.5737291",
"0.56953084",
"0.56941867",
"0.5691556",
"0.5662967",
"0.5647241",
"0.5642331",
"0.56421"... | 0.68984526 | 0 |
Return a unique name for an anonymously defined block (i.e. a block that has not been given a name) | def anonymous_block_name
self.anonymous_block_number += 1
"block_#{anonymous_block_number}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_name \n to_sym\n end",
"def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n ... | [
"0.7266279",
"0.711747",
"0.6894549",
"0.6894549",
"0.6743855",
"0.64937365",
"0.64157474",
"0.62972915",
"0.6205214",
"0.6133405",
"0.6133405",
"0.6036275",
"0.60225195",
"0.58905625",
"0.5851871",
"0.5851871",
"0.58397675",
"0.58160347",
"0.58117604",
"0.57431936",
"0.57295... | 0.83050674 | 0 |
Render a block, first trying to find a previously defined block with the same name | def render_block(name_or_container, *args, &block)
buffer = ActiveSupport::SafeBuffer.new
name, block_render_options = extract_block_name_and_options(name_or_container)
block_definition_options = {}
if blocks[name]
block_container = blocks[name]
block_definition_options = block... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_parent_block(name, context, blocks = {})\n # ob_start();\n display_parent_block(name, context, blocks)\n # return ob_get_clean();\n end",
"def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n ... | [
"0.67557204",
"0.6693612",
"0.66921425",
"0.6538668",
"0.6538668",
"0.6502267",
"0.6465307",
"0.641846",
"0.6403105",
"0.6339931",
"0.6322441",
"0.6174666",
"0.61651057",
"0.6150046",
"0.61497",
"0.61346275",
"0.605528",
"0.60551906",
"0.60551906",
"0.6010276",
"0.5993535",
... | 0.64739263 | 6 |
Render all the before blocks for a partial block | def render_before_blocks(name_or_container, *args)
render_before_or_after_blocks(name_or_container, "before", *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_block\n end",
"def pre_block\n end",
"def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end",
"def before_each(&block)\n @before_each_blocks << block\n end",
"def _Gvn_before(&block)\n _Gvn_before_blocks << block\n end",
"def ren... | [
"0.6681968",
"0.6681968",
"0.6535729",
"0.628239",
"0.6227567",
"0.6167728",
"0.6129468",
"0.6096138",
"0.6042019",
"0.6012528",
"0.5984095",
"0.5890831",
"0.5873981",
"0.584487",
"0.5820287",
"0.57442856",
"0.5726144",
"0.56941485",
"0.56887496",
"0.5676654",
"0.56675607",
... | 0.7268148 | 0 |
Render all the after blocks for a partial block | def render_after_blocks(name_or_container, *args)
render_before_or_after_blocks(name_or_container, "after", *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_render(&block)\n @after_render_block = block\n end",
"def after(&block)\n @blocks << block\n end",
"def after_each(&block)\n @after_each_blocks << block\n end",
"def after(&block)\n @after << block\n end",
"def after_block_boundary?; end",
"def render_before_or_a... | [
"0.68821067",
"0.6662712",
"0.6319804",
"0.6187833",
"0.6153579",
"0.6002141",
"0.5995399",
"0.59916854",
"0.59323484",
"0.59323484",
"0.5906733",
"0.5799515",
"0.5763784",
"0.5727507",
"0.57124907",
"0.56906766",
"0.5674781",
"0.56679696",
"0.565864",
"0.56512755",
"0.564593... | 0.7496595 | 0 |
Utility method to render either the before or after blocks for a partial block | def render_before_or_after_blocks(name_or_container, before_or_after, *args)
options = args.extract_options!
block_options = {}
if (name_or_container.is_a?(Blocks::Container))
name = name_or_container.name.to_sym
block_options = name_or_container.options
else
name = name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_partial(context, options, &block); end",
"def render_before_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"before\", *args)\n end",
"def render_partial(*ignore_args); end",
"def render_after_blocks(name_or_container, *args)\n render_before_or_af... | [
"0.69064844",
"0.66394305",
"0.63921726",
"0.6139292",
"0.6085669",
"0.6035155",
"0.5979546",
"0.59664035",
"0.58847994",
"0.58707213",
"0.58612597",
"0.58612597",
"0.5859913",
"0.58227104",
"0.58227104",
"0.581345",
"0.581345",
"0.581345",
"0.581345",
"0.57896",
"0.5780207",... | 0.7122868 | 0 |
Build a Blocks::Container object given the passed in arguments | def build_block_container(*args, &block)
options = args.extract_options!
anonymous = false
if args.first
name = args.shift
else
name = self.anonymous_block_name
anonymous = true
end
block_container = Blocks::Container.new
block_container.name = name.to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_block_container(*args, &block)\n block_container = self.build_block_container(*args, &block)\n blocks[block_container.name] = block_container if blocks[block_container.name].nil? && block_given?\n block_container\n end",
"def build(*args)\n # create the container they ask for ... | [
"0.7367841",
"0.7033346",
"0.6462313",
"0.6360746",
"0.633526",
"0.62938404",
"0.61372554",
"0.61268455",
"0.59123755",
"0.5905156",
"0.5814367",
"0.5787508",
"0.57627004",
"0.5741977",
"0.5713474",
"0.5704639",
"0.5678478",
"0.5651259",
"0.5611382",
"0.55782515",
"0.55489695... | 0.8039163 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.