query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
TODO(jon): Make the search form fill better than openstruct impl. Temporarily preserve most search form values. This will break if someone wants to search for "20140905" as a string :( | def set_q_for_form_values
if params[:q]
q_hash = params[:q].dup
q_hash.each do |key, value|
if value.to_s.match(/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/)
q_hash[key] = DateTime.parse(value)
end
end
@q = OpenStruct.new(q_hash)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_search_for_value(inv_keys)\n\t\tregx_search = Regexp.new('[12]\\d\\d\\d')\n\t\tsearch_info = {\n\t\t\tsearch_keys: ['title','name','chapters'],\n\t\t\ttypes: inv_keys\n\t\t}\n\t\tfound_data = @helpers.make_hohoa\n\t\treturned_hash = nil\n\t\tcounter = 0\n\t\tnames_with_years = nil\t\n\n\t\treturn counter,found_data,regx_search,search_info,names_with_years\n\tend",
"def parse_search; end",
"def build_date_from_params(params, search_object, search_date)\n\n anio = params[search_object][search_date + \"(1i)\"]\n mes = params[search_object][search_date + \"(2i)\"]\n dia = params[search_object][search_date + \"(3i)\"]\t\t\n\n\t\treturn Date.new(anio.to_i, mes.to_i, dia.to_i)\n\n\tend",
"def search_params_post_1984(d)\n # http://pqasb.pqarchiver.com/latimes/results.html?st=advanced&QryTxt=*&type=current&sortby=CHRON&datetype=6&frommonth=03&fromday=06&fromyear=1989&tomonth=03&today=06&toyear=1989&By=&Title=&at_curr=ALL&Sect=ALL\n add_default_params( d, {\n :QryTxt=>\"*\",\n :type=>\"current\",\n :at_curr=>\"ALL\",\n :Sect=>\"ALL\"\n })\n end",
"def searchable_date(attribute)\n searchable do\n time attribute\n string attribute\n end\n end",
"def search_fields(val)\n raise \"search_fields requires a String.\" unless val.is_a? String\n @searchFields = val\n self\n end",
"def search_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def search_params_post_1986(d)\n # http://pqasb.pqarchiver.com/washingtonpost/results.html?st=advanced&uid=&MAC=50a23aa1f3f5c6104e90e36051420d61&QryTxt=*&sortby=RELEVANCE&datetype=6&frommonth=03&fromday=06&fromyear=1989&tomonth=12&today=03&toyear=2011&By=&Title=&Sect=ALL\n add_default_params( d, {\n :uid=>\"\",\n :MAC=>\"50a23aa1f3f5c6104e90e36051420d61\",\n :QryTxt=>\"*\",\n :Sect=>\"ALL\",\n })\n end",
"def find_date(field008)\n return unless field008 && field008.length >= 11\n\n date_type = date_type(field008)\n return if date_type.nil?\n\n date1_str, date2_str = dates_str(field008)\n\n case date_type\n when 'p', 'r'\n # Reissue/reprint/re-recording, etc.\n resolve_date date_to_resolve(date1_str, date2_str)\n when 'q'\n # Questionable\n resolve_range(date1_str, date2_str)\n else\n # Default case, just resolve the first date.\n resolve_date date1_str\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 test_struct_types_with_same_name\n deploy_app(SearchApp.new.\n sd(selfdir + 'schemas/foo.sd').\n sd(selfdir + 'schemas/foobar.sd').\n sd(selfdir + 'schemas/mystruct.sd').\n sd(selfdir + 'schemas/bar.sd'))\n start\n feed(:file => selfdir + 'docs.json')\n vespa.adminserver.execute('vespa-visit')\n assert_hitcount('query=sddocname:foo', 1)\n assert_hitcount('query=sddocname:mystruct', 1)\n assert_hitcount('query=sddocname:bar', 1)\n assert_hitcount('query=sddocname:foobar', 1)\n assert_hitcount('query=f2.age:20', 1)\n assert_hitcount('query=f2.age:30', 1)\n assert_hitcount('query=f2.name:infoo', 1)\n assert_hitcount('query=f2.name:\"in foo too\"', 1)\n assert_hitcount('query=f4:my', 1)\n assert_hitcount('query=f5.key:one', 1)\n assert_hitcount('query=f5.key:two', 1)\n\n assert_hitcount('/search/?yql=select * from sources * where f5.value.something contains \"some thing\"', 1)\n assert_hitcount('/search/?yql=select * from sources * where f5.value.something contains \"the Answer to Everything\"', 1)\n assert_hitcount('/search/?yql=select * from sources * where f5.value.number = 90', 1)\n assert_hitcount('/search/?yql=select * from sources * where f5.value.number = 42', 1)\n\n assert_hitcount('query=f5.value.number:90', 1)\n assert_hitcount('query=f5.value.number:42', 1)\n assert_hitcount('query=f5.value.something:\"some thing\"', 1)\n assert_hitcount('query=f5.value.something:\"the answer to everything\"', 1)\n end",
"def search_field(object_name, method, options = T.unsafe(nil)); end",
"def search_params\r\n\t new_date = Date.today # Default value\r\n\t if(params[:chosen_date])\r\n\t choice = params[:chosen_date]\r\n\t new_date = Date.new(choice[\"date(1i)\"].to_i, choice[\"date(2i)\"].to_i, 1)\r\n\t end\r\n\t \r\n\t { title_keywords: params[:title_keywords], chosen_date: new_date, free_food_select: params[:free_food_select] } \r\n\tend",
"def from_search_document(document)\n place = PublicEarth::Db::Place.new\n\n place.id = document.delete('id')\n place.slug = document.delete('slug') || ''\n place.category = PublicEarth::Db::Category.new :id => document.delete('category_id'), \n :name => document.delete('category').first, :slug => document.delete('category_slug')\n place.tags = document.delete('keyword').map{ |tag| PublicEarth::Db::Tag.create(tag)} rescue []\n place.name = document['attribute_text_name'] || document['name']\n place.rating = document['rating']\n place.number_of_ratings = document['number_of_ratings'].to_i || 0\n\n # Search ranking\n place.score = document['score'] \n\n # TODO: Feature comments?!?\n results = []\n \n document.each do |key, value|\n if key =~ /\\Aattr_(?:text|date|int|float)_(.*?)\\Z/\n name = $1\n\n # We skip the comments in here, because we don't want them as attributes on the place.\n unless name =~ /_comments\\Z/\n # Grab the comment, if there is one...\n comment = document[\"#{key}_comments\"]\n \n if value.kind_of? Array\n value.each do |array_value|\n results << {\n 'attribute_language' => 'en',\n 'attribute_definition_name' => name,\n 'attribute_value' => array_value\n # 'attribute_comments' => comment\n }\n end\n else\n results << {\n 'attribute_language' => 'en',\n 'attribute_definition_name' => name,\n 'attribute_value' => value\n # 'attribute_comments' => comment\n }\n end\n end\n \n else\n place.write_attribute(key, value)\n end\n end\n \n place.details = PublicEarth::Db::Details.new(place, nil, nil, results)\n place\n end",
"def search_fields(*args)\n @@search_fields = args.map { |a| a.to_sym }\n end",
"def to_search\n self.class.properties.map do |name, opts|\n next unless opts\n val = instance_variable_get( \"@#{ name }\" )\n next unless val\n val = val.strftime \"%Y-%m-%dT%H:%M:%S\" if val.respond_to? :strftime\n case opts[:search]\n when :prefix\n \"#{ name }:\" + val.to_s\n when :fulltext\n val.to_s\n end\n end.compact.join \"\\n\"\n end",
"def build_date_from_hash(hash_params, search_date)\n\n anio = hash_params[search_date + \"(1i)\"]\n mes = hash_params[search_date + \"(2i)\"]\n dia = hash_params[search_date + \"(3i)\"]\t\t\n\n\t\treturn Date.new(anio.to_i, mes.to_i, dia.to_i)\n\n\tend",
"def advanced_search_legacy_field_mapping\n {\n author: 'search_author',\n title: 'search_title',\n subject: 'subject_terms',\n description: 'search',\n pub_info: 'pub_search',\n number: 'isbn_search'\n }\n end",
"def processValuesV2(keyword, value)\n key_orig = keyword\n comp = \"\"\n\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n keyword = keyword + \"bigger\"\n comp = \"bigger\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n keyword = keyword + \"smaller\"\n comp = \"smaller\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n keyword = keyword + \"min\"\n comp = \"min\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n keyword = keyword + \"max\"\n comp = \"max\"\n end\n\n if key_orig == \"modified_at\" || key_orig == \"created_at\"\n if value =~ /^\\d{4}$/\n keyword += \"year\"\n \n elsif value =~ /^\\d{4}\\-\\d{1,2}$/\n if comp == \"bigger\" || comp == \"max\"\n value += '-31'\n elsif comp == \"\"\n # This is a piece of jenkki-purukumi, When searching for files in a month.\n # This is the first search and from 'value' and 'keyword' will be generated another one\n @conditions.merge!({keyword+'mindate', value+'-01'})\n value += '-31'\n keyword += 'max'\n else\n value += '-01'\n end\n keyword += \"date\"\n # keyword += \"month\"\n elsif value =~ /^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/\n keyword += \"date\"\n elsif QueryController::check_datetime(value)\n puts \"datetime: true\"\n else\n keyword = \"FALSE\"\n end\n end\n\n\n return keyword, value\n end",
"def search_field_def_for_key(key, lens = nil)\n blacklight_config(lens).search_fields[key.to_s]\n end",
"def fields\n search_params.return_fields +\n %w[document_type\n title\n description\n organisation_content_ids\n topic_content_ids\n mainstream_browse_page_content_ids\n popularity\n format\n link\n public_timestamp\n updated_at\n indexable_content]\n end",
"def imported_events\n# ImportedEvent.new.search(summary)\n ImportedEvent.find_by_term_and_date(summary,date)\n end",
"def initialize(open_struct)\n #self.force_encoding 'UTF-8'\n #Encoding.default_external = 'UTF-8'\n @searchwords = open_struct.searchwords\n puts open_struct.searchdir\n @searchdir = open_struct.searchdir\n @is_recursive = open_struct.is_recursive\n end",
"def criterion_list searchable_attr = {}, formats ={}, criteria = {}\n\n searchable_attr.each{|attr|\n criterion_key = attr_2_criterion_sym(attr)\n #operator_key = attr_2_operator(attr)\n if params[criterion_key] then\n if not params[criterion_key].blank? then\n if criterion_key.to_s.ends_with?('_date') || criterion_key.to_s.ends_with?('_at') then\n # This is a bit shakey: duck programming at its \"best\" providing you know ath all date attributes must end with \"_date\"\n #criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?t($DF + \"default\") : t(formats[criterion_key])))\n criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?$DATE_TRANSFER_FORMAT : t(formats[criterion_key])))\n else\n criteria[attr] =params[criterion_key]\n end\n #else\n \n \n end # not blank\n end \n }\n return criteria\n end",
"def search_form objs_type, searches\n\t\t\n\t\tdates = [\"date\",\"created_at\",\"updated_at\"]\n\t\ttimes = [\"depart_time\",\"arrive_time\",\"return_time\"]\n\t\tselections = [\"trip_id\",\"destination_id\"]\n\t\t\n\t\thtml = \"\"\n\t\t\n\t\thtml << '<table><tr><th></th><th></th><th></th></tr>'.html_safe\n\t\t\n\t\tsearches.each do |search|\n\t\t\n\t\t\thtml << '<form accept-charset=\"UTF-8\" action=\"/'.html_safe + objs_type + '\" method=\"get\">'.html_safe\n\t\t\thtml << '<tr><td>'.html_safe\n\t\t\n\t\t\tif dates.include? search\n\t\t\t\thtml << (label_tag(search + \"1\", \"Search for \" + objs_type + \" with \" + search + \" between \")).html_safe\n\t\t\t\thtml << '</td><td>'.html_safe\n\t\t\t\thtml << (date_select(search, \"1\")).html_safe\n\t\t\t\thtml << (label_tag(search + \"2\", \" and \")).html_safe\n\t\t\t\thtml << (date_select(search, \"2\")).html_safe\n\t\t\telse\n\t\t\t\thtml << (label_tag(search, \"Search for \" + objs_type + \" with \" + search + \": \")).html_safe\n\t\t\t\thtml << '</td><td>'.html_safe\n\t\t\t\thtml << (text_field_tag(search)).html_safe\n\t\t\tend\n\t\t\t\n\t\t\thtml << '</td><td>'.html_safe\n\t\t\thtml << (submit_tag(\"Search\")).html_safe\n\t\t\thtml << '</td>'.html_safe\n\t\t\t\n\t\t\thtml << '</tr>'.html_safe\n\t\t\thtml << '</form>'.html_safe\n\t\tend\n\t\t\n\t\thtml << '</table>'.html_safe\n\t\t\n\t\thtml.html_safe\n\tend",
"def metadataCompareDate(type_id, value, tempArray)\n comparison = \"=\"\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n comparison = \">\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n comparison = \"<\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n comparison = \">=\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n comparison = \"<=\"\n \n end\n\n # If value is full datetime, use it as it is\n if QueryController::check_datetime(value)\n datetimeOrDate = \"CONVERT(value, DATETIME)#{comparison}'#{value}'\"\n else\n\n # If searching with year and month\n if value =~ /^\\d{4}\\-\\d{1,2}$/\n # First day of month\n valueFirst = value+'-01'\n \n # Date in this exact month\n if comparison == '='\n datetimeOrDate = \"CONVERT(value, DATE)>='#{valueFirst}' AND CONVERT(value, DATE)<=LAST_DAY('#{valueFirst}')\"\n \n # Date bigger than this month\n elsif comparison == '>'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n\n # Date max this month\n elsif comparison == '<='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n \n # Date smaller than this month\n elsif comparison == '<'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n \n # Date min this month\n elsif comparison == '>='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n end\n \n\n \n # If searching with only year\n elsif value =~ /^\\d{4}$/\n datetimeOrDate = \"YEAR(value)#{comparison}'#{value}'\"\n else\n\n # Check if value_number is date and convert it if needed\n valueNew = QueryController::transform_date(value)\n if valueNew == false\n raise Exception.new(\"Invalid date value\")\n end\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueNew}'\"\n end\n \n \n end\n\n sql = \"SELECT id, value, devfile_id, metadata_type_id\" +\n \" FROM metadatas\" +\n \" WHERE metadata_type_id = #{type_id} AND #{datetimeOrDate}\"\n puts sql\n tmps = Metadata.find_by_sql(sql) \n \n if tmps != nil\n tmps.each do |x|\n tempArray.push(x.devfile_id)\n end\n end\n end",
"def relevant_fields\n @relevant_fields ||= marc.fields(tags + ['880']).map { |field| MarcFieldWrapper.new(field) }.select do |field|\n field.tag != '880' || (\n field.vernacular_matcher? &&\n tags.include?(field.vernacular_matcher_tag) &&\n field.vernacular_matcher_iterator == '00'\n )\n end\n end",
"def search(live=false)\n user = nil\n patient = nil\n date = nil\n\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('users') unless user.nil?\n tables.push('patients') unless patient.nil?\n\n matches = [\"form_instances.doctor_id=:doctor_id AND 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.user_id=users.id') unless user.nil?\n matches.push('form_instances.patient_id=patients.id') unless patient.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, :doctor_id => current_doctor.id}\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 find(any_verb_form)\n end",
"def updated_date\n extractor = MarcExtractor.new(\"907b\", :first => true)\n lambda do |record, acc|\n datestr = extractor.extract(record).first\n begin\n date = Date.strptime(datestr, \"%m-%d-%y\")\n acc << solr_date(date)\n rescue ArgumentError\n yell.debug \"Unable to parse datestr #{datestr}\"\n end\n end\n end",
"def open_search\n @open_search ||= OpenSearch.new(@doc)\n end",
"def open_search\n @open_search ||= OpenSearch.new(@doc)\n end",
"def search(options = {})\n self.date = options[:date] || date\n self.hd = options[:hd] || hd\n response = HTTParty.get(DEFAULT_URL, query: attributes)\n handle_response(response)\n end",
"def to_search_result\n row = self.attributes \n row.delete(\"order_id\") \n row[\"name\"].capitalize! if !row[\"name\"].nil?\n row[\"date_in\"] = OrderEntity.format_pretty_date(self.attributes[\"date_in\"])\n row[\"date_out\"] = OrderEntity.format_pretty_date(self.attributes[\"date_out\"]) \n row\n end",
"def parse_search(q)\n # TODO continue\n end",
"def find_by_function(search_fields)\n \"function(doc) {\n if(doc.ruby_class == '#{self.name}') {\n emit(\n [#{(search_fields).map{|attr| 'doc.' + attr.to_s}.join(', ')}], doc\n );\n }\n }\"\n end",
"def search(live=false)\n restrict('allow only store admins') or begin\n user = nil\n date = nil\n formtype = nil\n\n user = \"%\" + params[:user_field] + \"%\" if !params[:user_field].nil? and params[:user_field].length > 0\n formtype = params[:formtype_field] if !params[:formtype_field].nil? and params[:formtype_field].length > 0\n date = (!params[:Time][:tomorrow].nil? and params[:Time][:tomorrow].length > 0) ? params[:Time][:tomorrow] : Time.tomorrow\n\n tables = ['form_instances']\n tables.push('users') unless user.nil?\n\n matches = [\"form_instances.store_id=:store_id AND 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.data_type=:formtype') unless formtype.nil?\n matches.push('form_instances.user_id=users.id') unless user.nil?\n matches.push('users.friendly_name LIKE :user') unless user.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, :store_id => current_store.id}\n @form_values.merge!({:user_field => params[:user_field]}) unless user.nil?\n @values.merge!({:user => user}) unless user.nil?\n @form_values.merge!({:formtype_field => params[:formtype_field]}) unless formtype.nil?\n @values.merge!({:formtype => formtype}) unless formtype.nil?\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], 20)\n @search_entity = @results.length == 1 ? \"Archived Form\" : \"Archived Forms\"\n render :layout => false\n end\n end",
"def scaffold_search_object(attributes = {})\n object = new\n scaffold_attributes(:search).each{|field| object.send(\"#{field}=\", nil) unless object.send(field) == nil}\n scaffold_set_attributes(object, attributes)\n object\n end",
"def search_params\n params.require(:search).permit(:result_no, :generate_no, :last_result_no, :last_generate_no, :e_no, :sub_no, :main_no, :i_no, :i_name, :value)\n end",
"def search_params_pre_1984(d)\n # http://proquest.umi.com.libproxy.mit.edu/pqdweb?SQ=&DBId=15108&date=ON&onDate=03%2F05%2F1979&beforeDate=&fromDate=&toDate=&FT=1&AT=any&author=&sortby=CHRON&RQT=305&querySyntax=PQ&searchInterface=1&moreOptState=CLOSED&TS=1326228265&h_pubtitle=&h_pmid=&clientId=5482&JSEnabled=1\n add_default_params( d, {\n :DBId=>'15108',\n })\n end",
"def index_date_info(solr_doc)\n dates = temporal_or_created\n\n unless dates.empty?\n dates.each do |date|\n if date.length() == 4\n date += \"-01-01\"\n end\n\n valid_date = Chronic.parse(date)\n unless valid_date.nil?\n last_digit= valid_date.year.to_s[3,1]\n decade_lower = valid_date.year.to_i - last_digit.to_i\n decade_upper = valid_date.year.to_i + (10-last_digit.to_i)\n if decade_upper >= 2020\n decade_upper =\"Present\"\n end\n Solrizer.insert_field(solr_doc, 'year', \"#{decade_lower} to #{decade_upper}\", :facetable)\n end\n end\n end\n end",
"def get_field_from_document(doc)\n return doc.send(field) unless field == :year\n return nil unless doc.year\n\n # Support Y-M-D or Y/M/D dates, even though this field is supposed to\n # be only year values\n parts = doc.year.split(%r{[-/]})\n parts[0]\n end",
"def search_params_pre_1986(d)\n # http://proquest.umi.com.libproxy.mit.edu/pqdweb?SQ=&DBId=9866&date=ON&onDate=03%2F05%2F1979&beforeDate=&fromDate=&toDate=&FT=1&AT=article&author=&sortby=CHRON&RQT=305&querySyntax=PQ&searchInterface=1&moreOptState=OPEN&TS=1326313179&h_pubtitle=&h_pmid=&clientId=5482&JSEnabled=1\n add_default_params( d, {\n :DBId=>'9866',\n })\n end",
"def search_data\n attributes.merge(\n brief_summary: brief_summary && brief_summary.description,\n detailed_description: detailed_description && detailed_description.description,\n browse_condition_mesh_terms: browse_conditions.map(&:mesh_term),\n conditions: conditions.map(&:downcase_name),\n browse_interventions_mesh_terms: browse_interventions.map(&:mesh_term),\n interventions_mesh_terms: interventions.map(&:name).reject(&:nil?),\n interventions: interventions.map(&:description).reject(&:nil?),\n design_outcome_measures: design_outcomes.map(&:measure),\n facility_names: facilities.map(&:name),\n facility_states: facilities.map(&:state),\n facility_cities: facilities.map(&:city),\n facility_countries: facilities.map(&:country),\n locations: facility_coords_hash,\n average_rating: average_rating,\n reviews_count: reviews.count,\n reviews: reviews && reviews.map(&:text),\n sponsors: sponsors && sponsors.map(&:name),\n rating_dimensions: rating_dimensions.keys,\n indexed_at: Time.now.utc,\n study_views_count: study_view_logs.count,\n wiki_page_edits: {\n email: wiki_page_edits.map(&:user).map(&:email),\n created_at: wiki_page_edits.map(&:created_at).map(&:to_time),\n },\n reactions:{\n email: reactions.order(:id).map(&:user).map(&:email),\n kind: reactions.order(:id).map(&:reaction_name)\n\n },\n ).merge(\n average_rating_dimensions,\n ).merge(\n wiki_search_data,\n ).except(\n # https://github.com/clinwiki-org/clinwiki/issues/111\n *NON_INDEX_FIELDS, *NON_INDEX_FIELDS.map(&:to_s)\n )\n end",
"def search_fields(options)\n search_fields = options.delete(:use_key)\n if search_fields\n search_fields = [search_fields] unless search_fields.is_a?(Array)\n search_fields = search_fields.sort_by{|f| f.to_s}\n else\n search_fields = options[:conditions].to_a.sort_by{|f| f.first.to_s}.map(&:first)\n end\n\n # If no seach field fall back on :created_at or :id\n if search_fields.empty?\n if property_names.include?(:created_at)\n search_fields << :created_at\n else\n search_fields << :_id\n end\n end\n\n # Deal with missing underscore automatically\n search_fields << :_id if search_fields.delete(:id)\n search_fields << :_rev if search_fields.delete(:rev)\n search_fields\n end",
"def filter_by_date(term)\n search_data = term.split(DATE_SEARCH_SEPARATOR)\n comparison_date = load_comparison_date(search_data.last)\n return \"[#{comparison_date.xmlschema} TO *]\" if search_data.first == DATE_SEARCH_TERMS.last\n return \"[* TO #{comparison_date.xmlschema}]\" if search_data.first == DATE_SEARCH_TERMS.first\n \"[#{comparison_date.xmlschema.to_s} TO #{(comparison_date + 1.days).xmlschema}]\"\n end",
"def fetch_custom_search_params; end",
"def search_fields\n [ 'name', 'email', 'description' ]\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_type\n 0\n end",
"def search_books(name = nil, author = nil, price_start = nil, price_end = nil, page_size = nil, page_no = nil)\n query_string = <<QUERY_STRING\n {\n books(name: \\\"#{name}\\\", author: \\\"#{author}\\\"#{', priceStart: ' + price_start.to_s if price_start}#{', priceEed: ' + price_end.to_s if price_end}#{', pageSize: ' + page_size.to_s if page_size}#{', pageNo: ' + page_no.to_s if page_no}) {\n id\n name\n author\n price\n }\n }\nQUERY_STRING\nputs query_string.inspect\n # books(name: \\\"\\\", author: \\\"\\\", priceStart: , priceEnd: 33)\n# byebug\n result_hash = GplTestSchema.execute(query_string)\n puts result_hash.inspect\nend",
"def search(field, options)\n\toptions = {duration: 120}.merge(options)\n\tif options.has_key?(:duration)\n\t\tduration = options[:duration]\n\t\toptions.delete(:duration)\n\tend\n\tif options.has_key?(:genre)\n\t\tgenre = options[:genre]\n\t\toptions.delete(:genre)\n\tend\n\tfail \"Invalid options: #{options.keys.join(', ')}\" unless options.empty?\nend",
"def processField033(field, index)\n field.find_all do |subfield|\n \n if subfield.code == \"a\"\n data = subfield.value.gsub(/[^0-9]/, \"\")\n \n if data.length == 4 # a simple 4-digit year\n date = data\n elsif data.length == 5 # this is a year and month, 19781\n date = \"#{data[0..3]}-0#{data[4]}\"\n elsif data.length == 6 # a year with a 2 digit date\n date = \"#{data[0..3]}-#{data[4..5]}\" # 4 digit year, two digit month, one digit day\n elsif data.length == 7\n \t\t date = \"#{data[0..3]}-#{data[4..5]}-0#{data[6]}\"\n \t\telsif data.length == 8 # 4 year, 2 month, 2 day\n \t\t date = \"#{data[0..3]}-#{data[4..5]}-#{data[6..7]}\"\n \t end\n\t \n \t if date\n \t return MARC::DataField.new('980', '', ' ', ['a', date], ['b', \"033\"], ['c', \"1\" ], [ \"d\", \"a\"], [ \"e\", index])\n else \n nil\n end\n end\n \n end\n end",
"def parse_exact_date(string, today)\n tokens = string.split(DELIMITER)\n\n if tokens.length >= 2\n if tokens[0] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[0], tokens[1], tokens[2], today)\n elsif tokens[1] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[1], tokens[0], tokens[2], today)\n end\n end\n end",
"def search(find_val)\n false\n end",
"def advanced_search_options_via_search_form(params, offset, per_page)\n query = {}\n query[:q] = params[:description] || \"\"\n query[:l] = params[:location] || \"\"\n query[:radius] = validate_radius( params )\n query[:postedDate] = validate_fromage( params )\n query[:jtype] = validate_job_type( params )\n query[:startPage] = (offset / per_page)\n query[:limit] = per_page\n query[:sort] = validate_sort( params )\n \n return query\n end",
"def birthdaysearch\n end",
"def setSearchDate\n @searchDate = params[:requestDate];\n\n if @searchDate.to_s.empty?\n @searchDate=Time.now.strftime(\"%d-%m-%Y\");\n end\n end",
"def from_search_document(document)\n place = Atlas::ReadOnly::Place.new\n place.readonly!\n\n place.id = document.delete('id')\n\n place.category = Atlas::Category.new :name => document.delete('category_name'), :slug => document.delete('category_slug')\n place.category.id = document.delete('category_id')\n place.category.readonly!\n \n place.slug = document.delete('slug') || ''\n place.latitude = document.delete('latitude')\n place.longitude = document.delete('longitude')\n place.created_at = Time.parse(document.delete('created_at')) if document['created_at']\n place.updated_at = Time.parse(document.delete('updated_at')) if document['updated_at']\n \n place.route = document.delete('route') if document['route']\n place.region = document.delete('region') if document['region']\n \n place.score = document['score']\n \n if document['contributor_id']\n document.delete('contributor_id').zip(document.delete('contributor')).each do |contrib_params|\n contributor = Atlas::Source.new(:name => contrib_params[1])\n contrib_params[0] =~ /([\\w\\-]+)([\\!\\+])(\\*)?/\n contributor.id = $1\n \n # TODO!!!\n # contributor.publicly_visible = ($2 == \"+\")\n # contributor.creator = ($3 == '*')\n \n contributor.readonly!\n place.contributors << contributor\n end\n end\n \n place.tags = document.delete('keyword').map do |keyword| \n t = Atlas::Tag.new(:name => keyword) \n t.readonly!\n t\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Tag)\n\n place.moods = document.delete('mood').map do |mood| \n m = Atlas::Mood.new(:name => mood) \n m.readonly!\n m\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Mood)\n \n place.features = document.delete('feature').map do |feature| \n f = Atlas::Feature.new(:name => feature) \n f.readonly!\n f\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Feature)\n\n place.average_rating = document.delete('average_rating')\n place.number_of_ratings = document.delete('number_of_ratings').to_i || 0\n \n # TODO!!!\n # place.photo = ...\n \n place_attributes = Atlas::Util::ArrayAssociation.new(self, Atlas::ReadOnly::PlaceAttribute, :place_id)\n document.each do |key, value|\n if key =~ /\\Aattr_(?:text|date|int|float)_(.*?)\\Z/\n name = $1\n pa = Atlas::ReadOnly::PlaceAttribute.new :place => place, :attribute_definition => name\n pa.values = value.map { |v| Atlas::PlaceValue.new :value => v }\n place_attributes << pa\n end\n end\n place.place_attributes = place_attributes\n \n place\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 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 searchable(*attr_names)\r\n attr_names.each do |attr_name|\r\n scope \"search_#{attr_name}\", -> attr_value do\r\n where(attr_name => (attr_name =~ /_on$/ ? parse_date_string(attr_value) : attr_value))\r\n end\r\n end\r\n end",
"def search_params_for_display(search_query)\n display_map = {}\n # name fields\n display_map[\"First Name\"] = search_query.first_name.upcase if search_query.first_name\n display_map[\"Last Name\"] = search_query.last_name.upcase if search_query.last_name\n display_map[\"Exact Match?\"] = \"Yes\" unless search_query.fuzzy\n display_map[\"Exact Match?\"] = \"No\" if search_query.fuzzy\n\n display_map[\"Record Type\"] = RecordType::display_name(search_query.record_type) if search_query.record_type\n display_map[\"Record Type\"] = \"All\" if search_query.record_type.blank?\n\n display_map[\"Start Year\"] = search_query.start_year if search_query.start_year\n display_map[\"End Year\"] = search_query.end_year if search_query.end_year\n\n counties = search_query.chapman_codes.map{|code| ChapmanCode::name_from_code(code)}.join(\" or \")\n display_map[\"Counties\"] = counties if search_query.chapman_codes.size > 1\n display_map[\"County\"] = counties if search_query.chapman_codes.size == 1\n if search_query.places.size > 0\n first_place = search_query.places.first\n place = first_place.place_name\n if search_query.all_radius_places.size > 0\n last_place = search_query.all_radius_places.last\n place <<\n \" (including #{search_query.all_radius_places.size} additional places within\n #{geo_near_distance(first_place,last_place,Place::MeasurementSystem::ENGLISH).round(1)}\n #{Place::MeasurementSystem::system_to_units(Place::MeasurementSystem::ENGLISH)} )\"\n end\n display_map[\"Place\"] = place if search_query.places.size > 0\n end\n display_map[\"Include Family Members\"] = \"Yes\" if search_query.inclusive\n display_map[\"Include Winesses\"] = \"Yes\" if search_query.witness\n display_map\n end",
"def search; end",
"def index\n #@website_details = WebsiteDetail.all\n\n @website_details = WebsiteDetail.search(params[:dateF], params[:agentF])\n \n end",
"def search_record\n return unless @parser < RDoc::Parser::Text\n\n [\n page_name,\n '',\n page_name,\n '',\n path,\n '',\n snippet(@comment),\n ]\n end",
"def search_patient(name,dob)\n exact_match.click\n sleep 2\n date_of_birth.click\n date_of_birth.set(dob)\n sleep 1\n patient_name.set(name)\n search_button.click\n end",
"def search(query); end",
"def search_field_list(lens = nil)\n blacklight_config(lens).search_fields.values\n end",
"def search_data\n updated_date = Arel.sql('DATE(updated_at)')\n activity_dates = activities.group(updated_date).pluck(updated_date)\n {\n type: type,\n name: name,\n tags: all_tag_names,\n user_tags: user_tag_list.map(&:downcase),\n content: search_content,\n organization_id: organization_id,\n user_ids: search_user_ids,\n group_ids: search_group_ids,\n parent_id: parent&.id,\n parent_ids: parent_ids,\n activity_dates: activity_dates.empty? ? nil : activity_dates,\n created_at: created_at,\n updated_at: updated_at,\n archived: archived,\n master_template: master_template,\n collection_type: collection_type,\n activity_count: activities_and_child_activities_count,\n }\n end",
"def open_struct_form\n @application ||= JSON.parse(form, object_class: OpenStruct)\n @application.form = application_type\n @application\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 search_3(field, genre: nil, duration: 120, **rest)\n\tp [field, genre, duration, rest]\nend",
"def set_searchable_fields\n NUMBER_TO_OBJECT_MAP.each do |num, object|\n @searchable_fields[num] = object.column_names - ['id']\n end\n \n @searchable_fields.each do |key, _|\n @searchable_fields[key] += ['_id', 'tags']\n end\n\n @searchable_fields['1'] << 'domain_names'\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 build_date_from_params(field_name, params)\n Date.new(params[\"#{field_name.to_s}(1i)\"].to_i, \n params[\"#{field_name.to_s}(2i)\"].to_i, \n params[\"#{field_name.to_s}(3i)\"].to_i)\n end",
"def convert_date\n params[:search][:date_lte] = params[:search]['date_lte(1i)'].to_s + \"-\" + params[:search]['date_lte(2i)'].to_s + \"-\" + params[:search]['date_lte(3i)'].to_s\n params[:search][:date_gte] = params[:search]['date_gte(1i)'].to_s + \"-\" + params[:search]['date_gte(2i)'].to_s + \"-\" + params[:search]['date_gte(3i)'].to_s\n ['date_lte(1i)', 'date_lte(2i)', 'date_lte(3i)', 'date_gte(1i)', 'date_gte(2i)', 'date_gte(3i)'].each do |d|\n params[:search].delete(d)\n end \n end",
"def search_fields (code = 'all')\n @available_search_criteria.fetch('AvailableSearchFields',{}).select{|item| item['FieldCode'] == code || code == 'all'}\n end",
"def search(query)\n @form['query'] = query\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\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 test_alias_field_construction\n value_ = ::Versionomy.create({:major => 1, :minor => 9, :field2 => 2}, :rubygems)\n assert_equal([1, 9, 2, 0, 0, 0, 0, 0], value_.values_array)\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def search\n\n end",
"def filter_db\n \n start = params[:start]\n finish = params[:finish]\n search_field = params[:search_on][:field]\n sort_field = search_field == \"year_month\" ? \"pe_tenyear\" : search_field\n \n @db = Macroval.find(:all, :conditions => {\"#{search_field}\" => start..finish}, :limit => 24, :order => \"#{sort_field} ASC\")\n \n render :partial => 'macroval', :layout=>false \n end",
"def search_params\n params.require(:search_string)\n end",
"def search_results(form_values)\n results = form_values.submit\n results.search('p.row')\nend",
"def transit_asset_query_builder search_string, search_number \n query = TransamAsset.arel_table[:asset_tag].matches(search_string)\n .or(TransamAsset.arel_table[:other_manufacturer_model].matches(search_string))\n .or(TransamAsset.arel_table[:description].matches(search_string))\n .or(TransamAsset.arel_table[:external_id].matches(search_string))\n .or(TransamAsset.arel_table[:quantity_unit].matches(search_string))\n if search_number\n query = query.or(TransamAsset.arel_table[:manufacture_year].matches(search_number))\n .or(TransamAsset.arel_table[:quantity].matches(search_number))\n .or(TransamAsset.arel_table[:purchase_cost].matches(search_number))\n .or(TransitAsset.arel_table[:pcnt_capital_responsibility].matches(search_number))\n end\n query \n end",
"def search_string\n @search_string\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 query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\n end",
"def value(name)\n description = FIELD_DESCRIPTIONS[name]\n iname_parts = description.split(':', 2)\n iname_parts.insert(0, nil) unless iname_parts.size == 2\n short_iname, long_iname = iname_parts\n \n @values[name] ||= OpenStruct.new(\n name: name,\n indicator_name: long_iname.strip,\n indicator_short_name: short_iname ? short_iname.strip : short_iname,\n description: description,\n contents: nil\n )\n end",
"def scaffold_search(options)\n conditions = []\n search_model = options[:model] || {}\n object = scaffold_search_object(search_model)\n null = options[:null]\n notnull = options[:notnull]\n form_params= {:model=>{}, :null=>[], :notnull=>[], :page=>options[:page]}\n \n limit, offset = nil, nil\n if scaffold_search_pagination_enabled?\n limit = scaffold_search_results_limit + 1\n offset = options[:page] > 1 ? (limit-1)*(options[:page] - 1) : nil\n end\n \n if search_model\n scaffold_attributes(:search).each do |field|\n fsym = field\n field = field.to_s\n next if (null && null.include?(field)) || \\\n (notnull && notnull.include?(field)) || \\\n search_model[field].nil? || search_model[field].empty?\n case scaffold_column_type(fsym)\n when :string, :text\n conditions << scaffold_substring_condition(field, object.send(field))\n else\n conditions << scaffold_equal_condition(field, object.send(field))\n end\n form_params[:model][field] = search_model[field] if scaffold_search_pagination_enabled?\n end\n end\n \n scaffold_attributes(:search).each do |field|\n field = field.to_s\n if null && null.include?(field)\n conditions << scaffold_null_condition(field)\n form_params[:null] << field if scaffold_search_pagination_enabled?\n end\n if notnull && notnull.include?(field)\n conditions << scaffold_notnull_condition(field)\n form_params[:notnull] << field if scaffold_search_pagination_enabled?\n end\n end\n \n conditions << scaffold_session_conditions(options[:session])\n\n objects = scaffold_get_objects(:conditions=>conditions, :include=>scaffold_include(:search), :order=>scaffold_select_order(:search), :limit=>limit, :offset=>offset)\n if scaffold_search_pagination_enabled? && objects.length == scaffold_search_results_limit+1\n form_params[:next_page] = true\n objects.pop\n end\n [form_params, objects]\n end",
"def full_text_search\n @attributes[:full_text_search]\n end",
"def search_params\n params.require(:search).permit(:ticker, :year, :filing )\n end",
"def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end",
"def search_params\n # note: search_fields_attributes are assigned id's when errors occur,\n # so we remove them since no records are in the db for this search:\n unless params['search']['search_fields_attributes'].blank?\n params['search']['search_fields_attributes'].each { |k,v| v.delete('id') }\n end\n # remove single/double quotes from name which cause chart's to fail:\n params[:search][:name] = params[:search][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:search][:name].blank?\n params.require(:search).permit(\n :name, :query, :sources,\n :date_from, :time_from, :date_to, :time_to, :relative_timestamp,\n :host_from, :host_to,\n :search_type, :group_by,\n :query_params,\n search_fields_attributes: [\n :id, :_destroy,\n :and_or, :data_source_id, :data_source_field_id, :match_or_attribute_value\n ]\n )\n end",
"def fs_search_fields\n flds = studied_factors.collect do |fs|\n [fs.measured_item.title,\n fs.substances.collect do |sub|\n #FIXME: this makes the assumption that the synonym.substance appears like a Compound\n sub = sub.substance if sub.is_a?(Synonym)\n [sub.title] |\n (sub.respond_to?(:synonyms) ? sub.synonyms.collect { |syn| syn.title } : []) |\n (sub.respond_to?(:mappings) ? sub.mappings.collect { |mapping| [\"CHEBI:#{mapping.chebi_id}\", mapping.chebi_id, mapping.sabiork_id.to_s, mapping.kegg_id] } : [])\n end\n ]\n end\n flds.flatten.uniq\n end",
"def search_text_fields\n #self.content_columns.select {|c| [:string,:text].include?(c.type) }.map {|c| c.name }\n \n end",
"def default_search_field(lens = nil)\n blacklight_config(lens).default_search_field\n end"
] | [
"0.544088",
"0.5350648",
"0.5284637",
"0.5179762",
"0.5178104",
"0.5176092",
"0.51591474",
"0.51563525",
"0.50769454",
"0.5036817",
"0.50316507",
"0.502441",
"0.50224274",
"0.49930757",
"0.49842748",
"0.49739656",
"0.4939908",
"0.493401",
"0.4921299",
"0.49165082",
"0.49082404",
"0.49078894",
"0.49054044",
"0.48913154",
"0.487608",
"0.48704237",
"0.48655725",
"0.48586193",
"0.48495597",
"0.48449758",
"0.48448417",
"0.48448417",
"0.48431614",
"0.48356166",
"0.48186168",
"0.48107976",
"0.47917497",
"0.47837943",
"0.4781282",
"0.47801298",
"0.47722727",
"0.47681084",
"0.47589666",
"0.4753793",
"0.47415337",
"0.47060633",
"0.4702318",
"0.47003433",
"0.46992078",
"0.46935055",
"0.46911862",
"0.46881625",
"0.4687151",
"0.46836224",
"0.46818823",
"0.46717253",
"0.46667418",
"0.46600324",
"0.46549198",
"0.4651985",
"0.4650987",
"0.4650507",
"0.4643227",
"0.4642678",
"0.46396792",
"0.46338958",
"0.46309668",
"0.46257922",
"0.46255758",
"0.46137628",
"0.45843607",
"0.4579097",
"0.4569896",
"0.45683265",
"0.45654893",
"0.45582843",
"0.45530543",
"0.45519605",
"0.45455033",
"0.45402274",
"0.45388243",
"0.45351446",
"0.45348707",
"0.45347947",
"0.4532557",
"0.45322546",
"0.45318478",
"0.45310274",
"0.4529214",
"0.45289972",
"0.4527891",
"0.45260864",
"0.4524552",
"0.4523723",
"0.4510204",
"0.45034015",
"0.4500079",
"0.4495211",
"0.44951573",
"0.44906592"
] | 0.5078706 | 8 |
TODO(jon): Figure out a better way to do transforms that is easy to extend. | def transform(transforms, key, value)
split = transforms[key].split('#')
klass = eval(split[0])
method = split[1]
return klass.send(method, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transforms; end",
"def transform; end",
"def transform\n end",
"def transformation\n end",
"def transformations; end",
"def transform(transform)\n end",
"def transform(transformation)\n end",
"def apply_custom_transformation\n end",
"def transform!\n raise NotImplementedError, \"You have to implement #transform! in your transformer\"\n end",
"def transform\n # Pass through\n @target.transform\n end",
"def run_and_transform; end",
"def transform!(transform)\n end",
"def transform!(transform)\n end",
"def transform_entities(transform, entities)\n end",
"def transform\n raise 'Implement this method in subclass'\n end",
"def transform_values!; end",
"def transforms\n @transforms ||= []\n end",
"def transform(tree); end",
"def transform(params)\n raise NotImplementedError\n end",
"def transforms( inputs, type )\n return inputs.map {|abs| self.transform( abs )}\n end",
"def transform(t)\n ovwrite_me t.vectormult(self)\n end",
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform\n ]\n end",
"def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, &rendering_code); end",
"def apply_transforms(data)\n data.map do |line|\n line.merge(@transforms.keys.map do |key|\n next if line[key].nil?\n func_list = @transforms[key]\n value = func_list.reduce(line[key]) do |accum, func|\n func.call(accum)\n end\n { key => value}\n end.compact.reduce({}, :merge))\n end\n end",
"def normalize\n Transformation.new(self, self, [lambda{|x|x}])\n end",
"def transform(value, instance); end",
"def transform(source)\n method_name = \"transform_#{source.node_type}\"\n if respond_to?(method_name)\n send method_name, source\n end\n end",
"def transformed(*args)\n raise NoMethodError.new('transformed')\n end",
"def def_transform sym, &block\n sym = \"transform_#{sym}\".to_sym\n if block_given?\n define_method sym,&block\n else\n define_method(sym) {|v|v} # just return self if no transform defined\n end\n module_function sym\n end",
"def def_transform sym, &block\n sym = \"transform_#{sym}\".to_sym\n if block_given?\n define_method sym,&block\n else\n define_method(sym) {|v|v} # just return self if no transform defined\n end\n module_function sym\n end",
"def transform\n self.output = converter.convert(self.content)\n end",
"def transform! &block\n @transformer||=[]\n @transformer << block if block_given?\n self\n end",
"def to_proc\n method(:transform).to_proc\n end",
"def run_transforms(method_binding)\n default( method_binding ) if value.blank?\n\n override( method_binding )\n\n substitute( method_binding )\n\n prefix( method_binding )\n\n postfix( method_binding )\n\n # TODO: - enable clients to register their own transformation methods and call them here\n end",
"def apply_transforms(query, transforms)\n transforms.reduce(query) do |q, transform|\n transform.call(q)\n end\n end",
"def transform\n if rotate\n \"rotate(#{rotate},#{x},#{y})\"\n else\n nil\n end\n end",
"def transform_method(transform = nil)\n @transform ||= transform || :\"to_#{@format}\"\n @transform\n end",
"def transform(from, to)\n configurable_frames(from, to)\n\t needed_transformations.push(NeededTransformation.new(from.to_s, to.to_s))\n\tend",
"def transform\n Transform.new(handle: @handle, apikey: @apikey, security: @security)\n end",
"def transform(value)\n value\n end",
"def transform_and_import\n transform_files\n import\n end",
"def transformation=(transform)\n end",
"def to_proc\n @to_proc ||= method(:transform).to_proc\n end",
"def build_transform_attr(transform = {})\n # TODO: Support matrix, scale, and translate transforms\n \"\" if transform.nil?\n\n transforms = []\n\n unless transform[:rotate].nil?\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].join(\",\")})\"\n end\n transforms << \"rotate(#{transform[:rotate]})\"\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].map{|el| -el}.join(\",\")})\"\n end\n end\n\n transforms.join(\" \")\n end",
"def transform\n options[:transform] || name\n end",
"def transform!\n state = inc_current_state\n print_by_line transform_message if state == 1\n\n self\n end",
"def transformation_for(word)\n @composed_transformations ||= {}\n transformation = @composed_transformations[word]\n if transformation.nil?\n if word.nil? or word.empty?\n transformation = MobiusTransformation::IDENTITY\n elsif word.length == 1\n transformation = @generators[word]\n else\n transformation = transformation_for(word.chop) * @generators[word[-1]]\n end\n @composed_transformations[word] = transformation\n end\n transformation\n end",
"def transform(file, format:); end",
"def normalizer; end",
"def transform(x)\n z = @transformers.values.map { |t| t.transform(x) }\n Numo::NArray.hstack(z)\n end",
"def transform(x)\n x = check_convert_sample_array(x)\n z = x.dup\n\n z[z.ne(0)] = Numo::NMath.log(z[z.ne(0)]) + 1 if @params[:sublinear_tf]\n z *= @idf if @params[:use_idf]\n case @params[:norm]\n when 'l2'\n z = Rumale::Preprocessing::L2Normalizer.new.fit_transform(z)\n when 'l1'\n z = Rumale::Preprocessing::L1Normalizer.new.fit_transform(z)\n end\n z\n end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def transforms(direction = :from)\n direction == :from ? transforms_from : transforms_to\n end",
"def transform\r\n trans(:class => SimpleXMIMetaModel::UML::Clazz)\r\n end",
"def translate( *args ) \n ## From Martin Rinehart 'Edges to Rubies' chapter 15\n ## May be called with a transformation and a vector, \n ## or with a transformation and r, g, b values.\n\n trans = args[0]\n if args.length == 2\n vec = args[1]\n r = vec[0]; g = vec[1]; b = vec[2] \n else\n r = args[1]; g = args[2]; b = args[3] \n end\n arr = trans.to_a()\n arr[12] += r; arr[13] += g; arr[14] += b \n return Geom::Transformation.new( arr )\n \n\tend",
"def transformed_entries entries\n\t\tentries\n\tend",
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end",
"def normalize\n Transformation.new(self, base, @to_base)\n end",
"def transformer\n @transformer ||= Transformer.new self\n end",
"def transform\n renderer.convert(content)\n end",
"def transform(transformation)\n if transformation.from == self.from\n transform_quantity(transformation)\n transform_units(transformation)\n # TODO: else raise exception\n end\n end",
"def translate output_collection, ⛓, what\n what.x += ⛓.x\n what.y += ⛓.y\n output_collection << what\nend",
"def transform(vec)\n return getRotationMatrix() * vec\n end",
"def doc_transformed(root)\n\n end",
"def transform_value(value)\n if value.is_a?(::Enumerable)\n value.map { |v| value_transformation.call(v) }\n else\n value_transformation.call(value)\n end\n end",
"def add_transformation(&block)\n @transformation ? @transformation >>= block : @transformation = block\n end",
"def transform( abs )\n result = @proc.call( abs )\n # Trace(\"Filter::transform abs #{abs} result #{result.inspect}\")\n return result\n end",
"def apply_transform(tree)\n raise \"Abstract method called\"\n end",
"def normalize; end",
"def Transform(arg)\n rb = @__cucumber_runtime.load_programming_language('rb')\n rb.execute_transforms([arg]).first\n end",
"def translate(x, y = 0)\n current_transformation.translate(x, y)\n self[\"transform\"] = current_transformation.to_s\n end",
"def transform (xmlIn,xmlOut)\r\n begin\r\n now = Time.now\r\n self.basic_transform xmlIn,xmlOut\r\n puts \"#{self.class} - [#{xmlIn}] -> [#{xmlOut}] : #{Time.now - now} ms\"\r\n rescue\r\n puts \"#{self.class} - ERROR: Unable to transform [#{xmlIn}] into [#{xmlOut}] because: #{$!}\"\r\n end\r\n end",
"def map(&block)\n append(Transform.new(&block))\n end",
"def trm_transform(x, y)\n trm = text_rendering_matrix\n if x == 0 && y == 0\n [trm.e, trm.f]\n else\n [\n (trm.a * x) + (trm.c * y) + (trm.e),\n (trm.b * x) + (trm.d * y) + (trm.f)\n ]\n end\n end",
"def transform()\n @stages.each do |stage|\n# Pry::ColorPrinter.pp stage\n @ead = stage.transform(@ead)\n#Rails.logger.debug(\"#{@ead.to_s.pretty_inspect}\")\n end\n @ead.to_s\n end",
"def transform(value)\n raise NoMethodError, \"#{__method__} not defined for #{self.class.name}\"\n end",
"def fit_transform(x, y = nil)\n fit(x, y).transform(x)\n end",
"def convert!; end",
"def transform(xsl, xml)\n Rexslt.new(xsl, xml).to_s\n end",
"def transforming_body_expr; end",
"def fit_transform(x, _y = nil)\n fit(x).transform(x)\n end",
"def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n fit_transform(x)\n end",
"def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n fit_transform(x)\n end",
"def transformers\n strong_memoize(:transformers) do\n defined_transformers = self.class.transformers.map(&method(:instantiate))\n\n transformers = []\n transformers << self if respond_to?(:transform)\n transformers.concat(defined_transformers)\n transformers\n end\n end",
"def encode\n transform :encode \n end",
"def convert\n end",
"def convert\n end",
"def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n x.dot(@components.transpose)\n end",
"def transform_keys(&block); end",
"def transformations_for_entity(entity)\n path = entity.model.active_path || []\n \n if group?(entity.parent)\n parents = [entity.parent]\n elsif definition?(entity.parent)\n parents = entity.parent.instances\n else\n parents = nil\n end\n \n path_index = path.index(entity)\n \n if path_index\n #puts path_index\n t = Geom::Transformation.new\n path.slice(path_index, path.length).each do |g|\n t = g.transformation.inverse * t\n end\n return [t]\n elsif parents\n transformations = []\n parents.each do |p|\n transformations.concat transformations_for_entity(p).map {|t| t * p.transformation }\n end\n return transformations\n else\n t = Geom::Transformation.new\n path.each do |g|\n t = g.transformation * t\n end\n return [t]\n end\n end",
"def setTransform(transform)\n # Pass through\n @target.transform = transform\n end",
"def each_transformation(&block)\n if !block_given?\n return enum_for(:each_transformation)\n end\n\n seen = Set.new\n needed_transformations.each do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_inputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_outputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n\n supercall(nil, :each_transformation, &block)\n end",
"def add_transform_primitives(gc)\n @transforms.each { |transform| gc.__send__(transform[0], *transform[1]) }\n end",
"def transform_row!(row)\n @row_transform.call(row) unless @row_transform.nil?\n @col_transforms.each do |name, func|\n next unless row.has_key?(name)\n if func.respond_to?(:transform)\n row[name] = func.transform(row[name])\n else\n row[name] = func.call(row[name])\n end\n end\n end",
"def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n # initialize transformed features\n n_samples, n_features = x.shape\n z = Numo::DFloat.zeros(n_samples, n_output_features)\n # bias\n z[true, 0] = 1\n curr_col = 1\n # itself\n z[true, 1..n_features] = x\n curr_col += n_features\n # high degree features\n curr_feat_ids = Array.new(n_features + 1) { |n| n + 1 }\n (1...@params[:degree]).each do\n next_feat_ids = []\n n_features.times do |d|\n f_range = curr_feat_ids[d]...curr_feat_ids.last\n next_col = curr_col + f_range.size\n z[true, curr_col...next_col] = z[true, f_range] * x[true, d..d]\n next_feat_ids.push(curr_col)\n curr_col = next_col\n end\n next_feat_ids.push(curr_col)\n curr_feat_ids = next_feat_ids\n end\n z\n end",
"def compile_transformer(transformer, var, i = 2)\n transformer.inject(var) do |value, name|\n raise ArgumentError, \"Unknown transformer #{name}\" unless t = TRANSFORMER[name]\n require t[3] if t[3]\n code = t[i]\n if t[0] == :serialize && var == 'key'\n \"(tmp = #{value}; String === tmp ? tmp : #{code % 'tmp'})\"\n else\n code % value\n end\n end\n end",
"def transform_keys!(&block); end",
"def normalize!; end",
"def transformation_device(*eras); end",
"def deep_transform! &block\n\n\t\tdo_deep_transform_on_self_(&block)\n\tend"
] | [
"0.8603482",
"0.8401353",
"0.82809573",
"0.8136617",
"0.79939467",
"0.7782055",
"0.7755684",
"0.77082825",
"0.734179",
"0.71710676",
"0.712064",
"0.7085596",
"0.7085596",
"0.69879735",
"0.6922067",
"0.6898412",
"0.68260807",
"0.67068833",
"0.65906334",
"0.6569768",
"0.65341043",
"0.6527855",
"0.649976",
"0.64907384",
"0.6437382",
"0.6423539",
"0.6417105",
"0.63993084",
"0.62757295",
"0.62757295",
"0.62744796",
"0.6266888",
"0.62520266",
"0.6226155",
"0.62004066",
"0.6196316",
"0.6186205",
"0.6144704",
"0.61434555",
"0.61058813",
"0.6023836",
"0.6019829",
"0.59720117",
"0.5961406",
"0.59579635",
"0.5954544",
"0.59475046",
"0.5945852",
"0.59424275",
"0.59124416",
"0.5902573",
"0.58988786",
"0.5896752",
"0.5893115",
"0.58893955",
"0.5885762",
"0.5861939",
"0.58452433",
"0.5841274",
"0.5838938",
"0.5833465",
"0.5808969",
"0.5800662",
"0.57987434",
"0.5797172",
"0.5733318",
"0.5702502",
"0.5696271",
"0.56855816",
"0.5680232",
"0.56767935",
"0.567546",
"0.56719136",
"0.5662288",
"0.5654141",
"0.56503373",
"0.56392515",
"0.5620095",
"0.5614322",
"0.5580566",
"0.55700755",
"0.55535036",
"0.55535036",
"0.55512315",
"0.5548919",
"0.5527265",
"0.5527265",
"0.5517963",
"0.55056405",
"0.55031455",
"0.54943806",
"0.5491979",
"0.54879814",
"0.54830104",
"0.54813606",
"0.54691726",
"0.54688555",
"0.5457768",
"0.5452361",
"0.54506034"
] | 0.6205526 | 34 |
GET /properties GET /properties.json | def index
@properties = Property.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @properties }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end",
"def index\n @properties = Property.all\n\n render json: @properties\n end",
"def show\n @property = Property.find(params[:id])\n\n render json: @property\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def properties_get(opts = {})\n data, _status_code, _headers = properties_get_with_http_info(opts)\n return data\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n property = Property.find params[:id]\n respond_to do |format|\n format.html {}\n format.json { render :json => property}\n end\n end",
"def property_keys\n headers = { 'Accept' => 'application/json; charset=UTF-8' }\n get_request 'propertykeys', headers\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def index\n @properties = @user.properties.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @properties }\n end\n end",
"def relationship_get_property id, name\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n get_request 'relationship/' + id + '/properties/' + name, headers\n end",
"def index\n\n @properties = Property.search( params[:query] || \"\" )\n\n respond_to do |format|\n\n format.html\n format.json { render json: @properties }\n\n end\n\n end",
"def index\n @api_v1_properties = Api::V1::Property.all\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json { render json: @property }\n end\n end",
"def show\n property = Property.by_key(params[:id], nil, current_user.id)\n if property\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json([property])) }\n format.xml { render :xml => properties_to_xml([property]) }\n format.text { render :text => text_not_supported }\n end\n else\n render_error('Not found', 404)\n end\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties\n .includes(:reservations)\n .order('reservations.created_at DESC')\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def index\n properties = current_user.properties\n\n if properties.any?\n render status: 200, json: { properties: properties.to_json }\n else\n render status: 404, json: { error: 'You have no properties' }\n end\n end",
"def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end",
"def show\n authorize_action_for @property, at: current_store\n\n respond_to do |format|\n format.json { render json: @property.product_properties, status: 200 }\n format.html\n end\n end",
"def show\n render json: @property\n end",
"def show\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @estate_agent = EstateAgent.find(params[:id])\n @properties = Property.where(\"estate_agent_id = ?\", @estate_agent.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @properties }\n end\n end",
"def get_properties(options={})\n return send_message(SkyDB::Message::GetProperties.new(options))\n end",
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def property_properties\n _property_properties\n end",
"def index\n @properties = current_user.properties.order(:id => :desc)\n render \"index.json.jb\"\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def featured\n properties = []\n begin\n # Try to get the 3 properties with priority flag\n Property.where(priority: true, status: :active).order('RANDOM()').limit(3).each { |p| properties << p }\n\n # Get the missing properties\n missing = 3 - properties.count\n Property.where(priority: false, status: :active).order('RANDOM()').limit(missing).each { |p| properties << p } if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n\t\t@properties = Property.all\n\tend",
"def index\n @properties = Property.get_all(params[\"city\"], params[\"country\"])\n end",
"def show\n respond_to do |format|\n \tformat.html # show.html.erb\n \tformat.json { render json: @property }\n end\n end",
"def get_properties()\n return @properties\n end",
"def index\n id = params[:id].to_i\n\n if id != 0\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').\n find_all_by_id(id)\n if @properties.any?\n @property_name = @properties.first.name\n end\n else\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def properties\n return @values['properties'] if @values.key?('properties')\n @values['properties'] = {}\n @values['properties']\n end",
"def properties\n @properties\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def properties(path, property_names)\n result = properties_for_path(path, property_names, 0)\n if result[0].key?(200)\n return result[0][200]\n else\n return []\n end\n end",
"def show\n @prop = Prop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prop }\n end\n end",
"def get_properties(did, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(did, opts)\n return data\n end",
"def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end",
"def show\n @property = Property.find(params[:id])\n @json = @property.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @sample_property = SampleProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_property }\n end\n end",
"def featured\n properties = []\n begin\n # Tenta pegar 3 propriedades com a flag de prioridade\n Property.where(priority: true, status: :active).order(\"RANDOM()\").limit(3).each {|p| properties << p}\n # Verifica quantas propriedades faltam pra completar 3\n missing = 3 - properties.count\n # Pega as propriedades faltantes caso existam\n Property.where(status: :active).order(\"RANDOM()\").limit(missing).each {|p| properties << p} if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def get_properties(uuid, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(uuid, opts)\n data\n end",
"def index\n @props = Prop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @props }\n end\n end",
"def properties\n @properties\n end",
"def index\n @properties = Property.order(:id).page (params[:page])\n end",
"def get_properties\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperties']['List']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def index\n @client_properties = ClientProperty.all\n end",
"def show\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_property }\n end\n end",
"def available_properties\n @properties ||= list.properties\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def get_properties\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n\n return stream_hash['DocumentProperties']['List'] if stream_hash['Code'] == 200\n false\n\n rescue Exception => e\n print e\n end\n\n end",
"def properties_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PropertiesApi.properties_get ...'\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 PropertiesApi.properties_get\"\n end\n # resource path\n local_var_path = '/v1/properties/{id}'.sub('{' + 'id' + '}', id.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', 'text/json', 'text/html'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'DomainPublicAdapterWebApiModelsV1PropertiesProperty')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PropertiesApi#properties_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def properties_get(id, opts = {})\n data, _status_code, _headers = properties_get_with_http_info(id, opts)\n data\n end",
"def show\n @property_user = PropertyUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_user }\n end\n end",
"def get_properties\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties\"\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperties\"][\"List\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def get_property(*args)\n return unless alive?\n\n command(\"get_property\", *args)[\"data\"]\n end",
"def properties\n properties = []\n relations = self.property_relations\n relations.each do |relationship|\n properties.push relationship.property\n end\n properties\n end",
"def index\n @properties = Property.find(:all, :order => 'name')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @properties.to_xml }\n end\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def jsonProperties\n\t\t\tallItems = {\n\t\t\t\t:mp3Url\t\t=> @mp3Url,\n\t\t\t}\n\t\t\treturn allItems\n\n\t\tend",
"def properties\n model.properties\n end",
"def show\n @property = Property.find(params[:id])\n end",
"def show\n @property_field = PropertyField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_field }\n end\n end",
"def properties\n _properties\n end",
"def search\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = @user.properties.all\n # if params[:search]\n # @properties = @user.properties.search(params[:search], params[:page]).order(\"created_at DESC\")\n \n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @properties }\n # end\n # else\n # @properties = Property.order(\"created_at DESC\")\n # end\n\n end",
"def jsonProperties\n\t\t\tallItems = {\n\t\t\t\t:swf\t\t=> @mp3Url,\n\t\t\t\t:width\t\t=> @width,\n\t\t\t\t:height\t\t=> @height\n\t\t\t}\n\t\t\treturn allItems\n\n\t\tend",
"def property_params\n params[:property]\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def index\n @current_api_v1_user = current_api_v1_user\n @api_v1_properties = Property.all\n end",
"def getProperties\n @widget = Widget.find(params[:id])\n wtype = WidgetType.find(@widget.widget_type_id)\n\n # Return a hash of properties obtained from each source\n # TBD: Currently used for cal widget. Can be used to send authentication tokens\n srcdata = {}\n str2lst(@widget.sources).each do |source_id|\n src = Source.find(source_id)\n sdata = src.getProperties()\n #logger.debug(\"getProperties():sdata = #{sdata}\")\n srcdata[source_id] = sdata\n end\n\n data = {:srcdata => srcdata}\n #logger.debug(\"getProperties():data = #{data}\")\n\n # The final returned hash looks like this\n # data -> {\n # srcdata -> { ... },\n # };\n render :json => {:data => data}\n end",
"def properties\n @properties ||= {}\n end",
"def get_prop(values)\n cmd = \"{\\\"id\\\":1,\\\"method\\\":\\\"get_prop\\\",\\\"params\\\":[#{values}]}\\r\\n\"\n request(cmd)\n end",
"def get_properties_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectPropertyApi.get_properties ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validation && uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling ProjectPropertyApi.get_properties\"\n end\n # resource path\n local_var_path = '/v1/project/{uuid}/property'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))\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/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\n return_type = opts[:return_type] || 'Array<ProjectProperty>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\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: ProjectPropertyApi#get_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n format = params[:format] || 'json'\n data = @container.config.get_properties(flavor: :public, format: format)\n\n render response_ok data\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n []\n end",
"def query\n @property_hash\n end",
"def show\n @property = Property.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @property.blank?\n # to provide a version specific and secure representation of an object, wrap it in a presenter\n \n format.xml { render :xml => property_presenter }\n format.json { render :json => property_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def show\n @quick_property = QuickProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quick_property }\n end\n end",
"def index\n @properties = Property.with_deleted.where(id: AccessResource.get_ids(resource_klass: 'Property', user: current_user))\n @properties = @properties.where(deleted_at: nil) unless params[:trashed].to_b\n @properties = @properties.where.not(deleted_at: nil) if params[:trashed].to_b\n @last = @properties.try(:last).try(:id) || 0\n if params[\"purchased\"]\n if ((params[\"purchased\"][\"accepted\"] == \"1\") && (params[\"prospective_purchase\"][\"accepted\"] == \"1\"))\n elsif ((params[\"purchased\"][\"accepted\"] == \"0\") && (params[\"prospective_purchase\"][\"accepted\"] == \"0\"))\n @properties = @properties.where.not(ownership_status: ['Prospective Purchase', 'Purchased'])\n else\n @properties = @properties.where(ownership_status: 'Purchased') if params[\"purchased\"][\"accepted\"] == \"1\"\n @properties = @properties.where(ownership_status: 'Prospective Purchase') if params[\"prospective_purchase\"][\"accepted\"] == \"1\"\n end\n end\n @properties = @properties.order(created_at: :desc).paginate(page: params[:page], per_page: sessioned_per_page)\n @activeId = params[:active_id]\n \n render template: 'properties/xhr_list', layout: false if request.xhr?\n end",
"def properties\n return @properties\n end",
"def get_server_properties\n http_get(:uri=>\"/server/properties\", :fields=>x_cookie)\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end"
] | [
"0.75018007",
"0.7475009",
"0.746873",
"0.7341186",
"0.73298395",
"0.728888",
"0.728888",
"0.7288875",
"0.71567196",
"0.7149775",
"0.71148396",
"0.7105831",
"0.7083838",
"0.7083838",
"0.7083838",
"0.7083838",
"0.70709115",
"0.70466745",
"0.70451057",
"0.70230925",
"0.70224357",
"0.7018248",
"0.7006206",
"0.69799036",
"0.69642925",
"0.69531786",
"0.69522244",
"0.693088",
"0.6927656",
"0.6879894",
"0.68693507",
"0.6847459",
"0.68435395",
"0.6813667",
"0.6811128",
"0.6792631",
"0.6792631",
"0.6792631",
"0.6792631",
"0.6792631",
"0.6792631",
"0.6772058",
"0.676866",
"0.6766727",
"0.67487013",
"0.6743893",
"0.67270887",
"0.6722367",
"0.66456664",
"0.6639931",
"0.6639101",
"0.66389555",
"0.66316783",
"0.6627592",
"0.65998614",
"0.65857863",
"0.6585719",
"0.65835613",
"0.6575083",
"0.6571959",
"0.6566735",
"0.65618753",
"0.6559311",
"0.65495825",
"0.65444994",
"0.6539084",
"0.6522242",
"0.6512929",
"0.6499916",
"0.6490093",
"0.64868546",
"0.6480112",
"0.64765245",
"0.6472079",
"0.6470897",
"0.64671296",
"0.6465398",
"0.6465338",
"0.646006",
"0.6453586",
"0.64334214",
"0.6399189",
"0.63971305",
"0.6381545",
"0.6381545",
"0.63673633",
"0.6360048",
"0.63472253",
"0.6339415",
"0.63378483",
"0.6328721",
"0.6326396",
"0.63247675",
"0.63226616",
"0.6321451",
"0.6300468",
"0.62893385",
"0.6283081",
"0.6273931",
"0.62713593"
] | 0.7455118 | 3 |
GET /properties/1 GET /properties/1.json | def show
@property = Property.find(params[:id])
@json = @property.to_gmaps4rails
respond_to do |format|
format.html # show.html.erb
format.json { render json: @property }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @property = Property.find(params[:id])\n\n render json: @property\n end",
"def show\n property = Property.find params[:id]\n respond_to do |format|\n format.html {}\n format.json { render :json => property}\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = Property.all\n\n render json: @properties\n end",
"def index\n @api_v1_properties = Api::V1::Property.all\n end",
"def relationship_get_property id, name\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n get_request 'relationship/' + id + '/properties/' + name, headers\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def index\n @properties = Property.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def show\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def show\n property = Property.by_key(params[:id], nil, current_user.id)\n if property\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json([property])) }\n format.xml { render :xml => properties_to_xml([property]) }\n format.text { render :text => text_not_supported }\n end\n else\n render_error('Not found', 404)\n end\n end",
"def index\n id = params[:id].to_i\n\n if id != 0\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').\n find_all_by_id(id)\n if @properties.any?\n @property_name = @properties.first.name\n end\n else\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties\n .includes(:reservations)\n .order('reservations.created_at DESC')\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json { render json: @property }\n end\n end",
"def index\n\n @properties = Property.search( params[:query] || \"\" )\n\n respond_to do |format|\n\n format.html\n format.json { render json: @properties }\n\n end\n\n end",
"def show\n @sample_property = SampleProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_property }\n end\n end",
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def show\n @estate_agent = EstateAgent.find(params[:id])\n @properties = Property.where(\"estate_agent_id = ?\", @estate_agent.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @properties }\n end\n end",
"def show\n @property = Property.find(params[:id])\n end",
"def featured\n properties = []\n begin\n # Try to get the 3 properties with priority flag\n Property.where(priority: true, status: :active).order('RANDOM()').limit(3).each { |p| properties << p }\n\n # Get the missing properties\n missing = 3 - properties.count\n Property.where(priority: false, status: :active).order('RANDOM()').limit(missing).each { |p| properties << p } if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def show\n @prop = Prop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prop }\n end\n end",
"def show\n render json: @property\n end",
"def index\n @properties = @user.properties.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @properties }\n end\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def show\n respond_to do |format|\n \tformat.html # show.html.erb\n \tformat.json { render json: @property }\n end\n end",
"def index\n @properties = Property.order(:id).page (params[:page])\n end",
"def show\n @property = Property.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @property.blank?\n # to provide a version specific and secure representation of an object, wrap it in a presenter\n \n format.xml { render :xml => property_presenter }\n format.json { render :json => property_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def show\n authorize_action_for @property, at: current_store\n\n respond_to do |format|\n format.json { render json: @property.product_properties, status: 200 }\n format.html\n end\n end",
"def index\n @properties = current_user.properties.order(:id => :desc)\n render \"index.json.jb\"\n end",
"def index\n\t\t@properties = Property.all\n\tend",
"def featured\n properties = []\n begin\n # Tenta pegar 3 propriedades com a flag de prioridade\n Property.where(priority: true, status: :active).order(\"RANDOM()\").limit(3).each {|p| properties << p}\n # Verifica quantas propriedades faltam pra completar 3\n missing = 3 - properties.count\n # Pega as propriedades faltantes caso existam\n Property.where(status: :active).order(\"RANDOM()\").limit(missing).each {|p| properties << p} if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def show\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_property }\n end\n end",
"def properties_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PropertiesApi.properties_get ...'\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 PropertiesApi.properties_get\"\n end\n # resource path\n local_var_path = '/v1/properties/{id}'.sub('{' + 'id' + '}', id.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', 'text/json', 'text/html'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'DomainPublicAdapterWebApiModelsV1PropertiesProperty')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PropertiesApi#properties_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @current_api_v1_user = current_api_v1_user\n @api_v1_properties = Property.all\n end",
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def show\n @property_field = PropertyField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_field }\n end\n end",
"def property_keys\n headers = { 'Accept' => 'application/json; charset=UTF-8' }\n get_request 'propertykeys', headers\n end",
"def get_property(*args)\n return unless alive?\n\n command(\"get_property\", *args)[\"data\"]\n end",
"def index\n properties = current_user.properties\n\n if properties.any?\n render status: 200, json: { properties: properties.to_json }\n else\n render status: 404, json: { error: 'You have no properties' }\n end\n end",
"def show\n @quick_property = QuickProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quick_property }\n end\n end",
"def index\n @properties = Property.get_all(params[\"city\"], params[\"country\"])\n end",
"def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end",
"def show\n @property_details = PropertyDetail.find_by_property_id(params[:id])\n end",
"def index\n @props = Prop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @props }\n end\n end",
"def properties_get(opts = {})\n data, _status_code, _headers = properties_get_with_http_info(opts)\n return data\n end",
"def show\n @property_user = PropertyUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_user }\n end\n end",
"def properties(path, property_names)\n result = properties_for_path(path, property_names, 0)\n if result[0].key?(200)\n return result[0][200]\n else\n return []\n end\n end",
"def index\n @properties = Property.find(:all, :order => 'name')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @properties.to_xml }\n end\n end",
"def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def index\n @client_properties = ClientProperty.all\n end",
"def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @property }\n end\n end",
"def details\n @estate_agent = EstateAgent.find(params[:id])\n @property = Property.where(\"estate_agent_id = ? and id = ?\", @estate_agent.id, params[:id2])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def index\n @properties = Property.with_deleted.where(id: AccessResource.get_ids(resource_klass: 'Property', user: current_user))\n @properties = @properties.where(deleted_at: nil) unless params[:trashed].to_b\n @properties = @properties.where.not(deleted_at: nil) if params[:trashed].to_b\n @last = @properties.try(:last).try(:id) || 0\n if params[\"purchased\"]\n if ((params[\"purchased\"][\"accepted\"] == \"1\") && (params[\"prospective_purchase\"][\"accepted\"] == \"1\"))\n elsif ((params[\"purchased\"][\"accepted\"] == \"0\") && (params[\"prospective_purchase\"][\"accepted\"] == \"0\"))\n @properties = @properties.where.not(ownership_status: ['Prospective Purchase', 'Purchased'])\n else\n @properties = @properties.where(ownership_status: 'Purchased') if params[\"purchased\"][\"accepted\"] == \"1\"\n @properties = @properties.where(ownership_status: 'Prospective Purchase') if params[\"prospective_purchase\"][\"accepted\"] == \"1\"\n end\n end\n @properties = @properties.order(created_at: :desc).paginate(page: params[:page], per_page: sessioned_per_page)\n @activeId = params[:active_id]\n \n render template: 'properties/xhr_list', layout: false if request.xhr?\n end",
"def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end",
"def fetch_property(name)\n properties.where(\"name = ?\", name).first\n end",
"def search\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end",
"def get_property _property\n send_cmd(\"get_property #{_property}\")\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def get_property(property_name)\n command(\"get_property\", property_name)\n end",
"def property_params\n params[:property]\n end",
"def set_api_v1_property\n @api_v1_property = Property.find(params[:id])\n end",
"def index\n @properties = @user.properties.all\n # if params[:search]\n # @properties = @user.properties.search(params[:search], params[:page]).order(\"created_at DESC\")\n \n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @properties }\n # end\n # else\n # @properties = Property.order(\"created_at DESC\")\n # end\n\n end",
"def show\n @property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @property.to_xml }\n end\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def get_properties_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectPropertyApi.get_properties ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validation && uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling ProjectPropertyApi.get_properties\"\n end\n # resource path\n local_var_path = '/v1/project/{uuid}/property'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))\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/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\n return_type = opts[:return_type] || 'Array<ProjectProperty>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\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: ProjectPropertyApi#get_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_prop(values)\n cmd = \"{\\\"id\\\":1,\\\"method\\\":\\\"get_prop\\\",\\\"params\\\":[#{values}]}\\r\\n\"\n request(cmd)\n end",
"def show\n @property_picture = PropertyPicture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_picture }\n end\n end",
"def properties_get(id, opts = {})\n data, _status_code, _headers = properties_get_with_http_info(id, opts)\n data\n end",
"def index\n if params[:ax] && params[:ay] && params[:bx] && params[:by]\n @properties = Property.find_by_coordinates(\n upper_x: params[:ax],\n upper_y: params[:ay],\n bottom_x: params[:bx],\n bottom_y: params[:by]\n )\n else\n @properties = Property.all #in this case is much necessary to implement pagination system\n end\n\n respond_with :api, :v1, @properties, status: :ok\n end",
"def query\n @property_hash\n end",
"def get_properties\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperties']['List']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def property_details\n details = VendorApi.new(params[:udprn].to_i, nil, params[:vendor_id].to_i).property_details\n render json: details, status: 200\n end",
"def show\n @property_image = PropertyImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_image }\n end\n end",
"def index\n @property = Property.all\n end",
"def show\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @property }\n end\n end",
"def show\n @property = Property.find(params[:id])\n\n do_search(@property.number_of_rooms, @property.location)\n @properties.delete @property\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end",
"def get_property property_name\n\n begin\n\n if property_name == ''\n raise 'Property name not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DocumentProperty'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def index\n # @properties = Property.all('date') ## Who put this in? What is ('date') intended to do ?\n @properties = Property.all\n respond_to do |format|\n format.html {} # do nothing - this is the default. display as normal html\n format.json {render :json => @properties}\n end\n end",
"def get_properties(options={})\n return send_message(SkyDB::Message::GetProperties.new(options))\n end",
"def show\n format = params[:format] || 'json'\n data = @container.config.get_properties(flavor: :public, format: format)\n\n render response_ok data\n end",
"def get_property(property, data, uri = nil, is_url: false, single: true, &block)\n values = data ? data[property] : nil\n if values.is_a?(Array)\n values = values.map { |value| get_property_value(value, is_url: is_url, &block) }\n single ? values[0] : values\n else\n value = get_property_value(values, is_url: is_url, &block)\n single ? value : [value]\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def get_param(name, property)\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 property.is_a?(String)\n raise('wrong value: property must be valid') unless !property.nil? && !property.empty?\n\n r = @client.post({\n 'action' => 'getparam',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, property],\n }.to_json)\n\n JSON.parse(r)['result']\n end",
"def set_api_v1_property\n @api_v1_property = Property.find(params[:id])\n end",
"def property_properties\n _property_properties\n end"
] | [
"0.7496478",
"0.7347074",
"0.7304781",
"0.72560406",
"0.7233263",
"0.7233263",
"0.7233263",
"0.7233263",
"0.7187529",
"0.71720874",
"0.71457875",
"0.7129162",
"0.70889425",
"0.70887244",
"0.70887244",
"0.70553535",
"0.7040372",
"0.69893247",
"0.6987463",
"0.6971353",
"0.6939464",
"0.69108415",
"0.68753433",
"0.6842614",
"0.68410856",
"0.682568",
"0.6814403",
"0.68058234",
"0.68032545",
"0.677716",
"0.6777144",
"0.6670462",
"0.66638887",
"0.6655435",
"0.6653962",
"0.6646788",
"0.6646788",
"0.6646788",
"0.6646788",
"0.6646788",
"0.6646788",
"0.66450965",
"0.6644562",
"0.66147786",
"0.6590978",
"0.65827906",
"0.65808636",
"0.6560614",
"0.65564406",
"0.65498793",
"0.6544223",
"0.64877087",
"0.6484933",
"0.64826417",
"0.647743",
"0.64766514",
"0.64677584",
"0.64646864",
"0.64596176",
"0.6441866",
"0.6426041",
"0.6380217",
"0.6370084",
"0.6343601",
"0.63296914",
"0.6328447",
"0.62989116",
"0.62954384",
"0.62832725",
"0.62685233",
"0.626072",
"0.6238681",
"0.6218793",
"0.62004596",
"0.61994255",
"0.6195819",
"0.6193166",
"0.61847085",
"0.61841655",
"0.6179005",
"0.617014",
"0.6166904",
"0.6158392",
"0.61419666",
"0.6120921",
"0.6116127",
"0.6111324",
"0.61034876",
"0.6086981",
"0.6082867",
"0.6079447",
"0.60776097",
"0.60721993",
"0.60709345",
"0.60479635",
"0.60446495",
"0.6039249",
"0.60312104",
"0.6029796",
"0.601801"
] | 0.65524054 | 49 |
GET /properties/new GET /properties/new.json | def new
@property = Property.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @property }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @property = Property.new\n\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property }\n end\n end",
"def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prop }\n end\n end",
"def new\n @property = @user.properties.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @property }\n end\n end",
"def new\n @property_field = PropertyField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property_field }\n end\n end",
"def new\r\n property = Property.new\r\n property.save\r\n puts \"\\nStarting with new property #{property.id}\\n\\n\"\r\n create_or_continue_property(property)\r\n end",
"def new\n @sample_property = SampleProperty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_property }\n end\n end",
"def new\n @rent = Rent.new\n @properties = AddProperty.find(:all, :conditions =>\" is_rented = 0 \");\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rent }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @property }\n end\n end",
"def new\n @location_property = LocationProperty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_property }\n end\n end",
"def new\n @quick_property = QuickProperty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_property }\n end\n end",
"def new\n @propose = Propose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @propose }\n end\n end",
"def new\n @property_user = PropertyUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property_user }\n end\n end",
"def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prop }\n end\n end",
"def create\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @property_picture = PropertyPicture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property_picture }\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n if @property.save\n render json: @property, status: :created, location: @property\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'new' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'new' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tenant = Tenant.new\n @property = Property.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenant }\n end\n end",
"def new\n @prop_value = PropValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prop_value }\n end\n end",
"def new\n @property_image = PropertyImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @property_image }\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to after_save_path, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def create\n @property = Property.new\n if @property.save\n redirect_to(:action => 'index')\n else\n render ('new')\n end\n end",
"def create\n @prop = Prop.new(prop_params)\n\n respond_to do |format|\n if @prop.save\n format.html { redirect_to @prop, notice: \"Prop was successfully created.\" }\n format.json { render :show, status: :created, location: @prop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @n=0\n @property = Property.new(property_params)\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: \"Property was successfully created.\" }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to [:admin, @property], notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for Property, at: current_store\n @property = current_store.properties.build(property_params.merge(priority: current_store.properties.count))\n\n respond_to do |format|\n if @property.save\n track @property\n format.html { redirect_to edit_admin_property_path(@property),\n notice: t('.notice', property: @property) }\n format.json { render :show, status: :created, location: admin_property_path(@property) }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to [@category, @sub_category, @item, @property], notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n flash[:notice] = 'Property was successfully created.'\n format.html { redirect_to admin_property_url(@property) }\n format.xml { head :created, :location => admin_property_url(@property) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @property.errors.to_xml }\n end\n end\n end",
"def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end",
"def new\n @proef = Proef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proef }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def create\n @property = Property.new(property_params)\n @property.rent_table_version = 0\n @property.lease_base_rent = @property.current_rent\n @property.user_id = current_user.id\n\n if !(@property.owner_person_is.nil? || @property.owner_person_is==0)\n if @property.owner_person_is == 1 && [email protected]_entity_id_indv.nil?\n @property.owner_entity_id = @property.owner_entity_id_indv\n end\n else\n @property.owner_entity_id = @property.owner_entity_id_indv = 0\n end\n\n respond_to do |format|\n if @property.save\n AccessResource.add_access({ user: current_user, resource: @property })\n flash[:success] = \"Congratulations, you have just created a record for #{@property.title}\"\n format.html { redirect_to edit_property_path(@property.key, type_is: 'basic_info') }\n # format.html { redirect_to properties_path }\n format.js { render json: @property.to_json, status: :ok }\n format.json { render action: 'show', status: :created, location: @property }\n else\n # flash[:error] = \"Failed to create new property.\"\n format.html { render action: 'new' }\n format.js { render action: 'new', status: :unprocessable_entity, layout: false }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_property = Api::V1::Property.new(api_v1_property_params)\n\n if @api_v1_property.save\n render :show, status: :created, location: @api_v1_property\n else\n render json: @api_v1_property.errors, status: :unprocessable_entity\n end\n end",
"def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end",
"def new\n @property = Property.new\n end",
"def new\n @property = Property.new\n end",
"def new\n @binder = Binder.new(created_by: current_user.id, primary: current_user.binders.count == 0)\n @binder.build_property\n @binder.property.property_type_id = PropertyType.where(:name => 'Single Family').first.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @binder }\n end\n end",
"def new\n @preference = Preference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @preference }\n end\n end",
"def create\n @property_detail = PropertyDetail.new(property_detail_params)\n\n respond_to do |format|\n if @property_detail.save\n format.html { redirect_to @property_detail.property, notice: 'Property detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @property_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @job_property_value = JobPropertyValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_property_value }\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to(@property, :notice => 'Property was successfully created.') }\n format.xml { render :xml => @property, :status => :created, :location => @property }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.properties = RecipeProperties.new(params[:recipe][:properties])\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @resource }\n end\n end",
"def new\n @school_property = SchoolProperty.new\n list\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school_property }\n end\n end",
"def new\n @prod = Prod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @prod }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def create\n property = current_user.properties.new(\n title: params[:title],\n value: params[:value]\n )\n\n if property.save\n render status: 200, json: { property_id: property.id }\n else\n render status: 422, json: {\n error: property.errors.full_messages.join(', ')\n }\n end\n end",
"def create\n @prop = Prop.new(params[:prop])\n\n respond_to do |format|\n if @prop.save\n format.html { redirect_to(@prop, :notice => 'Prop was successfully created.') }\n format.xml { render :xml => @prop, :status => :created, :location => @prop }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prop.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @attribute = Attribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end",
"def create\n @property = Property.create(property_params)\n # @property = Property.new(safe_params)\n\n if @property.save\n render json: @property, status: :created, location: @property\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n first: @resource[:first],\n second: @resource[:second],\n kind: @resource[:kind],\n symmetrical: @resource[:symmetrical],\n new: true\n }\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def create\n if !check_permissions?(session[:user_type], \"create_property\")\n redirect_to root_path\n end\n @property = Property.new(property_params)\n respond_to do |format|\n if @property.save\n # , :, :in_unit_laundry, :parking\n add_property_feature(@property)\n format.html { redirect_to @property, notice: \"Property was successfully created.\" }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @product = Product.new\n\n render json: @product\n end",
"def new\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n end",
"def create\n @property = Property.new(property_params)\n @property.user=current_person\n respond_to do |format|\n @property.add_location_to_property\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @property = Property.find(params[:property_id])\n @work_order = @property.work_orders.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_order }\n end\n end",
"def new\n @attribute = Attribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attribute }\n end\n end",
"def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:property][:price] = Money.from_string(params[:property][:price], params[:property][:currency])\n params[:property][:currency] = nil\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to [:admin, @property], notice: 'Nuevo inmueble creado.' }\n format.json { render json: @property, status: :created, location: [:admin, @property] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @protein = Protein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def create\n @sys_property = Sys::Property.new(sys_property_params)\n\n respond_to do |format|\n if @sys_property.save\n format.html { redirect_to @sys_property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sys_property }\n else\n format.html { render action: 'new' }\n format.json { render json: @sys_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @proficiency = Proficiency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proficiency }\n end\n end",
"def create_new_property\n type = @prompt.select(\"Choose the property type?\", %w(Unit House Townhouse))\n street_number = @prompt.ask(\"What is the street number?\", required: true) do |q|\n number_input_validate(q)\n end\n \n street_name = @prompt.ask(\"What is the street name?\", required: true) do |q|\n letter_input_validate(q)\n end\n suburb = @prompt.ask(\"What is the suburb?\", required: true) do |q|\n letter_input_validate(q)\n end\n\n weekly_rent = @prompt.ask(\"What is the weekly rent? (number only)\", required: true) do |q|\n number_input_validate(q)\n end\n\n property_status = @prompt.select(\"Please select the current property status?\", %w(Occupied Vacant))\n if property_status == 'Occupied'\n tenant_first_name = @prompt.ask(\"What is the current tenant first name?\", required: true) do |q|\n letter_input_validate(q)\n end\n tenant_last_name = @prompt.ask(\"What is the current tenant last name?\", required: true) do |q|\n letter_input_validate(q)\n end\n end\n landlord_firstname = @prompt.ask(\"What is the landlord firstname\", required: true) do |q|\n letter_input_validate(q)\n end\n landlord_lastname = @prompt.ask(\"What is the landlord lastname\", required: true) do |q|\n letter_input_validate(q)\n end\n\n @property_list.create_property(type, \"$#{weekly_rent}\", property_status, {street_number: street_number, street_name: street_name, suburb: suburb}, {first_name: landlord_firstname, last_name: landlord_lastname}, {first_name: tenant_first_name, last_name: tenant_last_name})\n end",
"def create\n @property = Property.new\n respond_to do |format|\n begin\n success = @property.update_attributes(params[:property])\n rescue Exception => e\n @exception = { :message => e.message, :backtrace => e.backtrace.inspect }\n end\n\n if success\n format.xml { render :xml => property_presenter, :status => :created }\n format.json { render :json => property_presenter, :status => :created }\n elsif @exception\n format.xml { render :xml => @exception, :status => :internal_server_error }\n format.json { render :json => @exception, :status => :internal_server_error }\n else\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n format.json { render :json => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @property_closet = PropertyCloset.new(property_closet_params)\n\n respond_to do |format|\n if @property_closet.save\n format.html { redirect_to @property_closet, notice: 'Property closet was successfully created.' }\n format.json { render :show, status: :created, location: @property_closet }\n else\n format.html { render :new }\n format.json { render json: @property_closet.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7802905",
"0.7802905",
"0.7802905",
"0.7802905",
"0.7802905",
"0.7799518",
"0.77899367",
"0.77023524",
"0.7676439",
"0.7641626",
"0.7340625",
"0.7294141",
"0.72753036",
"0.72743183",
"0.7229975",
"0.7199456",
"0.71836406",
"0.70413727",
"0.6951421",
"0.6927972",
"0.6655688",
"0.662418",
"0.6621279",
"0.6621279",
"0.66195035",
"0.66193503",
"0.6585007",
"0.6585007",
"0.6576393",
"0.6551314",
"0.653222",
"0.6513121",
"0.6504565",
"0.6500562",
"0.6500562",
"0.6500562",
"0.6500562",
"0.6500562",
"0.6500562",
"0.6500562",
"0.645631",
"0.64394504",
"0.64380026",
"0.64210093",
"0.6416233",
"0.6404314",
"0.6390075",
"0.6384346",
"0.63824135",
"0.6380408",
"0.63748735",
"0.6353358",
"0.6348995",
"0.63445115",
"0.634373",
"0.63220656",
"0.63220656",
"0.6320864",
"0.6313718",
"0.6306994",
"0.63003737",
"0.62938076",
"0.6292346",
"0.6288927",
"0.6276553",
"0.6272817",
"0.62669194",
"0.62666106",
"0.6265375",
"0.6265375",
"0.6265375",
"0.6260361",
"0.6249173",
"0.6247459",
"0.6247459",
"0.62206876",
"0.621877",
"0.62102103",
"0.6207074",
"0.620565",
"0.6204453",
"0.6202988",
"0.61954635",
"0.61940247",
"0.6192738",
"0.6190212",
"0.61808443",
"0.61590016",
"0.61563027",
"0.61546886",
"0.61520773",
"0.6149223",
"0.6142942",
"0.61391443",
"0.61371064",
"0.61325693",
"0.6130169",
"0.61283094",
"0.61273783",
"0.6125403"
] | 0.780913 | 0 |
POST /properties POST /properties.json | def create
params[:property][:price] = Money.from_string(params[:property][:price], params[:property][:currency])
params[:property][:currency] = nil
@property = Property.new(params[:property])
respond_to do |format|
if @property.save
format.html { redirect_to [:admin, @property], notice: 'Nuevo inmueble creado.' }
format.json { render json: @property, status: :created, location: [:admin, @property] }
else
format.html { render action: "new" }
format.json { render json: @property.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @property = Property.new(property_params)\n\n if @property.save\n render json: @property, status: :created, location: @property\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def property_params\n params.require(:property).permit!\n end",
"def create\n property = current_user.properties.new(\n title: params[:title],\n value: params[:value]\n )\n\n if property.save\n render status: 200, json: { property_id: property.id }\n else\n render status: 422, json: {\n error: property.errors.full_messages.join(', ')\n }\n end\n end",
"def create\n @property = Property.create(property_params)\n # @property = Property.new(safe_params)\n\n if @property.save\n render json: @property, status: :created, location: @property\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def property_params\n params.require(:property).permit(:resource_id, :resource_type, :name, :value)\n end",
"def property_params\n params.require(:property).permit!\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to after_save_path, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:name, :address, :property_type, :description, :size_type, :rent, :date_available, :security_deposit, :image_urls, :landlord_id)\n end",
"def property_params\n params.require(:property).permit(:title, :property_type_id, :description)\n end",
"def create\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !check_permissions?(session[:user_type], \"create_property\")\n redirect_to root_path\n end\n @property = Property.new(property_params)\n respond_to do |format|\n if @property.save\n # , :, :in_unit_laundry, :parking\n add_property_feature(@property)\n format.html { redirect_to @property, notice: \"Property was successfully created.\" }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:name, :area, :price, :description, :property_type_id, :interest, :status, :user_id, :bed_rooms, :bath_rooms, :address, :county_id, :state_id, :city_id, :latitude, :longitude, :video_url, option_ids: [])\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def properties_params\n\t\t\tparams.require(:property).permit(:status,:address,:city,:state,:zip,:lat,:lon)\n\t\tend",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'new' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'new' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(\n :property_name,\n :property_address,\n :landlord_first_name,\n :landlord_last_name,\n :landlord_email,\n :tenancy_start_date,\n :tenancy_security_deposit,\n :tenancy_monthly_rent,\n :rented,\n :tenants_emails,\n :multiple_landlords, \n :other_landlords_emails\n )\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.properties = RecipeProperties.new(params[:recipe][:properties])\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:title, :propType, :address, :latitude, :longitude,:price, :beds, :rooms, :guests, :description, :user_id)\n end",
"def create\n @api_v1_property = Api::V1::Property.new(api_v1_property_params)\n\n if @api_v1_property.save\n render :show, status: :created, location: @api_v1_property\n else\n render json: @api_v1_property.errors, status: :unprocessable_entity\n end\n end",
"def property_params\n params.require(:property).permit(:name, :price, :population, :state, :region, :town, :kind, :position, :description)\n end",
"def create\n @n=0\n @property = Property.new(property_params)\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: \"Property was successfully created.\" }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:name, :description, :beds, :baths, :square_feet, :price, :address, :city, :state, :zip_code, :has_laundry, :has_parking, :image_url, :is_available, :date_available)\n end",
"def create\n key = params[:key]\n value = params[:value]\n if key\n begin\n Property.clear(key, nil, current_user.id)\n property=Property.create(:prop_key => key, :text_value => value, :user_id => current_user.id)\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json([property])) }\n format.xml { render :xml => properties_to_xml([property]) }\n format.text { render :text => text_not_supported }\n end\n\n rescue Exception => e\n render_error(e.message, 500)\n end\n else\n render_error('Bad request: missing key', 400)\n end\n end",
"def property_params\n params\n .require(:property)\n .permit(\n :name,\n :type_of_property,\n :street,\n :external_number,\n :internal_number,\n :neighborhood,\n :city,\n :country,\n :rooms,\n :bathrooms,\n :comments\n )\n end",
"def property_params\n params.require(:property).permit(:address, :apt, :city, :state, :zip)\n end",
"def property_params\n params.require(:property).permit(:number, :buildinginfo, :building_id, :suitedfor, :notes, :rented, :avatar)\n end",
"def create\n @notify_observer = NotifyObserver.new(params[:notify_observer])\n @notify_observer.save\n @properties = params[:notify_observer_properties]\n \n for property in @properties\n @notify_observer.notify_observer_properties.create(:name => property)\n end if @properties\n \n respond_to do |format|\n if @notify_observer.save\n format.html { redirect_to @notify_observer, :notice => 'Notify observer was successfully created.' }\n format.json { render :json => @notify_observer, :status => created, :location => @notify_observer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @notify_observer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n # Get features parameter\n features = params[:features]\n\n # Verify whether features array comes in the parameters list\n if features.present?\n # Intantiate & create features by property\n features_property_create = FeaturesPropertyCreate.new(@property)\n features_property_create.create(features, params[:quantities])\n end\n\n # Get photos parameter\n photos = params[:photos]\n\n # Verify whether photos array comes in the parameters list\n if photos.present?\n # Intantiate & create photos by property\n photo_create = PhotoCreate.new(@property)\n photo_create.create(photos)\n end\n\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n @property.user=current_person\n respond_to do |format|\n @property.add_location_to_property\n if @property.save\n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:code, :name, :description, :property_type_id, :static, :variant, :property_kind_id)\n end",
"def create\n @users_property = UsersProperty.new(users_property_params)\n\n respond_to do |format|\n if @users_property.save\n format.html { redirect_to @users_property, notice: 'Users property was successfully created.' }\n format.json { render :show, status: :created, location: @users_property }\n else\n format.html { render :new }\n format.json { render json: @users_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to [@category, @sub_category, @item, @property], notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:title, :description_short, :description_long, :city, :state, :country, :latitude, :longitude, :postcode, :image, :remote_image_url, :image_cache, :remove_image, :image_url, :property_pictures_attributes => [:id, :avatar_url, :name, :_destroy, :avatar_url_cache])\n end",
"def property_params\n #params.fetch(:property, {})\n params.require(:property).permit(:address, :suburb, :landsize, :bedrooms, :bathrooms, :private_parking, :expected_price)\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to [:admin, @property], notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:city, :number, :state, :street, :zip)\n end",
"def property_params\n params.require(:property).permit(:situation, :type_property, :status, :iptu,\n :project_id, :cep, :region, :district, :group,\n :block, :number, :address, :complement, :reference_point, \n :address_link_visible, :rooms, :unit, :value, :value_m2, \n :area, :suit, :parking_spaces, :floor, :sun_position, \n :link_tour, :value_rent,:description, :commercial, :elevator, :coverage, \n :expiration_date, :name, image_path: [], construction_companies_id: [], sellers_id: [], property_attribute_id: [])\n end",
"def create\n @property = Property.new(property_params)\n @property.landlord = authenticated_user\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to @property, notice: \"Property was successfully created.\" }\n format.json { render :show, status: :created, location: @property }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prop = Prop.new(prop_params)\n\n respond_to do |format|\n if @prop.save\n format.html { redirect_to @prop, notice: \"Prop was successfully created.\" }\n format.json { render :show, status: :created, location: @prop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:name, :address, :size, :units, :terms_available, :earliest_start_date, :application_fee, :monthly_rent)\n end",
"def create\n @property = Property.new\n respond_to do |format|\n begin\n success = @property.update_attributes(params[:property])\n rescue Exception => e\n @exception = { :message => e.message, :backtrace => e.backtrace.inspect }\n end\n\n if success\n format.xml { render :xml => property_presenter, :status => :created }\n format.json { render :json => property_presenter, :status => :created }\n elsif @exception\n format.xml { render :xml => @exception, :status => :internal_server_error }\n format.json { render :json => @exception, :status => :internal_server_error }\n else\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n format.json { render :json => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @property_detail = PropertyDetail.new(property_detail_params)\n\n respond_to do |format|\n if @property_detail.save\n format.html { redirect_to @property_detail.property, notice: 'Property detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @property_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @property_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_properties(properties); end",
"def property_params\n params.require(:property).permit(\n :value_type, :measurement_unit_id, :unit_pricing, :searchable,\n :name, :external_name\n )\n end",
"def create\n property = Property.new(property_params)\n\n if property.save\n respond_with property\n else\n head status: :expectation_failed\n return false\n end\n end",
"def property_params\n params.require(:property).permit(:id, :auctionStatus, :caseID, :caseType, :judgement, :assesed, :parcel, :address, :city, :state, :zip, :legal, :beds, :baths, :area, :lot, :year, :estimate, :rentEstimate, :zillow, :date)\n end",
"def relationship_set_props id, data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n\n put_request 'relationship/' + id + '/properties', data, headers\n end",
"def create\n authorize_action_for Property, at: current_store\n @property = current_store.properties.build(property_params.merge(priority: current_store.properties.count))\n\n respond_to do |format|\n if @property.save\n track @property\n format.html { redirect_to edit_admin_property_path(@property),\n notice: t('.notice', property: @property) }\n format.json { render :show, status: :created, location: admin_property_path(@property) }\n else\n format.html { render :new }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(property_params)\n @property.rent_table_version = 0\n @property.lease_base_rent = @property.current_rent\n @property.user_id = current_user.id\n\n if !(@property.owner_person_is.nil? || @property.owner_person_is==0)\n if @property.owner_person_is == 1 && [email protected]_entity_id_indv.nil?\n @property.owner_entity_id = @property.owner_entity_id_indv\n end\n else\n @property.owner_entity_id = @property.owner_entity_id_indv = 0\n end\n\n respond_to do |format|\n if @property.save\n AccessResource.add_access({ user: current_user, resource: @property })\n flash[:success] = \"Congratulations, you have just created a record for #{@property.title}\"\n format.html { redirect_to edit_property_path(@property.key, type_is: 'basic_info') }\n # format.html { redirect_to properties_path }\n format.js { render json: @property.to_json, status: :ok }\n format.json { render action: 'show', status: :created, location: @property }\n else\n # flash[:error] = \"Failed to create new property.\"\n format.html { render action: 'new' }\n format.js { render action: 'new', status: :unprocessable_entity, layout: false }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @property_form.submit(params[:property])\n format.html { redirect_to properties_path, notice: 'Property was successfully created.' }\n format.json { render json: {message:'Property successfully created!', id:@property_form.property.id}, status: :created, location:properties_path }\n else\n format.html { render action: 'index' , error: 'An error prevented the property from being created.'}\n format.json { render json: @property_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:country, :province, :city, :address, :holding_type, :project_name, :project_code, :property_name, :property_code, :main_photo, :cover_photo, :city_location_photo, :description, :price, :featured, :latitude, :longitude, :facilities => [], :gallery_photos => [], :floor_plan_photos => [])\n end",
"def property_params\n params.require(:property).permit(\n :marketing_name,\n :website,\n :description,\n :contact_email,\n :contact_phone,\n :street,\n :city,\n :state,\n :zip,\n :latitude,\n :longitude,\n :pet_dog,\n :pet_cat,\n :amenities,\n { floorplan_ids: [] },\n )\n end",
"def property_params\n params.require(:property).permit(:business_name, :street_address, :city, :state, :zip, :mdu, :units, :content)\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n value: @resource[:value]\n }\n end",
"def property_params\n params.require(:property).permit(:lol3, :unit, :group, :tenantid, :resident_name, :resident_rent, :unit_rent, :discount, :status, :days_vacant, :move_out, :lease_to, :amenities, :amenities_amount, :discounts, :company_id, :unit_type_id)\n end",
"def create\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive => @resource[:primitive],\n :node_name => @resource[:node_name],\n :score => @resource[:score],\n :resource_discovery => @resource[:resource_discovery],\n :cib => @resource[:cib],\n :rule => @resource[:rule]\n }\n end",
"def property_params\n params.require(:property).permit(:street_address_1, :street_address_2, :city, :state_id, :postal_code)\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n first: @resource[:first],\n second: @resource[:second],\n kind: @resource[:kind],\n symmetrical: @resource[:symmetrical],\n new: true\n }\n end",
"def properties_value_params\r\n params.fetch(:properties_value, {}).permit(:value, :property_id, :is_show_website)\r\n end",
"def property_params\n params.require(:property).permit(:state_policy_id, :stop_initiating_evictions, :stop_enforcing_evictions, :grace_period_or_security_deposit_towards_rent, :froze_utility_shut_offs, :froze_mortgage_payments)\n end",
"def property_params\n params.require(:property).permit(:Code, :County, :Price, :CurrentPrice, :Shares, :Rate, :ShareValue, :locality, :LR, :Title, :Reason, :StartOffer, :EndOffer, :user_id, :Area_of_land, :brochure)\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to(@property, :notice => 'Property was successfully created.') }\n format.xml { render :xml => @property, :status => :created, :location => @property }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:price, :arv, :street, :city, :state, :zip_code, :nbeds, :nbath, :description, :sqft, :property_category, :number_unit, :year_built, :rental_rating, :parking, :lot_size, :zoning, :PropertyListing_id, :defaultimage, :PropertyType_id, :rehab_cost, :photo_data => [])\n end",
"def create\n @location_property = LocationProperty.new(params[:location_property])\n\n respond_to do |format|\n if @location_property.save\n format.html { redirect_to @location_property, notice: 'Location property was successfully created.' }\n format.json { render json: @location_property, status: :created, location: @location_property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params[:property]\n end",
"def create\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive => @resource[:primitive],\n :node_name => @resource[:node_name],\n :node_score => @resource[:node_score],\n :rules => @resource[:rules],\n :cib => @resource[:cib],\n }\n end",
"def property_params\n pp = params.require(:property).permit(:title, :info, :description, :status, :development_id, :property_type_id, :age, :environments, :garages, :bathrooms, :toilettes, :expenses, :sale_price, :sale_currency, :rent_price, :rent_currency, :area_unit, :constructed_area, :unconstructed_area, :zone_id, :address, :zip_code, :lat, :lng)\n pp[:expenses].tr!('.', '') if pp[:expenses].present?\n pp[:sale_price].tr!('.', '') if pp[:sale_price].present?\n pp[:rent_price].tr!('.', '') if pp[:rent_price].present?\n pp[:constructed_area].tr!('.', '') if pp[:constructed_area].present?\n pp[:unconstructed_area].tr!('.', '') if pp[:unconstructed_area].present?\n return pp\n end",
"def create\n @property_field = PropertyField.new(params[:property_field])\n\n respond_to do |format|\n if @property_field.save\n format.html { redirect_to @property_field.property, notice: 'Property field was successfully created.' }\n format.json { render json: @property_field, status: :created, location: @property_field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n flash[:notice] = 'Property was successfully created.'\n format.html { redirect_to admin_property_url(@property) }\n format.xml { head :created, :location => admin_property_url(@property) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @property.errors.to_xml }\n end\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n node_name: @resource[:node_name],\n score: @resource[:score],\n resource_discovery: @resource[:resource_discovery]\n }\n end",
"def property_params\n params.require(:property).permit(:ad_type, :property_type, :country, :sponsored, :price, :bedroom, :bathroom, :area, :description, :city, { photos: [] })\n end",
"def property_params\n params.require(:property).permit(:id,:account_id,:featured,:comision,:duenos_id,:descripcion,:tipoOp,:tipoProp, :zona, :colonia, :precio, :mConst, :mTerreno, :banos,:ac,:alarm,:lift,:balcony,:furnished,:bbq,:heating,:fireplace,:backyard,:pool,:terrace,:security,:comision, :recamaras,:cover_picture,pictures: [],ids: [])\n end",
"def create\n @quick_property = QuickProperty.new(params[:quick_property])\n\n respond_to do |format|\n if @quick_property.save\n format.html { redirect_to @quick_property, notice: 'Quick property was successfully created.' }\n format.json { render json: @quick_property, status: :created, location: @quick_property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quick_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n node_name: @resource[:node_name],\n score: @resource[:score],\n rules: @resource[:rules],\n resource_discovery: @resource[:resource_discovery]\n }\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n users = User.all\n users.each { |u|\n options = {\n :registration_id => u.registration_id,\n :message => \"New property added to Property Market!\",\n :id => @property.id,\n :name => @property.name,\n :ptype => @property.ptype,\n :collapse_key => @property.id.to_s\n }\n puts options.inspect\n response = SpeedyC2DM::API.send_notification(options)\n puts response.inspect\n }\n \n\n \n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def properties=(value)\n @properties = value\n end",
"def users_property_params\n params.require(:users_property).permit(:user_id, :property, :property_value)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def property_params\n params.require(:property).permit(:type_of_offer,:price, :brunk_type, :brunk, :parking_lot, :property_type, :runner_id, :country_id, :department, :city, :address, :latitude, :length, :prince, :stratum, :area, :blueprints, :number_bedrooms, :number_bathrooms, :levels, :state, :state_favorite, :url_video, :images, property_images_attributes: [:id, :property_id, :runner_id, :file, :_destroy])\n end",
"def create_property\n @p = Property.create(address: params[:address], state: params[:state], city: params[:city])\n redirect_to '/'\n end",
"def create\n @property_user = PropertyUser.new(params[:property_user])\n\n respond_to do |format|\n if @property_user.save\n format.html { redirect_to @property_user, notice: 'Property user was successfully created.' }\n format.json { render json: @property_user, status: :created, location: @property_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sys_property = Sys::Property.new(sys_property_params)\n\n respond_to do |format|\n if @sys_property.save\n format.html { redirect_to @sys_property, notice: 'Property was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sys_property }\n else\n format.html { render action: 'new' }\n format.json { render json: @sys_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def property_params\n params.require(:property).permit(:title, :short_desc, :price, :property_for, :landmark, :facing,\n :location, :property_in, :total_no_of_floors, :bed_rooms,\n :total_rooms, :bathrooms, :parking, :flooring, :furnishing,\n :open_for_inspection, :address, :city, :district, :zipcode,\n :available_from, :photo, :contact_hours, :long_desc, :property_type, \n :rent, :saleable_area, :gross_area, :vacant_or_possession, :landlord_name, \n :hkid_no, :furniture_and_fittings, :electronic_appliences, :no_of_keys,\n :other_assets, :terms_and_conditions_of_sale, :accept_short_lease, :accept_shared_rent,\n :require_income_proof, :deposite, :tenancy_terms, :fixed_period, :break_clause_notice,\n :availablity_date, :rent_inclusive_of_management_fee, :rent_inclusive_of_gov_rent,\n :meter_reading, :rent, :property_type, :available_for_rent, :available_for_sale,\n :balcony, :rooftop, :clubhouse, :swiming_pool, :gym_room, :shuttle_bus, :sea_view,\n :building_name, :flat, :street, :year_build, :private_garden, :pet_allowed, :expiration_date,\n :parking_garage, :private_parking_space, property_images_attributes: [:id, :photo, :_destroy]\n )\n end",
"def property_detail_params\n params.require(:property_detail).permit(:property_id, :name, :source_type, :source_contact, :status, :date_of_contact, :requirements, :comments)\n end",
"def api_v1_property_params\n params.require(:api_v1_property).permit(:title, :description)\n end",
"def api_v1_property_params\n params.require(:api_v1_property).permit(:title, :description)\n end",
"def create\n @propuestum = Propuestum.new(propuestum_params)\n\n respond_to do |format|\n if @propuestum.save\n format.html { redirect_to @propuestum, notice: 'Propuestum was successfully created.' }\n format.json { render :show, status: :created, location: @propuestum }\n else\n format.html { render :new }\n format.json { render json: @propuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_property( propname, value )\n params = { 'prop' => propname, 'value' => value }\n resp = conn.post( '/users/'+name+'/props/', params )\n \n case resp.code.to_i\n when 201\n return\n when 404\n raise RestAuthUserNotFound.new( resp )\n when 409\n raise RestAuthPropertyExists.new( resp )\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def create\n @property = Property.new(property_params)\n\n respond_to do |format|\n if @property.save\n format.html { redirect_to user_path(@property.user_id) }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @auth_property = AuthProperty.new(auth_property_params)\n @token.authProperties << @auth_property\n\n respond_to do |format|\n if @auth_property.save\n format.html { redirect_to [@owner, @token, @auth_property], notice: 'Auth property was successfully created.' }\n format.json { render :show, status: :created, location: @auth_property }\n else\n format.html { render :new }\n format.json { render json: @auth_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chef_property = ChefProperty.new(chef_property_params)\n\n respond_to do |format|\n if @chef_property.save\n format.html { redirect_to @chef_property, notice: 'Chef property was successfully created.' }\n format.json { render :show, status: :created, location: @chef_property }\n else\n format.html { render :new }\n format.json { render json: @chef_property.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7252889",
"0.70592815",
"0.704662",
"0.7033797",
"0.7011505",
"0.6940878",
"0.69251686",
"0.69003457",
"0.68883616",
"0.68742",
"0.68607503",
"0.6831917",
"0.6831917",
"0.6831917",
"0.6831917",
"0.6831917",
"0.6831917",
"0.6831917",
"0.6801031",
"0.67961967",
"0.67936516",
"0.67936516",
"0.6771883",
"0.67659575",
"0.67659575",
"0.67432475",
"0.67350864",
"0.673306",
"0.67020166",
"0.66994846",
"0.6692995",
"0.6692982",
"0.6652709",
"0.66447794",
"0.6643982",
"0.6628447",
"0.66072303",
"0.6596844",
"0.6589824",
"0.6581533",
"0.6581249",
"0.6573622",
"0.6571733",
"0.6545733",
"0.6531466",
"0.6526447",
"0.6503088",
"0.6500882",
"0.64839166",
"0.64722985",
"0.6470817",
"0.64702153",
"0.6446458",
"0.6434946",
"0.6431508",
"0.64301383",
"0.64128435",
"0.63893515",
"0.63874584",
"0.6383942",
"0.6372047",
"0.6365978",
"0.63652486",
"0.6345213",
"0.6344337",
"0.63332075",
"0.6320358",
"0.6299322",
"0.6293917",
"0.6292363",
"0.6287805",
"0.6286977",
"0.6284299",
"0.62806773",
"0.6276693",
"0.62719494",
"0.62719214",
"0.62588876",
"0.62541926",
"0.6252342",
"0.62501484",
"0.6249755",
"0.6245288",
"0.62445563",
"0.62429476",
"0.62429476",
"0.62347895",
"0.622952",
"0.62210846",
"0.6220648",
"0.6220156",
"0.6199673",
"0.61964643",
"0.619568",
"0.6169578",
"0.6169578",
"0.6160237",
"0.6157446",
"0.6131737",
"0.61244535",
"0.6124043"
] | 0.0 | -1 |
PUT /properties/1 PUT /properties/1.json | def update
@property = Property.find(params[:id])
unless params[:property][:photos_attributes].nil?
params[:property][:photos_attributes].each_key { |key|
if params[:property][:photos_attributes][key.to_sym][:remove_file] == "1"
@photo = Photo.find(params[:property][:photos_attributes][key.to_sym][:id])
@photo.remove_file!
@photo.destroy
params[:property][:photos_attributes].delete(key.to_sym)
end
}
end
respond_to do |format|
if @property.update_attributes(params[:property])
format.html { redirect_to [:admin, @property], notice: 'Inmueble actualizado.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @property.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @property = Property.find(params[:id])\n\n if @property.update(property_params)\n head :no_content\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n if @property.update(params[:property])\n head :no_content\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end",
"def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"def update\n if @api_v1_property.update(api_v1_property_params)\n render :show, status: :ok, location: @api_v1_property\n else\n render json: @api_v1_property.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update\n puts 'kkkkkkkkkkkkkkkkkkkkk'\n puts property_params\n\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relationship_set_props id, data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n\n put_request 'relationship/' + id + '/properties', data, headers\n end",
"def update\n p = recipe_params\n @recipe.properties = RecipeProperties.new(p.delete(:properties))\n respond_to do |format|\n if @recipe.update(p)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to [@category, @sub_category, @item, @property], notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relationship_set_property id, name, value\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n put_request 'relationship/' + id + '/properties/' + name, value, headers\n end",
"def update\n if !check_permissions?(session[:user_type], \"edit_property\")\n redirect_to root_path\n end\n puts \"The params in update are\",params\n respond_to do |format|\n if @property.update(property_params)\n add_property_feature(@property)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n # Remove all features by property objects\n @property.features_properties.delete_all\n\n # Get features parameter\n features = params[:features]\n\n # Verify whether features array comes in the parameters list\n if features.present?\n # Intantiate & create features by property\n features_property_create = FeaturesPropertyCreate.new(@property)\n features_property_create.create(features, params[:quantities])\n end\n\n # Remove all photos by property objects\n #@property.photos.delete_all\n\n # Get photos parameter\n photos = params[:photos]\n\n # Verify whether photos array comes in the parameters list\n if photos.present?\n # Intantiate & create photos by property\n photo_create = PhotoCreate.new(@property)\n photo_create.create(photos)\n end\n\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_property\n @api_v1_property = Property.find(params[:id])\n end",
"def update\n @property = Property.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @property\n begin\n success = @property.update_attributes(params[:property])\n rescue Exception => e\n @exception = { :message => e.message, :backtrace => e.backtrace.inspect }\n end\n\n if success\n format.xml { render :xml => property_presenter, :status => :accepted }\n format.json { render :json => property_presenter, :status => :accepted }\n elsif @exception\n format.xml { render :xml => @exception, :status => :internal_server_error }\n format.json { render :json => @exception, :status => :internal_server_error }\n else\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n format.json { render :json => @property.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to after_save_path, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to(@property, :notice => 'Property was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to [:admin, @property], notice: 'Property was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_property\n @api_v1_property = Property.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @request_property.update(request_property_params)\n format.html { redirect_to @request_property, notice: 'Request property was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_property }\n else\n format.html { render :edit }\n format.json { render json: @request_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quick_property = QuickProperty.find(params[:id])\n\n respond_to do |format|\n if @quick_property.update_attributes(params[:quick_property])\n format.html { redirect_to @quick_property, notice: 'Quick property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n flash[:notice] = 'Property was successfully updated.'\n format.html { redirect_to(@property) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @property.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prop.update(prop_params)\n format.html { redirect_to @prop, notice: \"Prop was successfully updated.\" }\n format.json { render :show, status: :ok, location: @prop }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: \"物件情報を更新しました\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_form.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render json: {message:'Property successfully updated!', id:@property.id}, status: :accepted }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end",
"def update\n respond_to do |format|\n if @property_detail.update(property_detail_params)\n format.html { redirect_to @property_detail, notice: 'Property detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n flash[:notice] = 'Property was successfully updated.'\n format.html { redirect_to admin_property_url(@property) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @property.errors.to_xml }\n end\n end\n end",
"def update\n authorize_action_for @property, at: current_store\n\n respond_to do |format|\n if @property.update(property_params)\n track @property\n format.html { redirect_to admin_property_path(@property),\n notice: t('.notice', property: @property) }\n format.json { render :show, status: :ok, location: admin_property_path(@property) }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"def set_property( propname, value )\n params = { 'value' => value }\n resp = conn.put('/users/'+name+'/props/'+propname+'/', params)\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 201\n return\n when 404\n raise RestAuthResourceNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def update\n if @property.user.id != @user.id\n redirect_to properties_path, notice:\"Not authorized\"\n end\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n property=Property.find(params[:id]) \n if property.update(params[:property].permit(:property_name,:property_desc,:property_price,:property_address))\n render json: {errors:property.errors.full_messages}\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to user_path(@property.user_id) }\n else\n format.html { render :edit }\n end\n end\n end",
"def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update\n @contact = Contact.find(params[:contact_id])\n @property = Property.find(params[:id])\n authorize @property\n\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to edit_contact_path(@contact), notice: 'Property was successfully updated.' }\n format.json { redirect_to edit_contact_path(@contact), status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property = Property.find(params[:id])\n if @property.update_attributes(property_params)\n redirect_to(:action => 'show', :id => @property.id)\n else\n render('index')\n end\n end",
"def update\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n if @location_property.update_attributes(params[:location_property])\n format.html { redirect_to @location_property, notice: 'Location property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_property.update(client_property_params)\n format.html { redirect_to @client_property, notice: 'Client property was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_property }\n else\n format.html { render :edit }\n format.json { render json: @client_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property_field = PropertyField.find(params[:id])\n\n respond_to do |format|\n if @property_field.update_attributes(params[:property_field])\n format.html { redirect_to @property_field, notice: 'Property field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def update\n @property_user = PropertyUser.find(params[:id])\n\n respond_to do |format|\n if @property_user.update_attributes(params[:property_user])\n format.html { redirect_to @property_user, notice: 'Property user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_property\n @api_v1_property = Api::V1::Property.find(params[:id])\n end",
"def update\n respond_to do |format|\n if(@property.user == current_person || current_person== current_admin)\n\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n\n else\n format.html { redirect_to @property, alert: 'Please update your property only.' }\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @youtube_uri = args[:youtube_uri] if args.key?(:youtube_uri)\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\n @prop = Prop.find(params[:id])\n\n respond_to do |format|\n if @prop.update_attributes(params[:prop])\n format.html { redirect_to(@prop, :notice => 'Prop was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prop.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"def update\n @sample_property = SampleProperty.find(params[:id])\n @sample = Sample.find(@sample_property.sample_id)\n respond_to do |format|\n if @sample_property.update_attributes(params[:sample_property])\n format.html { redirect_to project_sample_set_sample_path(params[:project_id],params[:sample_set_id],@sample), notice: 'Sample property was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"Property was not Updated: #{@sample_property.errors.messages[:error][0]}.\"\n format.html { redirect_to project_sample_set_sample_property_path(params[:project_id],params[:sample_set_id],params[:sample_id],@sample_property) }\n format.json { render json: @sample_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def set_property\n @property = Property.find(params[:id])\n end",
"def put_properties!(properties = {})\r\n raise WAZ::Blobs::InvalidOperation if self.snapshot_date\r\n self.class.service_instance.set_blob_properties(path, properties)\r\n end"
] | [
"0.71732235",
"0.71470046",
"0.70486635",
"0.69714004",
"0.6937445",
"0.6937445",
"0.6937445",
"0.6937445",
"0.6937445",
"0.6879232",
"0.68430614",
"0.6842351",
"0.6835369",
"0.6835369",
"0.6835369",
"0.6799251",
"0.6795511",
"0.6795511",
"0.67801327",
"0.67801327",
"0.67801327",
"0.67801327",
"0.67801327",
"0.67801327",
"0.67801327",
"0.67801327",
"0.6769227",
"0.67654145",
"0.67516",
"0.67424935",
"0.66975695",
"0.6636704",
"0.66366464",
"0.66306376",
"0.6624423",
"0.659824",
"0.65719587",
"0.65654194",
"0.6563444",
"0.6556041",
"0.64987504",
"0.6481504",
"0.6472498",
"0.6472459",
"0.6437623",
"0.64307564",
"0.64023453",
"0.6388583",
"0.6387893",
"0.6361475",
"0.6350285",
"0.63399035",
"0.63399035",
"0.6332157",
"0.6330003",
"0.6318279",
"0.6256558",
"0.6244918",
"0.62311924",
"0.6226981",
"0.6223395",
"0.6172531",
"0.6170976",
"0.61612785",
"0.61612785",
"0.61612785",
"0.61612785",
"0.61559135",
"0.61362094",
"0.61356056",
"0.61293787",
"0.6105825",
"0.61032706",
"0.610194",
"0.61013126",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.6075534",
"0.60753995"
] | 0.0 | -1 |
DELETE /properties/1 DELETE /properties/1.json | def destroy
@property = Property.find(params[:id])
property_address = @property.address
@property.destroy
respond_to do |format|
format.html do
flash[:success] = "El inmueble ubicado en #{property_address.upcase} fue eliminado correctamente."
redirect_to admin_root_path(:anchor => 'properties')
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end",
"def delete_property(id)\n delete(\"/properties/#{id}\")\n end",
"def destroy\n @property.photos.delete_all\n @property.features_properties.delete_all\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n head :no_content\n end",
"def destroy\n begin\n if params[:id]\n Property.clear(params[:id], nil, current_user.id)\n end\n render_success(\"Property deleted\")\n rescue Exception => e\n logger.error(\"Fails to execute #{request.url} : #{e.message}\")\n render_error(e.message)\n end\n end",
"def delete\n @property = Property.find(params[:id])\n end",
"def destroy\n @api_v1_property.destroy\n end",
"def destroy\n properties_delete(@property)\n @property.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to my_properties_properties_url , notice: \"Property was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to(properties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prop = Prop.find(params[:id])\n @prop.destroy\n\n respond_to do |format|\n format.html { redirect_to props_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to(properties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: \"Property was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to runner_home_path, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_properties_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @property.destroy\n\n head :no_content\n end",
"def delete_property property_name\n\n begin\n raise 'Property name not specified.' if property_name.empty?\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.delete(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200\n\n rescue Exception => e\n print e\n end\n\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n format.js { render nothing: true}\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to propertys_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_detail.destroy\n respond_to do |format|\n format.html { redirect_to property_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to category_sub_category_item_properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end",
"def del_property( propname )\n resp = conn.delete('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 204\n return\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_properties_url }\n format.json { head :ok }\n end\n end",
"def delete_property property_name\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.delete(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return true\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def destroy\n @request_property.destroy\n respond_to do |format|\n format.html { redirect_to request_properties_url, notice: 'Request property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_property.destroy\n respond_to do |format|\n format.html { redirect_to client_properties_url, notice: 'Client property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quick_property = QuickProperty.find(params[:id])\n @quick_property.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prop.destroy\n respond_to do |format|\n format.html { redirect_to props_url, notice: \"Prop was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to after_destroy_path, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id]).destroy\n redirect_to(:action => 'index')\n end",
"def destroy\n @prop = Prop.find(params[:id])\n @prop.destroy\n\n respond_to do |format|\n format.html { redirect_to(props_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: \"物件情報を消去しました\" }\n format.json { head :no_content }\n end\n end",
"def delete_property property_name\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n if property_name == ''\n raise 'Property name not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response_stream = RestClient.delete(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return true\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def destroy\n @location_property = LocationProperty.find(params[:id])\n @location_property.destroy\n\n respond_to do |format|\n format.html { redirect_to location_properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_field = PropertyField.find(params[:id])\n @property_field.destroy\n\n respond_to do |format|\n format.html { redirect_to property_fields_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize_action_for @property, at: current_store\n track @property\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_properties_path,\n notice: t('.notice', property: @property) }\n format.json { head :no_content }\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @property = Property.find(params[:property_id])\n @prenotation.destroy\n respond_to do |format|\n format.html { redirect_to property_prenotations_path(@property), notice: 'Prenotazione eliminata con successo.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chef_property.destroy\n respond_to do |format|\n format.html { redirect_to chef_properties_url, notice: 'Chef property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:contact_id])\n @property = Property.find(params[:id])\n authorize @property\n @property.destroy\n respond_to do |format|\n format.html { redirect_to edit_contact_path(@contact), notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, alert: @property.errors[:base][0] }\n format.json { head :ok }\n end\n end",
"def destroy\n @sample_property = SampleProperty.find(params[:id])\n @sample = Sample.find(@sample_property.sample_id)\n @sample_property.destroy\n\n respond_to do |format|\n format.html { redirect_to project_sample_set_sample_path(params[:project_id],params[:sample_set_id],@sample) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_property.destroy\n respond_to do |format|\n format.html { redirect_to line_properties_url, notice: 'Line property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @property.user.id != @user.id\n redirect_to properties_path, notice:\"Not authorized\"\n end\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n end\n end",
"def destroy\n @users_property.destroy\n respond_to do |format|\n format.html { redirect_to users_properties_url, notice: 'Users property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_attachment.destroy\n respond_to do |format|\n format.html { redirect_to property_attachments_url, notice: \"Property attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_note.destroy\n respond_to do |format|\n format.html { redirect_to property_notes_url, notice: t('.notice') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stolen_property.destroy\n respond_to do |format|\n format.html { redirect_to stolen_properties_url, notice: 'Stolen property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @r_property_definition.destroy\n respond_to do |format|\n format.html { redirect_to r_property_definitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_owner.destroy\n respond_to do |format|\n format.html { redirect_to property_owners_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @auth_property.destroy\n respond_to do |format|\n format.html { redirect_to owner_token_auth_properties_path [@owner, @token], notice: 'Auth property 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 @sys_property.destroy\n respond_to do |format|\n format.html { redirect_to sys_properties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @horizontal_property.destroy\n respond_to do |format|\n format.html { redirect_to act_path(@act), notice: 'Horizontal property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_properties(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = delete_properties_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = delete_properties_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def destroy\n @checklist_property = ChecklistProperty.find(params[:id])\n @checklist_property.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_user = PropertyUser.find(params[:id])\n @property_user.destroy\n\n respond_to do |format|\n format.html { redirect_to property_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_heating.destroy\n respond_to do |format|\n format.html { redirect_to property_heatings_url, notice: 'Property heating 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_property_item.destroy\n respond_to do |format|\n format.html { redirect_to line_property_items_url, notice: 'Line property item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to user_path(@property.user_id) }\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 @contact_property.destroy\n respond_to do |format|\n format.html { redirect_to contact_properties_url, notice: 'Contact property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !check_permissions?(session[:user_type], \"checkin_applicant\")\n redirect_to root_path\n end\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: \"Property was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy_many\n @properties = Property.where(id: params[:ids])\n @properties.destroy_all\n respond_to do |format|\n format.html { redirect_to after_destroy_path, notice: 'Properties where successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_closet.destroy\n respond_to do |format|\n format.html { redirect_to property_closets_url, notice: 'Property closet 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 @propose = Propose.find(params[:id])\n @propose.destroy\n\n respond_to do |format|\n format.html { redirect_to proposes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner_property.destroy\n respond_to do |format|\n format.html { redirect_to owner_owner_properties_url(@owner), notice: 'Owner property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_image = PropertyImage.find(params[:id])\n @property_image.destroy\n\n respond_to do |format|\n format.html { redirect_to property_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def destroy\n @prop_value = PropValue.find(params[:id])\n @prop_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(prop_values_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def destroy\n @property_service_type.destroy\n respond_to do |format|\n format.html { redirect_to property_service_types_url, notice: 'Property service type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property = Property.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @property\n success = @property.try(:deactivate!) rescue false\n \n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => property_presenter, :status => :precondition_failed }\n format.json { render :json => property_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @property_toilet_artifact.destroy\n respond_to do |format|\n format.html { redirect_to property_toilet_artifacts_url, notice: 'Property toilet artifact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_picture = PropertyPicture.find(params[:id])\n @property_picture.destroy\n\n respond_to do |format|\n format.html { redirect_to property_pictures_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @component_prop.destroy\n respond_to do |format|\n format.html { redirect_to component_props_url, notice: 'Component prop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end"
] | [
"0.7364613",
"0.73575217",
"0.73575217",
"0.73561615",
"0.73561615",
"0.73491865",
"0.73491865",
"0.7317726",
"0.7288179",
"0.727353",
"0.7259411",
"0.7255245",
"0.72499126",
"0.7248999",
"0.72075725",
"0.7179407",
"0.71657205",
"0.7145741",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.711052",
"0.71061295",
"0.7086546",
"0.7081039",
"0.7078751",
"0.70746523",
"0.70622784",
"0.70573986",
"0.7027524",
"0.70243853",
"0.7011602",
"0.7008798",
"0.69632506",
"0.6958396",
"0.6956685",
"0.6949512",
"0.6934311",
"0.6927564",
"0.6915517",
"0.6913269",
"0.6878975",
"0.6869542",
"0.68214214",
"0.68098414",
"0.67935514",
"0.6786618",
"0.67614657",
"0.67589116",
"0.67570007",
"0.67345506",
"0.67139906",
"0.66929305",
"0.6665738",
"0.666376",
"0.6643128",
"0.6639561",
"0.66387105",
"0.65802586",
"0.65793675",
"0.65658665",
"0.6562217",
"0.65543944",
"0.65451974",
"0.6539791",
"0.65361685",
"0.65151215",
"0.650864",
"0.6506235",
"0.65051055",
"0.65038985",
"0.64994854",
"0.6487326",
"0.6474795",
"0.64714885",
"0.64713573",
"0.6468518",
"0.64681435",
"0.6466824",
"0.64542174",
"0.64419425",
"0.64153636",
"0.64064294",
"0.6400464",
"0.6395498",
"0.639447",
"0.637895",
"0.6341043",
"0.63305557",
"0.6326944",
"0.6316105",
"0.63030213",
"0.6293381",
"0.6261906"
] | 0.65210307 | 72 |
Create a new Camapign | def create(options=nil)
valid_param?(:options, options, Hash, true)
if not options[:brand_id]
raise_invalid_request("brand_id must be provided")
end
if not options[:vertical]
raise_invalid_request("vertical must be provided")
end
if not options[:usecase]
raise_invalid_request("usecase must be provided")
end
if not options[:message_flow]
raise_invalid_request("message_flow must be provided")
end
if not options[:help_message]
raise_invalid_request("help_message must be provided")
end
if not options[:optout_message]
raise_invalid_request("optout_message must be provided")
end
perform_create(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camCreate _obj, _args\n \"_obj camCreate _args;\" \n end",
"def create\n @camino = Camino.new(camino_params)\n\n respond_to do |format|\n if @camino.save\n format.html { redirect_to @camino, notice: 'Camino was successfully created.' }\n format.json { render :show, status: :created, location: @camino }\n else\n format.html { render :new }\n format.json { render json: @camino.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capacitacion = Capacitacion.new(params[:capacitacion])\n\n respond_to do |format|\n if @capacitacion.save\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully created.' }\n format.json { render json: @capacitacion, status: :created, location: @capacitacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @capacitacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @signature = Signature.new(params[:signature])\n\n respond_to do |format|\n if @signature.save\n format.html { redirect_to(@signature, :notice => 'La asignatura se ha creado correctamente.') }\n format.xml { render :xml => @signature, :status => :created, :location => @signature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @signature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @capacidad = Capacidad.new(capacidad_params)\n\n respond_to do |format|\n if @capacidad.save\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully created.' }\n format.json { render :show, status: :created, location: @capacidad }\n else\n format.html { render :new }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capacidad = Capacidad.new(params[:capacidad])\n\n respond_to do |format|\n if @capacidad.save\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully created.' }\n format.json { render json: @capacidad, status: :created, location: @capacidad }\n else\n format.html { render \"new\" }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imagecapturing = Imagecapturing.new(imagecapturing_params)\n\n respond_to do |format|\n if @imagecapturing.save\n format.html { redirect_to @imagecapturing, notice: 'Imagecapturing was successfully created.' }\n format.json { render :show, status: :created, location: @imagecapturing }\n else\n format.html { render :new }\n format.json { render json: @imagecapturing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capture = Capture.new(params[:capture])\n\n respond_to do |format|\n if @capture.save\n format.html { redirect_to @capture, notice: 'Capture was successfully created.' }\n format.json { render json: @capture, status: :created, location: @capture }\n else\n format.html { render action: \"new\" }\n format.json { render json: @capture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capture = Capture.new(capture_params)\n\n respond_to do |format|\n if @capture.save\n format.html { redirect_to @capture, notice: 'Capture was successfully created.' }\n format.json { render action: 'show', status: :created, location: @capture }\n else\n format.html { render action: 'new' }\n format.json { render json: @capture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sign = Sign.new(sign_params)\n if @sign.save\n respond_with(@sign)\n else\n @error = \"签到 失败 !\"\n respond_with(@error)\n end\n end",
"def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully created.' }\n format.json { render json: @asignatura, status: :created, location: @asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cotiz_mes_cam = CotizMesCam.new(cotiz_mes_cam_params)\n\n respond_to do |format|\n if @cotiz_mes_cam.save\n format.html { redirect_to @cotiz_mes_cam, notice: 'Cotiz mes cam was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_mes_cam }\n else\n format.html { render :new }\n format.json { render json: @cotiz_mes_cam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\tresult = Cloudinary::Uploader.upload(foto_params[:src])\n\t@foto = @proyecto.fotos.build(foto_params) do |t|\n t.src = result['url']\n\t\tt.public_id = result['public_id']\n end\n\tif @foto.save\n redirect_to @proyecto\n else\n render :new\n end\n end",
"def create\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.new(params[:capacite])\n\n respond_to do |format|\n if @capacite.save\n format.html { redirect_to @capacite, notice: 'Capacite a été crée avec succès.' }\n format.json { render json: @capacite, status: :created, location: @capacite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @capacite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv = Cv.new(cv_params)\n\n respond_to do |format|\n if @cv.save\n format.html { redirect_to @cv, notice: 'Cv was successfully created.' }\n format.json { render :show, status: :created, location: @cv }\n else\n format.html { render :new }\n format.json { render json: @cv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv = Cv.new(cv_params)\n\n respond_to do |format|\n if @cv.save\n format.html { redirect_to @cv, notice: 'Cv was successfully created.' }\n format.json { render :show, status: :created, location: @cv }\n\n else\n format.html { render :new }\n format.json { render json: @cv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coleccion_imagene = ColeccionImagene.new(coleccion_imagene_params)\n\n respond_to do |format|\n if @coleccion_imagene.save\n format.html { redirect_to @coleccion_imagene, notice: 'Coleccion imagene was successfully created.' }\n format.json { render :show, status: :created, location: @coleccion_imagene }\n else\n format.html { render :new }\n format.json { render json: @coleccion_imagene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sigil = Sigil.new(sigil_params)\n\n respond_to do |format|\n if @sigil.save\n format.html { redirect_to @sigil, notice: 'Sigil was successfully created.' }\n format.json { render :show, status: :created, location: @sigil }\n else\n format.html { render :new }\n format.json { render json: @sigil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cap = Cap.new(params[:cap])\n\n respond_to do |format|\n if @cap.save_with_captcha\n flash[:notice] = 'Cap was successfully created.'\n format.html { redirect_to(@cap) }\n format.xml { render :xml => @cap, :status => :created, :location => @cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @signature = Signature.new(params[:signature])\n\n respond_to do |format|\n if @signature.save\n format.html { redirect_to(@signature, :notice => 'Signature was successfully created.') }\n format.xml { render :xml => @signature, :status => :created, :location => @signature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @signature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n end",
"def create\n @my_cv = MyCv.new(my_cv_params)\n\n respond_to do |format|\n if @my_cv.save\n format.html { redirect_to @my_cv, notice: 'My cv was successfully created.' }\n format.json { render :show, status: :created, location: @my_cv }\n else\n format.html { render :new }\n format.json { render json: @my_cv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_license(to_hash)\n end",
"def create\n @camera_catalogue = CameraCatalogue.new(params[:camera_catalogue])\n\n respond_to do |format|\n if @camera_catalogue.save\n format.html { redirect_to @camera_catalogue, notice: 'Camera catalogue was successfully created.' }\n format.json { render json: @camera_catalogue, status: :created, location: @camera_catalogue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @camera_catalogue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mircopost = Mircopost.new(mircopost_params)\n\n respond_to do |format|\n if @mircopost.save\n format.html { redirect_to @mircopost, notice: 'Mircopost was successfully created.' }\n format.json { render :show, status: :created, location: @mircopost }\n else\n format.html { render :new }\n format.json { render json: @mircopost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @signspot_project = Signspot::Project.new(params[:signspot_project])\n\n respond_to do |format|\n if @signspot_project.save\n format.html { redirect_to @signspot_project, notice: 'Project was successfully created.' }\n format.json { render json: @signspot_project, status: :created, location: @signspot_project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @signspot_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n make_create_request\n end",
"def create\n @cap = Cap.new(params[:cap])\n\n respond_to do |format|\n if @cap.save\n format.html { redirect_to(@cap, :notice => 'Cap was successfully created.') }\n format.xml { render :xml => @cap, :status => :created, :location => @cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n end",
"def create\n @correspondenciasasignada = Correspondenciasasignada.new(params[:correspondenciasasignada])\n\n respond_to do |format|\n if @correspondenciasasignada.save\n flash[:notice] = 'Correspondenciasasignada was successfully created.'\n format.html { redirect_to(@correspondenciasasignada) }\n format.xml { render :xml => @correspondenciasasignada, :status => :created, :location => @correspondenciasasignada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @correspondenciasasignada.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @alphasignup = Alphasignup.new(params[:alphasignup])\n\n respond_to do |format|\n if @alphasignup.save\n format.html { redirect_to(@alphasignup, :notice => 'Thank you for signing up.') }\n format.xml { render :xml => @alphasignup, :status => :created, :location => @alphasignup }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alphasignup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \t\n end",
"def create\n \n end",
"def create!\n end",
"def create\n @asignacione = Asignacione.new(asignacione_params)\n\n respond_to do |format|\n if @asignacione.save\n format.html { redirect_to asignaciones_url, notice: 'Asignacione Se creó correctamente.' }\n format.json { render :index, status: :created, location: @asignacione }\n else\n format.html { render :new }\n format.json { render json: @asignacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proforma_invoice = ProformaInvoice.new(proforma_invoice_params)\n\n respond_to do |format|\n if @proforma_invoice.save\n format.html { redirect_to @proforma_invoice, notice: 'Proforma invoice was successfully created.' }\n format.json { render :show, status: :created, location: @proforma_invoice }\n else\n format.html { render :new }\n format.json { render json: @proforma_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capture = Capture.new(capture_params)\n @capture.user = current_user\n\n if @capture.save\n render json: @capture, status: :created\n else\n render json: @capture.errors, status: :unprocessable_entity\n end\n ensure\n clean_tempfile\n end",
"def create\n @bitcoin = Bitcoin.new(bitcoin_params)\n @bitcoin.user = current_user\n respond_to do |format|\n if @bitcoin.save\n format.html { redirect_to bitcoin_steps_path, notice: 'Add images and enter payment details' }\n format.json { render :show, status: :created, location: @bitcoin }\n else\n format.html { render :new }\n format.json { render json: @bitcoin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @signature = Signature.new(signature_params)\n @signature.save\n\n respond_to do |format|\n if @signature.save\n #format.html { redirect_to @signature, notice: 'Signature was successfully created.' }\n format.json { render :json => @signature.to_json({}) }\n else\n format.html { render action: 'new' }\n format.json { render json: @signature.errors, status: :unprocessable_entity }\n end\n\n end\n\n end",
"def create\n params.permit!\n @quartz_photo = QuartzPhoto.new(params[:quartz_photo])\n\n respond_to do |format|\n if @quartz_photo.save\n format.html { redirect_to(@quartz_photo, :notice => 'Quartz photo was successfully created.') }\n format.xml { render :xml => @quartz_photo, :status => :created, :location => @quartz_photo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quartz_photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @web_cam_capture = WebCamCapture.new(web_cam_capture_params)\n\n respond_to do |format|\n if @web_cam_capture.save\n format.html { redirect_to @web_cam_capture, notice: 'Web cam capture was successfully created.' }\n format.json { render action: 'show', status: :created, location: @web_cam_capture }\n else\n format.html { render action: 'new' }\n format.json { render json: @web_cam_capture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, Pupil\n @pupil = Pupil.new(pupil_attrs)\n\n respond_to do |format|\n if @pupil.save\n format.html { redirect_to @pupil, notice: t('action.create.succeed', entity: Pupil.model_name.human) }\n format.json { render action: 'show', status: :created, location: @pupil }\n else\n format.html { render action: 'new' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cv = Cv.new\n end",
"def create\n @sign = Sign.new(sign_params)\n\n respond_to do |format|\n if @sign.save\n @sign.create_activity(:create, owner: current_user, parameters: { name: @sign.name })\n current_user.signs << @sign\n format.html { redirect_to @sign; flash[:notice] = 'Sign was successfully created.' }\n format.json { render :show, status: :created, location: @sign }\n else\n format.html { render :new }\n format.json { render json: @sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @picture = Picture.new(picture_params)\n\n if params[:file].present?\n req = Cloudinary::Uploader.upload params[:file]\n @picture.image = req['public_id']\n end\n\n respond_to do |format|\n if @picture.save\n format.html { redirect_to @picture, notice: 'Picture was successfully created.' }\n format.json { render :show, status: :created, location: @picture }\n else\n format.html { render :new }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cargapp_payment = CargappPayment.new(cargapp_payment_params)\n\n respond_to do |format|\n if @cargapp_payment.save\n format.html { redirect_to @cargapp_payment, notice: 'Cargapp payment was successfully created.' }\n format.json { render :show, status: :created, location: @cargapp_payment }\n else\n format.html { render :new }\n format.json { render json: @cargapp_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv = Cv.new(params[:cv])\n\n respond_to do |format|\n if @cv.save\n flash[:notice] = 'Cv was successfully created.'\n format.html { redirect_to(@cv) }\n format.xml { render :xml => @cv, :status => :created, :location => @cv }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cv.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n if negocio_params[:imagen] == nil\n base64 = \"\"\n elsif negocio_params[:imagen] == \"\"\n base64 = \"\"\n else\n base64 = negocio_params[:imagen]\n base64.slice!('data:image/png;base64,')\n end\n\n @negocio = Negocio.new(negocio_params)\n\n respond_to do |format|\n if @negocio.save\n\n format.html { redirect_to @negocio, notice: 'Negocio was successfully created.' }\n format.json { render :show, status: :created, location: @negocio }\n else\n format.html { render :new }\n format.json { render json: @negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plaimage = Plaimage.new(plaimage_params)\n\n respond_to do |format|\n if @plaimage.save\n format.html { redirect_to @plaimage, notice: 'Plaimage was successfully created.' }\n format.json { render :show, status: :created, location: @plaimage }\n else\n format.html { render :new }\n format.json { render json: @plaimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n update_staffs\n docusign @company, params[:company][:sign_documents_attributes]\n # if company_params[:background_image].present?\n # redirect_to company_crop_url(@company) and return\n # else\n image_cropping\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n # end\n else\n flash[:danger] = @company.errors.full_messages[0]\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prevision = Prevision.new(prevision_params)\n\n respond_to do |format|\n if @prevision.save\n format.html { redirect_to @prevision, notice: 'Previsión guardada correctamente.' }\n format.json { render :show, status: :created, location: @prevision }\n else\n format.html { render :new }\n format.json { render json: @prevision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relassigncollection = Relassigncollection.new(relassigncollection_params)\n\n respond_to do |format|\n if @relassigncollection.save\n format.html { redirect_to @relassigncollection, notice: 'Relassigncollection was successfully created.' }\n format.json { render :show, status: :created, location: @relassigncollection }\n else\n format.html { render :new }\n format.json { render json: @relassigncollection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pay_cmb_sign = Pay::CmbSign.new(pay_cmb_sign_params)\n\n respond_to do |format|\n if @pay_cmb_sign.save\n format.html { redirect_to @pay_cmb_sign, notice: 'Cmb sign was successfully created.' }\n format.json { render :show, status: :created, location: @pay_cmb_sign }\n else\n format.html { render :new }\n format.json { render json: @pay_cmb_sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @im = Im.new(im_params)\n\n respond_to do |format|\n if @im.save\n format.html { redirect_to @im, notice: 'Im was successfully created.' }\n format.json { render :show, status: :created, location: @im }\n else\n format.html { render :new }\n format.json { render json: @im.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n end",
"def create\n @inter_cap = InterCap.new(params[:inter_cap])\n\n respond_to do |format|\n if @inter_cap.save\n format.html { redirect_to(@inter_cap, :notice => 'A asequence was successfully created.') }\n format.xml { render :xml => @inter_cap, :status => :created, :location => @inter_cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inter_cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @capa = Capa.new\n @capa = @capa.incrament(@capa)\n @capa_file = @capa.capa_files.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capa }\n end\n end",
"def create\n @grave = Grave.new(grave_params)\n @grave.created_by_id = current_user.id\n @grave.updated_by_id = current_user.id\n\n if @grave.attachment.present?\n @grave.attachment.created_by_id = current_user.id\n @grave.attachment.updated_by_id = current_user.id\n end\n respond_to do |format|\n if @grave.save\n format.html { redirect_to graves_url, notice: 'Grave was successfully created.' }\n format.json { render :show, status: :created, location: @grave }\n else\n @grave.build_attachment\n format.html { render :new }\n format.json { render json: @grave.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @canvas = Canvas.create(canvas_params)\n end",
"def create\n @cafephoto = Cafephoto.new(cafephoto_params)\n\n respond_to do |format|\n if @cafephoto.save\n format.html { redirect_to @cafephoto, notice: 'Cafephoto was successfully created.' }\n format.json { render :show, status: :created, location: @cafephoto }\n else\n format.html { render :new }\n format.json { render json: @cafephoto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vicarage = Vicarage.new(vicarage_params)\n\n respond_to do |format|\n if @vicarage.save\n format.html { redirect_to @vicarage, success: 'La Vicaría fue <strong>registrada</strong> exitosamente.' }\n format.json { render :show, status: :created, location: @vicarage }\n else\n format.html { render :new }\n format.json { render json: @vicarage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capitulo = Capitulo.new(capitulo_params)\n\n respond_to do |format|\n if @capitulo.save\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully created.' }\n format.json { render :show, status: :created, location: @capitulo }\n else\n format.html { render :new }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n @envelope = Envelope.new(params[:envelope].merge({:account_id => Docusign::Config[:account_id]}))\n\n respond_to do |format|\n if @envelope.save\n flash[:notice] = 'Envelope was successfully created.'\n format.html { redirect_to(@envelope) }\n format.xml { render :xml => @envelope, :status => :created, :location => @envelope }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @currentgwamokid = params[:currentgwamokid]\n @sigan = Sigan.new(sigan_params)\n\n respond_to do |format|\n if @sigan.save\n format.html { redirect_to @sigan, notice: 'Sigan was successfully created.' }\n format.json { render :show, status: :created, location: @sigan }\n else\n format.html { render :new }\n format.json { render json: @sigan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @perspectiva = Perspectiva.new(params[:perspectiva])\n\n respond_to do |format|\n if @perspectiva.save\n format.html { redirect_to(@perspectiva, :notice => 'Perspectiva was successfully created.') }\n format.xml { render :xml => @perspectiva, :status => :created, :location => @perspectiva }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @perspectiva.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n parameters = crew_params.dup\n parameters.delete(:images)\n parameters.delete(:videos)\n @crew = Crew.new(parameters)\n\n respond_to do |format|\n if @crew.save\n @crew.save_attachments(crew_params)\n format.json { render :show, status: :created }\n else\n format.json { render json: @crew.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto_imagen = ProyectoImagen.new(proyectos_imagen_params)\n\n respond_to do |format|\n if @proyecto_imagen.save\n format.html { redirect_to @proyecto_imagen, notice: 'Proyecto imagen was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto_imagen }\n else\n format.html { render :new }\n format.json { render json: @proyecto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_picture = ProjectPicture.new(project_picture_params)\n\n respond_to do |format|\n if @project_picture.save\n format.html { redirect_to @project_picture, notice: 'Project picture was successfully created.' }\n format.json { render :show, status: :created, location: @project_picture }\n else\n format.html { render :new }\n format.json { render json: @project_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignacion_aula = AsignacionAula.new(asignacion_aula_params)\n\n respond_to do |format|\n if @asignacion_aula.save\n format.html { redirect_to @asignacion_aula, notice: 'Asignacion aula was successfully created.' }\n format.json { render :show, status: :created, location: @asignacion_aula }\n else\n format.html { render :new }\n format.json { render json: @asignacion_aula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv = Cv.new(params[:cv])\n\n respond_to do |format|\n if @cv.save\n flash[:notice] = 'Cv was successfully created.'\n format.html { redirect_to(edit_cv_path(@cv)) }\n format.xml { render :xml => @cv, :status => :created, :location => @cv }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cv.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new\n @project.build_image\n end",
"def create\n @pagina_principal = PaginaPrincipal.new(pagina_principal_params)\n\n respond_to do |format|\n if @pagina_principal.save\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' }\n format.json { render :show, status: :created, location: @pagina_principal }\n else\n format.html { render :new }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if ((can_access_invoice payment_params, @payment) && @payment.save)\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'Congratulations! Your payment was successfully processed.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'We were unable to process your payment. Please try again.' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n raise 'Not implemented'\n # signature_type, success = jsonapi_create.to_a\n\n # if success\n # render_jsonapi(signature_type, scope: false)\n # else\n # render_errors_for(signature_type)\n # end\n end",
"def create\n @poc = Poc.new(poc_params)\n\n respond_to do |format|\n if @poc.save\n format.html { redirect_to @poc, notice: 'Poc was successfully created.' }\n format.json { render :show, status: :created, location: @poc }\n else\n format.html { render :new }\n format.json { render json: @poc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params) \n if @asignatura.save\n \tflash[:info] = \"Asignatura inscrita\"\n redirect_to asignaturas_url\n else\n render 'new'\t\n end \t\n end",
"def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return nil if created?\n request :create_creative_on_bidstalk do\n client = Bidstalk::Creative::Client.new\n client.create to_platform_creative!\n end\n end",
"def new\n @campeonato = Campeonato.new\n end",
"def create\n @im = Im.new(params[:im])\n \n respond_to do |format|\n if @im.save\n flash[:notice] = 'Im was successfully created.'\n format.html { redirect_to(@im) }\n format.xml { render :xml => @im, :status => :created, :location => @im }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @im.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @campeonato = Campeonato.new(campeonato_params)\n\n respond_to do |format|\n if @campeonato.save\n format.html { redirect_to @campeonato, notice: 'Campeonato was successfully created.' }\n format.json { render :show, status: :created, location: @campeonato }\n else\n format.html { render :new }\n format.json { render json: @campeonato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @origami = Origami.new(params[:origami])\n\n respond_to do |format|\n if @origami.save\n format.html { redirect_to @origami, notice: 'Origami was successfully created.' }\n format.json { render json: @origami, status: :created, location: @origami }\n else\n format.html { render action: \"new\" }\n format.json { render json: @origami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @origami = Origami.new(params[:origami])\n\n respond_to do |format|\n if @origami.save\n format.html { redirect_to @origami, notice: 'Origami was successfully created.' }\n format.json { render json: @origami, status: :created, location: @origami }\n else\n format.html { render action: \"new\" }\n format.json { render json: @origami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gomi = Gomi.new(gomi_params)\n\n respond_to do |format|\n if @gomi.save\n format.html { redirect_to @gomi, notice: 'Gomi was successfully created.' }\n format.json { render :show, status: :created, location: @gomi }\n else\n format.html { render :new }\n format.json { render json: @gomi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n end",
"def create\n @incentive = Incentive.new(params[:incentive])\n\n respond_to do |format|\n if @incentive.save\n format.html { redirect_to(@incentive, :notice => 'Incentive was successfully created.') }\n format.xml { render :xml => @incentive, :status => :created, :location => @incentive }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incentive.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @cvupload = Cvupload.new(cvupload_params)\r\n\r\n respond_to do |format|\r\n if @cvupload.save\r\n format.html { redirect_to @cvupload, notice: \"Cvupload was successfully created.\" }\r\n format.json { render :show, status: :created, location: @cvupload }\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n format.json { render json: @cvupload.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @plane_picture = PlanePicture.new(plane_picture_params)\n\n respond_to do |format|\n if @plane_picture.save\n format.html { redirect_to @plane_picture, notice: 'Plane picture was successfully created.' }\n format.json { render :show, status: :created, location: @plane_picture }\n else\n format.html { render :new }\n format.json { render json: @plane_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @conta_a_pagar = ContaAPagar.new(conta_a_pagar_params)\n\n respond_to do |format|\n if @conta_a_pagar.save\n format.html { redirect_to @conta_a_pagar, notice: 'Conta a pagar was successfully created.' }\n format.json { render :show, status: :created, location: @conta_a_pagar }\n else\n format.html { render :new }\n format.json { render json: @conta_a_pagar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n\t\t@pic = Pic.new\n\t\n\tend",
"def create(id, timestamp = to_zuora_time(Time.now), token = create_token)\n PaymentForm.new(id, tenant_id, token, api_security_key, timestamp)\n end",
"def create\n @paise = Paise.new(paise_params)\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render :show, status: :created, location: @paise }\n else\n format.html { render :new }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representante = Representante.new(representante_params)\n\n respond_to do |format|\n if @representante.save\n format.html { redirect_to @representante, notice: 'Representante was successfully created.' }\n format.json { render :show, status: :created, location: @representante }\n else\n format.html { render :new }\n format.json { render json: @representante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @piiza_id = PiizaId.new(piiza_id_params)\n\n respond_to do |format|\n if @piiza_id.save\n format.html { redirect_to @piiza_id, notice: 'Piiza was successfully created.' }\n format.json { render :show, status: :created, location: @piiza_id }\n else\n format.html { render :new }\n format.json { render json: @piiza_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Imagen.new(imagen_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paise = Paise.new(params[:paise])\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render json: @paise, status: :created, location: @paise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.64293593",
"0.63894695",
"0.63406765",
"0.6328831",
"0.62295043",
"0.6181105",
"0.61537945",
"0.6140979",
"0.6105808",
"0.61028767",
"0.6064084",
"0.60603863",
"0.6033622",
"0.60092276",
"0.59952116",
"0.59749913",
"0.5955507",
"0.5954376",
"0.5927891",
"0.5922227",
"0.5914673",
"0.59128463",
"0.59126246",
"0.58991367",
"0.588749",
"0.5886434",
"0.587708",
"0.58479077",
"0.58450645",
"0.584332",
"0.5839285",
"0.5820698",
"0.58145773",
"0.5808265",
"0.57975143",
"0.5797219",
"0.5797162",
"0.57820404",
"0.5777172",
"0.5772757",
"0.5771267",
"0.5757817",
"0.5756526",
"0.5754927",
"0.57547694",
"0.57510054",
"0.5740099",
"0.573063",
"0.5728505",
"0.572074",
"0.57186025",
"0.57181615",
"0.5710556",
"0.5703414",
"0.57030916",
"0.5695281",
"0.56938076",
"0.5689779",
"0.56845987",
"0.5682169",
"0.56820893",
"0.56815124",
"0.56795686",
"0.56727535",
"0.56727535",
"0.56727535",
"0.56675816",
"0.56671125",
"0.56642056",
"0.56597024",
"0.56534296",
"0.564895",
"0.5640525",
"0.5639227",
"0.5634637",
"0.5634555",
"0.5634103",
"0.5633838",
"0.5628234",
"0.5628053",
"0.5626468",
"0.5619275",
"0.5616609",
"0.5616088",
"0.56141275",
"0.5613178",
"0.5612842",
"0.5612842",
"0.5612595",
"0.5611551",
"0.5607556",
"0.5605469",
"0.5599935",
"0.5598388",
"0.5597249",
"0.5591855",
"0.5590732",
"0.5589272",
"0.55861044",
"0.5586014",
"0.5582427"
] | 0.0 | -1 |
Reset all associated sheets total_response_count to nil to trigger refresh of sheet answer coverage | def reset_sheet_total_response_count
sheets.where(missing: false).update_all(response_count: nil, total_response_count: nil, percent: nil)
sheets.where(missing: true).update_all(response_count: 0, total_response_count: 0, percent: 100)
SubjectEvent.where(id: sheets.select(:subject_event_id)).update_all(
unblinded_responses_count: nil,
unblinded_questions_count: nil,
unblinded_percent: nil,
blinded_responses_count: nil,
blinded_questions_count: nil,
blinded_percent: nil
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 total_calls.clear\n total_success_calls.clear\n total_failed_calls.clear\n end",
"def clear_all\n @sheets = []; self\n end",
"def reset_stats\n self.actual_rounds = 0\n self.points = 0\n self.average = 0.0\n self.total_correct = 0\n self.total_errors = 0\n self.rank = 0\n \n # total quizzes\n total_quizzes = 0\n self.quiz_team.round_teams.each do |round_team|\n total_quizzes += 1 if round_team.round.complete? and round_team.round.from_prelims?\n end\n self.total_rounds = total_quizzes\n end",
"def reset\n @count = 0\n end",
"def reset_hit_count\n \"0\"\n end",
"def reset\n @previous_valid_total_score = 0\n @previous_valid_scores = Hash.new(0)\n end",
"def reset_stats; reset!; end",
"def reset!\n @last_response = nil\n @last_exit_code = nil\n end",
"def reset\n @results = {}\n @success = false\n end",
"def clear_stats\n reset!\n NewRelic::Agent::BusyCalculator.reset\n end",
"def reset_results\n @loaded = false\n @results = ResultSet.new\n @solr_response = nil\n end",
"def reset\n @results = []\n @number = 0\n @score = 0\n @average = 0\n @min = 0\n @max = 0\n end",
"def reset_statistics!; end",
"def reset_statistics!; end",
"def reset_discounts\n @discounts = []\n end",
"def stats_reset\n @stats = nil\n end",
"def reset_contents\n self.quizzes.destroy_all\n end",
"def reset_response\n self.instance_variable_set(:@_response_body, nil)\n end",
"def reset_stats\n self.rounds = 0\n self.wins = 0\n self.losses = 0\n self.total_points = 0\n self.rank = 0\n end",
"def reset_response\n self.instance_variable_set(:@_response_body, nil)\n end",
"def clear\n @total = 0\n end",
"def reset_all_statistics\n super\n end",
"def reset\n @errors = []\n @journal_rows = []\n @journaled_facility_ids = Set.new\n @product_recharges = {}\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 executions.reset\n end",
"def reset\n @dice_cup.clear\n @number_of_dice = 6\n @farkle_count= 0\n end",
"def reset_abs_data\n # reset killed battlers arrays and the counters\n @killed, @battlers_number = {}, {}\n end",
"def reset\n @equations = nil\n @results = nil\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_checks\n @counter = 0\n end",
"def reset!\n self.result = nil\n @rows = nil\n @docs = nil\n end",
"def set_counters\r\n @score_count = 0\r\n @score_total = 0\r\nend",
"def reset()\r\n\t\[email protected]\r\n\t\[email protected]\r\n\t\t@usedHelp = 0\r\n\t\t@numberOfStars = 0\r\n\t\t@isFinished = false\r\n\t\t@nbClick = 0\r\n\t\treturn self\r\n\tend",
"def reset_all!\n initialize_histograms_hash\n end",
"def reset\n # TODO\n end",
"def reset\n @sets = {}\n self\n end",
"def reset_counter\n @run_count = 0\n end",
"def reset\n @value = nil\n @count = 0\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset_statistics\n super\n end",
"def reset\n # Empty, but subclasses will override this.\n end",
"def reset\n @rows = nil\n end",
"def reset_category_quantities_and_reports\n\t\tself.categories.map {|cat|\n\t\t\tcat.quantity = 0\t\n\t\t\tcat.required_for_reports = []\n\t\t\tcat.optional_for_reports = []\n\t\t}\n\tend",
"def no_responses\n #below is code to fix a bizarre bug. When triggered by the \"cut\" function, for some reason survey_id is erased. Have not found reason yet. Temporary fix.\n if !survey_section && self.id\n self.reload\n end\n if self.id && self.survey_section && self.survey_section.survey\n #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.\n self.survey_section.survey.response_sets.where('test_data = ?',true).each {|r| r.destroy}\n end\n if self.id && !survey_section.survey.template && survey_section.survey.response_sets.count>0\n errors.add(:base,\"Reponses have already been collected for this survey, therefore it cannot be modified. Please create a new survey instead.\")\n return false\n end\n end",
"def reset\n @conditions.reset\n @results = []\n end",
"def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end",
"def reset_score\n @score = 0\n end",
"def reset_fields\n self.sender_doc_id_version = nil\n self.receiver_doc_id_version = nil\n self.project_doc_id_version = nil\n self.submission_receiver_doc_id = nil\n self.submission_project_doc_id = nil\n self.response_sender_doc_id = nil\n self.response_project_doc_id = nil\n self.plnd_submission = nil\n self.actl_submission = nil\n self.xpcd_response = nil\n self.actl_response = nil\n self.response_status = nil\n end",
"def reset\n @values = {\n 'loading_bar' => 'true',\n 'date_format' => 'relative',\n 'theme' => 'bootstrap',\n 'auto_fill' => 'true'\n }\n end",
"def reset\n\t @result_set = nil\n\t self\n\tend",
"def reset\n each(&:reset)\n self\n end",
"def reset_counter; end",
"def reset_http_statistics\n super\n end",
"def reset_checks\n @check_count = 0\n end",
"def reset\n end",
"def reset\n end",
"def clear_results\n @derived_values = []\n end",
"def reset\n @assigned = false\n end",
"def reset!\n @headers = []\n @result = []\n end",
"def reset\n end",
"def reset\n end",
"def implementation_specific_reset\n end",
"def reset\n\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset\n cleanup(true)\n end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset_counters!\n reload!\n self.class.counter_columns.each do |cc|\n counter = self.send(cc.name)\n counter.reset! unless counter.nil?\n end\n save\n end",
"def reset\n invoke_on_reset_callbacks\n self\n end"
] | [
"0.6726427",
"0.6726427",
"0.66224194",
"0.6501848",
"0.6456136",
"0.6179454",
"0.61737",
"0.6166184",
"0.6092449",
"0.6084171",
"0.6077026",
"0.6005463",
"0.5977864",
"0.5970744",
"0.59525883",
"0.59525883",
"0.5930283",
"0.5920953",
"0.5910665",
"0.5909001",
"0.59019107",
"0.58992356",
"0.58723444",
"0.5848999",
"0.5819857",
"0.57671905",
"0.57671905",
"0.5738055",
"0.5732397",
"0.5730844",
"0.57253724",
"0.571635",
"0.57135534",
"0.5699941",
"0.5692453",
"0.5691192",
"0.5682379",
"0.5677309",
"0.5657965",
"0.5651821",
"0.56498015",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.56372976",
"0.5637135",
"0.56370777",
"0.5629356",
"0.5625556",
"0.5612395",
"0.56043965",
"0.55976903",
"0.55951655",
"0.55895156",
"0.5586754",
"0.5582523",
"0.5570074",
"0.55428535",
"0.5540894",
"0.5535334",
"0.5535334",
"0.553059",
"0.55100226",
"0.5505743",
"0.5497223",
"0.5497223",
"0.5491441",
"0.54788756",
"0.5477356",
"0.5477356",
"0.5477356",
"0.5477356",
"0.5474001",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.5465092",
"0.54618",
"0.5459164"
] | 0.8666964 | 0 |
Constructor which initializes only logger | def initialize
@logger = RubyConfigr::AppLogger.get_logger();
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @log = Logging::Logger[self]\n @options = self.default_options\n end",
"def initialize\n @logger = Logging::Logger[self]\n end",
"def initialize\n @log = Logging::Logger[self]\n end",
"def initialize logger = Nacreon.log\n\t\t\tself.log = logger\n\t\tend",
"def initialize\n @logProvider = DefaultLogger.new\n end",
"def initialize( )\n ::Logging.init unless ::Logging.initialized?\n\n @name = 'root'\n @appenders = []\n @additive = false\n @caller_tracing = false\n @level = 0\n ::Logging::Logger.define_log_methods(self)\n end",
"def initialize(logger = T.unsafe(nil)); end",
"def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end",
"def initialize( logger )\n @logger = logger\n end",
"def initialize(logger)\n @log = logger\n end",
"def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end",
"def initialize(logger: nil)\n @logger = logger || default_logger\n end",
"def initialize(logger: default_logger)\n @logger = logger\n end",
"def initialize\n Logging.setup(Logger::INFO)\n end",
"def initialize()\n @log = {}\n end",
"def initialize\n @logger = BikeIn::Common::CustomLogger.new self.to_s\n end",
"def initialize\n @logger = Logger.new('cf_flattener.log')\n end",
"def initialize(logger)\n\t\t\t\t\t@logger = logger\n\t\t\t\tend",
"def initialize_logger\n return if @logger.blank?\n log = @logger\n log = log.to_s if log.is_a?(Pathname)\n if log.is_a?(String)\n log = File.join(TMP_ROOT_DIR, log) unless log.start_with?('/')\n @logger =\n Logger.new(log).tap { |l| l.level = Logger.const_get(@log_level) }\n end\n unless @logger.is_a?(Logger)\n raise \"expected String, got #{log.class} #{log.inspect}\"\n end\n end",
"def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend",
"def initialize\n self.logger = Logger.new(STDOUT)\n reset!\n end",
"def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end",
"def initialize(options = {})\n @logger = options[:logger]\n end",
"def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:\n\t\t\t@logger = logger\n\t\t\t@format = format\n\t\t\tsuper()\n\t\tend",
"def initialize(*args)\n @init_args = args\n set_log(*args)\n end",
"def initialize(logger, options = T.unsafe(nil)); end",
"def initialize(logger=Logger.new(STDERR))\n setup_signals\n @logger = logger\n @logger.level = level_from_env || Logger::INFO\n end",
"def initialize(name:)\n # Create a logger before any appenders\n # Avoids a situation where Filters::Normal levels are nil\n #\n # Logging::Filters::Level.new bug:\n # @filter has nil levels set on the first invocation\n @logger = Logging.logger[name]\n end",
"def initialize(options = {})\n\n # If there's no logger, let's get it setup.\n @logger = Logger.new(STDOUT) if !@logger\n\n end",
"def initialize *_args\n super\n @service_logger =\n case logger\n when 'sidekiq'\n Sidekiq::Logging.logger\n else\n Rails.logger\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def logger\n initialize_logger unless @logger\n @logger\n end",
"def initialize(log)\n @log = log\n end",
"def initialize(options={})\n @options = options.dup\n\n Logger.set(*@options[:log_to])\n end",
"def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end",
"def logger\n init unless @initialized\n logger = @logger\n end",
"def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end",
"def initialize( logger, format=DEFAULT_FORMAT, debug=DEFAULT_DEBUG_FORMAT ) # :notnew:\n\t\t\t@logger = logger\n\t\t\t@format = format\n\t\t\t@debug_format = debug\n\n\t\t\tsuper()\n\t\tend",
"def initialize prev=nil\n @prev_logger = prev\n super(nil)\n end",
"def initialize(options = {})\n\t\t\t@logger = Logger.new(STDOUT)\n\t\t\[email protected] = Logger::INFO\n\t\tend",
"def initialize(*)\n @l = SingLogger.instance\n end",
"def init(identity = nil, path = nil)\n unless @initialized\n @initialized = true\n @level_frozen = false\n logger = nil\n\n if @log_to_file_only || RightLinkConfig[:platform].windows?\n if path\n file = File.join(path, \"nanite.#{identity}.log\")\n else\n file = STDOUT\n end\n logger = Logger.new(file)\n logger.formatter = Formatter.new\n else\n logger = SyslogLogger.new(@program_name || identity || 'RightLink')\n end\n\n @logger = Multiplexer.new(logger)\n self.level = :info\n end\n @logger\n end",
"def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end",
"def init_logger\n l = Logger.new(STDOUT)\n l.level = Logger::INFO\n Log.logger = l\nend",
"def initialize( name, *args )\n case name\n when String\n raise(ArgumentError, \"logger must have a name\") if name.empty?\n else raise(ArgumentError, \"logger name must be a String\") end\n\n repo = ::Logging::Repository.instance\n opts = args.last.instance_of?(Hash) ? args.pop : {}\n _setup(name, opts.merge({:parent => repo.parent(name)}))\n end",
"def init(*opts)\n reset!\n @logger = logger_for(BeanStalk::Worker::Config[:log_location])\n if @logger.respond_to?(:formatter=)\n if BeanStalk::Worker::Config[:log_formatter].eql?(:json)\n @logger.formatter = Mixlib::Log::JSONFormatter.new()\n else\n @logger.formatter = Mixlib::Log::Formatter.new()\n end\n end\n @logger.level = Logger.const_get(\n BeanStalk::Worker::Config[:log_level].to_s.upcase)\n @logger\n end",
"def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n else\n eval(get_rails_default_logger_name)\n end \n end",
"def initialize(env)\n # get log level (default to \"warn\" if unspecified)\n log_level = (env.get('LOG_LEVEL', DEFAULT_LEVEL)).upcase\n\n # create logger from log path (default to STDERR)\n super(env.get('LOG_PATH', STDERR))\n\n # set log level (default to WARN)\n self.level = ::Logger.const_get(log_level)\n\n # log level\n info('Env::Log#initialize') do\n 'level = %p' % [log_level]\n end\n end",
"def initialize(cache_dir, logger = nil)\n @cache_dir = cache_dir\n @logger = logger || Logger.new(STDOUT)\n end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def initialize(logfile_path=nil)\n if logfile_path\n ar_logger = Logger.new(logfile_path)\n ar_logger.level = Logger::INFO\n ActiveRecord::Base.logger = ar_logger\n end\n end",
"def initialize_log\n if @configuration[:debug].nil?\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'send.log'\n l.adapter STDOUT\n end\n else\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'test.log'\n l.adapter STDOUT\n end\n end\n end",
"def initialize(name)\n @name = name.is_a?(Module) ? SLF4J.to_log_name(name) : name\n @logger = org.slf4j.LoggerFactory.getLogger(@name)\n @level = ::Logger::Severity::INFO\n end",
"def initialize(*args)\n # Handle default\n if args.empty?\n args = [STDOUT]\n end\n\n # Initialization\n @default_level = Logger::Severity::INFO\n @formatter = ::TeeLogger::Formatter.new\n @loggers = {}\n @ios = {}\n\n # Load built-in filters\n load_filters(*args)\n\n # Create logs for all arguments\n args.each do |arg|\n add_logger(arg)\n end\n end",
"def initLogger()\n\tconfig = FileUtil.loadjson(File.dirname(__FILE__) + '/utilcfg.json')\n\tif config.key?('log.path')\n\t\tlpath = config['log.path']\n\t\tunless File.file?(lpath)\n\t\t\tdpath = lpath.gsub(/[^\\/]+$/,'')\n\t\t\tDir.mkdir(dpath) unless Dir.exist?(dpath)\n\t\tend\n\t\tif config.key?('log.interval')\n\t\t\t$logger = Logger.new(lpath, config['log.interval'])\n\t\telse\n\t\t\t$logger = Logger.new(lpath)\n\t\tend\n\tend\n\tLogUtil.setformatter\n\tLogUtil.setloglevel(config['log.level'])\nend",
"def initialize(options = {})\n @options = merge_options({}, options || {})\n @logger = @options[:logger] || Logger.new($stdout, level: :fatal)\n end",
"def initialize\n log_path = @@log[:path] + 'one2influx.log'\n begin\n $LOG = Logger.new(log_path, 'daily', 30)\n rescue Exception => e\n raise \"Unable to create log file. #{e.message}\"\n end\n $LOG.level = @@log[:level]\n\n convert_to_sec\n prepare_storage_ids\n prepare_vm_config\n end",
"def initialize(*, verbose: '1', log_file: STDERR, **)\n v = (verbose =~ /\\d+/) ? verbose.to_i : verbose.to_sym\n self.logger = Logger.new(log_file, v)\n end",
"def initialize(file_path = nil)\n _init(file_path)\n @log.info('Logger initialization complete.')\n end",
"def initialize(target, logger=nil)\r\n @target=target \r\n \r\n @log=logger || $logger || nil\r\n \r\n if @log == nil\r\n @log = Logger.new(STDOUT)\r\n @log.level = Logger::INFO\r\n @log.datetime_format = \"%Y-%m-%d %H:%M:%S\" \r\n @log.formatter = proc do |severity, datetime, progname, msg|\r\n \"#{datetime}: #{msg}\\n\"\r\n end \r\n end\r\n end",
"def initialize(options={})\n @root = File.expand_path('../../../../../', __FILE__)\n \n if @log.nil?\n # @logdir = @root + \"/log/worker\"\n # FileUtils.mkdir_p @logdir\n # @logfile = @logdir + \"/#{self.class.to_s.downcase}.log\"\n # FileUtils.touch @logfile\n \n @log = Logger.new(STDOUT) #MultiDelegator.delegate(:write, :close).to(STDOUT, File.open(@logfile,'a'))\n @log.level = Logger::WARN # TODO Only log if development environment\n \n @log.formatter = proc do |severity, datetime, progname, msg|\n \"[#{severity}] - #{datetime}: #{msg}\\n\"\n end\n \n @log.info(\"Started logging in: #{@logfile}\")\n end\n \n return self\n end",
"def initialize(logger)\n @external_logger = logger\n\n @log_level_map = {\n debug: :debug,\n info: :info,\n notice: :notice,\n warning: :warn,\n err: :error,\n # Nothing in Puppet actually uses alert, emerg or crit, so it's hard to say\n # what they indicate, but they sound pretty bad.\n alert: :error,\n emerg: :fatal,\n crit: :fatal\n }\n end",
"def initialize(*args)\n io = args.shift if args.first.is_a?(IO) || args.first.is_a?(StringIO)\n io ||= STDOUT\n opts = args.shift if args.first.is_a?(Hash)\n opts ||= {}\n raise ArgumentError, '(io, opts) are expected as parameters' unless args.empty?\n\n # module configured?\n self.class.configure() if self.class.options.empty?\n\n @options = self.class.options.deep_merge(opts)\n @logger_instance = ::Logger.new(io)\n @logger_instance.level = self.class.level_from_any(options[:logger_level])\n io.sync = true if io.respond_to?(:sync=)\n @logger_instance.formatter = self.class.formatter(options)\n end",
"def initialize options\n log_file = options['file'] || default_log_file\n @logger = Logger.new log_file\n end",
"def initialize(project_root_path)\n @project_root_path = project_root_path\n\n @log ||= Logger.new(\"#{local_log_dir}/#{WATCHER_LOG_FILE}\")\n @log.level = Logger::DEBUG\n\tend",
"def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii::Config.root, Lokii::Config.log))\n end",
"def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n ),\n Logging.appenders.rolling_file(\n @log_file,\n :backtrace => true,\n :level => :debug,\n :layout => Logging.layouts.pattern(:pattern => LOG_FILE_PATTERN)\n )\n )\n Logging.mdc['client'] = 'server'\n end",
"def initialize(log_dir = VidazingLogger::LOG_DIR, name:)\n @name = name\n @log_dir = log_dir\n\n create_log_dir\n end",
"def initialize\n self.class.output_to_stdout\n if $DEBUG\n self.class.set_level :debug\n else\n self.class.set_level :info\n end\n end",
"def initialize(to_log = false, verbose = false)\n @to_log = to_log\n @verbose = verbose\n end",
"def initialize(logdev, shift_age=0, shift_size=0)\n @default_shift_age = shift_age\n @default_shift_size = shift_size\n target = ::Logger.new(logdev, shift_age, shift_size)\n target.formatter = DEFAULT_FORMATTER\n @targets = [target]\n end",
"def initialize(params={})\n @logger = params[:logger] || Logger.new(STDOUT)\n @entries = {}\n @entries_mutex = Mutex.new\n end",
"def logger\n @_logger ||= ::Logger.new(log_file)\n end",
"def initialize device = STDOUT, level = INFO\n self.level = level\n @logformat = '%d{%Y-%m-%d %H:%M:%S}%t%L%t%m %s %e'\n @placeholder = {\n 'n' => \"\\n\",\n 'p' => $$,\n 't' => \"\\t\",\n 'x' => File.basename($0),\n 'X' => File.expand_path($0)\n }\n\n @filename = nil\n if device.kind_of? IO then\n raise \"log destination already closed #{ device }\" if device.closed?\n @device = device\n @fileformat = nil\n else\n @device = nil\n @fileformat = device.to_s\n reopen\n end\n\n @sign = @mark = false\n end",
"def initialize( logger, settings={} ) # :notnew:\n\t\t\tsettings = LEVEL_FORMATS.merge( settings )\n\n\t\t\t@logger = logger\n\t\t\t@settings = settings\n\n\t\t\tsuper()\n\t\tend",
"def initialize(filename, level, rotation=10, max_size=1024000)\n # create the directory for the log if it doesn't exist\n if !File.exist? File.dirname(filename)\n FileUtils.mkdir_p File.dirname(filename)\n end\n\n @log ||= Logger.new(filename, rotation, max_size)\n @log.level = level\n @log\n end",
"def enable_logging\n initialize_logger\n end",
"def logger=(logger); end",
"def logger=(logger); end",
"def initialize(*loggers)\n # We don't really inherit from Logger\n #super(nil)\n\n @loggers = []\n loggers.each do |logger|\n next if logger.nil?\n\n attach(logger)\n end\n end",
"def initialize(logger:, **args, &block)\n @logger = logger\n\n # Check if the custom appender responds to all the log levels. For example Ruby ::Logger\n does_not_implement = LEVELS[1..-1].find { |i| [email protected]_to?(i) }\n if does_not_implement\n raise(ArgumentError,\n \"Supplied logger does not implement:#{does_not_implement}. It must implement all of #{LEVELS[1..-1].inspect}\")\n end\n\n super(**args, &block)\n end",
"def logger\n @_logger ||= Logger.new(self)\n end",
"def initialize\n @log_level = :info\n @ssl_verify = :none\n end",
"def initialize(tag_suffix = nil)\n return if defined? SYSLOG\n\n if tag_suffix.nil?\n if defined?(Rails)\n tag_suffix = 'rails'\n else\n tag_suffix = 'logger'\n end\n end\n\n @level = PsdLogger::INFO\n self.class.const_set :SYSLOG, Syslog.open(\"psd_#{tag_suffix}\")\n self.debug(\"PsdLogger.initialize()\")\n end",
"def initialize(resource = nil)\n @resource = resource\n @logger = @resource&.create_log # This is an ImportLog.\n end",
"def initialize(program_name = 'rails')\n @level = Logger::DEBUG\n\n return if defined? SYSLOG\n self.class.const_set :SYSLOG, Syslog.open(program_name)\n end",
"def log=(logger); end",
"def initialize(mode = :normal)\n self.mode = mode\n time = Time.now.strftime(LOG_TIMESTAMP_FORMAT)\n @log_file = \"#{Dir.pwd}/logs/#{time}.log\"\n @log_modes = [:warn, :error]\n end",
"def logger\n @logger ||= create_logger\n end",
"def logger\n @logger ||= create_logger\n end",
"def initialize(logdev)\n @progname = nil\n @level = DEBUG\n @default_formatter = Formatter.new\n @formatter = nil\n @logdev = nil\n if logdev\n @logdev = LogDevice.new(logdev)\n end\n end",
"def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end"
] | [
"0.8202202",
"0.8191563",
"0.80274665",
"0.80038434",
"0.79815876",
"0.7904817",
"0.79038453",
"0.78801125",
"0.78716683",
"0.7868313",
"0.7838396",
"0.7796416",
"0.7783396",
"0.77636755",
"0.7743999",
"0.7734923",
"0.7669375",
"0.7668466",
"0.75839615",
"0.7573425",
"0.75410646",
"0.75286824",
"0.75150996",
"0.75122476",
"0.7502335",
"0.7499322",
"0.7481578",
"0.74685276",
"0.74558043",
"0.74300367",
"0.7407567",
"0.7407567",
"0.7407567",
"0.7389152",
"0.73444605",
"0.73332703",
"0.73173064",
"0.7308885",
"0.7283643",
"0.72825783",
"0.72435844",
"0.72424537",
"0.72289723",
"0.7210939",
"0.71917677",
"0.71748954",
"0.71613234",
"0.7144815",
"0.71313703",
"0.7120739",
"0.7110282",
"0.71063316",
"0.71063316",
"0.71063316",
"0.71063316",
"0.71063316",
"0.71063316",
"0.71063316",
"0.7079871",
"0.70601887",
"0.70571303",
"0.7049479",
"0.7023237",
"0.7000493",
"0.6981744",
"0.69602215",
"0.695712",
"0.6951019",
"0.6950034",
"0.6935227",
"0.69348305",
"0.6924263",
"0.6922909",
"0.69211644",
"0.69195175",
"0.6910372",
"0.68976295",
"0.6876821",
"0.687335",
"0.6829321",
"0.68243414",
"0.68210995",
"0.6811513",
"0.6809919",
"0.6802572",
"0.6796591",
"0.6796591",
"0.6786212",
"0.67830986",
"0.6778397",
"0.67722934",
"0.6771552",
"0.6762066",
"0.6759575",
"0.6757495",
"0.67517924",
"0.67370945",
"0.67370945",
"0.67346674",
"0.6733542"
] | 0.7693135 | 16 |
GET /api/favourites curl v u admin:admin | def index
respond_to do |format|
format.json { render :json => jsonp(favourites_to_json(current_user.favourites)) }
format.xml { render :xml => favourites_to_xml(current_user.favourites) }
format.text { render :text => text_not_supported }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end",
"def index\n authorize! :index, Spree::Favorite\n @favorites = spree_current_user.favorites\n respond_to do |format|\n format.html\n format.json { render json: @favorites }\n end\n end",
"def favorites(options = nil)\n def uri_suffix(opts); opts && opts[:page] ? \"?page=#{opts[:page]}\" : \"\"; end\n uri = '/favorites.json' + uri_suffix(options)\n response = http_connect {|conn|\tcreate_http_get_request(uri) }\n bless_models(Twitter::Status.unmarshal(response.body))\n end",
"def index\n @favorites = current_user.favorites\n render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json\n end",
"def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend",
"def index\n if !current_user.favorites.blank?\n return current_user.favorites\n else\n render json: { errors: \"No favorites for current user\" }, status: :not_found\n end\n end",
"def get_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: Product.order(created_at: :desc).limit(20).map(&:simple_info.with(follower)),\n status: :ok\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favorites = current_user.favorites\n respond_with(@favorites)\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def get_user_favorites username_for\n do_request 'get_user_favorites', username_for: username_for\n end",
"def show\n json_response(@fav)\n end",
"def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend",
"def index\n respond_with @favorites\n end",
"def favorites\n @lists = current_user.favorites\n respond_with(@lists)\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def index\n @favorites = current_user.favorites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @favorites }\n end\n end",
"def show_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: follower.favorite_products.map(&:simple_info.with(follower)), status: :ok\n end",
"def favorite(action, value)\n raise ArgumentError, \"Invalid favorite action provided: #{action}\" unless @@FAVORITES_URIS.keys.member?(action)\n value = value.to_i.to_s unless value.is_a?(String)\n uri = \"#{@@FAVORITES_URIS[action]}/#{value}.json\"\n case action\n when :add\n response = http_connect {|conn| create_http_post_request(uri) }\n when :remove\n response = http_connect {|conn| create_http_delete_request(uri) }\n end\n bless_model(Twitter::Status.unmarshal(response.body))\n end",
"def favorites(action=nil)\n my.favorites(action)\n end",
"def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def index\n @favorites = Favorite.all\n @user = current_user\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @favorites }\n end\n end",
"def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def index\n @favorites = user.favorites\n end",
"def getFavorites(userID, ofWhat)\n request('getFavorites', {'userID' => userID, 'ofWhat' => ofWhat})\nend",
"def index\n @favorites = Favorite.all\n end",
"def index\n @favorites = Favorite.all\n end",
"def index\n @favorites = Favorite.all\n end",
"def list_favourites(user_id)\n @favourites_store.where(user_id)\n end",
"def favourite_for(user)\n favourites.find_by_user_id user\n end",
"def favorites(screen_name)\n url = 'https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=' + screen_name\n request(@agent, @token, url)\n end",
"def favorites(user = nil, params = {})\n args = [user, params]\n get path_from_args('favorites', args), params_from_args(args)\n end",
"def index\n favoritable_type = params[:type] || params[:favoritable_type]\n\n @favorites = if favoritable_type.present?\n current_user.favoritables\n .where(favoritable_type: favoritable_type)\n else\n current_user.favoritables\n end\n\n @total = @favorites.count\n\n @favorites = @favorites\n .page(params[:page])\n .per(params[:per])\n\n # render json: {favorites: @favorites, total: @total}\n end",
"def index\n @favours = Favour.all\n end",
"def favourite\n if session[:user_id] == nil\n render json: {code: 401}\n else\n url_id = params[:id]\n url = Url.find_by(id: url_id)\n current_user = User.find_by(id: session[:user_id])\n if current_user.urls.exists?(url_id)\n current_user.urls.delete(url)\n favourite = false\n else\n current_user.urls << url\n favourite = true\n end\n users = url.users\n render json: {code: 200, favourite: favourite, users: users}\n end\n end",
"def show\n @favourite_listing = get_favourite_listing(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def favourites\n @bottom_bar_header = \"Favourites\"\n @favourited_links = Link.joins(:favourites).where( favourites: { user_id: current_user } )\n end",
"def show\n @fav = Fav.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fav }\n end\n end",
"def index\n if user_signed_in?\n @favorites = current_user.favorites\n\n end\n end",
"def all\n @favourites = Favourite.get_all(@user.id, 'Product').page(params[:page]).per(10)\n end",
"def show\n @favorites = Favorite.all\n end",
"def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n @kf_course_user_favs = Kf::CourseUserFav.order(\"id DESC\").paginate(:page => params[:page], :per_page => params[:per_page] )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_course_user_favs }\n end\n end",
"def index\n # @favorites = Favorite.all\n if user_signed_in?\n @favorites = current_user.favorites\n else\n redirect_to new_user_session_path\n end\n end",
"def index\n @list_favorites = ListFavorite.all\n end",
"def my_favorites\n\tend",
"def index\n @favoritos = perfil.favoritos\n end",
"def show\n @favorite = current_user.favorites.find_by(session_login_id: @session_login.id)\n end",
"def get_user_favorites(id, &block)\n\n end",
"def show\n @favourites = Favourite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favourites }\n end\n end",
"def index\n @favoritens = Favoriten.all\n end",
"def index\n @auction_favorites = Auction::Favorite.all\n end",
"def index \n @favorites = Favorite.all\n @users = User.all\n end",
"def favorites\n if params[:id]\n if params[:id].to_i.to_s == params[:id]\n\t@user = User.find(params[:id])\n else\n\t@user = User.find(:first, :conditions => [\"username=?\", params[:id]])\n end\n else\n @user = @current_user\n end\n\n @beu = @user.following_by_type('Beu')\n end",
"def favorite(id)\n post(\"/favorites/create/#{id}.json\")\n end",
"def favorites(action=nil)\n if @favorites\n case action\n when :update, :sync, :refresh\n @favorites = @client.favorites\n when nil\n @favorites\n else\n raise ArgumentError, \"#{action} is not a valid argument for @favorites.\"\n end\n else\n @favorites = @client.favorites\n end\n end",
"def set_api_v1_favorite\n @api_v1_favorite = Api::V1::Favorite.find(params[:id])\n end",
"def index\n @user_scheme_favorites = UserSchemeFavorite.all\n end",
"def _my_favorite_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :view_my, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.my_favorite_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count === 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/my_favorite_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend",
"def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end",
"def set_api_favorite\n @api_favorite = Api::Favorite.find(params[:id])\n end",
"def index\n @favos = Favo\n .where(user_id: current_user.id)\n @tweets = Tweet.all\n end",
"def index\n @faves_arr = []\n @favourites = current_user.favourites.map do |fave|\n @faves_arr << Location.find_by_id(fave.location_id)\n end\n\n render json: @faves_arr.map(&:transform_json), status: 201\n end",
"def showFavorites\n if current_user\n @favorites = Favorite.where(user_id: current_user.id)\n else\n redirect_to '/'\n end\n end",
"def show\n @favor = Favor.find(params[:id])\n render json: @favor, meta: { status: :ok }, meta_key: 'result'\n end",
"def get_favorites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_favorites ...'\n end\n # resource path\n local_var_path = '/api/v2/contacts/favorite'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'query'] = opts[:'query'] if !opts[:'query'].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 # 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 => 'GetFavoritesPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_favorites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def my_list\n @user = get_current_user\n if @user\n favorites = UserGame.where(user_id: @user.id).map {|fav| fav.game.game_id }\n render json: favorites\n else\n render json: {\n error: \"Favorite Games Currently Unaccessible\",\n status: 400\n }, status: 400\n end\n end",
"def index\n @favorite_items = FavoriteItem.all\n end",
"def index\n @favoritos = Favorito.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @favoritos }\n end\n end",
"def index #devolver todos os filmes e series que a gente escolheu\n # (@favorites.map(&:favoritable)) - esta serializando todos os favoritos.\n # map -faz um mapeamento\n #tabela favorite campo favoritable, e mapeia todas as series e videos, com watchableserializer.\n @favorites = current_user.favorites.all \n render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json\n end",
"def index\n @favories = Favory.all\n end",
"def favorite_for(user)\n favs.find_by(user_id: user)\n end",
"def favourites\n curr_user = User.find(current_user.id)\n fav_posts = curr_user.destring(curr_user)\n fav_users = curr_user.destring_user(curr_user)\n @top_posts = []\n @top_users = []\n fav_posts.each do |n|\n post = Post.find(n)\n @top_posts << post\n end\n fav_users.each do |n|\n user = User.find(n)\n @top_users << user\n end\n render :favourites\n end",
"def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n \n current_user.breweries.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery.street\n puts brewery.city\n puts brewery.state\n puts brewery.phone\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n end \n end",
"def show\n render json: @favorite\n end",
"def favorites\n files = []\n session[:user].favorite_files.each do |file|\n files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files, success: true }\n end",
"def show\n respond_with favorites.first!\n end",
"def index\n @picture = Picture.all\n if logged_in?\n @favorite = current_user.favorites\n end\n end",
"def index\n @favor_users = FavorUser.all\n end",
"def favorite(path)\n response = @api.request(:proppatch, \"#{@path}/#{path}\", nil, MAKE_FAVORITE)\n parse_dav_response(response)\n end",
"def index\n @favors = Favor.order(@order)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @favors }\n end\n end",
"def display_favorites\n if @alive == true\n favorites_header\n else\n offline_header\n end\n if @fav_list.length == 0\n puts \"You have no favourites!!!\".center(@header_length).yellow\n else\n puts @fav_list.uniq\n end\n line_divider\n favorites_menu\n end",
"def show\n @favor = Favor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favor }\n end\n end",
"def show\n @favor = Favor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favor }\n end\n end",
"def search\n search = Favorite.search do\n fulltext params[:query]\n end\n \n @favorites = search.results\n \n respond_with @favorites\n end",
"def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n favorite_array = Favorite.where(user_id:current_user.id)\n \n favorite_array.each do |favorite|\n puts Brewery.find(favorite.brewery_id).name\n puts Brewery.find(favorite.brewery_id).street\n puts Brewery.find(favorite.brewery_id).city\n puts Brewery.find(favorite.brewery_id).state\n end \n # current_user.favorites\n end",
"def show\n @kf_course_user_fav = Kf::CourseUserFav.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_course_user_fav }\n end\n end",
"def show\n @favorite = Favorite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @favorite }\n end\n end",
"def favorite\n\t\tclient = Client.find(params[:client_id])\n\t\tfavorite = Favorite.new(client_id: params[:client_id])\n\t\tcurrent_user.customer.favorites ||= []\n\t\tcurrent_user.customer.favorites << favorite\n\t\tredirect_to root_path, notice: \"Company added to favorites\"\n\tend",
"def favorite_movies\n Enceladus::MovieCollection.new(\"account/#{id}/favorite/movies\", { session_id: session_id }) if authenticated?\n end",
"def get_favorite(key, json)\n return JSON.parse(json)[\"favorites\"][key]\nend",
"def index\n @favourites_recipes = FavouritesRecipe.all\n end",
"def set_favour\n @favour = Favour.find(params[:id])\n end",
"def show\n @favorite = current_user.favorites.find_by(recipe_id: @recipe.id)\n end",
"def check_favorite username, password, slideshow_id\n do_request 'check_favorite', username: username, password: password, slideshow_id: slideshow_id\n end",
"def index\n @favourite_categories = FavouriteCategory.all\n end",
"def show\n @favorite = Favorite.find(params[:id])\n respond_with(@favorite)\n end",
"def set_favorite\n @favorite = current_user.favorites.find(params[:id])\n end"
] | [
"0.7208633",
"0.71372694",
"0.7017088",
"0.6844159",
"0.6830898",
"0.6809243",
"0.67928225",
"0.678399",
"0.675279",
"0.6748336",
"0.6748336",
"0.6748336",
"0.6748336",
"0.67432666",
"0.67227274",
"0.6711299",
"0.66841656",
"0.66807073",
"0.6680474",
"0.66593146",
"0.66286314",
"0.6627936",
"0.65908474",
"0.6585064",
"0.65733474",
"0.6568807",
"0.6564188",
"0.6549595",
"0.6519813",
"0.6519813",
"0.6519813",
"0.6502353",
"0.64486325",
"0.6430561",
"0.64219314",
"0.64170176",
"0.6415107",
"0.6413823",
"0.6404767",
"0.63852894",
"0.6379959",
"0.63652694",
"0.6352881",
"0.63286924",
"0.62897396",
"0.6287851",
"0.6271622",
"0.62705123",
"0.6263861",
"0.6258345",
"0.6247727",
"0.6241464",
"0.62322414",
"0.62251365",
"0.6191566",
"0.6191281",
"0.61824936",
"0.6164666",
"0.61458534",
"0.6139991",
"0.61364263",
"0.61336",
"0.61256015",
"0.6122149",
"0.6119353",
"0.6118907",
"0.6110046",
"0.60844827",
"0.6073071",
"0.6071368",
"0.6062131",
"0.6054608",
"0.60517514",
"0.6051488",
"0.60395414",
"0.6032799",
"0.601925",
"0.60154086",
"0.6012026",
"0.597006",
"0.594867",
"0.59455955",
"0.59398425",
"0.5925935",
"0.5913084",
"0.5913084",
"0.59051",
"0.5901378",
"0.5900655",
"0.58898723",
"0.58810234",
"0.5873975",
"0.58671933",
"0.5861963",
"0.5856896",
"0.5852832",
"0.5833424",
"0.583053",
"0.58303577",
"0.58267844"
] | 0.6227884 | 53 |
POST /api/favourites?key= curl X POST v u admin:admin | def create
favourite=current_user.add_favourite(params[:key])
if favourite
respond_to do |format|
format.json { render :json => jsonp(favourites_to_json([favourite])) }
format.xml { render :xml => favourites_to_xml([favourite]) }
format.text { render :text => text_not_supported }
end
else
render_error('Favourite not found', 404)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_favorite(id)\n post \"favorites/create/#{id}\", {}\n end",
"def favorite(action, value)\n raise ArgumentError, \"Invalid favorite action provided: #{action}\" unless @@FAVORITES_URIS.keys.member?(action)\n value = value.to_i.to_s unless value.is_a?(String)\n uri = \"#{@@FAVORITES_URIS[action]}/#{value}.json\"\n case action\n when :add\n response = http_connect {|conn| create_http_post_request(uri) }\n when :remove\n response = http_connect {|conn| create_http_delete_request(uri) }\n end\n bless_model(Twitter::Status.unmarshal(response.body))\n end",
"def favorite(id)\n post(\"/favorites/create/#{id}.json\")\n end",
"def add_favorite username, password, slideshow_id\n do_request 'add_favorite', username: username, password: password, slideshow_id: slideshow_id\n end",
"def getFavorites(userID, ofWhat)\n request('getFavorites', {'userID' => userID, 'ofWhat' => ofWhat})\nend",
"def create\n @favorite = current_user.favoritables.build(favorite_params)\n\n if @favorite.save\n render json: @favorite, status: :created\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end",
"def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end",
"def index\n authorize! :index, Spree::Favorite\n @favorites = spree_current_user.favorites\n respond_to do |format|\n format.html\n format.json { render json: @favorites }\n end\n end",
"def add_to_favourites\n \n #pull out whichever recipe you are clicking on\n yummly_id = params[:yummly_id]\n recipe = Yummly.find(yummly_id)\n\n # make new instance of that recipe\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n UserFavouriteRecipe.create(recipe_id: r.id, user_id: current_user.id, yummly_id: yummly_id)\n\n redirect_to recipes_url, notice: \"Added recipe from your list of favourite recipes\"\n\n end",
"def favourite\n if session[:user_id] == nil\n render json: {code: 401}\n else\n url_id = params[:id]\n url = Url.find_by(id: url_id)\n current_user = User.find_by(id: session[:user_id])\n if current_user.urls.exists?(url_id)\n current_user.urls.delete(url)\n favourite = false\n else\n current_user.urls << url\n favourite = true\n end\n users = url.users\n render json: {code: 200, favourite: favourite, users: users}\n end\n end",
"def index\n @favorites = current_user.favorites\n render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json\n end",
"def create\n @favourite = Favourite.new(favourite_params)\n\n respond_to do |format|\n if @favourite.save\n sync_update @favourite.fav_post\n format.html { redirect_to :my_favourites, notice: 'Favourite was successfully created.' }\n format.json { render json: @favourite }\n else\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_favourite\n @favourite_artist = FavouriteArtist.where(spotify_id: params[:spotify_id]).first_or_create(_params)\n render :json => @favourite_artist.to_json\n end",
"def favorites(action=nil)\n my.favorites(action)\n end",
"def index\n respond_with @favorites\n end",
"def set_api_favorite\n @api_favorite = Api::Favorite.find(params[:id])\n end",
"def create\n @favourites = Favourite.new()\n @favourites.user_id = current_user.id;\n @favourites.army_list_id = params[:favourite][:army_list_id]\n \n respond_to do |format|\n if @favourites.save\n flash[:notice] = 'Favourites was successfully created.'\n format.html { redirect_back_or_default(user_favourites_url(current_user)) }\n format.xml { render :xml => @favourites, :status => :created, :location => @favourites }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @favourites.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_user_favorites username_for\n do_request 'get_user_favorites', username_for: username_for\n end",
"def add_word_to_favorites(word, *args)\n http_method = :post\n path = '/word/{word}/favorite'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: Product.order(created_at: :desc).limit(20).map(&:simple_info.with(follower)),\n status: :ok\n end",
"def add_favorite_food(food_id)\n post(\"/user/#{@user_id}/foods/log/favorite/#{food_id}.json\")\n end",
"def test_new_favourite_and_remove_favourite\n \n user = User.getByUsername(\"Adam\")\n bookmark = Bookmark.getAll[0]\n \n result = Favourite.newFavourite(bookmark.bookmarkId, user.userId)\n \n assert_equal true, result\n \n favourites = Favourite.getByUserId(user.userId)\n \n favourite = favourites[0]\n \n assert_equal \"amazon\", favourite.title\n assert_equal bookmark.bookmarkId, favourite.bookmarkId\n \n resultTwo = Favourite.removeFavourite(bookmark.bookmarkId, user.userId)\n \n assert_equal true, resultTwo\n \n end",
"def favourite_params\n params.require(:favourite).permit(:user_id, :fav_post_id)\n end",
"def show_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: follower.favorite_products.map(&:simple_info.with(follower)), status: :ok\n end",
"def create\n @favorite = current_user.favorites.build(params[:favorite])\n if @favorite.save\n flash[:notice] = \"Favorite saved!\"\n end\n # redirect_to root_path\n respond_with(@favorite)\n end",
"def create\n @favorite = user.favorites.new(favorite_params)\n\n if @favorite.save\n render :show, status: :ok\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end",
"def add_to_favorites(new_fav)\n @fav_list << new_fav \n end",
"def index #devolver todos os filmes e series que a gente escolheu\n # (@favorites.map(&:favoritable)) - esta serializando todos os favoritos.\n # map -faz um mapeamento\n #tabela favorite campo favoritable, e mapeia todas as series e videos, com watchableserializer.\n @favorites = current_user.favorites.all \n render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json\n end",
"def set_favorite\n @json = Punk::API.one_beer!(params[:id])\n @json = @json&.first\n if FavoriteBeer.where(punk_id: @json[:punk_id], user_id: @current_user.id).empty?\n @fav_beer = FavoriteBeer.new(@json)\n @fav_beer.user_id = @current_user.id.to_i\n @fav_beer.save!\n end\n\n @json[:favorite] = true\n render json: {\n favorite_beer_set: @json\n }\n end",
"def my_favorites\n\tend",
"def api_favorite_params\n params.require(:favorite).permit(:author_id, :project_id)\n end",
"def show\n json_response(@fav)\n end",
"def set_api_v1_favorite\n @api_v1_favorite = Api::V1::Favorite.find(params[:id])\n end",
"def favorites\n @lists = current_user.favorites\n respond_with(@lists)\n end",
"def index\n @favorites = current_user.favorites\n respond_with(@favorites)\n end",
"def create\n session[:return_to] ||= request.referer\n @favourites = Favourite.new(favourite_params)\n\n\n respond_to do |format|\n if @favourites.save\n format.html { redirect_to session.delete(:return_to), notice: 'Favourite was successfully created.' }\n format.json { render action: 'show', status: :created, location: data_show_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @faves_arr = []\n @favourites = current_user.favourites.map do |fave|\n @faves_arr << Location.find_by_id(fave.location_id)\n end\n\n render json: @faves_arr.map(&:transform_json), status: 201\n end",
"def get_favorite(key, json)\n\n # Add Your Code Here\n\nend",
"def index\n @favorites = Favorite.all\n @user = current_user\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @favorites }\n end\n end",
"def check_favorite username, password, slideshow_id\n do_request 'check_favorite', username: username, password: password, slideshow_id: slideshow_id\n end",
"def create\n @fav = Fav.new(params[:fav])\n\n respond_to do |format|\n if @fav.save\n format.html { redirect_to @fav, notice: 'Fav was successfully created.' }\n format.json { render json: @fav, status: :created, location: @fav }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fav.errors, status: :unprocessable_entity }\n end\n end\n end",
"def favorite\n\t\tclient = Client.find(params[:client_id])\n\t\tfavorite = Favorite.new(client_id: params[:client_id])\n\t\tcurrent_user.customer.favorites ||= []\n\t\tcurrent_user.customer.favorites << favorite\n\t\tredirect_to root_path, notice: \"Company added to favorites\"\n\tend",
"def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend",
"def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend",
"def create\n recipe = Recipe.find(params[:id])\n @favorite = current_user.add_to_favorite(recipe.id)\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to :back, notice: 'Favorite was successfully created.' }\n format.json { render :show, status: :created, location: @favorite }\n else\n format.html { render :new }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n fav = params[:favorite]\n fav[:user_id] = current_user.id\n fav[:name] = fav[:note]\n @favorite = Favorite.new(fav)\n @favorite.save\n render 'toggle'\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favourites = Favourite.all\n end",
"def index\n @favorites = current_user.favorites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @favorites }\n end\n end",
"def mark_item_as_favorite(product_id, item_number)\n self.client.post(\"products/#{product_id}/items/#{item_number}/favorites\")\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def set_favourite\n @favourite = Favourite.find(params[:id])\n end",
"def fave(favable)\n favorite_folder.add_favable(favable)\n end",
"def index\n @favourites = Favourite.all\n end",
"def set_favourite\n @favourite = Favourite.find(params[:id])\n end",
"def set_favourite\n @favourite = Favourite.find(params[:id])\n end",
"def set_favourite\n @favourite = Favourite.find(params[:id])\n end",
"def list_favorite_params\n params.require(:list_favorite).permit(:id_list_id, :id_user_id)\n end",
"def favourite_params\n params.require(:favourite).permit(:user_id, :book_id, :deleted_at, :deleted)\n end",
"def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end",
"def favorites(options = nil)\n def uri_suffix(opts); opts && opts[:page] ? \"?page=#{opts[:page]}\" : \"\"; end\n uri = '/favorites.json' + uri_suffix(options)\n response = http_connect {|conn|\tcreate_http_get_request(uri) }\n bless_models(Twitter::Status.unmarshal(response.body))\n end",
"def get_favorite(key, json)\n return JSON.parse(json)[\"favorites\"][key]\nend",
"def favourite_for(user)\n favourites.find_by_user_id user\n end",
"def set_favour\n @favour = Favour.find(params[:id])\n end",
"def favorites(action=nil)\n if @favorites\n case action\n when :update, :sync, :refresh\n @favorites = @client.favorites\n when nil\n @favorites\n else\n raise ArgumentError, \"#{action} is not a valid argument for @favorites.\"\n end\n else\n @favorites = @client.favorites\n end\n end",
"def set_favorite\n @favorite = current_user.favorites.find(params[:id])\n end",
"def list_params\n params.require(:favorite).permit(:list_id)\n end",
"def create\n @favourite = Favourite.new(favourite_params)\n\n respond_to do |format|\n if @favourite.save\n format.html { redirect_back notice: 'Favourite was successfully created.', fallback_location: root_path }\n format.json { render :show, status: :created, location: @favourite }\n else\n format.html { render :new }\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def favorite\n authorize @shelter\n current_user.favorite_shelter(@shelter)\n\n redirect_to shelter_path(@shelter)\n end",
"def favorites(screen_name)\n url = 'https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=' + screen_name\n request(@agent, @token, url)\n end",
"def create\n @favourite = Favourite.new(favourite_params)\n\n respond_to do |format|\n if @favourite.save\n format.html { redirect_to @favourite, notice: \"Favourite was successfully created.\" }\n format.json { render :show, status: :created, location: @favourite }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @favourite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_favorite(key, json)\n data =JSON.parse(json)\n return data['favorites'][key]\nend",
"def create\n @favorite = Favorite.new(params[:favorite])\n @favorite.user = current_user\n \n respond_to do |format|\n if @favorite.save\n format.html { redirect_to(favorites_url, :notice => 'Favorite was successfully created.') }\n format.xml { render :xml => @favorite, :status => :created, :location => @favorite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @favorite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list_favorite = ListFavorite.new(list_favorite_params)\n\n respond_to do |format|\n if @list_favorite.save\n format.html { redirect_to @list_favorite, notice: 'Lista foi adicionada aos favoritos!' }\n format.json { render :show, status: :created, location: @list_favorite }\n else\n format.html { render :new }\n format.json { render json: @list_favorite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favorite = Favorite.new(favorite_params)\n if @favorite.save\n render json: FavoriteSerializer.new(@favorite), status: :created\n else\n render json: @favorite.errors.full_messages.to_sentence, status: :unprocessable_entity\n end\n end",
"def add_to_favorites\n \tif user_signed_in?\n \t\t@user = current_user\n \t\[email protected]_listings << params[:listing_id] unless @user.favorite_listings.include?(params[:listing_id])\n \t\[email protected]\n \t\t\n \t\trender :nothing => true\n \tend\n end",
"def user_favorite\r\n\t\t\tif params[:is_add] == '1'\r\n\t\t\t\trender json: UsersFavoriteProject.add_favorite(params[:id])\r\n\t\t\telse\r\n\t\t\t\trender json: UsersFavoriteProject.remove_favorite(params[:id])\r\n\t\t\tend\r\n\t\tend",
"def favorite_params\n params.require(:favorite).permit(:user_id, :post_id)\n end",
"def favo_params\n params.require(:favo).permit(:user_id, :tweet_id)\n end",
"def add_favourite(user_id, favourite_name)\n @favourites_store.create(user_id, favourite_name)\n end",
"def send(key)\n HTTParty.post(@add_url, {\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :body => {\n #:url => formatted[:url],\n :url => \"https://www.engadget.com/2016/10/09/more-galaxy-note-7-replacement-fires/\",\n #:tags => formatted[:tags],\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :access_token => key\n }.to_json\n })\n end",
"def create\n @favor = Favor.new(params[:favor])\n\n respond_to do |format|\n if @favor.save\n format.html { redirect_to @favor, notice: 'Favor was successfully created.' }\n format.json { render json: @favor, status: :created, location: @favor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_favorite options={}\n\t options[:comic_id] = self.comic\n\t self.favorites.create!(options)\n\tend",
"def set_favory\n @favory = Favory.find(params[:id])\n end",
"def api_v1_favorite_params\n params.require(:api_v1_favorite).permit(:team_id)\n end",
"def create\n @favorite = Favorite.new(params[:favorite])\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to @favorite, notice: 'Favorite was successfully created.' }\n format.json { render json: @favorite, status: :created, location: @favorite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @favorite\n end",
"def post_to_pocket(url,title)\n path = '/v3/add'\n escaped_url = CGI::escape(url)\n escaped_title = CGI::escape(title)\n data = \"consumer_key=#{Consumer_key}&access_token=#{Token}&url=#{escaped_url}\"\n if title != \"\"\n data = data + \"title=#{escaped_title}\"\n end\n resp = pocket_api(path,data)\n if resp[0] == \"200\"\n puts \"Successfuly posted #{url} to Pocket\"\n else\n puts \"Something went wrong! Try to login again\"\n end\nend",
"def favorite\n type = params[:type] # get the type from the url (fav/unfav)\n ass = params[:controller] # get the current controller name\n clazz = params[:controller].classify.constantize # get the controllers class in with big upper letter\n obj = clazz.find_by tiss_id: params[:tiss_id] # find the object with the tiss_id\n obj = clazz.create tiss_id: params[:tiss_id] if obj.nil? # create if not exists\n alreadyfav = current_user.send(ass).exists?(obj.id) # is it already fav?\n if type == 'favorite' && !alreadyfav # if not already fav and we want to fav\n current_user.send(ass) << obj # fav it\n flash[:success] = \"Favorite successful\" # success msg\n elsif type == 'unfavorite' && alreadyfav # else\n current_user.send(ass).delete(obj) # unfav\n flash[:success] = \"Unfavorite successful\" # success msg\n else\n flash[:danger] = \"Nothing happened\" # nothing happened msg\n end\n redirect_back fallback_location: root_path # return\n end",
"def add(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/FavoriteBookmark/Add/20120627\", Rakuten::Api.merge(opts))\r\n end",
"def index\n @favorites = Favorite.all\n end",
"def index\n @favorites = Favorite.all\n end",
"def index\n @favorites = Favorite.all\n end",
"def create\n # @favoriteでとれないのはなぜじゃらほい\n\n @favorite = favorites.first_or_initialize\n @favorite.value = params[:value] ? params[:value] : 1\n @favorite.save\n # TODO 500 internal Server Error で落ちる。 ふぁぼ動作に支障なし\n # NoMethodError (undefined method `favorite_url' for #<FavoritesController:0x6c56718>):\n # app/controllers/application_controller.rb:7:in `respond'\n # app/controllers/favorites_controller.rb:24:in `create'\n # config/initializers/quiet_assets.rb:7:in `call_with_quiet_assets'\n respond_with @favorite\n\n\n end",
"def select_favorite\n Favorite.update_favorite(1,params[:id],current_user.id)\n redirect_back(fallback_location: restaurants_url)\n end",
"def favourite\n Video.add_to_favourite_by_media_id_and_user(params[:id], current_user)\n respond_to do |format|\n format.html {video = Video.find_by_id(params[:id]); redirect_to video_view_path(video.id, video.title)}\n format.js {render :nothing => true}\n end\n end",
"def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end",
"def favorite_params\n params.delete(:user_id)\n params.require(:favorite).permit(:gif_post_id)\n end"
] | [
"0.6387259",
"0.6329252",
"0.6308692",
"0.6107945",
"0.60683686",
"0.60001296",
"0.5972972",
"0.5876344",
"0.5863978",
"0.58421916",
"0.5823987",
"0.58015203",
"0.5791557",
"0.5779967",
"0.57413447",
"0.57254255",
"0.56926626",
"0.5689076",
"0.56798154",
"0.56775385",
"0.56735367",
"0.56696975",
"0.56607985",
"0.5636885",
"0.5631434",
"0.5603446",
"0.5597447",
"0.55931413",
"0.5587963",
"0.55848813",
"0.5578414",
"0.55736953",
"0.556633",
"0.5556415",
"0.55548716",
"0.5546773",
"0.55410534",
"0.55382866",
"0.55328393",
"0.5523913",
"0.55189794",
"0.55014896",
"0.54991806",
"0.54968584",
"0.546781",
"0.5465247",
"0.54612225",
"0.54612225",
"0.54612225",
"0.54612225",
"0.546029",
"0.5455688",
"0.5435654",
"0.54326",
"0.5431493",
"0.5429538",
"0.54273295",
"0.54273295",
"0.54273295",
"0.5420339",
"0.5406127",
"0.5401391",
"0.539509",
"0.53907025",
"0.5375658",
"0.5368412",
"0.5362067",
"0.53618467",
"0.5355133",
"0.53535986",
"0.53515416",
"0.5348486",
"0.5347945",
"0.5333893",
"0.532952",
"0.5325353",
"0.5320429",
"0.53177106",
"0.53172433",
"0.5311504",
"0.5302645",
"0.52992886",
"0.5293521",
"0.52821016",
"0.5281415",
"0.5274831",
"0.52705956",
"0.5261788",
"0.52615094",
"0.5256337",
"0.52549285",
"0.52531356",
"0.5248316",
"0.5248316",
"0.5248316",
"0.5248144",
"0.52394164",
"0.5237063",
"0.5233405",
"0.52313745"
] | 0.6386259 | 1 |
DELETE /api/favourites/ curl X DELETE v u admin:admin | def destroy
ok=current_user.delete_favourite(params[:id])
render_success(ok ? "Favourite deleted" : "Favourite not found")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @fav = Fav.find(params[:id])\n @fav.destroy\n\n respond_to do |format|\n format.html { redirect_to favs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @favourites = Favourite.find(params[:id])\n @favourites.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @favourite = Favourite.find(params[:id])\n @favourite.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize_action_for @favlink\n @favlink.destroy\n respond_to do |format|\n format.html { redirect_to favlinks_url, notice: 'Favlink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite.destroy\n respond_to do |format|\n format.html { redirect_to @favourite }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to favorites_url }\n format.json { head :no_content }\n end\n end",
"def destroy_favorite(id)\n delete \"favorites/destroy/#{id}\"\n end",
"def destroy\n @favourite.destroy\n respond_to do |format|\n format.html { redirect_to favourites_url, notice: \"Favourite was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite.destroy\n respond_to do |format|\n format.html { redirect_to favourites_url, notice: 'Favourite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list_favorite.destroy\n respond_to do |format|\n format.html { redirect_to list_favorites_url, notice: 'Lista removida dos favoritos!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favor = Favor.find(params[:id])\n @favor.destroy\n\n respond_to do |format|\n format.html { redirect_to favors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to(favorites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @favorite.destroy\n respond_to do |format|\n format.html { redirect_to favorites_url, notice: 'Favorito quitado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_listing = get_favourite_listing(params[:id])\n @favourite_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_food = FavouriteFood.find(params[:id])\n @favourite_food.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_foods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with favorites.first!.destroy\n end",
"def destroy\n @favor.destroy\n\n respond_to do |format|\n format.html { redirect_to favors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = @favourite.fav_post\n @favourite.destroy\n sync_update @post\n respond_to do |format|\n format.html { redirect_to :my_favourites, notice: 'Favourite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite.destroy\n\n head :no_content\n end",
"def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to favorites_url , notice: '削除しました。'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @favour.destroy\n respond_to do |format|\n format.html { redirect_to favours_url, notice: 'Favour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favo.destroy\n respond_to do |format|\n format.html { redirect_to favos_url, notice: 'Favo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite.destroy\n respond_to do |format|\n format.html { redirect_back notice: 'Favourite was successfully destroyed.', fallback_location: root_path }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @kf_course_user_fav = Kf::CourseUserFav.find(params[:id])\n @kf_course_user_fav.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_course_user_favs_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite.destroy\n respond_to do |format|\n format.html { redirect_to favorites_url, notice: 'Favorite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite.destroy\n respond_to do |format|\n format.html { redirect_to favorites_url, notice: 'Favorite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite.destroy\n respond_to do |format|\n format.html { redirect_to favorites_url, notice: 'Favorite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_favourite\n Favorite.find(:first, :conditions => [\"user_id =? AND favorable_id =?\", session[:user_id], params[:id]]).destroy\n flash[:notice] = \"Favourite removed\"\n redirect_to(:action => 'index')\n 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 destroy\n @favorecido.destroy\n respond_to do |format|\n format.html { redirect_to favorecidos_url, notice: 'Favorecido eliminado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shops_favorite = ShopsFavorite.find(params[:id])\n @shops_favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to(shops_favorites_url) }\n format.xml { head :ok }\n end\n end",
"def delete(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/FavoriteBookmark/Delete/20120627\", Rakuten::Api.merge(opts))\r\n end",
"def destroy\n favor = Favor.where(:user_id => params[:user_id], :post_id => params[:post_id])\n favor.destroy\n render :json => {:ok => true}, :head => :no_content\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\n request(:delete)\n end",
"def destroy\n @favourite.destroy\n redirect_to favourites_url\n end",
"def destroy\n @shop_favorite.destroy\n respond_to do |format|\n format.html { restore_last_request(notice: 'Shop favorite was successfully deleted.') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = current_user\n @FavoriteMovie = FavoriteMovie.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end",
"def destroy\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n @favorite_flyer.destroy\n\n respond_to do |format|\n format.html { redirect_to favorite_flyers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage_account, current_account\n @food = current_account.foods.find(params[:id])\n @food.destroy\n respond_with @food, :location => foods_url\n 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 destroy\n @auction_favorite.destroy\n respond_to do |format|\n format.html { redirect_to auction_favorites_url, notice: 'Favorite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_drink.destroy\n respond_to do |format|\n format.html { redirect_to favourite_drinks_url, notice: 'Favourite drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favor_user.destroy\n respond_to do |format|\n format.html { redirect_to favor_users_url, notice: 'Favor user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def unfavorite(id)\n post(\"/favorites/destroy/#{id}.json\")\n end",
"def destroy\n @favourites_recipe.destroy\n respond_to do |format|\n format.html { redirect_to favourites_recipes_url, notice: 'Favourites recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @favorite_dish.destroy\n respond_to do |format|\n format.html { redirect_to favorite_dishes_url, notice: 'Favorite dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favoriten.destroy\n respond_to do |format|\n format.html { redirect_to favoritens_url, notice: 'Favoriten was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favoritetweet = Favoritetweet.find(params[:id])\n @favoritetweet.destroy\n\n respond_to do |format|\n format.html { redirect_to(favoritetweets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @favoritepizza.destroy\n respond_to do |format|\n format.html { redirect_to favoritepizzas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_question = current_user.favourite_questions.find(params[:id])\n @favourite_question.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourite_questions_url) }\n format.xml { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n respond_with Favor.destroy(params[:id])\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @admin_fan.destroy\n respond_to do |format|\n format.html { redirect_to admin_fans_url, notice: 'Fan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @favorite_item.destroy\n respond_to do |format|\n format.html { redirect_to favorite_items_url, notice: t('.notice') }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @favourite_category.destroy\n respond_to do |format|\n format.html { redirect_to favourite_categories_url, notice: 'Favourite category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite_image.destroy\n respond_to do |format|\n format.html { redirect_to favorite_images_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_from_favorites(word, *args)\n http_method = :delete\n path = '/word/{word}/favorite'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def destroy\n @favorito.destroy\n respond_to do |format|\n format.html { redirect_to back_uri, warning: 'Favorito removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(url)\n call(url: url, action: :delete)\n end",
"def destroy\n @favorite_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to favorite_restaurants_url, notice: 'Favorite restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def destroy\n # Find error will be rescued from ApplicationController\n favorite_image = current_user.favorite_images.find(params[:id])\n favorite_image.destroy\n\n render json: {}, status: :ok\n end",
"def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end",
"def destroy\n favorite = Favorite.find(params[:id])\n favorite.destroy\n redirect_to :back\n end",
"def remove_from_favourites\n user_id = current_user.id\n yummly_id = params[:yummly_id]\n\n user_favourite_recipe = UserFavouriteRecipe.find_by(yummly_id: yummly_id, user_id: user_id)\n user_favourite_recipe.destroy\n\n redirect_to recipes_url, notice: \"Removed recipe from your list of favourite recipes\"\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def destroy\n @faction = Faction.find(params[:id])\n @faction.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_factions_url }\n format.json { head :no_content }\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(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('favorite', 'delete', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def destroy\n @favorite_album.destroy\n respond_to do |format|\n format.html { redirect_to favorite_albums_url, notice: 'Favorite album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n favorite = Favorite.find(params[:id])\n\n if favorite.user_id == current_user.id\n favorite.destroy\n render text: \"deleted\"\n else\n render text: \"You can't delete that favorite!\"\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n redirect_to action: \"latest\"\n @davis = Davis.find(params[:id])\n @davis.destroy\n\n #respond_to do |format|\n # format.html { redirect_to davis_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.favorites.destroy_all\n @music.destroy\n \n render :nothing => true\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n @get_restaurant_list.destroy\n\n head :no_content\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def destroy\n @favorite_web_thing.destroy\n respond_to do |format|\n format.html { redirect_to favorite_web_things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite_chapter.destroy\n respond_to do |format|\n format.html { redirect_to @favorite_chapter.chapter, notice: 'Chapter was succesfully unmarked as favorite.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @favorite_quotes.destroy\n respond_to do |format|\n format.html { redirect_to favorite_quotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_scheme_favorite.destroy\n respond_to do |format|\n format.html { redirect_to user_scheme_favorites_url, notice: 'User scheme favorite was successfully destroyed.' }\n format.json { head :no_content }\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 @fav_pokemon.destroy\n respond_to do |format|\n format.html { redirect_to fav_pokemons_url, notice: 'Fav pokemon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n # @venue = Venue.find(params[:venue_id])\n # @favorite = current_user.favorites.where(venue_id: params[:venue_id])\n # Favorite.destroy(@favorite.ids.first)\n redirect_to :back\n end",
"def destroy\n @coffeeshoplist.destroy\n respond_to do |format|\n format.html { redirect_to coffeeshoplists_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.71868145",
"0.7178901",
"0.70330167",
"0.70132256",
"0.69874495",
"0.69737864",
"0.6942786",
"0.69347465",
"0.6932927",
"0.6925335",
"0.6883672",
"0.6881248",
"0.68453246",
"0.68253446",
"0.68133926",
"0.68103534",
"0.6797247",
"0.6782409",
"0.6780309",
"0.67772985",
"0.676871",
"0.67483443",
"0.67399085",
"0.67324364",
"0.6709797",
"0.67067885",
"0.67067885",
"0.67067885",
"0.67021567",
"0.668441",
"0.668441",
"0.66786766",
"0.66684914",
"0.6652686",
"0.6643279",
"0.6606589",
"0.6606589",
"0.6606589",
"0.6606589",
"0.6603029",
"0.66002405",
"0.657919",
"0.6566245",
"0.6527924",
"0.65276647",
"0.65244216",
"0.65244216",
"0.6519717",
"0.651196",
"0.65106446",
"0.6504332",
"0.6481386",
"0.647504",
"0.6470964",
"0.64587605",
"0.6450638",
"0.6450318",
"0.64455533",
"0.6409969",
"0.6409365",
"0.6408499",
"0.6407206",
"0.6404079",
"0.6372407",
"0.63497806",
"0.6345947",
"0.6345041",
"0.63385886",
"0.63290644",
"0.63216037",
"0.63207614",
"0.6320595",
"0.63200784",
"0.6312918",
"0.63098246",
"0.63083875",
"0.63081187",
"0.63008755",
"0.6288005",
"0.6280738",
"0.6269647",
"0.62580514",
"0.62561107",
"0.6252201",
"0.6249891",
"0.6248091",
"0.62389797",
"0.6237914",
"0.62308",
"0.6227103",
"0.6219553",
"0.62158567",
"0.6212421",
"0.6212421",
"0.62022525",
"0.62014365",
"0.61960113",
"0.61939734",
"0.6182641",
"0.6181769"
] | 0.6968506 | 6 |
Description Sets that the notification has been seen by the user (see Notificationhas_been_seen) Mode Ajax Specific filters NotificationsControllerinitialize_notification_with_owner | def seen
if @ok
@ok = @notification.has_been_seen
end
@new_notifications = current_user.number_notifications_not_seen
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saw_notification\n current_user.notice_seen = true\n current_user.save\n end",
"def notifications_count\n notifications_count ||= self.notifications_to_show_user.where(:seen_by_user => false).count\n end",
"def show\n @notification.seen = true\n @notification.save\n end",
"def notifications_to_show_user\n notifications ||= UserEvent.where('user_id = ? AND error_during_render = ? AND event_type != ?', self.id, false, UserEvent.event_type_value(:video_play))\n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def validate_seen\n errors.add(:seen, :must_be_false_if_new_record) if !@notification && self.seen\n end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def put_seenNotification\n user = User.where(id: params[:idUser]).first\n token = params[:auth_token]\n if(user.auth_token == token)\n req = Notification.where(id: params[:idNotification]).first\n req.update(:seen=>true)\n\n\n render json: { status: 'SUCCESS', message: 'Notificacion actualizada' }, status: :ok\n else\n render json: { status: 'INVALID', message: 'Token invalido'}, status: :unauthorized\n end\n end",
"def notification\n notifications = Notification.where(\"user_id = ? AND viewed = ?\", current_user, false)\n flash[:notice] = \"Vous avez vendu #{notifications.size} bon(s)\" if notifications.size > 0\n notifications.each do |notification|\n notification.viewed = \"true\"\n notification.save\n end\n end",
"def initialize_notification_with_owner\n @notification_id = correct_integer?(params[:notification_id]) ? params[:notification_id].to_i : 0\n @notification = Notification.find_by_id @notification_id\n update_ok([email protected]? && current_user.id == @notification.user_id)\n end",
"def notified_users_with_custom_users\n notified = notified_users_without_custom_users\n\n custom_users_current = custom_users\n custom_users_changed = custom_users_added_or_removed\n\n notified_custom_users = (custom_users_current + custom_users_changed).select do |u|\n u.active? && u.notify_custom_user?(self, custom_users_current, custom_users_changed) && visible?(u)\n end\n notified += notified_custom_users\n notified.uniq\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def online_notification_seen_state(user_id_check = nil)\n state = Ticket::State.find_by(id: state_id)\n state_type = Ticket::StateType.find_by(id: state.state_type_id)\n\n # always to set unseen for ticket owner and users which did not the update\n if state_type.name != 'merged'\n if user_id_check\n end\n end\n\n # set all to seen if pending action state is a closed or merged state\n if state_type.name == 'pending action' && state.next_state_id\n state = Ticket::State.find_by(id: state.next_state_id)\n state_type = Ticket::StateType.find_by(id: state.state_type_id)\n end\n\n # set all to seen if new state is pending reminder state\n if state_type.name == 'pending reminder'\n if user_id_check\n return false if owner_id == 1\n\n return true\n end\n return true\n end\n\n # set all to seen if new state is a closed or merged state\n return true if state_type.name == 'closed'\n return true if state_type.name == 'merged'\n\n false\n end",
"def mark_shown_invite_friends\n current_user.shown_invite_friends!\n render nothing: true\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def set_notifications\n @notifications = current_user.my_notifications\n end",
"def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end",
"def update\r\n\t\tif @notification.update(notification_params)\r\n\t\t\tAction.create(info: current_user.username + ' has seen this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend",
"def personal_pnsqs_in_holder\n if ((@user = User.find_by_id(params[:id])) and (its_me?(@user)))\n\n @pnsqs = @user.privates_all\n\n # Notificaciones leidas\n @user.update_attributes(:notifications_count => 0)\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js { render }\n end\n\n else\n error404\n end\n end",
"def noCookieNotifications=(value)\n\t\t\t@noCookieNotifications = value\n\t\tend",
"def noCookieNotifications=(value)\n\t\t\t@noCookieNotifications = value\n\t\tend",
"def acknowledge\n if current_user\n if current_user.notifications_seen.nil?\n current_user.notifications_seen = [params[:notif_id]]\n else\n current_user.notifications_seen << params[:notif_id]\n end\n current_user.save\n end\n head 200, content_type: \"text/html\"\n end",
"def notified_watchers\n notified = (watcher_users.active + watcher_users_through_groups.active).uniq\n notified.reject! {|user| user.mail.blank? || user.mail_notification == 'none'}\n if respond_to?(:visible?)\n notified.reject! {|user| !visible?(user)}\n end\n notified\n end",
"def notify_user_actions\n @attributes[:notify_user_actions]\n end",
"def display_notif_unseen(usr_id)\n num = PublicActivity::Activity.where(is_seen: false, owner_id: usr_id, owner_type: \"User\").count\n return num if num > 0\n return \"\" # Else return blank string\n end",
"def apple_news_blocked=(value)\n @apple_news_blocked = value\n end",
"def set_user_notification\n @user_notification = @user.user_notifications.find(params[:id])\n end",
"def request_viewed(other_user)\n\t\trequest = received_relationships.find_by(friend_active_id: other_user.id)\n\t\tif request.new_request?\n\t\t\trequest.update_attributes(new_request: false)\n\t\tend\n\tend",
"def view_notification\n notification = Notification.find_by_short_id(params[:id])\n session[:via_notification] = notification.id if notification.present?\n\n # Figure out the time zone to assume the responder is using\n if current_user\n time_zone = current_user.time_zone_or_default\n elsif notification.user.present?\n time_zone = notification.user.time_zone_or_default\n elsif notification.from_user.present?\n time_zone = notification.from_user.time_zone_or_default\n else\n time_zone = 'Pacific Time (US & Canada)'\n end\n time_utc = Time.now.utc\n\n unless params[:suppress_stats].present?\n # If we don't have a referer for this link, save it now\n # Maybe I should only store it on initial response? \n if notification.ref_site.blank? and request.referer.present?\n referer_uri = URI.parse(request.referer)\n if referer_uri.host.present?\n notification.attributes = {:ref_site => referer_uri.host, :ref_url => request.referer}\n end\n end\n\n if !notification.responded? and current_user\n time_in_time_zone = Time.now.in_time_zone(time_zone)\n notification.attributes = {:responded_at => time_utc,\n :responded_hour_of_day => time_in_time_zone.hour,\n :responded_day_of_week => time_in_time_zone.wday,\n :responded_week_of_year => time_in_time_zone.strftime('%W').to_i,\n :responded_minutes => (notification.delivered_at.present? ? ((time_utc-notification.delivered_at)/60.0).round : nil),\n :total_clicks => notification.total_clicks+1,\n :responded => true,\n :method_of_response => nil}\n # Increment this method of delivery by 1\n if current_user and notification.expected_response?\n case notification.delivered_via\n when 'email'\n if current_user.contact_by_email_score < 10\n new_score = current_user.contact_by_email_score >= 9 ? 10 : current_user.contact_by_email_score+2\n current_user.update_attributes({:contact_by_email_score => new_score})\n end\n when 'sms'\n if current_user.contact_by_sms_score < 10\n new_score = current_user.contact_by_sms_score >= 9 ? 10 : current_user.contact_by_sms_score+2\n current_user.update_attributes({:contact_by_sms_score => new_score})\n end\n when 'public_tweet'\n if current_user.contact_by_public_tweet_score < 10\n new_score = current_user.contact_by_public_tweet_score >= 9 ? 10 : current_user.contact_by_public_tweet_score+2\n current_user.update_attributes({:contact_by_public_tweet_score => new_score})\n end\n when 'dm_tweet'\n if current_user.contact_by_dm_tweet_score < 10\n new_score = current_user.contact_by_dm_tweet_score >= 9 ? 10 : current_user.contact_by_dm_tweet_score+2\n current_user.update_attributes({:contact_by_dm_tweet_score => new_score})\n end\n when 'robocall'\n if current_user.contact_by_robocall_score < 10\n new_score = current_user.contact_by_robocall_score >= 9 ? 10 : current_user.contact_by_robocall_score+2\n current_user.update_attributes({:contact_by_robocall_score => new_score})\n end\n when 'facebook'\n if current_user.contact_by_facebook_wall_score < 10\n new_score = current_user.contact_by_facebook_wall_score >= 9 ? 10 : current_user.contact_by_facebook_wall_score+2\n current_user.update_attributes({:contact_by_facebook_wall_score => new_score})\n end\n when 'twitter'\n if current_user.contact_by_public_tweet_score < 10\n new_score = current_user.contact_by_public_tweet_score >= 9 ? 10 : current_user.contact_by_public_tweet_score+2\n current_user.update_attributes({:contact_by_public_tweet_score => new_score})\n end\n end\n end\n else\n notification.total_clicks = notification.total_clicks+1\n\n end\n notification.save\n end\n\n case notification.for_object\n when 'send_link_resource'\n # Stream\n link_resource = notification.data_object\n redirect_to (link_resource.bitly_url.present? ? link_resource.bitly_url : link_resource.url)\n\n when 'welcome_to_program'\n # Program\n redirect_to :controller => :play, :action => :program, :id => notification.for_id \n when 'new_coachee'\n # Program Player\n program_player = ProgramPlayer.find notification.for_id\n redirect_to :controller => :play, :action => :coach_stream, :id => program_player.id \n when 'welcome_to_program_coach'\n # Program Player\n program_player = ProgramPlayer.find notification.for_id\n redirect_to :controller => :play, :action => :program, :id => program_player.program_id \n when 'welcome_to_program_play'\n # Program\n redirect_to :controller => :play, :action => :program, :id => notification.for_id \n when 'gentle_nudge'\n # Stream\n redirect_to :controller => :play, :action => :index\n when 'daily_nudge'\n # ProgramPlayer\n program_player = ProgramPlayer.find notification.for_id\n redirect_to :controller => :play, :action => :program, :id => program_player.program_id\n when 'player_message'\n # View Program\n redirect_to :controller => :play, :action => :program, :id => PlayerMessage.find(notification.for_id).program_player.program_id\n when 'message_to_coach'\n player_message = PlayerMessage.find notification.for_id\n # View PlayerMessages from player who needs help from their coach\n if player_message.program_player.present?\n redirect_to :controller => :play, :action => :coach_stream, :id => player_message.program_player.id \n else\n redirect_to :controller => :stream, :action => :message, :id => notification.for_id\n end\n when 'message_to_player'\n # View PlayerMessages from player who needs help from their coach\n player_message = PlayerMessage.find notification.for_id\n if player_message.program_player.present?\n redirect_to :controller => :play, :action => :coach_stream, :id => player_message.program_player.id \n else\n redirect_to :controller => :stream, :action => :message, :id => notification.for_id\n end\n when 'entry_comment'\n # View stream item from player who needs help from their coach\n entry_comment = EntryComment.find notification.for_id rescue nil\n if entry_comment.present?\n redirect_to :controller => :stream, :action => :view, :id => entry_comment.entry_id\n \n # Old link... deprecated on 1/28/2012 by Buster\n else\n entry = Entry.find notification.for_id\n redirect_to :controller => :stream, :action => :view, :id => entry.parent_id\n end\n when 'entry_comment_participant'\n # View stream item from player who needs help from their coach\n entry_comment = EntryComment.find notification.for_id rescue nil\n redirect_to :controller => :stream, :action => :view, :id => entry_comment.entry_id\n when 'player_needs_help'\n # View Players who need help\n redirect_to :controller => :dash, :action => :program_player, :id => notification.for_id\n when 'entry'\n # Someone clicked on a shared entry post\n entry = Entry.find notification.for_id\n if entry.message_type == 'starting_soon'\n redirect_to :controller => :play, :action => :program, :id => entry.program_id \n elsif entry.message_type == 'comment'\n redirect_to :controller => :stream, :action => :index\n else # checkin, secret, nemesis\n redirect_to :controller => :stream, :action => :view, :id => entry.id\n end \n when 'invite_to_support'\n # Someone clicked on an invite to support\n supporter = Supporter.find notification.for_id\n redirect_to :controller => :home, :action => :support, :id => supporter.id\n when 'invitation_to_program'\n # Someone clicked on an invitation to a particular program\n invitation = Invitation.find notification.for_id\n redirect_to :protocol => 'https://', :host => SECURE_DOMAIN, :controller => :store, :action => :program, :id => invitation.program_player.program.token, :invitation_id => invitation.id \n when 'invitation_to_program_success'\n # Someone clicked on an invitation to a particular program\n invitation = Invitation.find notification.for_id\n redirect_to :controller => :invite, :action => :program, :id => invitation.program_player.program.id\n when 'completed_level'\n # Player budge -> pick a new level\n player_budge = PlayerBudge.find notification.for_id\n redirect_to :controller => :play, :action => :program, :id => player_budge.program_player.program_id\n when 'coached_player_checked_in'\n # Player budge -> pick a new level\n if notification.message_data[:data].class.to_s == 'Entry'\n entry = Entry.find notification.for_id\n redirect_to :controller => :play, :action => :coach_stream, :id => entry.program_player_id \n # For notifications of this type that are older than 1/18/2012\n else\n player_budge = PlayerBudge.find notification.for_id\n redirect_to :controller => :play, :action => :coach_stream, :id => player_budge.program_player_id\n end\n when 'coach_batch_report'\n # User\n redirect_to :controller => :coach, :action => :index\n when 'nag'\n # User\n redirect_to :controller => :play, :action => :index\n when 'nag_prompt'\n # nag_mode_prompt\n if current_user.present? and user_nag_mode = current_user.user_nag_mode\n redirect_to :controller => :play, :action => :program, :id => user_nag_mode.program_id \n else\n redirect_to :controller => :play, :action => :index\n end\n when 'robocall_nag_followup'\n # nag_mode_prompt\n if current_user.present? and user_nag_mode = current_user.user_nag_mode\n redirect_to :controller => :play, :action => :program, :id => user_nag_mode.program_id \n else\n redirect_to :controller => :play, :action => :index\n end\n \n when 'rewarded_invites'\n redirect_to :controller => :invite, :action => :index\n when 'new_follower'\n # Relationship\n relationship = Relationship.find notification.for_id\n redirect_to :controller => :profile, :action => :t, :id => relationship.user.twitter_username\n when 'invite_to_beta_cohort'\n redirect_to :controller => :home, :action => :flag_for_beta, :id => notification.message_style_token\n when 'phone_number_invalid'\n redirect_to :controller => :profile, :action => :settings\n when 'moment_of_truth'\n player_budge = PlayerBudge.find notification.for_id\n redirect_to :controller => :play, :action => :program, :id => player_budge.program_player.program_id\n when 'since_u_been_gone'\n redirect_to :controller => :stream, :action => :index\n when 'good_morning'\n redirect_to :controller => :stream, :action => :index \n when 'liked_entry'\n like = Like.find(notification.for_id)\n redirect_to :controller => :stream, :action => :view, :id => like.entry_id\n when 'super_follow_checkin'\n redirect_to :controller => :stream, :action => :view, :id => notification.for_id\n else\n raise \"Unknown notification type: #{notification.for_object}\"\n end\n end",
"def update_notifications\n user = current_user\n user.notify_on_private = params[:notify_on_private]\n user.notify_on_public = params[:notify_on_public]\n user.notify_on_reply = params[:notify_on_reply]\n user.save!\n redirect_to admin_settings_path\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def notification_params\r\n\t\tparams.require(:notification).permit(:info, :seen, :user_id)\r\n\tend",
"def set_NotifyNewEntityOwner(value)\n set_input(\"NotifyNewEntityOwner\", value)\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\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 old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#{listings_path(listing.id)}}'><b>#{listing.title}</b></a> has been approved.\"\n end",
"def replicate_notice\n users = case noticeable\n # Notify people who follow a topic\n when Post \n noticeable.topic.monitoring_users\n # Notify people who are the member of a group plus the creator's friends\n when GroupMembership\n (noticeable.group.members + creator.friends).uniq\n when Friendship\n creator.friends.reject {|u| u == noticeable.friend}\n # Notify the friends of the creator\n else\n creator.friends\n end\n self.notify_users(users) if users.size <= App.max_users_to_notify\n end",
"def friendship_notifications?\n notification_friendship\n end",
"def o_ucount_notify_once\n Rails.cache.fetch(o_ucount_notify_key, expires_in: 1.days) do\n o_ucount_notify\n true\n end\n end",
"def set_notification\n get_user\n @notification = @user.notifications.find(params[:id])\n end",
"def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end",
"def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end",
"def refreshnotify\n @title = \"\"\n\n puts '====================== refreshnotify'\n\n current_user.update_attributes!(:notify => \"NO\")\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :email, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url]) \n } }\n end\n end",
"def show\n @notificationss = Notification.where(user_id:current_user.id,estado:false).size\n @participants = Participant.all\n end",
"def show\n @notificationss = Notification.where(user_id:current_user.id,estado:false).size\n @participants = Participant.all\n end",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n @notification.update_attribute(:status, ::Users::Notification::Status::DELETED)\n\n elsif @notification.should_flag_viewed?\n @notification.update_attribute(:status, ::Users::Notification::Status::VIEWED)\n end\n set_referer_as_redirect_back\n end\n respond_to do |format|\n format.html { redirect_to @notification.uri }\n format.json { render json: @notification.as_json(relationship_to_user: auth_user)\n }\n end\n end",
"def edit\r\n return if handle_event_rsvp_unsubscribe\r\n\r\n @user = User.find_by_display_id params[:id]\r\n if @user.blank?\r\n logger.warn \"No user with display id '#{params[:id]}'\"\r\n handle_resource_not_found\r\n return\r\n end\r\n\r\n @cobrand = @user.cobrand\r\n\r\n # skip if already globally unsubed\r\n return if render_already_opted_out\r\n\r\n if params[:t] == 'p'\r\n # i param is the id of the relevant NotificationPreference\r\n @preference = NotificationPreference.find_by_id params[:i]\r\n unless @preference.blank?\r\n @preference = nil if @preference.frequency == NotificationPreference::NEVER\r\n if @preference.user != @user\r\n logger.error \"Preference user doesn't match recipient user\"\r\n @preference = nil\r\n end\r\n end\r\n else \r\n identified_by = 'unknown'\r\n list = nil\r\n owner = nil\r\n\r\n if params[:t] == 'r'\r\n identified_by = 'remote list id'\r\n list = EmailList.find_by_remote_list_id params[:i]\r\n topic = list.topic\r\n owner = list.owner\r\n elsif params[:t] == 'l'\r\n identified_by = 'list display id'\r\n list = EmailList.find_by_display_id params[:i]\r\n topic = list.topic\r\n owner = list.owner\r\n elsif params[:t] == 'n'\r\n identified_by = 'notification topic'\r\n topic, owner = case params[:i]\r\n when NEW_FAN_TOKEN\r\n [ :new_fan, @user ]\r\n when NEW_COMMENT_TOKEN\r\n [ :new_comment, @user ]\r\n when FRIENDS_DIGEST_TOKEN\r\n [ :friends_digest, Category.find_root ]\r\n else\r\n [ nil, nil ]\r\n end\r\n elsif params[:t] == 'c'\r\n identified_by = 'community name'\r\n topic = case params[:i]\r\n when PROMOTIONS_TOKEN\r\n :promotions\r\n when ACTIVATION_TOKEN\r\n :activation\r\n else\r\n nil\r\n end\r\n owner = Category.find_root\r\n end\r\n\r\n @preference = NotificationPreference.find_by_user_id_and_notifiable_id_and_notifiable_type_and_preference(\r\n @user.id, owner.id, owner.class.to_s, topic)\r\n end\r\n end",
"def index\n @notifications = current_user ? current_user.user_notifications.unopened : []\n\n respond_to do |format|\n format.js { render :partial => \"shared/notifications_list\", locals: { :notifications => @notifications } }\n end\n\n end",
"def started_viewing(user = nil, dont_notify: false)\n if user && !viewing?(user)\n Cache.set_add(viewing_cache_key, collaborator_json_stringified(user))\n end\n received_changes(num_viewers_changed: true) unless dont_notify\n end",
"def add_notification\n if followable_type == \"User\"\n Notification.create(\n target_id: followable_id,\n target_type: \"User\",\n notice_id: id,\n notice_type: \"Follow\",\n user_id: followable_id,\n notifier_id: follower_id\n )\n end\n end",
"def notifications\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def notify_starting\n\t\tuser_list = []\n\t\tparty_list.each do |uid, uhash|\n\t\t\tuser_list <<= uid if uhash[:status] == STATUS_ATTENDING\t\t\t\n\t\tend\n\t\tnotification = EventNotification.new(NOTIF_EVENT_STARTING, self)\n\t\tnotify(notification, user_list, false)\n\tend",
"def vendorNotificationsNew\n\t\t@vendor=current_vendor\n\t\t@notification = Notification.new\n\t\t@members=current_vendor.users.where(\"userApproved=1\").order('first_name ASC')\n\t\trender :layout=>'vendorprofile'\n\t\tend",
"def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end",
"def notify_friends\n # Create notifications to the users friends\n self.user.friends.each do |friend|\n friend.notifications.create!(:body => I18n.translate('notification.types.event_created'))\n end\n # Create notifications to the users who have this user as a friend\n self.user.inverse_friends.each do |friend|\n friend.notifications.create!(:body => I18n.translate('notification.types.event_created'))\n end\n end",
"def notify_friends\n # Create notifications to the users friends\n self.user.friends.each do |friend|\n friend.notifications.create!(:body => I18n.translate('notification.types.event_created'))\n end\n # Create notifications to the users who have this user as a friend\n self.user.inverse_friends.each do |friend|\n friend.notifications.create!(:body => I18n.translate('notification.types.event_created'))\n end\n end",
"def notifications_update\n @notifications = current_user.sk.followed_submissions.includes(:user, :problem).where(\"status > 0\").order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = false\n render :notifications\n end",
"def handle_notify_event(event, is_being_published)\n event.users.each do |user|\n I18n.with_locale(user.get_locale) do\n status = EventStatus.find_by(user_id: user.id, event_id: event.id)\n if !status.blank? && !status.not_attending?\n if is_being_published\n send_publish_event_notification(event, user, status)\n else\n send_delete_event_notification(event, user)\n end\n end\n end\n end\n end",
"def after_save(user)\n if user.confirmed_at_changed?\n Invitation.where(friend_id: user.id).each do |invitation|\n invitation.confirm!\n end\n end\n end",
"def notify_users\n ([requested_by, owned_by] + notes.map(&:user)).compact.uniq\n end",
"def before_create\n limit = 19\n # logger.debug2 \"notification.before_create: to_user_id = #{to_user_id}\"\n count = Notification.where(\"to_user_id = ? and internal = ?\", to_user_id, 'Y').length\n return if count <= limit\n # keep newest 19 notifications (0..18).\n ns = Notification.where(\"to_user_id = ? and internal = ?\", to_user_id, 'Y').order(\"updated_at desc\")\n ns = ns[limit..-1]\n ns.each { |n| n.destroy }\n # one new notification will be created just in a moment\n end",
"def toggle_notification(visible)\n @notification_visible = visible\n end",
"def accept_request\n @user = User.friendly.find(params[:user_id])\n @follow = Follow.find_by followable_id: current_user.id, follower_id: @user.id\n @follow.status = 1\n if @follow.save\n @user.add_notifications(\" has accepted your <strong>friend request</strong>.\", \n \" a accepté ta <strong>demande d'ami</strong>.\",\n current_user , nil, nil, Notification.type_notifications[:friend_request], nil)\n render :json => {:success => true}\n else \n render :json => {:success => false}\n end \n \n end",
"def reload\n @notifications = current_user.notifications_visible_block 0, SETTINGS['notifications_loaded_together']\n @new_notifications = current_user.number_notifications_not_seen\n @offset_notifications = @notifications.length\n @tot_notifications = current_user.tot_notifications_number\n end",
"def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end",
"def notification_approve\n @notifications = current_user.notifications.where(notification_type: [\"approve\", \"submit\"]).order(\"created_at desc\")\n render :layout => false\n end",
"def notify_users_after_change\n if !id ||\n saved_change_to_when? ||\n saved_change_to_where? ||\n saved_change_to_location_id? ||\n saved_change_to_notes? ||\n saved_change_to_specimen? ||\n saved_change_to_is_collection_location? ||\n saved_change_to_thumb_image_id?\n notify_users(:change)\n end\n end",
"def notify_owner_of_change(notebook, owner, user, type, emails, message, url)\n @notebook = notebook\n @url = url.chomp('/')\n @owner = owner\n @type = type\n if @type == \"shared notebook\"\n @sharer = user\n subject = \"NBGallery notebook shared with others\"\n elsif @type == \"ownership change\"\n @changer = user\n subject = \"NBGallery notebook ownership change\"\n end\n @message = message\n @email_needs_to_be_simplified = need_to_simplify_email?(@notebook, @message)\n mail(\n bcc: emails,\n subject: subject\n )\n end",
"def show\n set_user_activity\n end",
"def is_there_notification\n current_user.notifications\n end",
"def receives_emails_for\n recips = user.things_i_track.email_delivery.tracked_item_is_user.map(&:tracked_item_id)\n recips = User.find(:all, :conditions => {:id => recips}) unless recips.blank?\n return recips.uniq.select {|u| user.is_self_or_owner?(u)}\n end",
"def notifications_new\n @notifications = Submission.includes(:user, :problem, followings: :user).where(visible: true).order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = true\n render :notifications\n end",
"def set_user_notice\n @user_notice = UserNotice.find(params[:id])\n end",
"def set_notification\n @notification = Notification.for_user(current_api_v1_user).find(params[:id])\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 notify\n @attributes.fetch('notify', false)\n end",
"def relatedrequests \n @requests = User.get_myblood_requests(current_user.blood_type) \n current_user.update_attribute(:notifications , 0) \n end",
"def friend_request_accepted_notification(user, friend)\n @user = user\n @friend = friend\n @friend_url = \"http://www.lacquerloveandlend.com/users/#{@friend.id}\"\n\n mail(to: @user.email, subject: \"#{@friend.name} accepted your friendship on Lacquer Love&Lend!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def updateNotifications\r\n\t\tdataHash = {\r\n\t\t\tuser_id: params[:user].id,\r\n experience_p_status: params[:experience_p_status],\r\n experience_status: params[:experience_status],\r\n\t\t\tfeelike_status: params[:feelike_status],\r\n\t\t\tfollows_status: params[:follows_status],\r\n comment_status: 0\r\n\t\t}\r\n UsersSettings.byUser(params[:user].id).first.updateNotifications(dataHash)\r\n self.default_response\r\n\tend",
"def notified_users\n notified = []\n\n # Author and auditors are always notified unless they have been\n # locked or don't want to be notified\n notified << user if user\n\n notified += auditor_users\n\n # Only notify active users\n notified = notified.select { |u| u.active? }\n\n notified.uniq!\n\n notified\n end",
"def notified_users\n notified = []\n\n # Author and assignee are always notified unless they have been\n # locked or don't want to be notified\n notified << author if author\n\n notified += assigned_to_users\n notified += assigned_to_was_users\n\n notified = notified.select {|u| u.active?}\n\n notified.uniq!\n notified\n end",
"def seen!\n @last_seen = Time.now\n end",
"def increase_unseen_notification_count!(options, **)\n increase_unseen_notification_count(options['my.notification'])\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def set_notifylike\n @notifylike = Notifylike.find(params[:id])\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def set_user_notvenified\n @user_notvenified = UserNotvenified.find(params[:id])\n end",
"def sent_friend_requests\n self.followed_users.where(\"friend_status = 'PENDING'\")\n end",
"def index\n @page_header = \"通知\"\n unless params[:include_read]\n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(\"id desc\")\n else\n @notifications = Notification.where(user: current_user).page(params[:page]).per(10).order(\"id desc\")\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n\n end",
"def index\n if current_user.status == \"admin\" || current_user.status == \"staff\"\n @notifications = Notification.all.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.student\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"students\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.company\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"companies\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse \n end\n # @notifications = unreaded_notifications\n respond_to do |format|\n format.html {render template: \"/notifications/index\"}\n format.js\n end\n end",
"def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end",
"def show\n\n $new_unread_messages_cnt = Message.current_user_unread(current_user).unread_messages.length\n\n @userFriendships = Friendship.where(friend_id: current_user.id, status: \"pending\")\n @eventNotifs = EventNotif.where(user_id: current_user, is_checked: false)\n @friendships = Friendship.where(user_id: @user.id, friend_id: current_user.id, status: \"pending\")\n @acceptedFriendships = Friendship.where(user_id: @user.id, friend_id: current_user.id, status: \"accepted\")\n\n @interests = Interest.all\n\n @users = User.all\n @userNow = current_user\n @following = current_user.following\n\n\n collide = current_user.followingI.ids & @user.followingI.ids\n @collideInterests = Interest.find(params = collide).sort_by &:updated_at\n\n\n @user_groups = @user.groups.order(\"created_at DESC\")\n followingGroupsIds = @user.followingG.map(&:id)\n @groupsFollow = Group.find(params = followingGroupsIds).sort_by &:updated_at\n\n @user_events = @user.events.order(\"created_at DESC\")\n followingEventsIds = @user.followingE.map(&:id)\n @eventsFollow = Event.where(id: [followingEventsIds]).where('event_date > ?', Date.today).sort_by &:event_date\n\n @user_posts = @user.posts.order(\"created_at DESC\")\n\n if @user.date_of_birth.present?\n @age = current_user.age(current_user.date_of_birth)\n end\n \n end",
"def show\n @message.update(read: true) if @message.receiver == current_owner\n respond_to do |format|\n format.js\n format.html\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"
] | [
"0.6892667",
"0.66317225",
"0.65939784",
"0.63638735",
"0.61339563",
"0.59575915",
"0.59058136",
"0.58849347",
"0.5855978",
"0.5805134",
"0.5784054",
"0.5756029",
"0.5728686",
"0.5715061",
"0.5695581",
"0.56925845",
"0.5641947",
"0.56171817",
"0.5608322",
"0.5569345",
"0.5559753",
"0.55138975",
"0.55138975",
"0.5483",
"0.54665107",
"0.545881",
"0.544883",
"0.54412764",
"0.540461",
"0.53925437",
"0.53291506",
"0.53239435",
"0.531878",
"0.531878",
"0.53141457",
"0.52874047",
"0.52861",
"0.5285525",
"0.5284329",
"0.5274273",
"0.52668417",
"0.52563775",
"0.5254115",
"0.5240412",
"0.52332616",
"0.5226301",
"0.5225284",
"0.5225284",
"0.5209545",
"0.52082276",
"0.5206183",
"0.52059984",
"0.52045023",
"0.5196496",
"0.5191076",
"0.51874864",
"0.51840985",
"0.51783425",
"0.5160597",
"0.51598287",
"0.51545036",
"0.51545036",
"0.5150237",
"0.51442146",
"0.51315075",
"0.5125791",
"0.5124159",
"0.5123636",
"0.51227367",
"0.5106569",
"0.5106316",
"0.51018083",
"0.51016647",
"0.50999886",
"0.509977",
"0.5095901",
"0.5095592",
"0.5083791",
"0.5081302",
"0.50791234",
"0.5069421",
"0.5068858",
"0.5063401",
"0.5059999",
"0.5049759",
"0.5049488",
"0.50424135",
"0.50411946",
"0.50390655",
"0.50306475",
"0.50263816",
"0.5025709",
"0.5023521",
"0.5022554",
"0.5021597",
"0.5014959",
"0.5014943",
"0.5013584",
"0.5011982",
"0.5011892"
] | 0.70680195 | 0 |
Description Deletes a notification Mode Ajax Specific filters NotificationsControllerinitialize_notification_with_owner NotificationsControllerinitialize_notification_offset | def destroy
if @ok
resp = current_user.destroy_notification_and_reload(@notification.id, @offset_notifications)
if !resp.nil?
@offset_notifications = resp[:offset]
@next_notification = resp[:last]
@new_notifications = current_user.number_notifications_not_seen
@tot_notifications = current_user.tot_notifications_number
else
@error = I18n.t('activerecord.errors.models.notification.problem_destroying')
end
else
@error = I18n.t('activerecord.errors.models.notification.problem_destroying')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @notification_restriction = NotificationRestriction.find(params[:id])\n @notification_restriction.destroy\n\n respond_to do |format|\n format.html { redirect_to notification_restrictions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_notification.destroy\n\n head :no_content\n end",
"def delete_Notification\n dest = Notification.where(id: params[:idNotification]).first\n if (dest) \n Notification.where(id: params[:idNotification]).destroy_all\n render json: { status: 'SUCCESS', message: 'ELIMINACION EXITOSA'}, status: :ok\n else\n render json: { status: 'INVALID', message: 'NOTIFICACION NO ENCONTRADA'}, status: :unauthorized\n end\n end",
"def delete\n @notification = Users::Notification.find_by_id(params[:id])\n @notification.set_status_deleted\n\n respond_to do |format|\n format.html { redirect_to notification_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@notification = Notification.find(params[:id])\n #@notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize(Notification)\n if @notification.destroy\n msg = success_message(@notification, _('deleted'))\n redirect_to super_admin_notifications_path, notice: msg\n else\n flash.now[:alert] = failure_message(@notification, _('delete'))\n render :edit\n end\n end",
"def destroy\r\n\t\t@notification = Notification.find(params[:id])\r\n\t\tif current_user != nil\r\n\t\t\tAction.create(info: current_user.username + ' has deleted this notification: (' + @notification.info + ') belonging to ' + User.find(@notification.user_id).username + '.', user_email: current_user.email)\r\n\t\telse\r\n\t\t\tAction.create(info: 'A system has deleted this notification: (' + @notification.info + ') belonging to ' + User.find(@notification.user_id).username + '.', user_email: 'SystemAdmin')\r\n\t\tend\r\n\t\[email protected]\r\n\t\tredirect_to :back\r\n\tend",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to app_notifications_url, notice: 'Notifiation was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n head :no_content \n end",
"def destroy\n @notification_count.destroy\n\n head :no_content\n end",
"def destroy\n @notification = @application.notifications.find(params[:id])\n @notification.destroy\n\n respond_with @notification\n end",
"def destroy\n if @notification.from_type == \"product\"\n @notification.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.html { redirect_to denounced_products_path, notice: 'Notificacion eliminada correctamente' }\n end\n elsif @notification.from_type == \"comment\"\n @notification.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.html { redirect_to denounced_comments_path, notice: 'Notificacion eliminada correctamente' }\n end\n \n elsif @notification.from_type == \"contact\"\n @notification.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.html { redirect_to messages_path, notice: 'Notificacion eliminada correctamente' }\n end\n elsif @notification.from_type == \"suggest\"\n @notification.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.html {redirect_to suggested_products_path, notice: 'Notificacion eliminada correctamente'}\n end\n else\n @notification.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.html { redirect_to notifications_path, notice: 'Notificacion eliminada correctamente' }\n end\n end\n end",
"def destroy\n #@event_event.destroy\n @event_event.deleted = true\n dest = @event_event.id\n type = 7 #event_notifications_code\n Notification.clear_notifications(type,dest)\n @event_event.save\n @event_event.user.remove_event\n respond_to do |format|\n format.html { redirect_to admin_event_events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_category.destroy\n\n head :no_content\n end",
"def destroy\n @pic.destroy\n\n notifications = Notification.find(:all, :conditions => ['notification_type = ? and object_id = ?', \"comment\", @pic.id])\n notifications.each do |n|\n n.destroy\n end\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @apn_notification = APN::Notification.find(params[:id])\n @apn_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(apn_notifications_url) }\n format.xml { head :ok }\n end\n end",
"def delete_notification(principal_uri, notification)\n end",
"def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end",
"def destroy\n @notification_type = NotificationType.find(params[:id])\n @notification_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(notification_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notification = current_user.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notificationtype.destroy\n respond_to do |format|\n format.html { redirect_to moderator_notificationtypes_url, notice: 'Notificationtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n return_back_or_ajax\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n end\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n end",
"def destroy\n @notification = Notification.find_by(id: params[:id])\n if(curr_user_has_notification(@notification.id))\n @notification.destroy\n end\n redirect_to notification_url\n end",
"def destroy\n @eve_notification = EveNotification.find(params[:id])\n @eve_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to eve_notifications_url }\n format.json { head :no_content }\n end\n end",
"def delete_notifications\n @tutor = Tutor.find(params[:id])\n Notification.where(user_type: 'Tutor', user_id: @tutor.id).destroy_all\n end",
"def destroy\n \n \n #remove notification \n #remove plots \n\n\n if [email protected]_id\n notifications = Journal.where(notification_type: \"StoryCreate\", notification_id: @tale.id)\n notifications.each do|notification|\n notification.delete\n end \n\n\n @tale.destroy\n\n\n\n\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end\n\n\n end",
"def destroy\n @payment_notification = PaymentNotification.find(params[:id])\n @payment_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @notifications = Notification.where(item_id: @vacante_aplicada.id).unviewed #destrir todas las notificaciones que sean de esta vacante\n if(@notifications)\n @notifications.destroy_all #destruye todas las notificaciones que tengan que ver con esta vacante\n end\n\n @vacante_aplicada.destroy\n respond_to do |format|\n format.html { redirect_to vacante_aplicadas_url, notice: 'Vacante aplicada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to project_notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_notifications\n Notification.where(origin_type: 'Message', origin_id: @message.id).destroy_all\n end",
"def destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end",
"def destroy\n# @event_indicator_relationship = EventIndicatorRelationship.find(params[:id])\n# @event_indicator_relationship.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_custom_view'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_indicator_relationships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # We are just removing the notification from display for the current user\n # The super-user can still access it\n if !params[:id].nil? && params[:id] == 'delete_all'\n @notification_logs = current_user.notification_logs\n @notification_logs.each {|n| n.update_attribute(:disabled, true) }\n else\n @notification_log = NotificationLog.find(params[:id])\n @notification_log.update_attribute(:disabled, true)\n end\n\n respond_to do |format|\n format.html { redirect_to notification_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_type.destroy\n respond_to do |format|\n format.html { redirect_to notification_types_url, notice: 'Notification type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :delete, @notification_template\n\n if @notification_template.destroy\n flash[:notice] = I18n.t(:'notification_template.notices.deleted')\n else\n flash[:error] = I18n.t(:'notification_template.errors.not_deleted')\n end\n\n respond_to do |format|\n format.html { redirect_to(notification_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @new_city_notification = NewCityNotification.find(params[:id])\n @new_city_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to new_city_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_nota = Core::Nota.find(params[:id])\n @core_nota.destroy\n\n respond_to do |format|\n format.html { redirect_to core_notas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @municipality = Municipality.find(params[:municipality_id])\n @municipality_notice = @municipality.notices.find(params[:id])\n @municipality_notice.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def deleteForEvent\n deleteEventNotifications(current_user.id, params[:eid])\n end",
"def destroy\n @alarm_notification = AlarmNotification.find(params[:id])\n @alarm_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_notifications_url }\n format.json { head :no_content }\n end\n end",
"def delete_message_by_restaurant\n root_id = @parsed_json[\"message_id\"] if @parsed_json[\"message_id\"]\n check = Notifications.where(\"id=?\", root_id.to_i).first\n if check.nil?\n render :status=>412, :json=>{:status=>:failed, :error=>\"Not exist this message\"}\n else\n sql =\"notifications.alert_type != 'Publish Menu Notification' AND notifications.id=? OR notifications.reply=?\"\n notifications = Notifications.where(sql, root_id.to_i,root_id.to_i)\n for i in notifications\n i.update_attributes(:is_show=>0, :is_show_detail=>0)\n end\n render :status=>200, :json=>{:status=>:success}\n end\n end",
"def destroy\n #@academy_workshop.destroy\n flash[:notice] = \"Workshop destruido com sucesso.\"\n @academy_workshop.is_deleted=true\n dest = @academy_workshop.id\n Notification.clear_notifications(8,dest) #Aproved_workshop_Code\n Notification.clear_notifications(5,dest) #new_registration_in_your_workshop_code\n @academy_workshop.save\n respond_to do |format|\n format.html { redirect_to academy_workshops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dynamic.destroy\n respond_to do |format|\n format.html { redirect_to dynamics_url }\n format.json { head :no_content }\n end\n Notification.create :user_id => current_user.id , :text => \"You destroyed dynamic #{@dynamic.name}\" , :estado => false\n end",
"def destroy\n @doctor_notification.destroy\n respond_to do |format|\n format.html { redirect_to doctor_notifications_url, notice: 'Doctor notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_content.destroy\n respond_to do |format|\n format.html { redirect_to notification_contents_url, notice: 'Notification content was successfully destroyed.' }\n end\n end",
"def destroy\n @notification_rule.destroy\n respond_to do |format|\n format.html { redirect_to notification_rules_url, notice: 'Notification rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @notifications = Notification.where user_id: current_user.id, seen: nil\n @notifications = @notifications.sort { | x , y | x.seen? ? 1:0 <=> y.seen? ? 0:1}\n\n @notifications.each do |msg|\n msg.destroy\n end\n\n end",
"def destroy\n if @notification.action == \"Add\"\n HorseEquipment.where(:horse_id => @notification.send_id, :equipment_id => @notification.recv_id).delete_all\n notification = Notification.find_or_create_by!(send_id: @notification.recv_id, recv_id: @notification.send_id, action: \"Add Denied\")\n notification.save\n current_user.create_activity :denied_equipment_request, parameters: {equipment: Equipment.find_by_id(@notification.recv_id).name, action: 'Add', horse: @notification.send_id}, owner: current_user\n current_user.save\n elsif @notification.action == \"Remove\"\n HorseEquipment.find_or_create_by!(:horse_id => @notification.send_id, :equipment_id => @notification.recv_id)\n notification = Notification.find_or_create_by!(send_id: @notification.recv_id, recv_id: @notification.send_id, action: \"Remove Denied\")\n notification.save\n current_user.create_activity :denied_equipment_request, parameters: {equipment: Equipment.find_by_id(@notification.recv_id).name, action: 'Remove', horse: @notification.send_id}, owner: current_user\n current_user.save\n elsif @notification.action == \"Nominate\"\n horserace = Horserace.find_or_create_by!(:race_id => @notification.send_id, :horse_id => @notification.recv_id)\n horserace.status = 'Denied'\n horserace.save\n\n notification = Notification.find_or_create_by!(send_id: @notification.send_id, recv_id: @notification.recv_id, action: \"Nomination Denied\")\n notification.save\n\n current_user.create_activity :denied_nomination, parameters: {race: Race.find_by_id(@notification.send_id).name, horse: @notification.recv_id}, owner: current_user\n current_user.save\n else\n end\n\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Notification was successful' }\n end\n end",
"def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notify = Notify.find(params[:id])\n @notify.destroy\n\n respond_to do |format|\n format.html { redirect_to notifies_url }\n format.json { head :no_content }\n end\n end",
"def deleteEventNotifications(u, e)\n @ns = getEventNotifications(u, e)\n @ns.each do |n|\n n.destroy\n end\n if u != nil\n redirect_to \"/notifications\", notice: \"All notifications for \" + Event.find_by(id: e).name + \" deleted.\"\n end\n end",
"def destroy\n @kpi_notification.destroy\n respond_to do |format|\n format.html { redirect_to kpi_notifications_url, notice: 'Kpi notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_notificacione.destroy\n respond_to do |format|\n format.html { redirect_to tipo_notificaciones_url, notice: 'Tipo notificacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_notification.destroy\n respond_to do |format|\n format.html { redirect_to email_notifications_url, notice: 'Email notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notify_config = NotifyConfig.find(params[:id])\n @notify_config.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notificacao.destroy\n respond_to do |format|\n format.html { redirect_to notificacoes_url, notice: 'Notificacao foi removido do sistema.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification2.destroy\n respond_to do |format|\n format.html { redirect_to notification2s_url, notice: 'Notification2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n # All work done via before_filters.\n end",
"def destroy\n @notify_observer = NotifyObserver.find(params[:id])\n @notify_observer.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_observers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tauthorize! :destroy, NotificacionEmail\n @notificacion_email.destroy\n respond_to do |format|\n format.html { redirect_to notificacion_emailes_url\nflash[:success] = 'Notificacion email fue borrado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def delete_notification(principal_uri, notification)\n @notifications[principal_uri].delete_if do |value|\n notification == value\n end\n end",
"def destroy\n @event.delay.call_notification(I18n.t('Notification.event_deleted'), I18n.t('Email.event_deleted'))\n @event.destroy\n head :no_content\n end",
"def destroy\n @adm_noticia.destroy\n respond_to do |format|\n format.html { redirect_to adm_noticias_url, notice: t('noticias.destroy_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @estado_notificacion.destroy\n respond_to do |format|\n format.html { redirect_to estado_notificacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_notification = JobNotification.find(params[:id])\n @job_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to job_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parent_to_teacher_notification.destroy\n respond_to do |format|\n format.html { redirect_to parent_to_teacher_notifications_url, notice: 'Parent to teacher notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alarm_notification.destroy\n\n respond_with(@alarm_notification, location: alarm_notifications_url, notice: 'Alarm notification was successfully destroyed.')\n end",
"def destroy\n @front_page_notification.destroy\n redirect_to front_page_notifications_url, notice: 'Front page notification was successfully destroyed.'\n end",
"def destroy\n standard_destroy(DonationType, params[:id])\n end",
"def destroy\n @notice = Notice.find(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to person_notices_path( @person) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notifier.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifiers_url, :notice => 'Kennisgever is succesvol ontkoppeld.') }\n format.xml { head :ok }\n end\n end",
"def remove_notification\n if followable_type == \"User\"\n notice = Notification.where({\n target_id: followable_id,\n target_type: \"User\",\n notice_id: id,\n notice_type: \"Follow\",\n user_id: followable_id,\n notifier_id: follower_id\n }).first\n notice.blank? ? true : notice.destroy\n end\n end",
"def destroy\n @noticia.destroy\n respond_to do |format|\n format.html { redirect_to admin_noticias_url, notice: 'Noticia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @profile.stop_following(@friend)\n ArNotifier.delay.delete_friend(@profile, @friend) if @friend.wants_email_notification?(\"delete_friend\")\n if @friend.wants_message_notification?(\"delete_friend\")\n Profile.admins.first.sent_messages.create(\n :subject => \"[#{SITE_NAME} Notice] Delete friend notice\",\n :body => \"#{@profile.full_name} is Deleted you on #{SITE_NAME}\",\n :receiver => @friend,\n :system_message => true)\n end\n end\n respond_to do |format|\n format.js do\n render :partial => 'friends/friend_status', :locals => {:profile => @friend }\n end\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @custom_field = CustomField.find(params[:id])\n @custom_field.destroy\n @custom_field.register_user_action(@current_user.id, request.remote_ip, 'deleted', @current_user.branch_id)\n respond_to do |format|\n format.html { redirect_to(\"/custom_fields/show\", :notice => \"Custom fields for invoice has been deleted successfully\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @notice=Notice.new\n @notice.note=\"Admin Has Deleted your Event : \" [email protected]_s+\" For Being inappropriate, This was done During \"+Time.now.to_s\n @notice.user_id [email protected]_id\n @notice.save\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to adminhome_events_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @called_from = params[:called_from] || \"contact\"\n @contact_supported_country.destroy\n respond_to do |format|\n format.html { redirect_to(admin_contact_supported_countries_url) }\n format.xml { head :ok }\n format.js \n end\n add_log(user: current_user, action: \"Removed #{@contact_supported_country.country.harman_name} from #{@contact_supported_country.contact.name}\")\n end",
"def destroy\n @dormer_notification.destroy\n respond_to do |format|\n format.html { redirect_to dormer_notifications_url, notice: 'Dormer notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_message(data); end",
"def delete_message(data); end"
] | [
"0.67668676",
"0.67038316",
"0.6692421",
"0.65806526",
"0.6568857",
"0.65445143",
"0.6529771",
"0.65158004",
"0.6507634",
"0.6472982",
"0.6446379",
"0.64380604",
"0.64301336",
"0.633237",
"0.6328472",
"0.6328472",
"0.6328472",
"0.6328472",
"0.6322939",
"0.6322049",
"0.63090587",
"0.63035125",
"0.6299124",
"0.6295882",
"0.62893826",
"0.62853575",
"0.6284228",
"0.62815076",
"0.6255892",
"0.62276",
"0.617552",
"0.61537415",
"0.6102765",
"0.61000973",
"0.60976684",
"0.6085939",
"0.60840964",
"0.60829395",
"0.6077915",
"0.60743165",
"0.6072301",
"0.6072301",
"0.6072301",
"0.6072301",
"0.6072301",
"0.6071557",
"0.6066547",
"0.6044392",
"0.60296375",
"0.60173607",
"0.60153276",
"0.5990454",
"0.5973976",
"0.5971845",
"0.5955558",
"0.59514916",
"0.5938412",
"0.5885365",
"0.5880685",
"0.5876315",
"0.5871859",
"0.58483255",
"0.5841618",
"0.5840209",
"0.5829691",
"0.5829309",
"0.58200383",
"0.5819383",
"0.58090866",
"0.5807582",
"0.58052707",
"0.5794075",
"0.57587713",
"0.575708",
"0.5756723",
"0.5753312",
"0.574199",
"0.5728687",
"0.5726973",
"0.5719214",
"0.57166606",
"0.5707897",
"0.5704895",
"0.56969035",
"0.5696868",
"0.569505",
"0.56890726",
"0.5684884",
"0.5684007",
"0.567713",
"0.56770575",
"0.56729716",
"0.5662867",
"0.5661814",
"0.56614894",
"0.5658898",
"0.5649102",
"0.5648846",
"0.5611567",
"0.5611567"
] | 0.65759385 | 4 |
Description Pagination with infinite scroll Mode Ajax Specific filters NotificationsControllerinitialize_notification_offset | def get_new_block
@notifications = current_user.notifications_visible_block @offset_notifications, NOTIFICATIONS_LOADED_TOGETHER
@offset_notifications += @notifications.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_index_notification_by_limit_by_offset\n @notifications = Notification.order(\"updated_at desc\").limit(params[:limit]).offset(params[:offset])\n respond_to do |format|\n format.json { render json: @notifications }\n end\n end",
"def paginate_at ()\n return 8\n end",
"def initialize_notification_offset\n @offset_notifications = (correct_integer?(params[:offset]) ? params[:offset].to_i : NOTIFICATIONS_LOADED_TOGETHER)\n end",
"def after_pagination\n end",
"def index\n @reservation_requests = ReservationRequest.all.order(created_at: :desc)\n #@reservation_requests = Kaminari.paginate_array(@reservation_requests).page(params[:page]).per(5)\n @filterrific = initialize_filterrific(\n ReservationRequest,\n params[:filterrific],\n persistence_id: false\n ) or return\n\n @reservation_requests = @filterrific.find.page(params[:page]).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @page_header = \"通知\"\n unless params[:include_read]\n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(\"id desc\")\n else\n @notifications = Notification.where(user: current_user).page(params[:page]).per(10).order(\"id desc\")\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n\n end",
"def paginate; false; end",
"def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end",
"def pagination\n search_key = (params[:search] || {})[:value].presence\n offset = (params[:start] || 0).to_i\n limit = (params[:length] || 50).to_i\n record_total = (params[:record_total] || 100).to_i\n data = []\n\n rows = if search_key.present?\n KillBillClient::Model::Account.find_in_batches_by_search_key(search_key, offset, limit, false, false, options_for_klient)\n else\n KillBillClient::Model::Account.find_in_batches(offset, limit, false, false, options_for_klient)\n end\n\n account_ids = rows.map(&:account_id)\n email_notifications_configuration = Kenui::EmailNotificationService.get_configurations(account_ids, options_for_klient)\n\n rows.each do |row|\n events = ''\n unless email_notifications_configuration.first.is_a?(FalseClass)\n configuration = email_notifications_configuration.select { |event| event[:kbAccountId] == row.account_id }\n events = configuration.map { |event| event[:eventType] }.join(', ')\n end\n\n data << [\n row.name,\n view_context.link_to(row.account_id, \"/accounts/#{row.account_id}\"),\n events,\n view_context.link_to('<i class=\"fa fa-cog\" aria-hidden=\"true\"></i>'.html_safe,\n '#configureEmailNotification',\n data: { name: row.name, account_id: row.account_id,\n events: events, toggle: 'modal', target: '#configureEmailNotification' })\n ]\n end\n\n respond_to do |format|\n format.json { render json: { data: data, recordsTotal: record_total, recordsFiltered: record_total } }\n end\n end",
"def index\n #@notifications = Notification.all\n\t\t@notifications = Notification.paginate :order => \"created_at DESC\",\n\t\t\t:page => params[:page], :per_page => 15\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def paginator; end",
"def set_pagination\n set_params_page\n @updates = @updates.paginate(:page => params[:page], :per_page => params[:per_page], :order => :created_at.desc)\n set_pagination_buttons(@updates)\n end",
"def index\n \t@news = News.all.paginate(page: params[:page], per_page: 5).order(:position, 'created_at DESC')\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def set_activities_for_pagination\n \n end",
"def index \n response.headers['X-Total-Count'] = @admin_notifications.count.to_s\n response.headers['X-Unread-Count'] = @admin_notifications.unread.count.to_s\n @admin_notifications = @admin_notifications.page(params[:page] || 1)\n @admin_notifications = @admin_notifications.per(params[:per] || 8)\n \n _render collection: @admin_notifications\n end",
"def paginate_for_five_links(totalpages, options, page=nil)\n return %Q{\n <script type=\"text/javascript\">\n jQuery(document).ready(function() {\n paginate_for_five_links(#{totalpages}) \n jQuery(\".willpaginate:first, .bottom-pagination:first\").before('#{link_to_unless( (page.nil? || page.eql?(1)),\"\", {:params =>options} ,:class => \"icon_Pprev ml2 fl mt2\", :onmouseover=>'calltooltip(\"First\", jQuery(this))', :onmouseout => \"hidetooltip()\")}');\n jQuery(\".willpaginate:last, .bottom-pagination:last\").after('#{link_to_unless(page.eql?(\"#{totalpages}\"), \"\", {:params =>options.merge(:page=>totalpages)}, :class => \"icon_Nnext mr2 fl mt2\", :onmouseover=>'calltooltip(\"Last\", jQuery(this))', :onmouseout => \"hidetooltip()\")}');\n });\n </script>\n }\n end",
"def pagination\n settings.pagination || 50\n end",
"def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end",
"def index\n #@articles = Article.all\n # @article = Article.friendly.find(params[:id])\n # impressionist(@article)\n @articleOrder = Article.article_order(params[:page])\n # @jasonObject = render json: @articleOrder\n # puts JSON.pretty_generate(@articleOrder)\n if params[:tag]\n @articles = Article.tagged_with(params[:tag])\n else\n @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n end\n # @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n # all.page(params[:page]).per(4)\n @articles_corousal = Article.all\n # use scope\n @article_paginate = Article.paginate(page: params[:page], :per_page => 4)\n @widgetArticle = Article.widget_article(params[:page])\n \n end",
"def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end",
"def index\n @numberOfItem = 8\n @pageNumber = 1\n if params.has_key?(:p)\n @pageNumber = params[\"p\"].to_f\n end\n @lastPage = New.all.length / @numberOfItem + 1\n if @pageNumber == @lastPage\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(New.all.length - (@pageNumber-1)*@numberOfItem)\n else\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(@numberOfItem) \n end\n end",
"def index\n @motions = Motion.where('group_id = ?',@group.id)\n\n @limit = params[:limit];\n if @limit == nil\n @limit = 10;\n end\n if params[:tag].present? \n @filterrific = initialize_filterrific(\n Motion.where('group_id = ?',@group.id).tagged_with(params[:tag]),\n params[:filterrific],\n select_options: {\n sorted_by: Motion.options_for_sorted_by\n },\n default_filter_params: {},\n ) or return\n @motions = Kaminari.paginate_array(@filterrific.find).page(params[:page]).per(@limit)\n @tagged_label = ('Tagged with <span class=\"text-info\">' + params[:tag] + \"</span> #{view_context.link_to ''.html_safe, group_motions_path, :class=>'fa-text-block'}\").html_safe else\n @filterrific = initialize_filterrific(\n Motion.where('group_id = ?',@group.id),\n params[:filterrific],\n select_options: {\n sorted_by: Motion.options_for_sorted_by\n },\n default_filter_params: {},\n ) or return\n @motions = Kaminari.paginate_array(@filterrific.find).page(params[:page]).per(@limit)\n @tagged_label = 'Tagged with'\n end \n @tags = Motion.where('group_id = ?',@group.id).tag_counts_on(:tags)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n #@group_banners = GroupBanner.all\n\n #Sorting\n sort_init 'espositore'\n #asso number of occurrence\n sort_update 'espositore' => 'espositore',\n 'url' => 'url',\n 'priorita' => 'priorita',\n 'posizione' => 'posizione'\n\n respond_to do |format|\n #ovverride for paging format.html # index.html.erb\n format.html {\n # Paginate results\n @group_banner_count = GroupBanner.all.count\n @group_banner_pages = Paginator.new self, @group_banner_count, per_page_option, params['page']\n @group_banners = GroupBanner.find(:all,\n :order => sort_clause,\n :limit => @group_banner_pages.items_per_page,\n :offset => @group_banner_pages.current.offset)\n render :layout => !request.xhr?\n }\n format.xml { render :xml => @group_banners }\n end\n end",
"def do_pagination\n @page_number = 1\n if params[:page] && params[:page].to_i > 0\n @page_number = params[:page].to_i\n end\n @pagination = true\n @pagination_options = { :limit => items_per_page, :offset => (@page_number - 1) * items_per_page }\n @pagination_options = {} if params[:all]\n end",
"def pagination_options\n { :offset => offset, :limit => per_page } if paginated?\n end",
"def index\n # @events = Event.all.paginate(page: params[:page])\n @filterrific = initialize_filterrific(\n Event,\n params[:filterrific],\n :select_options => {\n with_event_category_id: EventCategory.options_for_select\n }\n ) or return\n @events = @filterrific.find.page(params[:page])\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @notifications = Notification.where(app_id: @app.id).order('scheduled_for DESC, updated_at DESC').page params[:page]\n end",
"def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end",
"def index\n @tconfigurations = Tconfiguration.all.sort{|x,y| x.Name<=>y.Name}\n #pagination\n @parametrs=params\n if params[:pagenum]\n @pagenum=params[:pagenum].to_i\n else\n @pagenum=1\n end\n @perpage=30\n @[email protected]/@perpage\n @pagecount+=1 if @tconfigurations.length%@perpage!=0\n @firstline=(@pagenum-1)*@perpage\n @[email protected](@firstline).take(@perpage)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tconfigurations }\n end\n end",
"def pager(method,filter_param,per_page=500)\n session[:ooc_deviation_search][:row_from]=0\n session[:ooc_deviation_search][:row_to]=per_page\n deviations = OocDeviationSearch.search(session[:ooc_deviation_search])\n count = deviations.size == 0 ? 0 : deviations.first.count\n if count > 0\n pages = (count / per_page.to_f).ceil\n if count < per_page\n per_page=count\n end\n pages.times do |page|\n page +=1\n session[:ooc_deviation_search][:row_from]=0\n session[:ooc_deviation_search][:row_to]=per_page\n if filter_param.downcase=='all'\n row_to=per_page*page\n row_from=(row_to-per_page)+1\n session[:ooc_deviation_search][:row_from]=row_from\n session[:ooc_deviation_search][:row_to]=row_to\n end\n #$stderr.puts \"pager: #{page} | #{pages} | #{session[:ooc_deviation_search][:row_from]} |\\\n ##{session[:ooc_deviation_search][:row_to]} | #{count}\"\n unless page==1\n SwareBase.uncached do\n deviations = OocDeviationSearch.search(session[:ooc_deviation_search])\n count = deviations.size == 0 ? 0 : deviations.first.count\n end\n end\n send(method, deviations)\n end\n end\n end",
"def index\n @news_updates = NewsUpdate.all.paginate(page: params[:page], per_page: 5).order(\"created_at desc\")\n end",
"def index\n @news = News.all_from(session['country_code']).order(created_at: :desc).paginate(page: params[:page], per_page: News::MAX_NEWS_PER_PAGE)\n end",
"def index\n @title += \" | #{t('activerecord.models.notification')}\"\n if params[:notification]\n @notifications = Notification.joins(:car).where([\"cars.name LIKE ? OR text LIKE ?\",\n \"%#{params[:notification][:text]}%\",\n \"%#{params[:notification][:text]}%\"\n ]).order(\"created_at DESC\")\n else\n @notifications = Notification.where([\"user_id = ?\", current_user.id]).order(\"created_at DESC\").page params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @notification }\n end\n end",
"def index\n @messages = Message.none_system_message.paginate(:all, :order => \"messages.sent_at DESC\", :page => params[:page], :per_page => 20)\n @sub_partial = \"/admin/messages/inbox\" \n render_list\n end",
"def index\n @news = News.all.last_created.paginate(:page => params[:page], :per_page => 15)\n fresh_when(:etag => [@news])\n drop_breadcrumb(\"价值微信\")\n end",
"def paginate_for_five_remote_links(totalpages, update_div, url_hash, page=nil)\n fpage = lpage = nil\n fpage = escape_javascript link_to_remote(\"\", {:update => update_div, :method => :get, :url => url_hash.merge(:page=>1), :before =>\"jQuery('#perpage_loader').show();\", :complete=>\"jQuery('#perpage_loader').hide();\"}, :class => \"icon_Pprev ml2 fl mt2\", :onmouseover=>'calltooltip(\"First\", jQuery(this))', :onmouseout => \"hidetooltip()\") if page.to_i > 1\n lpage = escape_javascript link_to_remote(\"\", {:update => update_div, :method => :get, :url => url_hash.merge(:page=>totalpages), :before =>\"jQuery('#perpage_loader').show();\", :complete=>\"jQuery('#perpage_loader').hide();\"}, :class => \"icon_Nnext mr2 fl mt2\", :onmouseover=>'calltooltip(\"Last\", jQuery(this))', :onmouseout => \"hidetooltip()\") unless page.eql?(\"#{totalpages}\")\n return %Q{\n <script type=\"text/javascript\">\n jQuery(document).ready(function() {\n paginate_for_five_links(#{totalpages}) \n jQuery(\".willpaginate:first, .bottom-pagination:first\").before('#{fpage}')\n jQuery(\".willpaginate:last, .bottom-pagination:last\").after('#{lpage}');\n });\n </script>\n }\n end",
"def apply_filter\n offset = (params[:page].to_i - 1) * params[:perpage].to_i\n limit = params[:perpage]\n\n results = get_results(offset, limit)\n result_list = get_fields_to_show(results['elements'])\n \n data = Hash.new\n data['total'] = results['total']\n data['result'] = result_list\n respond_to do |format|\n format.json { render :json => data.to_json }\n end\n end",
"def pagination_ajax_setting\n @current_page = params[:page_id] ||= 1\n @is_page_increment = params[:page_id].to_i > params[:current_page].to_i\n end",
"def page\n @data_management_plans = paginate_response(results: search_filter_and_sort)\n render layout: false\n end",
"def index\n (@filterrific = initialize_filterrific(\n BudgetRequest,\n params[:filterrific],\n select_options: {\n sorted_by: BudgetRequest.options_for_sorted_by\n },\n )) || return\n @budget_requests = @filterrific.find.page(params[:page])\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def pagination\n [ :next_page ]\n end",
"def index\n #p = logged_in? ? logged_in_person : nil\n per_page = 12\n conditions = []\n condition_vars = {}\n if params[:title] and params[:title] != ''\n conditions.push(\"lower(title) like :title\")\n condition_vars[:title] =\"%#{params[:title].downcase}%\"\n end\n find_conditions = [conditions.join(\" and \"), condition_vars]\n permitted_questionnaires = Questionnaire.all(:conditions => find_conditions, :order => 'id DESC')\n pager = ::Paginator.new(permitted_questionnaires.size, per_page) do |offset, pp|\n permitted_questionnaires[offset, pp]\n end\n @questionnaires = returning WillPaginate::Collection.new(params[:page] || 1, per_page, permitted_questionnaires.size) do |paginator|\n paginator.replace pager.page(params[:page]).items\n end\n \n\n respond_to do |format|\n format.html { }\n format.js do\n render :update do |page|\n page.replace_html 'questionnaire_list', :partial => 'paged_results'\n end\n end\n end\n end",
"def index\n @feed = Feed.find(params[:feed_id])\n @pages = ( @feed.articles.count.to_f/5).ceil\n @cur_feed_id = params[:feed_id].to_i\n @articlesBackbone = @feed.articles.order(\"create_time DESC\")\n @articles = @feed.articles.order(\"create_time DESC\").paginate(:page => params[:page], :per_page=> 5)\n @pages = ( @feed.articles.count.to_f/5).ceil\n gon.pages = @pages\n @cur_feed_id = params[:feed_id].to_i\n gon.cur_feed_id = @cur_feed_id\n if params[:only_list].blank? \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articlesBackbone }\n end\n else\n render :layout=>false, :action=>\"list\"\n end\n end",
"def index\n @filterrific = Filterrific.new(Publication, params[:filterrific])\n number_status = Publication.statuses[:republished]\n @publications = Publication.filterrific_find(@filterrific).\n where(\"user_id = ? AND status <> ? AND payment_status = ?\", current_user.id, number_status, \"Realizado\").paginate(page: params[:page])\n\n respond_to do |format|\n format.html { render :index}\n format.js \n format.json { render :json => @publications.to_a.map{ |p| p.to_json_for_index }.to_json }\n end\n end",
"def nextPrescribers\n @searchPrescribers = Prescriber.nextPrescribers params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchPrescribers.js'\n end",
"def pagination_range\n case JSONAPI.configuration.default_paginator\n when :paged\n number = page_params['number'].to_i.nonzero? || 1\n size = page_params['size'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n (number - 1) * size..number * size - 1\n when :offset\n offset = page_params['offset'].to_i.nonzero? || 0\n limit = page_params['limit'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n offset..offset + limit - 1\n else\n paginator.pagination_range(page_params)\n end\n end",
"def paginator=(_arg0); end",
"def set_paging\n if extjs_paging?\n offset = params[:start].to_i\n @page_limit = params[:limit].to_i\n @current_page = (offset / @page_limit) + 1 # start at page 1\n else\n @page_limit = 20 # sync with ExtJS PagingToolbar configuration in view!\n @current_page = 1\n end\n end",
"def index\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_data_pendidikan_agama_katolik_page]).per(6)\n end",
"def paginatable?; paginatable; end",
"def paginations(collection)\n content_tag :div, class: 'page-wrapper' do\n if collection.next_page\n will_paginate collection, renderer: BootstrapPagination::Rails\n else\n content_tag :div, \"没有更多了\", class: 'no-more'\n end\n end\n end",
"def pagination=(count)\n settings.pagination = count\n end",
"def pagination_page\n @pagination_page\n end",
"def index\n @notifications = current_user.notifications.reverse\n\n @notifications = Kaminari.paginate_array(@notifications).page(params[:page]).per(10)\n respond_to do |format|\n format.html\n end\n end",
"def pagination!\n parameter :page, :integer, :required => false, :default => 1, :paramType => \"query\"\n parameter :per_page, :integer, :required => false, :default => 30, :paramType => \"query\", \n :allowed => 1..1000\n end",
"def index\n #@unitarios = Unitario.all\n #@grupos_unitarios = GruposUnitario.all\n @filterrific = initialize_filterrific(\n InscripcionDiplomado,\n params[:filterrific],\n select_options: {\n with_grupos_unitario_id: GruposDiplomado.seleccion_curso_nombre,\n with_documentos_validados: InscripcionDiplomado.options_for_documentos_validados\n },\n ) or return\n @inscripcion_diplomados = @filterrific.find.page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se restablecieron los parámetros: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end",
"def per_page; end",
"def get_more\n @options = {\n :includeFirst => false, :limit => 10, :fetch_mode => 'normal', :fetch_focus_id => 0,\n :handle => \".endless_scroll_inner_wrap\" \n }\n\n if params.has_key? :includeFirst then\n @options[:includeFirst] = params[:includeFirst] == 'true' ? true : false \n end\n\n if params.has_key? :fetch_mode then\n if params[:fetch_mode] == 'following' then\n @options[:fetch_mode] = 'following'\n elsif params[:fetch_mode] == 'followers' then\n @options[:fetch_mode] = 'followers'\n end\n end\n\n if params.has_key? :fetch_focus_id then\n @options[:fetch_focus_id] = params[:fetch_focus_id].to_i\n end\n\n if params.has_key? :handle then\n @options[:handle] = params[:handle]\n end\n\n upper = @options[:includeFirst] ? 0..params[:last_id].to_i : 0..(params[:last_id].to_i - 1)\n\n if @options[:fetch_mode] == 'normal' then\n @next_personas = Persona.where( :id => upper).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'following' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(\n :id => persona.followers.where(:tracked_object_type => 'persona', \n :tracked_object_id => upper ).pluck(:tracked_object_id) \n ).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'followers' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(:id => Follower.where(\n :tracked_object_id => persona.id, :tracked_object_type => 'persona').pluck(:persona_id)\n ).order('id desc').group(:id).having(:id => upper)\n end\n end",
"def pagination_info\n @response ? super : {}\n end",
"def index\n\t\t\t\tlimit = (params[:limit] && params[:limit] != '') ? params[:limit].to_i : 10\n\t\t\t\tif params[:offset] && params[:offset] != '' && params[:offset].to_i > 0\n\t\t\t\t\toffset = params[:offset].to_i\n\t\t\t\telsif (@commentable.comments.count < limit) || (params[:offset].to_i < 0)\n\t\t\t\t\toffset = 0\n\t\t\t\telse\n\t\t\t\t\toffset = @commentable.comments.count - limit\n\t\t\t\tend\n\t\t\t\t#offset = params[:offset] || (@commentable.comments.count - limit)\n\t\t\t\tputs \"limit : #{limit}\"\n\t\t\t\tputs \"offset : #{offset}\"\n\t\t\t\tif offset > 0\n\t\t\t\t\t@can_load_more = true \n\t\t\t\t\t@comments = @commentable.comment_threads.order(\"lft ASC\").offset(offset).limit(limit)\n\t\t\t\t# 이전 댓글 보기의 마지막 페이지\t\n\t\t\t\telsif offset == 0\n\t\t\t\t\tsurplus_limit = @commentable.comments.count % limit\n\t\t\t\t\t# 댓글이 10개일 경우\n\t\t\t\t\tif surplus_limit == 0\n\t\t\t\t\t\t@comments = @commentable.comment_threads.order(\"lft ASC\").offset(offset).limit(limit)\n\t\t\t\t\telse\n\t\t\t\t\t\t@comments = @commentable.comment_threads.order(\"lft ASC\").offset(offset).limit(surplus_limit)\n\t\t\t\t\tend\n\t\t\t\t\t@can_load_more = false\n\t\t\t\t\t\n\t\t\t\t# 댓글이 limit 보다 작을 경우\n\t\t\t\telse\n\t\t\t\t\t@comments = @commentable.comments\n\t\t\t\t\t@can_load_more = false\n\t\t\t\tend\n\n\t\t\tend",
"def render_pagination\n num_pages = Document.num_results.to_f / @per_page.to_f\n num_pages = Integer(num_pages.ceil)\n return '' if num_pages == 0\n\n content_tag :div, :class => 'ui-grid-c' do\n content = content_tag(:div, :class => 'ui-block-a') do\n if @page != 0\n page_link(I18n.t(:'search.index.first_button'), 0, 'back')\n end\n end\n content << content_tag(:div, :class => 'ui-block-b') do\n if @page != 0\n page_link(I18n.t(:'search.index.previous_button'), @page - 1, 'arrow-l')\n end\n end\n\n content << content_tag(:div, :class => 'ui-block-c') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.next_button'), @page + 1, 'arrow-r', true)\n end\n end\n content << content_tag(:div, :class => 'ui-block-d') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.last_button'), num_pages - 1, 'forward', true)\n end\n end\n\n content\n end\n end",
"def index\n @sale_notes = Sale::Note.paginate(:page => params[:page], :per_page => 5)\n end",
"def pagination_links(obj)\n paginator = Paginator.new(obj)\n paginator.current_page = params[:page]\n\n # PAGE BUTTON LINKS (w/Bootstap styling)\n def previous_page_link(paginator)\n content_tag :li do\n link_to({ controller: \"#{controller_name}\", action: \"#{action_name}\", page: paginator.previous_page }, { remote: true, :'aria-label' => 'Previous Page', title: 'Previous Page', data: { toggle: 'tooltip', placement: 'top' } }) do\n raw '<span aria-hidden=\"true\">«</span>'\n end\n end\n end\n\n def previous_group_link(paginator)\n content_tag :li do\n link_to({ controller: \"#{controller_name}\", action: \"#{action_name}\", page: paginator.previous_range_first_page }, { remote: true, :'aria-label' => 'Previous Page Group', title: 'Previous Page Group', data: { toggle: 'tooltip', placement: 'top' } }) do\n raw '<span aria-hidden=\"true\">...</span>'\n end\n end\n end\n\n def page_link(page_num, current_page)\n status = 'active' if page_num == current_page\n\n content_tag :li, class: \"#{status}\" do\n link_to(\"#{page_num}\", controller: \"#{controller_name}\", action: \"#{action_name}\", page: \"#{page_num}\", remote: true)\n end\n end\n\n def next_group_link(paginator)\n content_tag :li do\n link_to({ controller: \"#{controller_name}\", action: \"#{action_name}\", page: paginator.next_range_first_page }, { remote: true, :'aria-label' => 'Next Page Group', title: 'Next Page Group', data: { toggle: 'tooltip', placement: 'top' } }) do\n raw '<span aria-hidden=\"true\">...</span>'\n end\n end\n end\n\n def next_page_link(paginator)\n content_tag :li do\n link_to({ controller: \"#{controller_name}\", action: \"#{action_name}\", page: paginator.next_page }, { remote: true, :'aria-label' => 'Next Page', title: 'Next Page', data: { toggle: 'tooltip', placement: 'top' } }) do\n raw '<span aria-hidden=\"true\">»</span>'\n end\n end\n end\n\n # BUILD PAGINATION LINKS\n # Start Bootstap pagination style\n output = '<nav class=\"text-center\"><ul class=\"pagination\">'\n\n # Show the '<<' aka previous page button\n unless paginator.first_page? || paginator.current_page < 1\n output += previous_page_link(paginator)\n end\n\n # Show the '...' aka previous page group button\n unless paginator.first_page? || paginator.current_page <= paginator.links_per_page\n output += previous_group_link(paginator)\n end\n\n # Show individual page links, stopping at the limit of links per page set by the user\n paginator.current_range_first_page.upto(paginator.last_page_in_current_range) do |page_num|\n output += page_link(page_num, paginator.current_page) unless page_num > paginator.total_pages\n end\n\n # Show the '...' aka next page group button\n unless paginator.next_range_first_page > paginator.total_pages || paginator.last_page?\n output += next_group_link(paginator)\n end\n\n # Show the '>>' aka next page button\n unless paginator.last_page? || paginator.current_page > paginator.total_pages\n output += next_page_link(paginator)\n end\n\n # Append page numbering and end Bootstap pagination style\n output += \"</ul><p><strong>Page:</strong> #{paginator.current_page} / #{paginator.total_pages}</p></nav>\"\n\n # Output the string to the view\n raw output unless paginator.total_pages <= 1\n end",
"def index\n @news = News.paginate(:page => params[:page],:per_page =>9 ).where(\"publish=true \", params[:id]).order('created_at DESC')\n\n end",
"def index\n # Find all news from the DB\n @news = News.all\n @news.sort!{|a,b| b.created_at <=> a.created_at}\n\n @items = Kaminari.paginate_array(@news).page(params[:page]).per(3)\n \n respond_to do |format|\n format.js\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @nombres_comunes = NombreComun.limit(params['limit'] ||= 100).offset(params['offset'] ||= 0)\n end",
"def index \n @petitions = Petition.where('group_id = ?',@group.id)\n @limit = params[:limit];\n if @limit == nil\n @limit = 10;\n end\n if params[:tag].present? \n @filterrific = initialize_filterrific(\n Petition.where('group_id = ?',@group.id).tagged_with(params[:tag]),\n params[:filterrific],\n select_options: {\n sorted_by: Petition.options_for_sorted_by\n },\n default_filter_params: {},\n ) or return\n @petitions = Kaminari.paginate_array(@filterrific.find).page(params[:page]).per(@limit)\n @tagged_label = ('Tagged with <span class=\"text-info\">' + params[:tag] + \"</span> #{view_context.link_to ''.html_safe, group_petitions_path, :class=>'fa-text-block'}\").html_safe\n else\n @filterrific = initialize_filterrific(\n Petition.where('group_id = ?',@group.id),\n params[:filterrific],\n select_options: {\n sorted_by: Petition.options_for_sorted_by\n },\n default_filter_params: {},\n ) or return\n @petitions = Kaminari.paginate_array(@filterrific.find).page(params[:page]).per(@limit)\n @tagged_label = 'Tagged with'\n end \n # @petitions = @filterrific.find.page(params[:page]).per(10)\n # if params[:tag].present? \n # @petitions = Petition.tagged_with(params[:tag])\n # else \n # @petitions = Petition.all\n # end \n @tags = Petition.where('group_id = ?',@group.id).tag_counts_on(:tags)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @filterrific = initialize_filterrific(\n ItInscripcionRegistro,\n params[:filterrific],\n select_options:{\n sorted_by: ItInscripcionRegistro.options_for_sorted_by,\n with_grupo_id: Grupo.where(estado: \"Abierto\").options_for_select,\n with_documentos_validados: ItInscripcionRegistro.options_for_documentos_validados,\n with_curso: CursoNombre.options_for_select\n },\n ) or return\n @it_inscripcion_registros = @filterrific.find.order(\"created_at DESC\").page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se tuvieron que restablecer los valores: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n\n end",
"def index\n if params[:completed]\n conds = ['completed_on NOT NULL']\n else\n conds = nil\n end\n \n @list_items = @list.list_items.find(:all, :conditions => conds,\n :offset => params[:offset], \n :limit => params[:limit])\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @list_items }\n end\n end",
"def index\n\n @per_page = 2\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n\n\n\n if ( params[:search] )\n @ciudades = Ciudade.search( params[:search] ).limit( @per_page ).skip( @skip )\n elsif ( params[:column] )\n @ciudades = Ciudade.sort( params[:column], params[:sort] ).limit( @per_page ).skip( @skip )\n else\n @ciudades = Ciudade.all.limit( @per_page ).skip( @skip )\n end\n \n\n@num_of_pages = ( @per_page.to_i > 0 ) ? ( @ciudades.size / @per_page.to_f ).ceil : 1\n\n \n respond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'ciudades/list', :locals => { :ciudades => @ciudades}, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @ciudades }\n end\n end",
"def index\n @contacts = prep_pagination Contact.all\n end",
"def index\n\t\t@page = params[:page].to_i\n @topics = Topic.paginate :page => @page, :per_page => 10\n\n\t\trespond_to do |format|\n format.html\n format.js do\n render :update do |page|\n page.replace_html 'topics', :partial => \"topics/list\"\n end\n end\n end\n end",
"def index\n @mails = Mail.paginate :all, :per_page => 20, :page => params[:p], :order => 'created_at DESC'\n end",
"def index\n #@comment_shows = ProductShow.all\n if params[:page].blank?\n page=1\n else\n page=params[:page]\n end\n @comment_shows = CommentShow.paginate :per_page=>20,:page=>page,:order=>\"id desc\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comment_shows }\n end\n end",
"def page\n\t\t@allNews = News.order(\"created_at DESC\")\n\t\tpage = params[:page]\n\t\tinterval = params[:interval]\n\t\trespond_to do |format|\n\t\t\tformat.js { render partial: \"news\", locals: { page: page, newsPerPage: interval } }\n\t\tend\n\tend",
"def index\n #@articles = Article.all\n #@articles = Article.paginate(page: params[:page]) #, per_page: 5)\n @articles = Article.paginate(page: params[:page], per_page: 5)\n\n end",
"def begin; pager.offset page; end",
"def index\n\t @robot_img = 'http://www.bia.or.th/en/images/photo/08dec.jpg'\n\t @title = 'Articles - Suan Mokkh'\n\t # @featured_books = Book.includes(:authors, :groups, :languages).where(featured: true, draft: false).order('created_at DESC').limit(10)\n\t # @recommended_books = Book.includes(:authors).where(recommended: true, draft: false).order('created_at DESC').limit(15)\n\t @filterrific = initialize_filterrific(\n\t Article,\n\t params[:filterrific],\n\t :select_options => {\n\t with_language_id: Language.options_for_select,\n\t with_author_id: Author.options_for_select,\n\t with_series: Article.options_for_series,\n\t },\n\t # default_filter_params: [],\n\t # persistence_id: 'shared_key',\n\t # available_filters: [],\n\t ) or return\n\t @articles = @filterrific.find.page(params[:page]).where(draft: false)\n\n\t respond_to do |format|\n\t format.html\n\t format.js\n\t end\n\tend",
"def paginate(collection)\n will_paginate(collection, :inner_window => 2)\n end",
"def index\n @informasi_pengumuman = InformasiPengumuman.order(\"created_at DESC\").page(params[:daftar_informasi_pengumuman_page]).per(6)\n end",
"def index\n @comments = Comment.paginate :page => params[:page], :per_page => 25, :conditions => {:flag => true}\n if request.xhr?\n render(:update) do |page|\n page.replace_html 'results', :partial => \"results\"\n end\n end\n end",
"def index\n manage_filter_state\n @subscriber_annotation_classes = SubscriberAnnotationClass.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriber_annotation_classes }\n format.js\n end\n end",
"def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @display = [MediaElement::DISPLAY_MODES[:compact], MediaElement::DISPLAY_MODES[:expanded]].include?(params[:display]) ? params[:display] : MediaElement::DISPLAY_MODES[:expanded]\n if @display == MediaElement::DISPLAY_MODES[:expanded]\n @for_row = correct_integer?(params[:for_row]) ? params[:for_row].to_i : 1\n @for_row = 1 if @for_row > 50\n @for_page = @for_row * 2\n else\n @for_page = FOR_PAGE\n end\n @filter = params[:filter]\n @filter = Filters::ALL_MEDIA_ELEMENTS if !Filters::MEDIA_ELEMENTS_SET.include?(@filter)\n @just_resizing = params[:resizing].present?\n end",
"def index\n\n \n @per_page = 5\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n \n\nif ( params[:search] )\n \n @paises = Paise.search( params[:search] ).limit(@per_page).skip(@skip)\n elsif ( params[:column] )\n @paises = Paise.sort( params[:column], params[:sort] ).limit(@per_page).skip(@skip)\n else\n @paises = Paise.all.limit(@per_page).skip(@skip)\n end \n \n @num_of_pages = ( @per_page.to_i > 0 ) ? ( @paises.size / @per_page.to_f ).ceil : 1\n\n\nrespond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'paises/list', :locals => { :paises => @paises }, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @paises }\n end\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def paginate!\n paginated?? nil : page!(1)\n end",
"def per_page\n 6\n end",
"def offset\n (current_page - 1) * per_page\n end",
"def index\n if is_user?\n # Left Excluding JOIN\n @messages = Message.paginate_by_sql(\"\n SELECT `messages`.*, COUNT(`f2`.`flaggable_id`) AS `flaggers` FROM `messages`\n LEFT JOIN `flaggings` AS `f` ON `f`.`flaggable_id`=`messages`.`id`\n LEFT JOIN `flaggings` AS `f2` ON `f2`.`flaggable_id`=`messages`.`id`\n WHERE (`f`.`flaggable_type`='Message' AND `f`.`flag`='visible_to'\n AND `f`.`flagger_id`=#{current_user.id}) OR `f`.`flaggable_id` IS NULL\n GROUP BY `messages`.`id` ORDER BY `messages`.`created_at` DESC\n \", :page => params[:page], :per_page => @per_page)\n else\n @messages = Message.paginate_by_sql(\"\n SELECT `messages`.*, COUNT(`f`.`flaggable_id`) AS `flaggers` FROM `messages`\n LEFT JOIN `flaggings` AS `f` ON `f`.`flaggable_id`=`messages`.`id`\n WHERE (`f`.`flaggable_type`='Message' AND `f`.`flag`='visible_to') OR `f`.`flaggable_id` IS NULL\n GROUP BY `messages`.`id` ORDER BY `messages`.`created_at` DESC\n \", :page => params[:page], :per_page => @per_page)\n end\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 pages = Page.find_by_sql(\"select * from pages\").map { |page| {page: page} }\n if params[:page]\n @pages = get_page_and_offset(13, params[:page].to_i, pages)\n else\n @pages = get_page_and_offset(13, 1, pages)\n end\n\n respond_to do |format|\n format.html\n format.js {render 'paginate_pages.js.erb'}\n end\n end",
"def index\n @found_items_top = FoundItem.where(\"user_id IS NOT NULL\").not_found.count\n @found_items = FoundItem.where(\"user_id IS NOT NULL\").not_found.order('id desc').page(params[:page]).per(10)\n\n respond_to do |format|\n format.js\n format.html # index.html.erb\n format.json { render json: @found_items }\n end\n end",
"def index\n @announcements = Feature.for_announcements.published.page params[:announcements]\n @activities = PublicActivity::Activity.order(\"created_at desc\").page params[:activities]\n \n \n # @all_features = Feature.homepage_list\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n format.js\n end\n end",
"def index\n @trending_photos = Photo.order(like_count: :desc).first(10)\n # @categories = Category.all\n\n if params[:filter]\n @photos = Photo.where(category_id: @current_category.id)\n elsif params[:page]\n @photos = Photo.offset(params[:page].to_i * 3).limit(3)\n else\n @photos = Photo.first(10)\n end\n\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def recent\n\t\t@page = params[:page].to_i\n @topics = Topic.paginate :page => @page, :per_page => 10\n\n\t\trespond_to do |format|\n format.html\n format.js do\n render :update do |page|\n page.replace_html 'topics', :partial => \"topics/list\"\n end\n end\n end\n end",
"def index\n @invitation_codes = InvitationCode.paginate :per_page => 25, \n :page => params[:page],\n :order => 'response_count DESC'\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitation_codes.to_xml }\n end\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 index\n @reservations = Reservation.all.order(created_at: :desc)\n @filterrific = initialize_filterrific(\n Reservation,\n params[:filterrific],\n select_options: {\n sorted_by_estado: Reservation.options_for_sorted_by_estado\n },\n persistence_id: false\n ) or return\n\n @reservations = @filterrific.find.page(params[:page]).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def offset\n if page <= 1\n # We want first page of results\n 0\n else\n # Max offset for search API is 999\n # If there are 20 results and the user requests page 3, there will be an empty result set\n [((page - 1) * limit), 999].min\n end\n end",
"def index\n @permissions = Permission.all.paginate(:page => params[:page], :per_page => 10).order('id desc')\n \n if params[:count]\n params[:count]\n else\n params[:count] = 10\n end\n \n if params[:page]\n page = params[:page].to_i\n else\n page = 1\n end\n \n if params[:per_page].present?\n # perpage = params[:per_page]\n @per_page = params[:per_page] || Permission.per_page || 10\n @permissions = Permission.paginate( :per_page => @per_page, :page => params[:page])\n else\n perpage = 10\n end\n @per_page = params[:per_page] || Permission.per_page || 10\n page = if params[:page]\n params[:page].to_i\n else\n 1 \n end\n \n\n \n# Filter \nif params[:provider_name]\n @provider_name = params[:provider_name] \n logger.info \"The provider is #{@provider_name.inspect}\"\n @pre_appointments = Permission.joins(:provider_master).where(provider_masters: {provider_name: @provider_name}).paginate( :page => params[:page], :per_page => 10).order('id desc') \n\nelsif params[:category]\n @category = params[:category]\n logger.info \"The category is #{@category.inspect}\"\n @pre_appointments = Permission.joins(:request_category).where(request_categories: {category: @category}).paginate( :page => params[:page], :per_page => 10).order('id desc')\n\nelsif params[:title]\n @type = params[:title]\n logger.info \"The type is #{@type.inspect}\"\n @pre_appointments = Permission.joins(:appointment_type).where(appointment_types: {title: @type}).paginate( :page => params[:page], :per_page => 10).order('id desc')\n\nend \n\n\n \n# \n # per_page = 5\n# \n # offset = (page - 1) * per_page\n # limit = page * per_page\n # @array = *(offset...limit)\n\n\n if params[:search_value] && params[:search_value].strip != ''\n \n if params[:search_param] == 'subject_class'\n logger.info \"the code comes to if doctor............\"\n @permissions = Permission.subject_class_search(params[:search_value].strip).paginate(page: params[:page], per_page: params[:count]).order('id asc')\n \n elsif params[:search_param] == 'patient'\n logger.info \"the code comes to elsif patient.............\"\n @confirmed_personal_doctor_services = ConfirmedPersonalDoctorService.patient_search(params[:search_value].strip).paginate(page: params[:page], per_page: params[:count]).order('id asc')\n \n elsif params[:search_param] == 'location'\n logger.info \"the code comes to elsif location.............\"\n @confirmed_personal_doctor_services = ConfirmedPersonalDoctorService.location_search(params[:search_value].strip).paginate(page: params[:page], per_page: params[:count]).order('id asc')\n \n else\n logger.info \"the code comes to the else....\"\n @confirmed_personal_doctor_services = ConfirmedPersonalDoctorService.paginate(page: params[:page], per_page: params[:count]).order('id desc')\n @search_json = [] \n end\n \n elsif params[:search_param] == 'date'\n logger.info \"the code comes to elsif date.............\"\n \n start = (params[\"start_date\"] + \" \" + \"0:00:00\")# Time.zone.parse(params[\"start_date\"].to_s + \" \" + \"0:00:00\").utc # params[\"start_date\"].to_s + \"0:00:00\"\n ended = params[\"end_date\"] + \" \" + (\"23:59:59\") # Time.zone.parse(params[\"end_date\"].to_s + \" \" + \"23:59:59\").utc # params[\"end_date\"].to_s + \"23:59:59\"\n @confirmed_personal_doctor_services = ConfirmedPersonalDoctorService.search_date(start,ended).paginate(page: params[:page], per_page: params[:count]).order('id asc')\n \n \n end\n p \"JSON ARRAY: #{@search_json}\"\n \n respond_to do |format|\n logger.info \"what is the url calling this??: ans #{request.referer}\"\n format.js\n format.html\n format.csv { send_data @permissions.to_csv(options = {}, page, perpage)}\n format.xls { send_data @permissios.to_csv(options={col_sep: \"\\t\"}, page, perpage)}\n end\n \n \n end",
"def default_action_block\n proc do\n all_records = model\n\n if allowed?(:paging) && params[:page]\n page = params[:page]\n per_page = params[:per_page] || 10\n lower_bound = (per_page - 1) * page\n upper_bound = lower_bound + per_page - 1\n\n body all_records[lower_bound..upper_bound]\n else\n body all_records\n end\n end\n end",
"def auto_paginate\n ENV['KARATEKIT_AUTO_PAGINATE']\n end"
] | [
"0.6507309",
"0.649626",
"0.64614606",
"0.6230897",
"0.62101585",
"0.61293805",
"0.6113088",
"0.6046998",
"0.6020789",
"0.60065055",
"0.5994652",
"0.5975834",
"0.5940254",
"0.59293747",
"0.5896611",
"0.5889158",
"0.5885517",
"0.58691007",
"0.58340436",
"0.58269864",
"0.5788288",
"0.5773247",
"0.57632196",
"0.5745862",
"0.5745107",
"0.57410276",
"0.5730774",
"0.57207644",
"0.57116765",
"0.5708251",
"0.57024294",
"0.5694976",
"0.56888586",
"0.5688571",
"0.5686946",
"0.5680108",
"0.56786215",
"0.5675776",
"0.5671045",
"0.5668768",
"0.5667411",
"0.5665643",
"0.5658057",
"0.5656285",
"0.5654672",
"0.5639987",
"0.5637169",
"0.5634734",
"0.562438",
"0.5616242",
"0.56122774",
"0.56105435",
"0.56029433",
"0.5598",
"0.55743885",
"0.5563233",
"0.5559981",
"0.55577415",
"0.5551546",
"0.5550599",
"0.55500567",
"0.55496955",
"0.5546024",
"0.55411536",
"0.55331683",
"0.5527929",
"0.5520155",
"0.55169547",
"0.5514383",
"0.55028224",
"0.5502642",
"0.5498468",
"0.5498432",
"0.54945254",
"0.5490651",
"0.54822636",
"0.54812926",
"0.5478315",
"0.54733676",
"0.5471636",
"0.54713964",
"0.54662013",
"0.54648596",
"0.54644907",
"0.5461356",
"0.54599285",
"0.5453599",
"0.5450476",
"0.54497725",
"0.5443031",
"0.5435183",
"0.5433726",
"0.5425099",
"0.54200673",
"0.54141253",
"0.5413939",
"0.5402943",
"0.5402695",
"0.5399842",
"0.53994864",
"0.5396747"
] | 0.0 | -1 |
Description Reloads the notifications Mode Ajax | def reload
@notifications = current_user.notifications_visible_block 0, SETTINGS['notifications_loaded_together']
@new_notifications = current_user.number_notifications_not_seen
@offset_notifications = @notifications.length
@tot_notifications = current_user.tot_notifications_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_reloading\n notify(\"RELOADING=1\")\n end",
"def notifications\n end",
"def json_reload(notice: nil)\n self.notice(notice) if notice\n json_response 'reload'\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to :back, notice: 'Notification was successfully updated.' }\n format.js { \n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(:id)\n }\n else\n format.html { redirect_to :back, alert: 'Failure.' }\n end\n end\n end",
"def refreshnotify\n @title = \"\"\n\n puts '====================== refreshnotify'\n\n current_user.update_attributes!(:notify => \"NO\")\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :email, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url]) \n } }\n end\n end",
"def do_refresh_confirmed!\n end",
"def ajax_refresh\n\t\trender(file: 'sales/ajax_reload.js.erb')\n\tend",
"def refresh_part\n\n if params[:restream].nil?\n @msg = current_user.check_message\n render layout: false\n else\n @msg = current_user.check_message\n\n respond_to do |format|\n format.js\n end\n end\n\n end",
"def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end",
"def refresh\n render js: \"location.reload()\"\n end",
"def show\n if params[:mode] == 'force_reload'\n @news_feed.force_reload\n end\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to root_path, notice: 'Mon notification a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @notification }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view_all_notifications_worker\n @notifications = NotificationWorker.where(admin:current_admin).unviewed\n\n @notifications.each do |notification|\n NotificationWorker.update(notification.id, :viewed => true)\n end\n\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Todas las notificaciones vistas' }\n format.js\n end\n end",
"def reload\n\t\tself.request( :reload )\n\tend",
"def notify\n # render :nothing => true\n end",
"def toggle_notification\n if params[:status].present?\n @user.update(notification_status: params[:status])\n if @user.errors.any?\n render json: user.errors.messages, status: 400\n else\n render json: { message: 'Notification status updated successfully!' }, status: 200\n end\n else\n render json: { message: 'Please set status' }, status: 400\n end\n end",
"def updated\n @notification = Notification.find(params[:id])\n\n # dispatches call to private method (if implemented)\n send(@notification.event) if respond_to?(@notification.event, true)\n\n @notification.destroy\n render json: {}, status: :ok\n end",
"def reminder_show\n respond_to do |format|\n format.js {render template: \"profiles/reminder_save\"}\n end\n end",
"def reset_and_resend\n @download_registration.update(download_count: 0)\n @download_registration.deliver_download_code\n @msg = \"Message to #{@download_registration.first_name} is on its way.\"\n respond_to do |format|\n format.html { redirect_to [:admin, @download_registration.registered_download], notice: @msg}\n format.js\n end\n end",
"def update\n if params[:dismiss]\n @notification.dismissed_on = Time.zone.now\n if @notification.save\n send_success_json(@notification.id, {:msg => \"dismissed\"})\n else\n send_error_json(@notification.id, \"dismiss_error\", 400)\n end\n return\n end\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reloads\n load_page\n end",
"def synch_products_now\n result = Product.synch_products_now\n status = eval_status_res(result)\n send_email_which_service_api_is_not_connected(status)\n respond_to do |f|\n @back_to_index = \"#{products_path}\"\n f.js {render :layout => false, :status => status}\n end\n end",
"def show\n respond_to do |format|\n if @notification==nil\n format.json { render json: {error: \"Esta notificacion ya no existe\"}, status: :not_found }\n format.html {\n redirect_to root_path, notice: \"Esta notificacion ya no existe\"\n }\n else\n format.json { render json: {notification: @notification}, status: :ok }\n format.html {\n @notification.update(readed: true)\n }\n end\n end\n end",
"def refresh\n\tto_delete = retrieve_deleted\n \n\trespond_to do |format|\n\t\tformat.js do \n\t\t\t@feed_items = current_user.feed\n\t\t\t\n\t\t\tif params[:num].to_i == @feed_items.count\n\t\t\t render text: \"cancel\"\n\t\t\telse\n\t\t\t render partial:'shared/feed'\n\t\t\tend\n\t\tend\n\t\t\t\n\t\tformat.mobile do\n\t\t\t@new_feed_items = current_user.feed_after(session[:feed_latest])\n\t\t\t\n\t\t\tif !@new_feed_items.empty?\n\t\t\t\tsession[:feed_latest] = @new_feed_items.maximum(\"updated_at\")\n\t\t\t\n\t\t\t\tupdates = []\n\t\t\t\t\n\t\t\t\t@new_feed_items.each do |update|\n\t\t\t\t\tupdates << update.to_mobile\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tjson_response = {status: \"success\", feed_items: updates, to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\telsif !to_delete.empty?\n\t\t\t\tjson_response = {status: \"success\", feed_items: [], to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\telse\n\t\t\t\tjson_response = {status: \"failure\", feed_items: [], to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\tend\n\t\tend\n\tend\n end",
"def destroy\n @notification.destroy\n return_back_or_ajax\n end",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n @notification.update_attribute(:status, ::Users::Notification::Status::DELETED)\n\n elsif @notification.should_flag_viewed?\n @notification.update_attribute(:status, ::Users::Notification::Status::VIEWED)\n end\n set_referer_as_redirect_back\n end\n respond_to do |format|\n format.html { redirect_to @notification.uri }\n format.json { render json: @notification.as_json(relationship_to_user: auth_user)\n }\n end\n end",
"def reload\n do_url 'reload', :put\n end",
"def action_reload\n proxy_action(:reload)\n end",
"def index\n @notifications = current_user ? current_user.user_notifications.unopened : []\n\n respond_to do |format|\n format.js { render :partial => \"shared/notifications_list\", locals: { :notifications => @notifications } }\n end\n\n end",
"def update\n @notification.update(notification_params)\n\n if params[:send] == 'now'\n @notification.update(scheduled_for: Time.now)\n else\n @notification.update(scheduled_for: Time.parse(notification_params['scheduled_for']).utc)\n end\n\n respond_modal_with @notification, location: app_notifications_url\n end",
"def send_notifications\n end",
"def notifications_update\n @notifications = current_user.sk.followed_submissions.includes(:user, :problem).where(\"status > 0\").order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = false\n render :notifications\n end",
"def provider_intention_note_ajax\n begin\n UserMailer.sendNoteToBecomePartner(params[:email])\n container = { \"status\" => \"success\" }\n rescue\n container = { \"status\" => \"fail\" }\n end\n render :json => container.to_json\n end",
"def updateNotifications\r\n\t\tdataHash = {\r\n\t\t\tuser_id: params[:user].id,\r\n experience_p_status: params[:experience_p_status],\r\n experience_status: params[:experience_status],\r\n\t\t\tfeelike_status: params[:feelike_status],\r\n\t\t\tfollows_status: params[:follows_status],\r\n comment_status: 0\r\n\t\t}\r\n UsersSettings.byUser(params[:user].id).first.updateNotifications(dataHash)\r\n self.default_response\r\n\tend",
"def no_ajax # :nologin: :norobots:\n end",
"def sync_notify\n status = @params['status'] ? @params['status'] : \"\"\n if status == \"error\"\n errCode = @params['error_code'].to_i\n if errCode == Rho::RhoError::ERR_REMOTESERVER\n @msg = @params['error_message']\n else \n @msg = Rho::RhoError.new(errCode).message\n end\n \n WebView.navigate(url_for(:action => :server_error, :query => {:msg => @msg}))\n elsif status == \"ok\"\n if SyncEngine::logged_in > 0\n WebView.navigate \"/app/Customer\"\n else\n # rhosync has logged us out\n WebView.navigate \"/app/Settings/login\" \n end\n end \n end",
"def notification\n request.websocket do |ws|\n ws.onopen do\n settings.sockets << ws\n end\n notifications\n ws.onclose do\n settings.sockets.delete(ws)\n end\n end\n end",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def reload_status\n get(\"reload\")\n end",
"def disable_inactivity_email\n @user.update_attributes(:is_receiving_inactivity_email => false)\n @notice = \"You have disabled inactivity notifications.\"\n \n respond_to do |format|\n format.html {\n redirect_to(manage_email_notifications_path, notice: @notice) and return\n return \n }\n format.js {\n render :unsubscribe\n }\n end\n end",
"def update\n respond_to do |format|\n format.html do\n # TODO(KARLA): REFACTOR THIS CODE\n if @notification_settings.update(notifications_settings_params)\n flash[:notice] = t('flashes.notification_settings.update.notice')\n if current_user.agent?\n redirect_to customer_dashboard_path\n else\n redirect_to co_borrower_dashboard_path\n end\n else\n flash[:alert] = t('flashes.notification_settings.update.alert')\n render 'edit'\n end\n end\n\n format.json do\n @notification_settings.update(notifications_settings_params)\n render json: {}, status: 200\n end\n end\n end",
"def notify\n end",
"def maintenance_update(statuspage_id, maintenance_id, maintenance_details, notifications = 0, message_subject = \"Maintenance Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n data['maintenance_details'] = maintenance_details\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/update',\n :payload => data\n end",
"def refresh\n send_cmd \"refresh\"\n nil\n end",
"def refresh_comments\n\n # Pass the post id in data \n @data = @post.id\n\n respond_to do |format|\n format.js\n end\n end",
"def open_all\n @opened_notifications = @target.open_all_notifications(params)\n return_back_or_ajax\n end",
"def reload\n get\n end",
"def reload()\n\t\t\tinit(@user.callAPI('push/get', { 'id' => @id }))\n\t\tend",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def refresh_vote_cache # :root: :norobots:\n return unless is_in_admin_mode?\n # Naming.refresh_vote_cache\n Observation.refresh_vote_cache\n flash_notice(:refresh_vote_cache.t)\n redirect_to(action: \"list_rss_logs\")\n end",
"def ajax_deactivate_funnel\n\n # Get the current funnel\n funnel = Funnel.find(params[:funnel_id])\n\n # Set Funnel Status To Active\n funnel.active = 0\n\n funnel.put('', {\n :active => funnel.active,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Funnel Updated!'\n }\n render json: response\n\n end",
"def update\n @admin_notification = AdminNotification.find(params[:id])\n\n if @admin_notification.update(admin_notification_params)\n head :no_content\n else\n render json: @admin_notification.errors, status: :unprocessable_entity\n end\n end",
"def comment\n comment_button\n wait_for_ajax(2)\n end",
"def status\n respond_to do |format|\n quest = Quest.find(params[:id])\n quest.update(:status=> params[:string])\n #update status in the db when it is done\n if (params[:string] == \"Done\")\n quest.is_completed=true\n quest.completed_at = DateTime.now.utc\n quest.save\n user = User.find(@current_user.id)\n user.points += 10\n user.save\n if @current_user.gender\n gender = 'Male'\n else\n gender = 'Female'\n end\n User.publish_event :gender, ({:gender => gender})\n\n userQuest = UsersQuest.find_by_quest_id(quest.id)\n if @current_user.id==userQuest.assignor_id && @current_user.id==userQuest.assignee_id\n User.publish_event :quest_type, ({:self_assigned => 'Self Assigned'})\n else\n User.publish_event :quest_type, ({:self_assigned => 'Not Self Assigned'})\n end\n\n notif_user = User.find_by(:id => userQuest.assignor_id)\n notif = Notification.create(:user_id => userQuest.assignor_id,\n :title => \"#{@current_user.first_name} #{@current_user.last_name} has completed your assigned quest: #{quest.title}\",\n :url => quest_path(userQuest.quest_id))\n @options = {:channel => \"/notifs/#{userQuest.assignor_id}\",\n :message => notif.title,\n :count => \"#{User.unread_notifications_count notif_user}\", :redirect => quest_path(params[:id]),\n :url => quest_path(userQuest.quest_id),\n :id => notif.id}\n\n end\n format.html {redirect_to quest_path(params[:id])}\n format.js\n end\n end",
"def send_notification\n\n\n end",
"def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def refresh\n tracking = tracking_handler.refresh!\n if tracking.success?\n flash[:success] = 'Tracking was successfully refreshed'\n else\n flash[:error] = tracking.error\n end\n redirect_to navigation.back(1)\n end",
"def act notification, options={}\n # ...or nothing\n end",
"def update\n puts \"==========================\"\n puts \"UPDATE\"\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_popup\n respond_to do |format|\n @identifier = Identifier.find(params[:id])\n format.js\n end\n end",
"def delete\n @notification = Users::Notification.find_by_id(params[:id])\n @notification.set_status_deleted\n\n respond_to do |format|\n format.html { redirect_to notification_path }\n format.json { head :no_content }\n end\n end",
"def refresh!; end",
"def show\n @notify = @course.notifies.find(params[:id])\n @notify.readed_times += 1\n @notify.save\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify }\n end\n end",
"def reload_comments\n redirect_to :action => 'show', :id => params[:id]\n end",
"def synch\n @results = PurchaseOrder.synch_retur_now\n status = eval_status_res(@results)\n send_email_which_service_api_is_not_connected(status)\n respond_to do |f|\n @back_to_index = \"#{returned_processes_path}\"\n f.js {render :layout => false, :status=>status}\n end\n end",
"def synch_product_based_on_code\n product_db = Product.find(params[:id]).callback_api_product_based_on_code\n status = eval_status_res(product_db)\n send_email_which_service_api_is_not_connected(status)\n respond_to do |f|\n f.js {render :layout => false, :status => status}\n end\n end",
"def after_refresh(_options = {}); end",
"def handle_subscribe\n\n @user = User.find(params[:user_id])\n current_user.follow(@user)\n\n #update the subscribe button using AJAX\n respond_to do |format|\n format.js { render :file => 'users/handle_sub_unsub.js.erb' }\n end\n\n #notify the user when someone subscribes to them\n @user.notifications.create(description:\"has subscribed to your memes!\", from_user_id: current_user.id)\n\n end",
"def push_relaunch\n\t\trequire \"config/initializers/launch_juggernaut.rb\"\n\t\trender :nothing => true\n\tend",
"def update\n respond_to do |format|\n if @notification.update(params.fetch(:notification, {}))\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refresh\n end",
"def refresh\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.json { render :show, status: :ok, location: @notification }\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n else\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def refresh\n page = @agent.get('https://wwws.mint.com/overview.event')\n\n @agent.post(\"https://wwws.mint.com/refreshFILogins.xevent\", {\"token\"=>@token})\n\n true\n \n end",
"def notify_incomplete\n Notification.notify_incomplete\n end",
"def enable_inactivity_email\n @user.update_attributes(:is_receiving_inactivity_email => true)\n @notice = \"You have enabled inactivity notifications.\"\n \n respond_to do |format|\n format.html {\n redirect_to(manage_email_notifications_path, notice: @notice) and return\n return \n }\n format.js {\n render :subscribe\n }\n\n end\n end",
"def reload\n end",
"def reload\n end",
"def show\n render json: @notification\n end",
"def reload_cards\n broadcast(reload_cards: true)\n end",
"def refresh\n update_databases()\n render json: {message: \"Information will be updated shortly\"}, status: :ok\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notify\n render :text => 'Ok, thank you.'\n end",
"def reload\n refresh\n end",
"def reload\n refresh\n end",
"def update\n @notification = Notification.find(params[:id])\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.updated\") }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n push_notification(@notification.id, @notification.car.device_token, @notification.text)\n end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def show\n # notification_email\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def js_reload\n riak_admin 'js_reload'\n end",
"def reload!\n fetch_data!\n end",
"def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end",
"def refresh()\r\n #set_browser_document()\r\n $jssh_socket.send(\"#{BROWSER_VAR}.reload();\\n\", 0)\r\n read_socket();\r\n wait()\r\n end"
] | [
"0.6492369",
"0.6262972",
"0.6181112",
"0.61580825",
"0.6157248",
"0.6097662",
"0.60796624",
"0.58724767",
"0.5869404",
"0.58647823",
"0.586097",
"0.58326864",
"0.58181334",
"0.5797232",
"0.5751939",
"0.571645",
"0.57088757",
"0.56689227",
"0.56669784",
"0.56524646",
"0.5631164",
"0.5606435",
"0.55930555",
"0.5577459",
"0.5568341",
"0.55663955",
"0.5512548",
"0.55045915",
"0.5471664",
"0.54563725",
"0.5443026",
"0.54244536",
"0.5422317",
"0.5413084",
"0.5386173",
"0.53779197",
"0.53699344",
"0.5359113",
"0.53332615",
"0.53160954",
"0.53049105",
"0.5283015",
"0.5258634",
"0.52484065",
"0.52386105",
"0.522175",
"0.522047",
"0.5209372",
"0.52060485",
"0.52047586",
"0.52029204",
"0.5195796",
"0.5195481",
"0.5193257",
"0.5192592",
"0.51797295",
"0.5176925",
"0.51752716",
"0.51744694",
"0.5166778",
"0.51612717",
"0.5159412",
"0.51565796",
"0.5153674",
"0.51456153",
"0.5144631",
"0.5140173",
"0.51397026",
"0.5139222",
"0.5139132",
"0.5138848",
"0.5138848",
"0.51379895",
"0.5128879",
"0.5123188",
"0.5123143",
"0.5120748",
"0.5120748",
"0.51176095",
"0.5104239",
"0.5103676",
"0.510203",
"0.510203",
"0.510203",
"0.51005024",
"0.5083904",
"0.5083904",
"0.50794363",
"0.50794154",
"0.50794154",
"0.50794154",
"0.50794154",
"0.50723726",
"0.5071774",
"0.5071774",
"0.5071774",
"0.50651664",
"0.50644606",
"0.50630754",
"0.50599146"
] | 0.5616177 | 21 |
Initializes the notifications offset | def initialize_notification_offset
@offset_notifications = (correct_integer?(params[:offset]) ? params[:offset].to_i : NOTIFICATIONS_LOADED_TOGETHER)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_notifications\n @notifications = Notification.all\n end",
"def init_position\n @init_position\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def offset!(offset)\n @offset = offset || 0\n self\n end",
"def offset(count=nil)\n if count\n @offset = count\n self\n else\n @offset\n end\n end",
"def set_default_position\n if self.position.nil?\n self.position = newsletter.blocs.count + 1\n end\n end",
"def set_offset(offset)\n @offset = offset\n self\n end",
"def initialize(offset, previous_offset, timestamp)\n super(offset, previous_offset)\n @timestamp = timestamp\n @at = nil\n end",
"def reload\n @notifications = current_user.notifications_visible_block 0, SETTINGS['notifications_loaded_together']\n @new_notifications = current_user.number_notifications_not_seen\n @offset_notifications = @notifications.length\n @tot_notifications = current_user.tot_notifications_number\n end",
"def default_offset_amount\n 50\n end",
"def offset; end",
"def offset; end",
"def offset; end",
"def offset()\n @offset__\n end",
"def _start_offset= offset\n fail(\"who dares set offset as such? #{offset}\") unless\n offset.kind_of?(Fixnum)\n @start_offset = offset\n end",
"def init\n if super\n @offset = 0\n @sg = ITALY\n self\n end\n end",
"def init\n\t\tself.extra_person = 0 if self.extra_person.nil?\n\t\tself.from_date = Date.today if self.from_date.nil?\n\t\tself.to_date = Date.today + 1.day if self.to_date.nil?\n\tend",
"def offset\n @offset ||= (position.unitless? || position.unit_str == \"px\") ? position.value : 0\n end",
"def offset= offset\n @value = nil\n @offset = offset\n end",
"def current_offset; end",
"def reset\n @offset = 0\n end",
"def initialize initial\n @markers = [initial]\n end",
"def initialize(api_client, received_options)\n @start_at_offset = 0\n @end_at_offset = nil\n\n unless received_options[OFFSET_KEYS[0]].nil?\n @start_at_offset = received_options[OFFSET_KEYS[0]].to_i\n end\n unless received_options[OFFSET_KEYS[1]].nil?\n @end_at_offset = received_options[OFFSET_KEYS[1]].to_i\n end\n\n @options = received_options.reject { |key| OFFSET_KEYS.include? key.to_sym }\n super(api_client)\n\n # Cache pagesize, MUST NOT change between requests\n @page_size = client.page_size\n end",
"def initialize_points\n self.current_points = 0\n self.expiring_points = 0\n end",
"def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end",
"def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end",
"def get_offset\n @offset\n end",
"def generate_notifications\n\t\t@notifications = Notification.find(:all, :order => \"created_at DESC\")\n\tend",
"def set_initial_values\n self.hints_used = 0\n end",
"def offset(*) end",
"def load_notifications\n \t\tif current_user\n \t\t\t@notifications = current_user.notifications.limit 5\n \t\t\t@unseen_notifications_count = current_user.notifications.unseen.count\n \t\tend\n \tend",
"def fires_in\n\t\t\t@offset - @group.current_offset if @offset\n\t\tend",
"def after_initialize\n #\n # we get points as an array named 'point' when Hash.form_xml is loaded using XML from device. phew! :)\n # :point virtual attribute is to avoid ActiveRecord erorrs.\n # It just holds points in memory as array of hashes. another phew! :)\n # we parse :point array to build Point.new values for this instance of OscopeMsg\n # I hope it makes sense. If not, just go through the business logic for this section, again.\n unless point.blank?\n point.each {|p| self.points.build(p)}\n point = nil # make it blank. both valid? and save! will call it otherwise, and make double copies\n end\n #\n # we need to link an OscopeStartMsg if we can find one suitable\n # only find and relate when not already related\n # oscope_start_msgs are created by gateway XMLs\n self.oscope_start_msg = OscopeStartMsg.find_by_timestamp_and_user_id(timestamp, user_id) \\\n if oscope_start_msg.blank?\n #\n # That is it. Let ActiveRecord do the magic from here. :)\n end",
"def at_init\n\n\t\tend",
"def defaults\n {\n name: '',\n offset: nil,\n type: :x,\n }\n end",
"def offset\n loffset + 6\n end",
"def init_event_holders\n @txtout_events = Array.new\n @resmon_events = Array.new\n end",
"def set_hash_offset(opts)\n opts = check_params(opts,[:offsets])\n super(opts)\n end",
"def occurred_events offset_size\n Event.reader_by offset_size, pseudo_graph_pattern: pseudo_graph_pattern\n end",
"def initialize\n self.messages = RingBuffer.new(LOG_MEMORY_RING_SIZE)\n end",
"def get_current_offset\n @offset < 0 ? 0 : @offset\n end",
"def get_new_block\n @notifications = current_user.notifications_visible_block @offset_notifications, NOTIFICATIONS_LOADED_TOGETHER\n @offset_notifications += @notifications.length\n end",
"def initialize(date_number, events, offset)\n @date_number = date_number\n @events = events\n @offset = offset\n end",
"def setup_unit_vars\n super\n @initial = @starting.beginning_of_week\n @final = @ending.next_week.beginning_of_week\n @pages = @last = page_offset(@initial, @final)\n @from = starting_time_for(@page)\n @to = @from.next_week\n end",
"def find_offsets\n offsets = []\n\n 0.upto(weblogs.count / DEFAULT_OFFSET) do |i|\n offsets << i * 20\n end\n\n offsets\n end",
"def x_offset; end",
"def initialize(begin_offset, end_offset, extension, truncated, missing_previous_data, metadata)\n @begin_offset = begin_offset\n @end_offset = end_offset\n @extensions = (extension.is_a?(Symbol)) ? [ extension ] : extension\n @truncated = truncated\n @missing_previous_data = missing_previous_data\n @metadata = metadata\n end",
"def initialize(offset, previous_offset, timestamp_value)\n @offset = offset\n @previous_offset = previous_offset\n @timestamp_value = timestamp_value\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def init\n self.position = self.class.count if position.nil?\n end",
"def offset_changes\n changes(col_offset: @col_offset, row_offset: @row_offset)\n end",
"def first_offset; end",
"def first_offset; end",
"def offset(offset)\n @last_query_context.offset = offset\n self\n end",
"def offset(arg0)\n end",
"def set_notifications\n @notifications = current_user.my_notifications\n end",
"def offset\n @offset ||= raw_response['response']['start']\n end",
"def initialize(user_offset)\n @retire_num = 3\n # @active_user_set = User.limit(10).offset(user_offset).map(&:id)\n @active_user_set = (1..10).to_a.map { |n| user_offset + n }\n @query_times = []\n end",
"def offset\n self[:ip_off]\n end",
"def offset(offset)\n self.query.offset = offset\n self\n end",
"def initial_unread_entries\n update unread_entries: feed.entries.count\n end",
"def initialize_order_events\n @order_events = %w{approve cancel resume}\n end",
"def offset\n 1\n end",
"def offset(count=nil)\n if count\n count = 1 if count < 1\n @offset = count.to_i\n return self\n else\n @offset\n end\n end",
"def new_offset(offset=0)\n self.class.new!(:civil=>civil, :parts=>time_parts, :offset=>(offset*86400).to_i)\n end",
"def hash_args\n [@offset_start] + super\n end",
"def initialize_notification_with_owner\n @notification_id = correct_integer?(params[:notification_id]) ? params[:notification_id].to_i : 0\n @notification = Notification.find_by_id @notification_id\n update_ok([email protected]? && current_user.id == @notification.user_id)\n end",
"def viewport_offset\n @viewport_offset ||= {x: part_layout.x.to_i, y: part_layout.y.to_i}\n end",
"def initialize(item, starting_offset = nil)\n if (@none = (item == NONE))\n @base, @offset = 0, 0\n elsif item.is_a?(GridIndex)\n Log.warn('GridIndex: starting_offset ignored') if starting_offset\n @base, @offset = item.base, item.offset\n else\n @base, @offset = item.to_i, starting_offset.to_i\n end\n end",
"def offset\n @options[:offset] || ((current_page - 1) * per_page)\n end",
"def offset\n limit_and_offset.last\n end",
"def offset(count)\n Fetcher.new(self).offset(count)\n end",
"def set_defaults\n self.notification_id ||= Thrive::Util::Uuid.generate\n self.state = 'new' unless state\n end",
"def offset\n\t\t\t@position + @offset\n\t\tend",
"def init_custom_fields\n @usage_count = 0\n end",
"def initialize\n @start = nil\n end",
"def initialize(history_length)\n @history_length = history_length\n @net_messages = [] # Fields with net_ prefix will get syncronized automatically inside an update loop\n end",
"def msg_init\n\t@msg_buf = []\n end",
"def first_notification=(int)\n @first_notification = check_integer(int)\n end",
"def initialize()\n get_dimensions()\n get_start_p()\n get_end_p()\n end",
"def initialize(notifications_engine)\n @notifications_engine = notifications_engine\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.chatMembersNotificationRecipient\"\n end",
"def initialize(start_date: Time.now - OFFSET, end_date: Time.now)\n @start_date = start_date\n @end_date = end_date\n\n super\n end",
"def initialize_defaults\n %w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|\n send(\"#{attr}=\", 0)\n end\n end",
"def getPayloadOffsets(payload)\n @offsets\n end",
"def events_notification_number\n @notifications = Notification.number_of_notifications_for_events current_user\n end",
"def initialize\n super\n @startup_times = []\n end",
"def finished_init\n super\n @wander_intention = AgentInternal::WanderIntention.new(engine, name)\n unless state[\"position\"] && state[\"position\"][\"#\"]\n # Move to legal position. If this is a TMX location or similar, it will assign a specific position.\n if self.location.respond_to?(:any_legal_position)\n state[\"position\"] = self.location.any_legal_position\n end\n end\n end",
"def initialize\n super\n @update_to_call = []\n Scheduler.start(:on_init, self.class)\n end",
"def after_initialize\n end",
"def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end",
"def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end",
"def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end",
"def initpos_1\n return [0,0]\n end",
"def view_offset\n @position + @view.position\n end",
"def start(begin_offset = 0)\n super\n @on = resolve(@on)\n @origin = resolve(@origin)\n @delta = resolve(@end) - @origin\n end",
"def offset_params\r\n if params[:offset]\r\n @offset = params[:offset].to_i\r\n end\r\n if params[:limit]\r\n @limit = params[:limit].to_i\r\n end\r\n @offset ||= OFFSET\r\n @limit ||= LIMIT\r\n end",
"def date_offset\n @date_offset ||= Date.today - EVENTS_EXPORTED_ON\n end",
"def initialize(obj)\n super\n @requested_at = nil\n @received_at = nil\n end",
"def initialize_page_information\n @issues = []\n @issues_have_changelog_notes = []\n @issues_status = []\n @issues_changelog_notes_descriptions = []\n initialize_issues_array unless @version.nil?\n end"
] | [
"0.5799061",
"0.57546103",
"0.5683678",
"0.5666489",
"0.5606115",
"0.55998945",
"0.5530408",
"0.55098337",
"0.55013764",
"0.54930305",
"0.54706126",
"0.54706126",
"0.54706126",
"0.5445654",
"0.5392907",
"0.53885037",
"0.53631544",
"0.53539306",
"0.5348342",
"0.5306498",
"0.5300385",
"0.5298791",
"0.52941567",
"0.5268243",
"0.5255322",
"0.5255322",
"0.5244668",
"0.52389336",
"0.5236014",
"0.52269804",
"0.52254623",
"0.522339",
"0.5216954",
"0.5205252",
"0.52013934",
"0.5178981",
"0.5172182",
"0.5162513",
"0.516148",
"0.51597685",
"0.5159627",
"0.51531523",
"0.5148392",
"0.5133521",
"0.51192373",
"0.51158607",
"0.5104058",
"0.506914",
"0.50678235",
"0.5063778",
"0.50624424",
"0.50585574",
"0.50585574",
"0.5058385",
"0.50571704",
"0.5056384",
"0.50540173",
"0.5041953",
"0.5038089",
"0.5032536",
"0.5025933",
"0.501892",
"0.50164336",
"0.4999669",
"0.49901143",
"0.49880052",
"0.49857983",
"0.4977915",
"0.49764907",
"0.49706995",
"0.49673435",
"0.49643335",
"0.496229",
"0.4959161",
"0.49544165",
"0.4949027",
"0.4946357",
"0.49237838",
"0.49142194",
"0.489197",
"0.4887993",
"0.48876685",
"0.48823127",
"0.48796314",
"0.48749682",
"0.48745552",
"0.48687991",
"0.48636982",
"0.4861535",
"0.4859284",
"0.48585996",
"0.48585996",
"0.48585996",
"0.485309",
"0.484751",
"0.4844947",
"0.48436472",
"0.4843107",
"0.48374826",
"0.48367047"
] | 0.84568256 | 0 |
Checks if the owner of the notification is correct | def initialize_notification_with_owner
@notification_id = correct_integer?(params[:notification_id]) ? params[:notification_id].to_i : 0
@notification = Notification.find_by_id @notification_id
update_ok([email protected]? && current_user.id == @notification.user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_mail_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Email.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_MAIL) and owner_id != @login_user.id\n Log.add_check(request, '[check_mail_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def is_owner_of?(thing)\n return false unless thing.user == self\n true\n end",
"def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end",
"def check_owner\n\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n mail_account = MailAccount.find(params[:id])\n\n if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def check_owner_user\n @guild = Guild.find(@invite[:guild_id])\n if self.admin?\n return 1\n end\n return (@guild[:owner_id] == session[:user_id]) ? 1 : nil\n end",
"def check_owner\n\n return if params[:id].blank? \\\n or (params[:id] == TreeElement::ROOT_ID.to_s) \\\n or @login_user.nil?\n\n begin\n owner_id = MailFolder.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_MAIL) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def check_owner\n\n return if params[:id].blank? or @login_user.nil?\n\n mail_account = MailAccount.find(params[:id])\n\n if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def is_owner?(user)\n user.id == self.user_id\n end",
"def is_owner?(this_user)\n user == this_user\n end",
"def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end",
"def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end",
"def owned_by?(u)\n self.user == u\n end",
"def check_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Workflow.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def owner?(user)\n\t\tuser.id == self.user.id\n\tend",
"def owner? (user)\n user == owner\n end",
"def is_owner?(pid, oid)\n oid.owner == get_object(pid).owner\n end",
"def owned?\n user.present?\n end",
"def owner?\n resource.user_id == current_user.id\n end",
"def owner? usr\n user_id == usr.id\n end",
"def owner?(key = :user_id)\n # Lookup the original user_id\n owner_id = was(key) || send(:\"_#{key}\")\n !owner_id.nil? && owner_id == Volt.current_user_id\n end",
"def has_owner(user)\n return self.user.id==user.id\n end",
"def owned?\n !owner.nil?\n end",
"def owner?(c_utor)\n contribution.owner?(c_utor)\n end",
"def owner?(photo)\n !photo.nil? && photo.owner == current_user\n end",
"def is_owner\n object == current_user\n end",
"def is_owner?(item)\n current_user_id == item.user_id\n end",
"def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end",
"def check_owner\n if @comment.user != current_user\n respond_to do |format|\n format.html { redirect_to post_comments_path, alert: \"You dont have permissions for this action!\"}\n end\n end\n end",
"def check_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Location.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_LOCATION) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def owner?(user)\n user == owner || owners.include?(user)\n end",
"def owner_set?\n return false if current_owner_name.nil?\n\n !current_owner_name.empty?\n end",
"def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end",
"def owner?(current_user)\n user == current_user\n end",
"def check_ownership_requestor_user(requestor,user)\n if requestor.nickname != user.nickname\n raise Error, \"Requestor #{requestor.nickname} and user requested #{user.nickname} do not match\"\n end\n end",
"def check_owner\n if current_user != Checklist.find(params[:format]).user\n flash[:notice] = \"Trying to be cheeky are we? You cannot modify a task that's not yours!\"\n redirect_to '/'\n end\n end",
"def validateOwner(dest_cell,owner)\n temp = cells[dest_cell[0]][dest_cell[1]].getPiece()\n temp.isOwner(player)\n end",
"def check_toy_owner\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n begin\n owner_id = Toy.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_DESKTOP) and owner_id != @login_user.id\n Log.add_check(request, '[check_toy_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def owner?\n name == 'owner'\n end",
"def owner?(resource:)\n current_user.present? && resource&.user_id == current_user.id\n end",
"def is_owner?\n Account.current ? Account.current.has_owner?(self) : false\n end",
"def deliver_store_owner_order_notification_email?\n store.new_order_notifications_email.present? && !store_owner_notification_delivered?\n end",
"def owner?\n record.id == user.id\n end",
"def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend",
"def has_owner_id(owner_id)\n content.owner_id == owner_id\n end",
"def validate_owner(user)\n if owner_editable.nil?\n load\n end\n if self.pmr.owner\n v = self.pmr.owner.name\n else\n v = \"Unknown\"\n end\n css_class, title, editable = [ owner_css, owner_message, owner_editable ]\n {\n :css_class => css_class,\n :title => title,\n :editable => editable,\n :name => v,\n :width => Retain::Fields.field_width(:pmr_owner_name)\n }\n end",
"def validateOwner(dest_cell, owner)\n piece = @cells[dest_cell[0]][dest_cell[1]].getPiece()\n if piece != nil\n return piece.isOwner(owner)\n end\n return false\n end",
"def is_owned_by_user?(user)\n self.user == user\n end",
"def check_is_guild_owner\n @guild = Guild.find(User.find(session[:user_id])[:guild_id])\n return (@guild[:owner_id] == session[:user_id]) ? 1 : nil\n end",
"def is_admin_or_owner client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['is_admin'] || info['user']['is_owner']\n end",
"def owner?(post_owner) # <= User object\n current_user == post_owner\n end",
"def owner?\n return if current_user == @event.creator\n\n redirect_back(fallback_location: root_path, alert: 'Unauthorized request!')\n end",
"def validate_owner_private(user)\n pmr_owner = pmr.owner\n # A blank owner is a bad dog.\n if pmr_owner.signon.blank?\n return [ \"wag-wag\", \"Owner should not be blank\", true ]\n end\n return [ \"normal\", \"PMR Owner assumed valid\", true]\n end",
"def owned_by? a_user\n a_user == user\n end",
"def owned?\n @owner == caller\n end",
"def owner?(id)\n if current_user.id == id\n return true\n else\n return false\n end\n end",
"def is_owner?(person)\n return person !=nil && person.team_id == self.id && person.role == \"captain\"\n end",
"def owner?(project)\n if id == project.user.id\n true\n else\n false\n end\n end",
"def is_owned_by?(user_id)\n self.user_id == user_id\n end",
"def verify_owner\n if @dog && @dog.owner && @dog.owner != current_user\n redirect_to root_path\n end\n end",
"def owner_of(resource)\n id == resource.user_id ? true : false\n end",
"def owned_by?(actor)\n # defaults to false. Override if resource has owner\n false\n end",
"def is_owner?(username)\n User.get_user(username).eql?(self.owner)\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end",
"def check_correct_owners\n if current_admin.nil?\n if @referral.referral_email != current_user.email && @referral.user != current_user\n redirect_to(new_user_session_path, notice: \"You cannot view this referral. Please login to the correct account.\")\n end\n else\n if @referral.job.admin != current_admin && @referral.admin_id != current_admin.id\n redirect_to(new_user_session_path, notice: \"You cannot view this referral. Please login to the correct account.\")\n end\n end\n end",
"def owned_by?(current_user)\n current_user && user_id == current_user.id\n end",
"def has_owner? user\n self.account_users.where(user: user, is_owner: true).count > 0\n end",
"def owner_preference?\n owner_uniq_favorite_vote&.value&.>= Vote.owner_id_min_confidence\n end",
"def owner?\n customer.owner_id == id\n end",
"def is_owner? (opportunity)\n \topportunity.user_id == self.id\n end",
"def owner?(owner_id)\n return true if current_user && current_user.id.to_i == owner_id.to_i\n\n flash[:info] = 'You are not authorised to view that page.'\n redirect '/app'\n false\n end",
"def is_owner\n if user_signed_in?\n if current_user.id == Cause.find(params[:id]).user_id\n return true\n else\n redirect_to causes_path\n end\n else\n redirect_to new_user_session_path\n end\n end",
"def object_owner?\n User.find(params[:user_id]) == current_user\n end",
"def owner_of_recurrence\n self.recurrence.present? && self.recurrence.owner == self\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end",
"def is_owner?(account)\n attachable == account.profile\n end",
"def check_for_room_owner\n unless whoami_owns_room?(ChatRoom.find(params[:id]))\n flash[:notice] = \"You do not have permissions to modify this room\"\n redirect_to chat_rooms_url\n end\n end",
"def owns_event\n unless @event.owner == current_user\n redirect_to events_path, :alert => \"Must be event owner to modify!\"\n return false\n end\n return true\n end",
"def verify_notification\n wait_for_css(input_elements[:entries])\n entries = get_entries\n entries.each do |entry|\n if entry[\"data-mention-id\"].eql?(@stream_post_id)\n user_icon = entry.all(input_elements[:notification_icon]).first\n return true if user_icon[\"data-original-title\"].include?(\"Assigned to \")\n return false\n end\n end\n return false\n end",
"def routine_owner\n record.user == user\n end",
"def check_notification\n referral = self\n admin = referral.job.admin\n\n if referral.is_interested == true && referral.is_admin_notified == false\n # binding.pry\n if referral.update_attribute(:is_admin_notified, true)\n ReferralMailer.deliver_admin_notification(referral, admin)\n referral.save\n else\n render 'edit', error: \"We had an issue with your referral request. Please try again.\"\n end\n end\n end",
"def game_owner?\n self == game.owner if game.winner.nil?\n end",
"def is_resource_owner?(resource)\n current_user && current_user.id == resource.user_id\n end",
"def sender? usr\n usr.id == user_id\n end",
"def owner?(user_asking)\n user_asking.in? company.owners\n end",
"def article_owner?(obj)\n\t\t\tcurrent_user.id == obj.user_id\n\t\tend",
"def is_owner?(xaccount:)\n # DRAFT and creator means owner\n return true if publication.is_draft? && publication.current_version.is_creator?(xaccount: xaccount)\n\n # Author means owner\n return true if publication.current_version.is_author?(xaccount: xaccount)\n\n # All others are not owners\n false\n end",
"def user_is_guild_owner?\n @guild = Guild.find(User.find(session[:user_id])[:guild_id])\n return (@guild[:owner_id] == session[:user_id]) ? true : false\n end",
"def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end",
"def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end",
"def update?\n owner?\n end",
"def comment_owner\n unless current_user.id == @comment.user.id\n flash[:notice] = \"You don't have access to that!\"\n redirect_to @post\n end\n \n end",
"def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n end\n rescue\n false\n end",
"def isCampaignOwner\r\n\t\[email protected]_id == session[:user_id]\r\n\tend",
"def require_owner\n @messsage = \"You don't have the permission to do this operation.\"\n render :file => \"shared/message\" unless @user.eql?(current_user)\n end",
"def require_owner\n @messsage = \"You don't have the permission to do this operation.\"\n render :file => \"shared/message\" unless @user.eql?(current_user)\n end",
"def verify_not_owner\n unless current_user && @dog && @dog.owner != current_user\n redirect_to root_path\n end\n end",
"def object_owner_for_resource?(object)\n object.user == current_user\n end",
"def owner?(obj)\n (self.id == RedisMutexer.config.redis.get(key(obj)).to_i)\n end",
"def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\n end",
"def owner_name_set?\n (owner_name.nil? || owner_name.empty?)\n end"
] | [
"0.69734174",
"0.68720585",
"0.6851387",
"0.6836907",
"0.6831485",
"0.68280834",
"0.678406",
"0.67624694",
"0.67619294",
"0.67489856",
"0.6721482",
"0.671365",
"0.67074805",
"0.670104",
"0.6677937",
"0.66641307",
"0.66480726",
"0.6645395",
"0.66423506",
"0.6620568",
"0.6605511",
"0.6604239",
"0.6594817",
"0.6585691",
"0.657643",
"0.657558",
"0.65591687",
"0.65540254",
"0.65370625",
"0.6536147",
"0.65315175",
"0.6528641",
"0.6520735",
"0.6498538",
"0.64935094",
"0.64520043",
"0.6451173",
"0.6448875",
"0.64409477",
"0.64314127",
"0.6425022",
"0.6409633",
"0.6406757",
"0.64032596",
"0.6379817",
"0.6373944",
"0.6373599",
"0.6373057",
"0.636441",
"0.63638157",
"0.63601816",
"0.6357741",
"0.63415635",
"0.6340116",
"0.63305837",
"0.6313539",
"0.63045704",
"0.6300894",
"0.62770647",
"0.6276742",
"0.62634784",
"0.6251783",
"0.6251654",
"0.62423736",
"0.6236482",
"0.62250704",
"0.6219069",
"0.62182707",
"0.6215911",
"0.62102133",
"0.62042373",
"0.6202723",
"0.61807674",
"0.61705774",
"0.61554796",
"0.6153079",
"0.6146732",
"0.6133928",
"0.6132177",
"0.613044",
"0.6129508",
"0.61245835",
"0.61201805",
"0.61169934",
"0.6104916",
"0.60861504",
"0.6079774",
"0.60672176",
"0.60672176",
"0.6055975",
"0.6054724",
"0.60476446",
"0.60253054",
"0.60198474",
"0.60192513",
"0.60185874",
"0.60138893",
"0.60077846",
"0.60034263",
"0.60004056"
] | 0.6444585 | 38 |
GET /locations/1 GET /locations/1.json GET /locations/1.xml | def show
Project.hit 4
@location = Location.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @location, callback: params[:callback] }
format.xml { render xml: @location }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locations\n get('locations')\n end",
"def locations(place)\n get :loc => place\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @locations = salor_user.get_locations(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locations = Location.all\n\n respond_with(@locations)\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end",
"def index\n @locations = Location.order(:country).order(:region).order(:city).page(params[:page])\n respond_with(@locations)\n end",
"def location\n @client.get(\"#{path}/location\")\n end",
"def index\n @locations = Location.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def locations(query = {})\n get('location', query)\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end",
"def show\n @location = Location.find(params[:id])\n @items = @location.location_items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(:first, :conditions => [ \"geonameid = ?\", params[:id] ] )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @locations_locationset = LocationsLocationset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @locations_locationset }\n end\n end",
"def list_locations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1LocationsApi.list_locations ...\"\n end\n # resource path\n local_var_path = \"/v1/me/locations\".sub('{format}','json')\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'Array<V1Merchant>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1LocationsApi#list_locations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end",
"def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end",
"def index\n @locations = current_user.locations\n respond_with @locations\n end",
"def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end",
"def show\n render json: Location.find(params[\"id\"])\n end",
"def locations\n @client.get('/BikePoint')\n end",
"def locations\n locations_params = Hashie::Mash.new( {f: params.f} )\n response = make_request(LOCATIONS_BASE, locations_params)\n return not_available (response) unless response.status == 200\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif [email protected]?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @locations = Location.search(params[:search]).includes(:locales).order(\"status desc, locations.id asc\").paginate(:page=>params[:page],:per_page=>$DEFAULT_PER_PAGE_BE)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def get_all_locations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LocationApi.get_all_locations ...\"\n end\n # resource path\n local_var_path = \"/location/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\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 => 'InlineResponse2003')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LocationApi#get_all_locations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n render :json => Location.find(params[:id])\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @location }\n end\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end",
"def index\n return redirect_to(request.env['REQUEST_URI'].include?(\"colleges\") ? college_path(params[:id]) : location_path(params[:id])) if params[:id]\n @locations = Location.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end",
"def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end",
"def show\n Project.hit 31\n @location = IphoneLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n format.xml { render xml: @location }\n end\n end",
"def location(id, options = {})\n get \"locations/#{id}\", options\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def index\n respond_to do |format|\n format.html {\n @locations = Location.with_samples.all\n render :template => 'locations/index'\n }\n format.xml { render :xml => @locations }\n format.js {\n # q and limit are coming from jQuery autocomplete plugin\n @locations = Location.find(:all, :conditions => [\"name like ?\", \"%#{params[:q]}%\"], :limit => params[:limit])\n render :text => @locations.map(&:name).join(\"\\n\")\n }\n end\n end",
"def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end",
"def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def index\n @specific_locations = SpecificLocation.all\n end",
"def query\n { :locations => [] }\n end",
"def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def index\n @locations = Spree::Location.all\n end",
"def show\n @location = Location.with_samples.find(params[:id])\n @sample_summaries = @location.sample_summaries.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end",
"def index\n @storage_locations = StorageLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @storage_locations }\n end\n end",
"def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end",
"def list_locations\n warn 'Endpoint list_locations in V1LocationsApi is deprecated'\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/locations'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def list\n @locations = Location.find(:all, :order => \"name\")\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end",
"def show\n @[email protected]\n map\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end",
"def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end",
"def locations\n locations = Occi::Core::Locations.new\n\n all(params[:entity]).each do |bt|\n bt_ids = backend_proxy_for(bt).identifiers\n locations_from(bt_ids, bt, locations)\n end\n return if locations.empty?\n\n respond_with locations\n end"
] | [
"0.76494104",
"0.7084628",
"0.7073745",
"0.7052324",
"0.6992383",
"0.6992383",
"0.6929134",
"0.68663377",
"0.6859151",
"0.6854235",
"0.6850819",
"0.6741951",
"0.674001",
"0.67131823",
"0.6699596",
"0.668567",
"0.6675169",
"0.6645048",
"0.6542486",
"0.6508795",
"0.64978045",
"0.64942354",
"0.6491714",
"0.6480763",
"0.64695746",
"0.6469153",
"0.6448873",
"0.6445112",
"0.64418125",
"0.6440644",
"0.64292085",
"0.64223933",
"0.6420687",
"0.63862276",
"0.6380568",
"0.6362884",
"0.6360589",
"0.6346721",
"0.63426673",
"0.63343304",
"0.63158476",
"0.6315116",
"0.63133025",
"0.63117796",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.6309061",
"0.63024884",
"0.6300614",
"0.6296496",
"0.62889147",
"0.62888235",
"0.6287262",
"0.6270747",
"0.6270729",
"0.6270109",
"0.6270109",
"0.6270109",
"0.6270109",
"0.6270109",
"0.6270109",
"0.6270109",
"0.6240189",
"0.62372416",
"0.62341213",
"0.62211376",
"0.6211665",
"0.6211576",
"0.6203762",
"0.61978406",
"0.6193008",
"0.61800665",
"0.61631614",
"0.6151128",
"0.6146759",
"0.61325634",
"0.6115905",
"0.61140716",
"0.60933095",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6091347",
"0.6074556",
"0.60716444",
"0.6071507",
"0.60661703"
] | 0.64870346 | 23 |
Without a document, the document cannot be signed. Generate the document once, and then set document and recall to_token | def document
return nil if @document.nil?
@document.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def salt_document\n raise ESignatureException, 'Document salt requires timestamp ms to be set' unless @signed_at_timestamp_ms\n\n @document_salt = generate_salt\n set_document_tag :esignuniquecode, @document_salt\n @document_salt\n end",
"def create\n @document = Document.new(params[:document])\n @document.generate_token\n @document.archived = false\n if params[:group_id]\n @document.owner = Group.find(params[:group_id]) \n else\n @document.owner ||= default_company\n end\n @document.author = current_user\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to document_path(@document), :flash => { :success => 'Document was successfully created.'} }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_document_status\n puts \"------ JSON que veio ------\"\n document_data = JSON.parse(request.body.read)\n puts document_data\n\n puts \"------ Nossa transformação ------\"\n document_data.deep_symbolize_keys!\n puts document_data\n\n puts \"----- doc_key: #{document_data[:document][:key]} -----------\"\n # testar escrever @operation como operation\n @operation = Operation.new\n\n if request.headers[\"Event\"] == \"auto_close\"\n @operation = Operation.find_by_sign_document_key(document_data[:document][:key])\n @operation.signed_at = Time.current\n @operation.signed = true\n @operation.save!\n SlackMessage.new(\"CHQFGD43Y\", \"<!channel> o contrato da *Operação #{@operation.id}* foi completamente assinado\").send_now\n elsif request.headers[\"Event\"] == \"sign\"\n @operation = Operation.find_by_sign_document_key(document_data[:document][:key])\n signer_email = document_data[:event][:data][:signer][:email]\n new_sign_document_info = @operation.sign_document_info.deep_symbolize_keys\n new_sign_document_info[:signer_signature_keys].each do |signer_signature_key|\n if signer_signature_key[:email] == signer_email\n signer_signature_key.store(:status, \"signed\")\n SlackMessage.new(\"CHQFGD43Y\", \"<!channel> #{signer_email} assinou o contrato da *Operação #{@operation.id}*\").send_now\n end\n end\n @operation.sign_document_info = new_sign_document_info\n @operation.save!\n end\n # testar tirar esse authorize\n authorize @operation\n render body: {}.to_json, status: :created\n\n end",
"def set_internal_token!\n self.token ||= generate_token\n end",
"def prepare\n raise ESignatureException, 'No document to prepare for signature' unless @e_sign_document\n\n @prepared_doc = generate_doc_from_model\n save_prepared_doc_digest\n end",
"def generate_doc_from_model\n # Get the config for the model to be signed\n elt = @e_sign_document.option_type_config\n\n # Use either the specified fields in the activity log e_sign configuration,\n # or the fields specified in the model to be signed\n sign_fields = @specified_fields || elt.fields\n\n # Limit the attributes to just the specified fields, and order them according the field config\n att_order = @e_sign_document.class.permitted_params\n all_atts = {}\n if att_order\n att_order.each do |a|\n a = a.to_s\n all_atts[a] = @e_sign_document.attributes[a]\n end\n else\n all_atts = @e_sign_document.attributes.dup\n end\n atts = all_atts.select { |k, _v| sign_fields.include? k }\n\n ApplicationController.render(template: 'e_signature/document', layout: 'e_signature', locals: {\n e_sign_document: @e_sign_document,\n prepared_document: self,\n attributes: atts,\n caption_before: elt.caption_before,\n labels: elt.caption_before,\n show_if: elt.show_if,\n current_user: current_user,\n document_title: @document_title,\n document_intro: @document_intro\n }).html_safe\n end",
"def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def save_prepared_doc_digest\n d = Hashing.checksum(@prepared_doc)\n set_document_tag(:esignprepdoc, d)\n end",
"def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end",
"def update_signature!; end",
"def update_signature!; end",
"def generate_verification_token!\n self.verification_token = generate_token\n self.verification_sent_at = Time.now.utc\n self.save(validate: false)\n end",
"def create\n\n @permit_saving = true\n @success = false\n\n if remotipart_submitted? and params[:docu_template][:self_sign] == \"1\"\n\n client = DocusignRest::Client.new\n\n document_envelope_response = client.create_envelope_from_document(\n email: {\n subject: \"test email subject\",\n body: \"this is the email body and it's large!\"\n },\n # If embedded is set to true in the signers array below, emails\n # don't go out to the signers and you can embed the signature page in an \n # iFrame by using the client.get_recipient_view method\n signers: [\n {\n embedded: true,\n name: current_account.user.name,\n email: current_account.email,\n role_name: 'Signer'\n },\n ],\n files: [\n { path: params[:docu_template][:document].path, name: params[:docu_template][:document].original_filename }\n ],\n status: 'sent'\n )\n \n @recipient_view = client.get_recipient_view(\n envelope_id: document_envelope_response[\"envelopeId\"],\n name: current_account.user.name,\n email: current_account.email,\n return_url: url_for( action: 'server_response', only_path: false )\n )\n\n session[:docusign] = { :status =>\"created\", :recipient_view => @recipient_view, :document => document_envelope_response }\n @permit_saving = false\n else\n end\n\n @docu_template = DocuTemplate.new(docu_template_params)\n @docu_template.company = account_company\n @docu_template.user = current_account.user\n #@docu_template.docu_signs.build if @docu_template.docu_signs.empty?\n\n if params[:docu_template][:self_sign] and session[:docusign] and session[:docusign][:status]==\"completed\"\n @docu_template.document = File.open( session[:docusign][:path] )\n @permit_saving = true\n end\n\n respond_to do |format|\n if @docu_template.valid? and @permit_saving\n @docu_template.save(validate: false)\n session.delete(:docusign)\n @docu_template = DocuTemplate.new\n @success = true\n \n store_docs_to_sign\n \n format.html { redirect_to url_for( action: 'index', anchor: 'template') , notice: 'Docu sign was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @docu_template }\n format.js\n else\n format.html { render action: 'new' }\n format.json { render json: @docu_template.errors, status: :unprocessable_entity }\n format.js\n end\n\n end\n end",
"def create_docusign_envelope(box_doc_id)\n\n box_user = user_client\n\n box_file = box_user.file_from_id(box_doc_id)\n raw_file = box_user.download_file(box_file)\n temp_file = Tempfile.open(\"box_doc_\", Rails.root.join('tmp'), :encoding => 'ascii-8bit')\n\n begin\n temp_file.write(raw_file)\n temp_file.close\n\n puts \"doc client\"\n ap DOCUSIGN_CLIENT\n envelope = DOCUSIGN_CLIENT.create_envelope_from_document(\n email: {\n subject: \"Signature Requested\",\n body: \"Please electronically sign this document.\"\n },\n # If embedded is set to true in the signers array below, emails\n # don't go out to the signers and you can embed the signature page in an\n # iFrame by using the client.get_recipient_view method\n signers: [\n {\n embedded: true,\n name: 'Marcus Doe',\n email: '[email protected]',\n role_name: 'Client',\n sign_here_tabs: [{anchor_string: \"Signature:\", anchor_x_offset: '100', anchor_y_offset: '0'}]\n }\n ],\n files: [\n {path: temp_file.path, name: \"#{box_file.name}\"}\n ],\n status: 'sent'\n )\n\n session[envelope[\"envelopeId\"]] = {box_doc_id: box_file.id, box_doc_name: box_file.name}\n rescue => ex\n puts \"Error in creating envo\"\n ensure\n temp_file.delete\n end\n\n envelope\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
"def create\n @current_user = User.find_by_id(session[:user_id])\n @document = Document.new(params[:document])\n @document.user = @current_user\n if @document.file && !document.file.empty?\n @document.name = @document.file.original_filename\n @document.status = 'pending'\n #@document.dt_reference = DocTrackrEnterprise.secure_document(@document.file, \"https://doctrackr-salesforce.herokuapp.com/documents/callback\")\n end\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def send_signature_complete_mail(document)\n DocumentMailer.with(email: document.user.email,\n document: document).signing_complete.deliver_later\n DocumentEvent.create!(document: document, message: \"Varsel om ferdig signering sendt til #{document.user.email} \")\n\n end",
"def generate_token\n #Token.generate_token(self.id)\n end",
"def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end",
"def regenerate_auth_token!\n generate_auth_token\n set_auth_token_expiry\n\n save\n end",
"def save_token\n self.token = SecureRandom.uuid unless self.token\n end",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def generate_token\n self.token = custom_token.presence || SecureRandom.hex(3)\n self.custom_token = nil\n generate_token if AliasedLink.exists?(token: token)\n end",
"def compute_token(doc_key)\n verify_doctype(doc_key)\n token = get_token\n Store.get_store(store_index(doc_key)).put_value(docname(doc_key),token)\n token.to_s\n end",
"def sign!(current_user, _password)\n @current_user = current_user\n unless current_user == signing_user\n raise ESignatureUserError, 'The current user does not match the user that prepared the document for signature'\n end\n\n validate_prepared_doc_digest\n set_signature_timestamp\n salt_document\n sign_document\n\n validate_signature\n @prepared_doc\n end",
"def generate_document\n config = Spree::BilletConfig\n doc_user = user.attributes[config.doc_customer_attr] rescue ''\n due_date = Date.today + config.due_date.days\n\n params = {cedente: config.corporate_name,\n documento_cedente: config.document,\n cedente_endereco: config.address,\n sacado: self.customer_name,\n sacado_documento: doc_user,\n sacado_endereco: order.bill_address.full_address,\n numero_documento: document_number,\n data_vencimento: due_date,\n data_documento: Date.parse(created_at.to_s),\n valor: amount,\n aceite: config.acceptance,\n agencia: config.agency,\n conta_corrente: config.account,\n convenio: config.agreement,\n carteira: config.wallet,\n variacao: config.variation_wallet\n }\n (1..6).each { |cont| params[\"instrucao#{cont}\".to_sym] = config[\"instruction_#{cont}\"] }\n if config.bank == 'sicredi' then\n params.merge!({posto: config.office_code,\n byte_idt: config.byte_idt})\n end\n\n document = case config.bank\n when 'banco_brasil' then Brcobranca::Boleto::BancoBrasil.new params\n when 'bradesco' then Brcobranca::Boleto::Bradesco.new params\n when 'caixa' then Brcobranca::Boleto::Caixa.new params\n when 'santander' then Brcobranca::Boleto::Santander.new params\n when 'itau' then Brcobranca::Boleto::Itau.new params\n when 'sicredi' then Brcobranca::Boleto::Sicredi.new params\n else\n raise 'It is necessary set the billet config'\n end\n document\n end",
"def regenerate?(document); end",
"def create\n @document = Document.new(document_params)\n @document.user = current_user\n @document.project = current_project\n @document.qr_code_position = QrCodePosition.find(@document.position)\n authorize @document\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: t('document.create.confirmation') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transmit_document!\n version_id = document_version_ref_id\n version_id.present? ? update_document(version_id) : upload_document\n end",
"def stored_signature; end",
"def generate_token\n if self.token.blank?\n self.id = self.token = UniqueToken.generate\n end\n end",
"def pdf_to_sign\n _get_pdf_to_sign\n end",
"def new\n @document = @instruction.documents.build\n authorize @document\n end",
"def initialize(original_doc, token_library)\n @original_doc = original_doc\n @token_library = token_library\n end",
"def calculate_signature(doc, node)\n sha1 = OpenSSL::Digest::SHA1.new\n node = doc.at_css(node)\n canon_signed_info_node = canonicalize_exclusively(node)\n signature = @signing_private_key.sign(sha1, canon_signed_info_node)\n\n encode(signature).gsub(/\\s+/, \"\")\n end",
"def generate_document options={}\n\n # which vendor or which account?\n party = options[\"party_type\"].constantize.find_by_id(options[\"party\"])\n\n # generate pending document_entity (the row in the document table)\n document = Document.create( document_type: options[\"doc_type\"],\n recipient: party.name,\n total: \"0\",\n event_id: self.id,\n status: DocumentStatus::requested,\n name: DocumentStatus::requested,\n creator_id: options[\"current_user\"])\n options[\"document_id\"] = document.id\n\n #if we're invoicing, lock invoicable line items\n if options[\"doc_type\"] == DocumentType::Event::invoice\n lock_new_invoice_line_items party, document\n end\n # queue the pdf creation and persistence\n Sidekiq::Client.enqueue( EventDocument, options )\n end",
"def prepared_doc_digest(from: nil)\n get_document_tag(:esignprepdoc, from: from)\n end",
"def signing_input=(_); end",
"def signing_input=(_); end",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def generate_token\n self.token = SecureRandom.hex if new_record?\n end",
"def generate_document options={}\n\n # which vendor or which account?\n party = options[\"party_type\"].constantize.find_by_id(options[\"party\"])\n\n # generate pending document_entity (the row in the document table)\n document = Document.create( document_type: options[\"doc_type\"],\n recipient: party.name,\n total: \"0\",\n event_id: self.id,\n status: DocumentStatus::requested,\n name: DocumentStatus::requested,\n creator_id: options[\"current_user\"])\n options[\"document_id\"] = document.id\n\n #if we're invoicing, lock invoicable line items\n if options[\"doc_type\"] == DocumentType::Event::invoice\n lock_new_invoice_line_items party, document\n end\n # queue the pdf creation and persistence\n Resque.enqueue( EventDocument, options )\n end",
"def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def signing_input; end",
"def signing_input; end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def create\n @document = @instruction.documents.build(document_params)\n authorize @document\n disable_primary if @document.primary\n respond_to do |format|\n if @document.save\n format.html { redirect_to @instruction, notice: t('documents.create.success') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@document = Document.new\n\t\tuser = User.find(current_user.id)\n\t\t@documents = user.documents\n\t\t@sign_security_levels = SignSecurityLevel.all\n\tend",
"def action\n begin\n\n # Get the token for this signature (rendered in a hidden input field, see pades_signature/new.html.erb)\n token = params[:token]\n\n # Instantiate the PadesSignatureFinisher class, responsible for completing the signature process\n # (see config/initializers/restpki.rb)\n signature_finisher = RestPki::PadesSignatureFinisher.new(get_restpki_client)\n\n # Set the token\n signature_finisher.token = token\n\n # Call the finish method, which finalizes the signature process and returns the signed PDF's bytes\n signed_bytes = signature_finisher.finish\n\n # Get information about the certificate used by the user to sign the file. This field can only be acquired\n # after calling the finish method.\n @signer_cert = signature_finisher.certificate_info\n\n # At this point, you'd typically store the signed XML on your database. For demonstration purposes, we'll\n # store the XML on a temporary folder publicly accessible and render a link to it.\n\n @filename = SecureRandom.hex(10).to_s + '.pdf'\n File.open(Rails.root.join('public', 'uploads', @filename), 'wb') do |file|\n file.write(signed_bytes)\n end\n\n rescue => ex\n @error = ex\n render 'layouts/_error'\n end\n end",
"def create\n render :template => '/pages/bot_detected' and return unless params[:javascript_enabled] == 'true'\n \n @document = Document.public.find(params[:id])\n \n params[:document][:state] = nil # prevent auto approval hack (FIXME: use attr_protected)\n\n if @document.meta_definition_for(params[:label]).allowed? current_user, 'create'\n\n new_document = Document.new(params[:document])\n new_document.parent = @document\n new_document.label = params[:label]\n new_document.author = current_user || User.anonymous\n new_document.published_at = Time.now\n\n if new_document.save\n flash[:notice] = new_document.meta_definition.flash_messages['create'] || \"Your #{params[:label]} has been saved\"\n if new_document.meta_definition.notify_admins\n DocumentMailer.deliver_new_document(new_document)\n end\n redirect_to document_path(@document)\n else\n flash.now[:notice] = 'Could not be saved'\n eval(\"@new_#{params[:label]} = new_document\")\n setup_view_environment\n render :template => view_for\n end\n else\n render :text => 'Not Allowed' and return\n end\n end",
"def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end",
"def new\n #creates a new document\n @doc = current_user.docs.build\n end",
"def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end",
"def create_token(opts = {})\n self.token = Digest::SHA256.hexdigest(\n Time.now.to_s + Rails.application.secrets.salt + email\n )\n save if opts[:save] == true\n end",
"def create\n #creates a new document and also its parameters(its title and its content)\n @doc = current_user.docs.build(doc_params)\n\n #says if the doc is saved then get the application to redirect the user to the document that was #just created/saved.\n if @doc.save\n redirect_to @doc\n # says if it fails to save then render the doc again so the user can have another go at saving it.\n # The reason why render 'new' is used here instead of 'redirect_to' is because redirect_to is a NEW http refresh. Meaning if the user has a long document and a save fails then if we used redireect_to they would lose all of their previous work!\n # but render does not refresh the page. It keeps the user where they are and they get to have another go at saving the doc.\n else\n render \"new\"\n end\n end",
"def keep_or_generate_token!\n return if api_token.present?\n\n generate_token! unless new_record?\n end",
"def new\n @doc = current_user.docs.build\n end",
"def create\n if signed_in?\n if current_user.admin?\n @document = Document.new(document_params)\n @document.user = current_user\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: I18n.t('documents.messages.create_success') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n else\n admin_user\n end\n else\n redirect_to signin_path\n end\n end",
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end",
"def create_or_renew_token()\n calculate_expiry_time()\n end",
"def generate_token\n unless self.token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless User.exists?(token: random_token)\n end\n self.save\n end\n end",
"def generate_document_structure; build_document_hash end",
"def validate_signature(test_doc = nil)\n test_doc ||= @prepared_doc\n\n doc_signature = get_document_tag :esigncode, from: test_doc\n doc_salt = get_document_tag :esignuniquecode, from: test_doc\n validate_prepared_doc_digest test_doc\n\n new_pdd = prepared_doc_digest(from: test_doc)\n new_signature = Hashing.sign_with(doc_salt, new_pdd)\n raise ESignatureUserError, 'Document signature is invalid' unless doc_signature == new_signature\n\n true\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Organization.exists?(token: random_token)\n end\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def ensure_token\n if self.token_expiration and Time.now > self.token_expiration\n self.token = nil\n end\n self.token ||= self.generate_token\n self.token_expiration = Time.now + 1.day\n self.save\n return self.token\n end",
"def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def post_document_save_as(request)\n data, _status_code, _headers = post_document_save_as_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def generate_token\n self.token = SecureRandom.base64(64)\n end",
"def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end",
"def create\n task = Task.find(params[:document][:task_id]) unless params[:document][:task_id].nil? # checks if was coming from task manager\n\n today = Date.today.strftime('%Y-%m-%d')\n @flat = Flat.find(params[:flat_id])\n @document = Document.new(document_params)\n\n expiration = params[:document][:expiration]\n\n @contract = Contract.where(flat_id: @flat.id, active: \"Active\")[0]\n @document.contract_id = @contract.id\n\n respond_to do |format|\n if @document.save!\n if !task.nil? && task.status == \"awaiting doc\" # if no expiration date, not task created\n task.status = \"doc uploaded\"\n task.description = task.description + \" \\(Uploaded on #{today}\\)\"\n task.save\n end\n if @document.expiration_date # checks if received and expiration date\n if expiration == \"Yes\"\n @task = Task.create(document_id: @document.id, owner: \"renter\", name: \"update \\\"#{@document.doc_type}\\\" document\",\n description: \"Update document: \" + @document.name , due_date: @document.expiration_date, contract_id: @document.contract_id)\n message = \"Document and task were successfully created.\"\n else\n message = \"Document was successfully created.\"\n end\n end\n format.html { redirect_to flat_documents_path(@flat), notice: message }\n else\n format.html { render :new }\n end\n end\n end",
"def initialize_stamper\n Java::ComLowagieTextPdf::PdfStamper.createSignature(@reader, @buffer, 0x00.to_java(Java::JavaLang::Character)) if sign_file?\n end",
"def set_signature_timestamp\n time = Time.now\n @signed_at = time\n @signed_at_timestamp = TimeFormatting.printable_time time\n @signed_at_timestamp_ms = TimeFormatting.ms_timestamp(time)\n set_document_tag :esigntimestamp, @signed_at_timestamp\n end",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def create\n \n forbidden unless current_account_user.create_legal_document\n if params[:transloadit]\n documents = TransloaditDocumentsParser.parse params[:transloadit], @account.id\n if documents\n documents.each do |document|\n \n CatalogsDocuments.where(catalog_id: @catalog.id, document_id: document.id)\n .first_or_create(catalog_id: @catalog.id, document_id: document.id)\n \n DocumentExtractTextWorker.perform_async( document.id )\n end\n end\n end\n redirect_to catalog_account_catalog_documents_path(@account, @catalog)\n \n end",
"def speculative_auth_document\n client_first_document.merge(db: user.auth_source)\n end",
"def test_put_protect_document\n filename = 'test_multi_pages.docx'\n remote_name = 'TestPutProtectDocument.docx'\n dest_name = remote_test_out + remote_name\n body = ProtectionRequest.new({:NewPassword => '123'})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PutProtectDocumentRequest.new remote_name, body, remote_test_folder + test_folder, nil,\n nil, nil, dest_name\n result = @words_api.put_protect_document request\n assert_equal 200, result.code\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_document\n if Document.exists?(params[:id])\n @document = Document.find(params[:id])\n unless current_user.id == @document.created_by_id\n error_renderer({code: 401, message: 'Unauthorized'})\n end\n else\n render partial: 'api/v1/error', locals: {:@error => {code: 404, message: 'Document Not Found'}}, status: 404\n end\n end",
"def generate_public_token(auth_token)\n return \"Authentication token required\" if auth_token.nil?\n expire_dt = 1.year.from_now\n Digest::SHA1.hexdigest([expire_dt, auth_token].join)\n end",
"def create\n @document = current_user.documents.build(document_params)\n get_identification_type\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_document_tag\n @issuer_document_tag = IssuerDocumentTag.find(params[:id])\n end",
"def prepare_for_signature\n prepare\n end",
"def upload_document(evss_claim_document)\n uploader = EVSSClaimDocumentUploader.new(@user.uuid, evss_claim_document.uploader_ids)\n uploader.store!(evss_claim_document.file_obj)\n # the uploader sanitizes the filename before storing, so set our doc to match\n evss_claim_document.file_name = uploader.final_filename\n EVSS::DocumentUpload.perform_async(auth_headers, @user.uuid, evss_claim_document.to_serializable_hash)\n rescue CarrierWave::IntegrityError => e\n log_exception_to_sentry(e, nil, nil, 'warn')\n raise Common::Exceptions::UnprocessableEntity.new(detail: e.message,\n source: 'EVSSClaimService.upload_document')\n end",
"def valid_token\n # generate the token\n self.token=Digest::MD5.hexdigest(\"#{Time.now}-#{self.ad_id}-#{self.publisher_id}\")\n\n # Aux var to the ValidatorLoop\n counter = 0\n\n # Loop which validate the token on the DB\n while true do\n another_access = Access.where(token: self.token).take\n break if another_access.nil?\n self.token=\"#{self.token}#{counter}\"\n counter=counter+1\n end\n end",
"def set_token\n self.token ||= SecureRandom.uuid.gsub(/\\-/, '').first(5).upcase\n end",
"def create_token\n token = SecureRandom.hex(10) #on crée un token de 10 caractères au hasard\n self.token = token #affectation du token à la candidature\n self.save\n end",
"def document_auth doc_id=nil\n doc_id ||= params[:doc]\n doc_id = doc_id.decode62 if doc_id.is_a? String\n\n doc = WSFile.get doc_id\n halt 404 if doc.nil?\n if doc.visibility == 'private'\n perms = doc.permissions(user:current_user)\n if not logged_in?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n elsif perms.empty? # isn't on the permission list\n halt 403\n end\n end\n doc\n end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end"
] | [
"0.6707589",
"0.63097113",
"0.6230448",
"0.61852044",
"0.6107902",
"0.6086259",
"0.60673976",
"0.60008085",
"0.59369826",
"0.58871096",
"0.58871096",
"0.58620447",
"0.58585876",
"0.5852365",
"0.5836483",
"0.5831261",
"0.58296484",
"0.58296484",
"0.5812042",
"0.57936126",
"0.5731921",
"0.5728076",
"0.5722809",
"0.57127535",
"0.57053417",
"0.5703742",
"0.5699068",
"0.5682961",
"0.5679497",
"0.56742245",
"0.56653255",
"0.56605744",
"0.56578743",
"0.5651828",
"0.56052893",
"0.5584397",
"0.5564399",
"0.55636424",
"0.5561435",
"0.5555692",
"0.5555692",
"0.5552914",
"0.55505323",
"0.5546316",
"0.5543998",
"0.5531159",
"0.5531159",
"0.5519433",
"0.55167156",
"0.5506076",
"0.54911476",
"0.548757",
"0.54829764",
"0.54811674",
"0.54807574",
"0.5478343",
"0.54775167",
"0.5466969",
"0.5464268",
"0.5454766",
"0.5451548",
"0.5442309",
"0.5439312",
"0.5436746",
"0.54304063",
"0.54265773",
"0.5418056",
"0.5416715",
"0.5416214",
"0.5403532",
"0.53954035",
"0.5387204",
"0.537154",
"0.5371295",
"0.5367627",
"0.5362053",
"0.5358986",
"0.5348638",
"0.5346084",
"0.5344777",
"0.5336755",
"0.5331835",
"0.53268737",
"0.53192323",
"0.53123647",
"0.53123647",
"0.53099054",
"0.53049755",
"0.53010875",
"0.52980804",
"0.5283323",
"0.527222",
"0.52625465",
"0.52584046",
"0.5251252",
"0.5248425",
"0.5238336",
"0.5238336",
"0.5238336",
"0.5238336",
"0.5238336"
] | 0.0 | -1 |
Cache "now" so that digests match... TODO: figure out how we might want to expire this cache... | def now
@now ||= Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now\n cache\n end",
"def now\n cache\n end",
"def now\n cache\n end",
"def expires_now; end",
"def cache_valid_from\n if caching_enabled?\n @cache_valid_from ||= Time.now\n else\n invalidate_cache!\n end\n @cache_valid_from\n end",
"def new_version\n # the expiry needs to be longer than any page that might use this as a\n # cache key.\n time = Time.now.to_i\n versionable_options[:cache].write(version_cache_key, time, :expires_in => versionable_options[:ttl])\n time\n end",
"def invalidate_cache! now\n end",
"def verify\n @cache[:last_accessed] = nil if\n @cache.has_key?(:last_accessed) &&\n @cache[:last_accessed].to_date != Date.today\n end",
"def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end",
"def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end",
"def expires_now\n response.cache_control.replace(no_cache: true)\n end",
"def expires_now\n response.cache_control.replace(no_cache: true)\n end",
"def cached?; end",
"def cache_for(time)\n expires_in time, :public => true\n end",
"def cache_set(key, data, from_now = nil)\n true\n end",
"def now; end",
"def now; end",
"def refresh_expiry\n self.expires_at = Time.now + ttl\n end",
"def test_ttl_eviction_on_access\n @cache.store(:a, 1)\n @cache.store(:b, 2)\n\n Timecop.freeze(Time.now + 330)\n\n @cache.store(:c, 3)\n\n assert_equal({ c: 3 }, @cache.raw[:cache])\n end",
"def refresh_time\n self.update_column( :expires, Time.zone.now + TOKEN_LIFE )\n end",
"def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end",
"def cache_on?; end",
"def cache_on?; end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def cache(time = 1.hour)\n expires_in(time)\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end",
"def http_cache_forever(public: false)\n expires_in 100.years, public: public\n\n yield if stale?(etag: request.fullpath,\n last_modified: Time.new(2011, 1, 1).utc,\n public: public)\n end",
"def now=(_arg0); end",
"def cache time: 3600, &block\n return yield if 'development' == ENV['RACK_ENV']\n\n key = \"url:#{I18n.locale}:#{request.path}\"\n cached = $redis.get(key)\n page = cached || yield\n etag Digest::SHA1.hexdigest(page)\n\n if cached\n ttl = $redis.ttl(key)\n response.header['redis-ttl'] = ttl.to_s\n response.header['redis'] = 'HIT'\n else\n response.header['redis'] = 'MISS'\n $redis.setex(key, time, page)\n end\n page\n end",
"def cache_fresh?(tmp_file)\n now = Time.now\n tmp_mtime = File.stat(tmp_file).mtime\n now - tmp_mtime < 300.0 && File.stat(__FILE__).mtime - tmp_mtime < 0.0\nend",
"def simulate_expire; end",
"def no_cache\n expires_now\n end",
"def seen!\n @last_seen = Time.now\n end",
"def now\n @now ||= Time.now.utc\n end",
"def new_expiration_score\n now + 3600\n end",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def cache_for(expires, *args, &blk)\n @cache_data ||= CacheData.new\n @cache_data.value caller_locations(1,1)[0].label.to_sym, expires, args, &blk\n end",
"def fresh?\n DateTime.now.new_offset(0) < @expire_at\n end",
"def cache_value?; end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def now?(t=@time)\n #\n # Use the cache if we've already worked out what happens at time t.\n #\n return @now_cache[t] if @now_cache.has_key?(t)\n \n #\n # Store the test time in an instance variable so the test knows what time\n # we're testing against.\n #\n @test_time = t\n\n #\n # Store the answer in our cache and return.\n #\n @now_cache[t] = (instance_eval(&@during) ? true : false)\n end",
"def now\n generate_otp(timecode(Time.now))\n end",
"def cache_expired?\n return true unless cache_exist?\n File.new(@cache_file).mtime < Time::now - (@cache_life.to_i * 60)\n # TODO check html rendered date\n end",
"def now(padding=false)\n generate_otp(timecode(Time.now), padding)\n end",
"def now\n @__space__.now\n end",
"def fresh_by_time?\n return false unless env.key?(IF_MODIFIED_SINCE) && !last_modified.nil?\n Time.parse(last_modified) <= Time.parse(env.fetch(IF_MODIFIED_SINCE))\n end",
"def fresh?( ses_obj )\n return true if ses_obj['expire'] == 0\n now = Time.now\n ses_obj['expire'] >= now \n end",
"def now\n Time.now\n end",
"def now\n Time.now\n end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def now\n @clock\n end",
"def cache!\n @@cache\n end",
"def cache_version\n if cache_versioning && timestamp = try(:updated_at)\n timestamp.utc.to_s(:usec)\n end\n end",
"def assert_cache_friendly_last_modified\n assert_last_modified 'Mon, 10 Jan 2005 10:00:00 GMT'\n end",
"def getExpiration; @expires; end",
"def pipeline_digest(element)\n value = digest(\"#{Time.now.to_s}::#{element}\")\n @literal_cache[element.to_s] ||= value\n end",
"def cache_expiry\n if options[:extend_cache_life]\n (1 + options[:extend_cache_life]) * super\n else\n super\n end\n end",
"def update! #update\n if @expires_in > LONG_EXPIRED\n add = 1\n elsif @expires_in > MEDIUM_EXPIRED\n add = 2\n elsif @expires_in > 0\n add = 3\n end\n @quality = @expires_in > 0 ? [@quality + add, 50].min : 0\n @expires_in -= 1\n end",
"def cache(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n if include? key\n @store[key].value\n else\n value = yield\n @store[key] = TimeCacheItem.new Time.now, value\n value\n end\n end",
"def age() Time.now - mtime end",
"def stale?\n if config.cache.is_a?(Proc)\n proc_timestamp != mem_timestamp\n else\n file_timestamp != mem_timestamp\n end\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end",
"def cache_buster_hash(*files)\n i = files.map { |f| File.mtime(f).to_i }.max\n (i * 4567).to_s.reverse[0...6]\n end",
"def counter_cache; end",
"def set_cache(value); end",
"def set_cache(value); end",
"def cache\n the_current_time = current_time\n cache_loaded_at = @cache.loaded_at if @cache\n\n if @cache && cache_expiration_policy_object.stale?(cache_loaded_at, the_current_time)\n flush!(:stale, :loaded => cache_loaded_at, :now => the_current_time)\n end\n\n unless @cache\n instrument('cache_load') do\n @cache = LowCardTables::LowCardTable::Cache.new(@low_card_model, @low_card_model.low_card_options)\n end\n end\n\n @cache\n end",
"def getContentCache(theContent)\n\n\ttheChecksum = Digest::SHA256.hexdigest(theContent).insert(2, '/');\n\ttheCache = \"#{PATH_FORMAT_CACHE}/#{theChecksum}\";\n\t\n\treturn theCache;\n\nend",
"def singleton_cache; end",
"def request_fresh?\n # make sure we have something to compare too.\n return false unless last_modified or etag\n\n fresh = true\n\n # only check if we have set the right headers\n fresh &&= etag_matches?(self.etag) if etag\n fresh &&= not_modified?(self.last_modified) if last_modified\n fresh\n end",
"def now\n Time.now\n end",
"def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end",
"def update_now_date_time\n @now_date_time = Time.new\n end",
"def cache_valid?(uri)\n last = last_cached(uri)\n (last > 0 && Time.now.to_i <= (last + @options[:expires_after].to_i))\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def fresh?\n last_compilation_digest&.== watched_files_digest\n end",
"def refresh_if_near_expiration; end",
"def singleton0_cache; end",
"def stale?\n digest != current_digest\n end",
"def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end",
"def fresh?\n ttl && ttl > 0\n end",
"def invalidate_cache!\n @cache_valid_from = Time.now\n end",
"def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end",
"def show\n @user = User.find(params[:id])\n fresh_when :last_modified => @user.updated_at.utc, :etag => @user\n end",
"def gmtime() end",
"def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end",
"def expire=(_); end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end"
] | [
"0.7746037",
"0.7746037",
"0.77393186",
"0.6729138",
"0.65105015",
"0.64688563",
"0.62893474",
"0.62785625",
"0.62239736",
"0.6201604",
"0.6172106",
"0.6172106",
"0.61532724",
"0.61470747",
"0.60668766",
"0.6062118",
"0.6062118",
"0.6048711",
"0.60390973",
"0.5999325",
"0.5998455",
"0.5950612",
"0.5950612",
"0.59385353",
"0.5938294",
"0.59363854",
"0.59363854",
"0.59363854",
"0.59363854",
"0.59363854",
"0.59363854",
"0.59363854",
"0.5935986",
"0.5935986",
"0.587295",
"0.58720726",
"0.58530635",
"0.5824517",
"0.58208835",
"0.58071315",
"0.57953227",
"0.57810825",
"0.57642835",
"0.5761437",
"0.5755523",
"0.57312787",
"0.572969",
"0.57291955",
"0.5724366",
"0.57140756",
"0.5714062",
"0.5684789",
"0.5674952",
"0.5671167",
"0.566393",
"0.566393",
"0.5660565",
"0.5648223",
"0.56477135",
"0.5630616",
"0.5630018",
"0.5629704",
"0.5627561",
"0.56249124",
"0.5621272",
"0.5610095",
"0.56083137",
"0.5605219",
"0.5604283",
"0.5604283",
"0.5601354",
"0.5598843",
"0.55779475",
"0.55770844",
"0.55770844",
"0.5576023",
"0.5575592",
"0.5570487",
"0.5562318",
"0.55612206",
"0.55582315",
"0.5558016",
"0.5553655",
"0.5550625",
"0.5550625",
"0.5550625",
"0.5550625",
"0.5549274",
"0.55457723",
"0.5532121",
"0.55312854",
"0.5530397",
"0.5523015",
"0.55147576",
"0.55099326",
"0.55072075",
"0.54940456",
"0.5489312",
"0.548559",
"0.54808253"
] | 0.59951276 | 21 |
Updates the last visited | def last_visited
Deck.find(params[:id]).update_attribute(:last_visited, DateTime.now)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visited\n self.visited_at = Time.now\n self.save!\n end",
"def visited!\n self.count = self.count.to_i + 1\n self.last_used = Time.now\n save!\n end",
"def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end",
"def update_visited_moves\n visited_coordinates << [x , y]\n end",
"def update_lastlyUsed(chall)\n $game_temp.lbchll_lastly_used = chall.id\n #for ch in @challenges\n # ch.lastly_used = false\n #end\n #chall.lastly_used = true\n end",
"def visited\n clone.visit!\n end",
"def update_visits_count\n if self.visited && self.visited.visits_count_column? || self.visited.views_count_column?\n \n self.visited.sweep_count_cache\n \n self.visited.class.transaction do \n self.visited.lock!\n \n attributes = {}\n \n # visits count\n if self.visited.visits_count_column? && self.unique?\n attributes[:visits_count] = self.visited[:visits_count] = self.visited.visits_count_cache = self.visited.calculate_visits_count\n end\n\n # views count\n if self.visited.views_count_column?\n attributes[:views_count] = self.visited[:views_count] = self.visited.views_count_cache = self.visited.calculate_views_count\n end\n \n self.visited.update_attributes(attributes) unless attributes.empty?\n end\n end\n end",
"def update!(**args)\n @visited_type = args[:visited_type] if args.key?(:visited_type)\n end",
"def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end",
"def update_activity\n self.last_activity = Time.now\n end",
"def store_path_visited(path)\n redis.sadd paths_visited_key, path\n end",
"def set_visited_url\n @visited_url = VisitedUrl.find(params[:id])\n end",
"def remember_last_visited_record(record)\n session[:last_admin_edited] = record.id if record.respond_to?(:id)\n end",
"def add_visit\n self.visits += 1\n self.date_last_visit = DateTime.now\n end",
"def visited(page)\n @visited[:forward] = [] unless @visited[:clicked]\n @visited[:back] << page unless @visited[:back].last.eql?(page)\n end",
"def seen!\n @last_seen = Time.now\n end",
"def last\n @history.last\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def show\n @bookmark = Bookmark.find(params[:id])\n# Update visited date\n @bookmark.visited_date=Time.now\n @bookmark.update_attributes(params[:bookmark])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookmark }\n end\n end",
"def doctors_visit(patient_id)\n patient = Patient.find(patient_id)\n patient.update(last_visited_on: DateTime.now)\nend",
"def refresh!\n self.update_attributes(:last_logged => Time.now)\n end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n session[:back_link_history] = { '1' => page }\n elsif last_step_page != page\n return clear_unused_steps if back_button && history\n\n log_action('Adding step to the back link history')\n session[:back_link_history][next_step] = page\n end\n end",
"def update_visits(short_url)\n\n url = Url.find_by_short_url(short_url)\n url.visit_count = url.visit_count + 1\n url.save\n \n end",
"def update\n\t\t\t@last_run = Time.new\n\t\tend",
"def seen!()\n self.redirects_count += 1\n self.last_redirect_at = Time.now\n end",
"def increment\n self.visits = self.visits.to_i.next\n self.save\n end",
"def bump_access\n @access_lock.synchronize do\n @last_acc = Time.new\n end\n end",
"def show\n @link = Link.find_by(token: params[:token])\n @link.times_visited = @link.times_visited + 1\n @link.save\n Click.create(link: @link) # for reporting on most popular\n redirect_to @link.original_url\n end",
"def access!\n \n if self[:last_access].nil? || last_access < Time.now\n self[:prev_access] = self[:last_access] \n self[:last_access] = Time.now\n save\n end\n end",
"def touch_recent\n self.recent_activity = Time.now\n self.save(touch: false)\n end",
"def get_paths_visited\n redis.smembers paths_visited_key\n end",
"def last_activity\n return nil if self.visited_pages.blank?\n self.visited_pages.order(\"created_at desc\").first.created_at\n end",
"def update_last_activity_at\n current_user.last_activity_at = Time.zone.now if current_user\n end",
"def update_current_metric_value\n\n # Find the ID of the most recent metric for this node and path.\n most_recent_metric = Metric.where(:node_id => node_id).where(:path => path).sort(:timestamp.desc).limit(1).first\n if !most_recent_metric.blank? && most_recent_metric.id == id\n\n # We are the most recent metric of this type, create or update the\n # current metric value.\n conditions = { :node_id => node_id, :path => path }\n value = { :node_id => node_id, :path => path, :counter => counter }\n Sherlock::Models::CurrentMetric.collection.update(conditions, value, :upsert => true)\n\n end\n\n end",
"def update_last_user_activity\n if current_user\n current_user.update_attributes(:last_user_activity => Time.now)\n end\n end",
"def remember(base)\n base.session[:last_visited_blog_id] = self.id\n base.session[:last_visited_blog_seo] = self.seo_id\n end",
"def touch\n @last_access_time = @@access_time_sequence\n @@access_time_sequence += 1\n end",
"def update_last_seen\n m = conversation.conversation_members.where(user_id: sender_id).take\n m.update_column(:last_seen, Time.current) if m\n conversation.conversation_members.where.not(user_id: sender_id).pluck(:user_id).each do |_id| # update total unread cache for all members\n Rails.cache.delete(\"user-unread_messages_count-#{_id}\")\n end\n end",
"def loadmore\n bookmarks_loader(session[:last_link_time], current_user.id)\n bookmark = @bookmarks.last\n if bookmark\n session[:last_link_time] = bookmark.updated_at \n end \n end",
"def change_location(target)\n @history.push target\n #TODO change used accessor\n end",
"def update_visits_cache(force=@update_visits_cache)\n if force\n @update_visits_cache = false\n\n self.sweep_count_cache\n \n # cached columns?\n if self.visits_count_column? || self.views_count_column?\n self.class.transaction do\n Visit.transaction do \n self.lock_self_and_visits!\n \n attributes = {}\n \n # visits count\n if self.visits_count_column?\n attributes[:visits_count] = self.visits_count_cache = self.calculate_visits_count\n end\n\n # views count\n if self.views_count_column?\n attributes[:views_count] = self.views_count_cache = self.calculate_views_count\n end\n \n self.update_attributes(attributes) unless attributes.empty?\n end\n end\n end\n end\n end",
"def next_history\n if @history_index && @history_index > 0\n @history_index -= 1\n else\n @history_index = @history.size - 1\n end\n\n self.value = @history[@history_index]\n end",
"def last_page!\n last_page.tap { |page| update_self(page) }\n end",
"def update_last_activity\n current_user.try(:update_last_activity)\n end",
"def set_visited_page\n @visited_page = VisitedPage.find(params[:id])\n end",
"def setLast(last)\n @last = last\n end",
"def save_old_last_ip_address\n\t\tif self.ip_address_changed? \\\n\t\t&& self.ip_address != self.ip_address_was\n\t\t\tself.last_ip_address = self.ip_address_was\n\t\tend\n\tend",
"def set_last_use!\n @last_use = Time.now\n end",
"def save_last_request\n\t\t# Check if Back-Button is pressed\n\t\tunless @is_back_search\n\t\t\t# Push the last search and thumbnail to stack.\n\t\t\t@searched << @current_search if @current_search != {phrase: \"\", thumbnail: nil}\n\t\t\t@current_search = {phrase: \"\", thumbnail: nil}\n\t\tend\n\t\t@is_back_search = false\n\tend",
"def visit!\n self.duration = [(Time.now - self.updated_at).to_i, 15 * 30].min # if user stay on page more than 15 min\n self.visits += 1\n self.save!\n end",
"def update_last_saved_by_to(user)\n self.last_saved_by_id = user.id\n self.save!\n end",
"def rewind\n @seen.clear\n super\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end",
"def refresh\n return if first.nil?\n\n i = first.index\n while at(i).exists?\n i += 1\n end\n i -= 1\n\n @last = at(i)\n end",
"def add_visit\n self.increment!(:visits, 1)\n end",
"def lastsave\n on_each_node :lastsave\n end",
"def update(current)\n end",
"def last\n @tail.lru_prev\n end",
"def save_last_location\n session[:last_location] = request.env[\"REQUEST_URI\"]\n true\n end",
"def store_interest_update\n self.last_interest_update = Time.now\n end",
"def mark_visited!(x, y)\n @maze[x][y] = 'V'\n end",
"def reset_visiting_state\n @visited = Array.new(@columns) { Array.new(@rows) }\n end",
"def users_by_amount_visited\n user_visits = self.visited_museums.count\n other_user_visits = User.where.not(id: self.id).map { |user| user.visited_museums.count }\n other_user_visits.unshift(user_visits)\n end",
"def add_to_search_history(*args)\n super\n\n session[:history_counter] ||= 0\n session[:history_counter] += 1\n end",
"def current=(node)\n\t\t\t@try_current[-1] = node\n\t\tend",
"def access!\n today = Time.now\n if last_access.nil? || last_access < today\n update_attribute :last_access, today\n end\n end",
"def visited_by_date\n ordered_visits = self.visits.sort_by(&:updated_at).reverse\n ordered_visited = ordered_visits.select { |visit| visit.visited == true }\n ordered_visited.map { |visit| visit.museum }\n end",
"def visit(item)\n @visited << item\n @visit.call(item)\n end",
"def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end",
"def last_retrieved=(new_last_retrieved)\n @last_retrieved = new_last_retrieved\n unless self.cache_object.nil?\n self.cache_object.last_retrieved = new_last_retrieved\n end\n end",
"def jump_back\n @banned_points[@path.last.hash] = @path.pop\n @current_point = @path.last || (@path << @start_vector).last\n @current_cost = get_cost @current_point\n @banned_points.delete @start_vector.hash\n @initial_run = true\n if @debug_level > 1\n puts \"Jumping back\"\n puts \"Banning #{@banned_points.last.inspect}\"\n end\n end",
"def save_old_last_ip_address\n if self.ip_address_changed? and self.ip_address != self.ip_address_was\n self.last_ip_address = self.ip_address_was\n end\n end",
"def update_visit_list(url)\n if @@url_hash.has_key?(url.to_sym)\n @@url_hash[url.to_sym] = true\n else\n puts \"Something wend wrong\"\n end\n end",
"def update_value(v)\n @history[@history_pos] = v\n @history_pos += 1\n # when history is full, overwrite from the beginning\n if @history_pos >= @history_len\n @history_pos = 0\n end\n end",
"def next_history()\r\n (@history_offset == @history_length) ? nil : @the_history[@history_offset+=1]\r\n end",
"def set_last_reload\n current_dreamer.update_column(:last_reload_at, Time.zone.now) if dreamer_signed_in?\n end",
"def last_synchronize\n last_update\n end",
"def visitar\n @publicacion.update(visitas: @publicacion.visitas + 1)\n end",
"def reunite()\n tour_cost = cost + @@graph.distance(@path.last, @path.first)\n LKTour.new(@path, tour_cost)\n end",
"def fresh_visit?(visit = nil)\n visit ||= current_visit\n visit && visit.updated_at + Const::VISIT_STALE_AFTER > Time.now\n end",
"def update\n advance( (Time.new - @updated).to_i )\n end",
"def update_last_completed_onboarding_step(new_step)\n if last_completed_onboarding_step_for_active_recipient.blank?\n self.last_completed_onboarding_step_for_active_recipient = new_step\n save!\n else\n onboarding = UserOnboarding.new(self)\n next_step = onboarding.next_step_after last_completed_onboarding_step_for_active_recipient\n if new_step == next_step\n self.last_completed_onboarding_step_for_active_recipient = new_step\n save!\n end\n end\n end",
"def update\n respond_to do |format|\n if @visited_url.update(visited_url_params)\n format.html { redirect_to @visited_url, notice: 'Visited url was successfully updated.' }\n format.json { render :show, status: :ok, location: @visited_url }\n else\n format.html { render :edit }\n format.json { render json: @visited_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def touch!\n self.check_security!\n self.last_activity_at = Time.now\n self.last_activity_ip = controller.request.ip\n self.last_activity_path = controller.request.path\n self.requests += 1\n self.save!\n end",
"def store_last_location\r\n session[:return_to] = request.referer unless URI(request.referer).path == \"/passwords\"\r\n end",
"def new_activity!\n update_attributes(most_recent_activity: DateTime.now)\n end",
"def quit_visit\n self.decrement!(:visits, 1)\n end",
"def reset_visiting_state\n @visited = Array.new(@height) { Array.new(@width) }\n end",
"def reset_visiting_state\n @visited = Array.new(@height) { Array.new(@width) }\n end",
"def set_last_key_as_key\n LAST_VALUE_WINS.each {|key| @hash[key] = @hash[key].last}\n end",
"def set_most_recent\n @recent = Doctor.order(\"created_at\").last\n end",
"def mark_changed\n self.last_changed = Time.now\n end",
"def refresh\n # logger.debug(\"refreshing registration #{to_param}\")\n self.last_all_fetch = nil\n self.last_day_fetch = nil\n self.save!\n end",
"def viewed!\n \tself.update_attribute :view_count, self.view_count+1\n end",
"def set_nxtvisit\n @nxtvisit = Nxtvisit.find(params[:id])\n end",
"def update_last_observation(latest_observation = nil)\n return if self.place_id || self.list.is_a?(CheckList)\n return unless self.list.user\n \n latest_observation ||= Observation.latest.by(\n self.list.user).first(:conditions => [\"taxon_id = ?\", self.taxon])\n \n self.last_observation = latest_observation if latest_observation\n true\n end",
"def used\n update(last_used: DateTime.now)\n end",
"def history; end"
] | [
"0.73839927",
"0.721183",
"0.66453266",
"0.6333308",
"0.5924842",
"0.5876325",
"0.58687824",
"0.58549196",
"0.58478695",
"0.5814965",
"0.57685786",
"0.56967264",
"0.56853765",
"0.5658096",
"0.565176",
"0.55385536",
"0.5486038",
"0.5485777",
"0.54771256",
"0.54714674",
"0.54658395",
"0.54175544",
"0.5390482",
"0.53833205",
"0.535917",
"0.53524756",
"0.53389084",
"0.5334937",
"0.53228205",
"0.53220445",
"0.53158414",
"0.5278914",
"0.5270445",
"0.52687854",
"0.5268565",
"0.526143",
"0.52583706",
"0.5251952",
"0.5249091",
"0.52243125",
"0.5219957",
"0.5203344",
"0.5189925",
"0.51877236",
"0.51876163",
"0.51848084",
"0.5178985",
"0.5177043",
"0.51572186",
"0.51496506",
"0.5148058",
"0.51373875",
"0.5126533",
"0.5124234",
"0.5124234",
"0.5117604",
"0.5109766",
"0.51090485",
"0.5106342",
"0.5105502",
"0.51021075",
"0.50949544",
"0.5091878",
"0.5088608",
"0.50849295",
"0.5077383",
"0.5075454",
"0.50752115",
"0.5071505",
"0.50591624",
"0.5057832",
"0.5040686",
"0.5037852",
"0.5036412",
"0.50178015",
"0.49998406",
"0.49957788",
"0.49899626",
"0.49821013",
"0.49785858",
"0.4973208",
"0.49729478",
"0.49714258",
"0.4969153",
"0.49686608",
"0.49665552",
"0.49585354",
"0.49553746",
"0.49465224",
"0.4936453",
"0.4936453",
"0.49289507",
"0.4924285",
"0.49132422",
"0.49103922",
"0.49102336",
"0.4908182",
"0.49074924",
"0.4905284",
"0.49023837"
] | 0.7327326 | 1 |
Checks if the owner of the deck is visiting or it is shared | def correct_user
unless current_user.id == Deck.find(params[:id]).user_id or Deck.find(params[:id]).share == true
flash[:error] = "You do not have permission to look at this deck"
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner?(user)\n user == owner || owners.include?(user)\n end",
"def owned?\n user.present?\n end",
"def owned_by?(current_user)\n current_user && user_id == current_user.id\n end",
"def owner_of_dog?\n dog_has_owner? && current_user ? dog_owner.id == current_user.id : false\n end",
"def verify_owner\n if @dog && @dog.owner && @dog.owner != current_user\n redirect_to root_path\n end\n end",
"def owned?\n !owner.nil?\n end",
"def is_owned_by_user?(user)\n self.user == user\n end",
"def own_shared_to?\r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n shared_to.user_id == self.user_id ? true : false\r\n end",
"def isCampaignOwner\r\n\t\[email protected]_id == session[:user_id]\r\n\tend",
"def ensure_owner_of_set\n user = current_user\n @flash_card_set = FlashCardSet.find params[:id]\n\n unless user == @flash_card_set.user || @flash_card_set.study_group&.has_member?(user)\n head 404\n end\n end",
"def owned_by?(u)\n self.user == u\n end",
"def is_not_global_and_is_owned_by?(user)\n !self.is_global? && self.user_id == user.id\n end",
"def owned_by? a_user\n a_user == user\n end",
"def game_owner?\n self == game.owner if game.winner.nil?\n end",
"def is_owner?(item)\n current_user_id == item.user_id\n end",
"def owned?\n @owner == caller\n end",
"def is_owned_by?(user_id)\n self.user_id == user_id\n end",
"def has_owner(user)\n return self.user.id==user.id\n end",
"def verify_not_owner\n unless current_user && @dog && @dog.owner != current_user\n redirect_to root_path\n end\n end",
"def other_user_profile?\n !is_owner\n end",
"def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end",
"def owning?(owned)\r\n master_song_relationships.find_by_owned_id(owned)\r\n end",
"def owner? (user)\n user == owner\n end",
"def owner?(current_user)\n user == current_user\n end",
"def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end",
"def owned_according_to_internal_state?\n @state_mutex.synchronize do\n unsynced_owned_according_to_internal_state?\n end\n end",
"def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end",
"def is_owner?(user)\n user.id == self.user_id\n end",
"def is_owner?(this_user)\n user == this_user\n end",
"def is_owner?(person)\n return person !=nil && person.team_id == self.id && person.role == \"captain\"\n end",
"def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n end\n rescue\n false\n end",
"def is_owner?\n Account.current ? Account.current.has_owner?(self) : false\n end",
"def shared?\n !self.native? & (self.fb_object_id != FBSharing::Underway) \n end",
"def owner?(owner_id)\n return true if current_user && current_user.id.to_i == owner_id.to_i\n\n flash[:info] = 'You are not authorised to view that page.'\n redirect '/app'\n false\n end",
"def shared?\n sharing != 'none'\n end",
"def owns?(object); object.owners.include?(self) end",
"def is_owner\n object == current_user\n end",
"def is_owner_of?(thing)\n return false unless thing.user == self\n true\n end",
"def is_global_or_owned_by?(user)\n self.is_global? || self.user_id == user.id\n end",
"def owned_by?(user)\n if (access_restricted?)\n return self.acl.owner?(user)\n end\n return false\n end",
"def can_put_in_foundation?\n (@pile_beneath.empty? && @card_to_drop.rank.ace?) ||\n (@card_beneath && foundation_conditions?(@card_beneath))\n end",
"def owner?(user)\n\t\tuser.id == self.user.id\n\tend",
"def owned?() end",
"def check_owner_user\n @guild = Guild.find(@invite[:guild_id])\n if self.admin?\n return 1\n end\n return (@guild[:owner_id] == session[:user_id]) ? 1 : nil\n end",
"def own?\n @cache[:is_own] ||= begin\n require_valid\n owner == obj_module || owner == obj_singleton_class\n end\n end",
"def owner?(mem)\n return false if not mem\n mem.lifes._ids.include?(data.owner_id)\n end",
"def is_owner? (opportunity)\n \topportunity.user_id == self.id\n end",
"def owner?\n customer.owner_id == id\n end",
"def owned_by?(peer_id)\n if peer_id == local_owner_id\n self_owned?\n else\n owners.include?(peer_id)\n end\n end",
"def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end",
"def private?\n return (self.owner_id != 0)\n end",
"def check_is_guild_owner\n @guild = Guild.find(User.find(session[:user_id])[:guild_id])\n return (@guild[:owner_id] == session[:user_id]) ? 1 : nil\n end",
"def owner?(post_owner) # <= User object\n current_user == post_owner\n end",
"def is_owner?(account)\n attachable == account.profile\n end",
"def shared?\n sharing != 'none'\n end",
"def owner?(id)\n if current_user.id == id\n return true\n else\n return false\n end\n end",
"def owner?\n name == 'owner'\n end",
"def owner_set?\n return false if current_owner_name.nil?\n\n !current_owner_name.empty?\n end",
"def own?(game)\n # current_user.games.find(id: game.id)\n end",
"def check_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Location.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_LOCATION) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def has_access\n if !current_user\n return false\n elsif current_user.mtu_id != @player.mtu_id && !Player.exists?(mtu_id: current_user.mtu_id, committee: true)\n return false\n end\n return true\n end",
"def updated_by?(peer); self_owned? || (remote_siblings[peer] && peer.owns?(self)) end",
"def owner? usr\n user_id == usr.id\n end",
"def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end",
"def owner?\n record.id == user.id\n end",
"def is_owner\n if user_signed_in?\n if current_user.id == Cause.find(params[:id]).user_id\n return true\n else\n redirect_to causes_path\n end\n else\n redirect_to new_user_session_path\n end\n end",
"def owner?(user_asking)\n user_asking.in? company.owners\n end",
"def self_owned?; owners.include?(Distributed) end",
"def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end",
"def is_owner\n cause_num = Support.find(params[:id]).cause_id\n cause = Cause.find(cause_num)\n if user_signed_in?\n if current_user.id == Support.find(params[:id]).user_id\n return true\n else\n # return them to the page they were at\n redirect_to cause\n end\n else\n # if the user not logged, redirect them to sign up\n redirect_to new_user_session_path\n end\n end",
"def owner?\n return if current_user == @event.creator\n\n redirect_back(fallback_location: root_path, alert: 'Unauthorized request!')\n end",
"def check_toy_owner\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n begin\n owner_id = Toy.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_DESKTOP) and owner_id != @login_user.id\n Log.add_check(request, '[check_toy_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def owner?(key = :user_id)\n # Lookup the original user_id\n owner_id = was(key) || send(:\"_#{key}\")\n !owner_id.nil? && owner_id == Volt.current_user_id\n end",
"def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end",
"def can_be_seen_by(current_user)\n self.probably_dead? || (current_user != nil && current_user.editor?)\n end",
"def cookbook_owner?\n if current_cookbook && current_user.id != current_cookbook.owner.id\n redirect_to sections_path, alert: \"As a Contributor you may only access the \\\"Recipes\\\" and \\\"Preview\\\" pages for the cookbook.\"\n end\n end",
"def owner?(photo)\n !photo.nil? && photo.owner == current_user\n end",
"def object_owner?\n User.find(params[:user_id]) == current_user\n end",
"def shared?\n @roomer_scope == :shared\n end",
"def has_owner_id(owner_id)\n content.owner_id == owner_id\n end",
"def check_cardOwn(card_id) #authroity\n\n value_return = false\n\n if Game.last.players.find_by(user: current_user,role: nil).id == Pockercard.find_by(id:card_id).player_id\n value_return = true\n end\n\n return value_return\n \n end",
"def accepted?\n return true if exclusive?\n\n accepted_by?(host_lead_member) && accepted_by?(guest_lead_member)\n end",
"def is_of_page_owner\n\t\treturn @is_of_page_owner \n\tend",
"def am_member?(card)\n # this works because I'm the only possible member.\n # if this changes, this method will have to search the members list instead\n card.members.first == me \n end",
"def check_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Workflow.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end",
"def user_is_guild_owner?\n @guild = Guild.find(User.find(session[:user_id])[:guild_id])\n return (@guild[:owner_id] == session[:user_id]) ? true : false\n end",
"def who_is_it(opponent)\n opponent.user == current_user\n end",
"def has_access(developer)\r\n current_user.id == developer.id\r\n end",
"def check_user_for_cardgroup(cardgroup)\n cardgroup_owner_id = cardgroup.owner_id\n current_user_not_cardgroup_owner = (cardgroup_owner_id != session[:user_id])\n\n if (accountant? && ((cardgroup_owner_id != 0) || (session[:acc_callingcard_manage].to_i == 0))) ||\n (reseller? && (current_user_not_cardgroup_owner || (session[:res_calling_cards].to_i != 2))) ||\n (admin? && current_user_not_cardgroup_owner)\n dont_be_so_smart\n redirect_to(:root) && (return false)\n end\n\n true\n end",
"def check_owner\n if @comment.user != current_user\n respond_to do |format|\n format.html { redirect_to post_comments_path, alert: \"You dont have permissions for this action!\"}\n end\n end\n end",
"def owner?(team)\n teams_created.include?(team)\n end",
"def not_currently_shared\n return false unless Share.where(recipient: recipient, user: user, birth_record: birth_record).kept.any?\n\n errors.add(:recipient, 'is currently shared with this entity')\n end",
"def check_kicked_user_from_guild\n return (@guild[:id] == @user[:guild_id] && @user[:id] != @guild[:owner_id]) ? 1 : nil\n end",
"def check_correct_owners\n if current_admin.nil?\n if @referral.referral_email != current_user.email && @referral.user != current_user\n redirect_to(new_user_session_path, notice: \"You cannot view this referral. Please login to the correct account.\")\n end\n else\n if @referral.job.admin != current_admin && @referral.admin_id != current_admin.id\n redirect_to(new_user_session_path, notice: \"You cannot view this referral. Please login to the correct account.\")\n end\n end\n end",
"def owner?\n resource.user_id == current_user.id\n end",
"def owned_by? a_user\n a_user == program.moderator\n end",
"def user_is_not_owner\n unless @likeable_obj.present? && @likeable_obj.user_id != current_user.id\n redirect_to @likeable_obj, notice: \"You cannot like your own dog... How sad...\"\n end\n end",
"def check_ownership \t\n \taccess_denied(:redirect => @check_ownership_of) unless current_user_owns?(@check_ownership_of)\n end",
"def allow(owner)\n u = User.find(session[:user_id])\n if u.role == :admin\n return true\n else\n if u.id == owner.id\n return true\n else\n return false\n end\n end\n end",
"def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend"
] | [
"0.68147546",
"0.6808663",
"0.6804204",
"0.67969203",
"0.6776396",
"0.67683697",
"0.6692686",
"0.6688245",
"0.6687429",
"0.66767997",
"0.6665103",
"0.6662769",
"0.6652151",
"0.6644697",
"0.66243875",
"0.6616203",
"0.65908605",
"0.6567708",
"0.6551893",
"0.6547483",
"0.65430754",
"0.65367484",
"0.653562",
"0.6535297",
"0.6531279",
"0.6531241",
"0.6531067",
"0.65274733",
"0.6520085",
"0.65148616",
"0.6508022",
"0.64947635",
"0.6492676",
"0.6482178",
"0.6473117",
"0.6452319",
"0.6444205",
"0.6442419",
"0.642831",
"0.64245117",
"0.6422469",
"0.64222586",
"0.6415323",
"0.64037174",
"0.63957524",
"0.63805455",
"0.6377493",
"0.63744193",
"0.6367293",
"0.6365312",
"0.6362893",
"0.63586164",
"0.63468385",
"0.6345497",
"0.6329375",
"0.6321903",
"0.63160783",
"0.63113004",
"0.63053244",
"0.63046014",
"0.62992454",
"0.62982875",
"0.6288883",
"0.62799495",
"0.62580836",
"0.6256541",
"0.62492007",
"0.6241635",
"0.6235386",
"0.623472",
"0.62323093",
"0.62299234",
"0.6219501",
"0.62142104",
"0.6213925",
"0.6211621",
"0.6207971",
"0.62066954",
"0.61995286",
"0.6189511",
"0.6189201",
"0.6187859",
"0.61831963",
"0.6180956",
"0.6179147",
"0.6178485",
"0.6170438",
"0.6168469",
"0.61591876",
"0.61510915",
"0.61496896",
"0.6149497",
"0.6134806",
"0.6132564",
"0.61319226",
"0.61316454",
"0.61300206",
"0.61291796",
"0.61249524",
"0.61187017"
] | 0.6216556 | 73 |
Checks if the current user is the creator of the deck | def creator?
unless current_user.id == Deck.find(params[:id]).user_id
flash[:error] = "You do not have permission to modify this deck"
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end",
"def creator?(object)\n current_user == object.user ? true : false\n \n end",
"def created_by?(user)\n unless user.nil?\n userid = user.send(BigbluebuttonRails.configuration.user_attr_id)\n self.creator_id == userid\n else\n false\n end\n end",
"def owned?\n user.present?\n end",
"def owner? usr\n user_id == usr.id\n end",
"def owner? (user)\n user == owner\n end",
"def owner?(current_user)\n user == current_user\n end",
"def is_owner?(this_user)\n user == this_user\n end",
"def creator?\n if session[:user_id] == @event.id\n @creator = true\n else\n @creator = false\n end\n end",
"def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end",
"def creatable_by?(user)\n true\n end",
"def creatable_by?(creator)\n creator.administrator? || !administrator\n end",
"def destroyable_by?(user)\n return !!(user.is_admin? or self.creator == nil or self.creator == user or (self.roll and self.roll.creator == user))\n end",
"def is_creator?\n\t\tself.is_creator == 1\n\tend",
"def owned_by?(current_user)\n current_user && user_id == current_user.id\n end",
"def is_owned_by_user?(user)\n self.user == user\n end",
"def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end",
"def is_owner?(user)\n user.id == self.user_id\n end",
"def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend",
"def owned_by?(u)\n self.user == u\n end",
"def owned_by? a_user\n a_user == user\n end",
"def owner?(user)\n\t\tuser.id == self.user.id\n\tend",
"def created_by?(check_user)\n return false unless check_user.present?\n return true if check_user.cornerstone_admin?\n self.user && self.user == check_user\n end",
"def is_owner\n object == current_user\n end",
"def creatable_by?(actor)\n actor.is_a?(User)\n end",
"def owner?\n resource.user_id == current_user.id\n end",
"def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end",
"def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end",
"def owner?(user)\n user == owner || owners.include?(user)\n end",
"def owner?(id)\n if current_user.id == id\n return true\n else\n return false\n end\n end",
"def is_user?\n user ? true : false\n end",
"def is_owner?(item)\n current_user_id == item.user_id\n end",
"def owner?\n record.id == user.id\n end",
"def object_owner?\n User.find(params[:user_id]) == current_user\n end",
"def user_is_owner?\n current_cookbook.is_owner?(current_user)\n end",
"def owned_by?(user)\n if (access_restricted?)\n return self.acl.owner?(user)\n end\n return false\n end",
"def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n end\n rescue\n false\n end",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def owner?\n name == 'owner'\n end",
"def can_edit?(current_user_id)\n\t\tif User.find(current_user_id) == creator\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def current_user?(user)\n\t\tcurrent_user == user\n\tend",
"def owner?(current_user)\n current_user && (self.user == current_user || current_user.has_role?(:refinery))\n end",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def set_current_user_to_creator_if_empty(options, current_user:, **)\n if options['contract.default'].creator_id\n true\n else\n options['contract.default'].creator_id = current_user.id\n end\n end",
"def has_owner(user)\n return self.user.id==user.id\n end",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def is_owner?(username)\n User.get_user(username).eql?(self.owner)\n end",
"def is_owned_by?(user_id)\n self.user_id == user_id\n end",
"def author?(user)\n self.user == user\n end",
"def user?\n get_mode == :user\n end",
"def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end",
"def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end",
"def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end",
"def current_user?(user)\r\n user == current_user\r\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n\t\tuser==current_user\n\tend",
"def current_user?(user)\n\t\tuser == self.current_user\n\t\t\n\tend",
"def current_user?(user)\n \tuser == current_user\n \tend",
"def current_user?(user)\n \tuser == current_user\n \tend",
"def created_by(user_id)\n\t\tuser = project_groups.find_by_user_id(user_id)\n\t\tif (! user.nil?) && user.project_creator then\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def created_by?(user)\n if @v_id == 1\n circuit = self\n else\n circuit = self.class.find_by_c_id_and_v_id(@c_id, 1)\n end\n circuit.uid == user.uid\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def valid_user?\n client.valid_user?(user_repo, @options)\n end",
"def current_user_is_author?\n current_user && current_user.is_author\n end",
"def owned_by? a_user\n a_user == program.moderator\n end",
"def current_user?(user)\n user && user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end"
] | [
"0.77848387",
"0.77739817",
"0.7398696",
"0.73590356",
"0.7240787",
"0.7201834",
"0.7200356",
"0.71779436",
"0.7176693",
"0.7141878",
"0.7140763",
"0.7075012",
"0.70477724",
"0.70252395",
"0.7017225",
"0.69944763",
"0.6974815",
"0.6963963",
"0.6956399",
"0.6948928",
"0.6917776",
"0.6910884",
"0.6910806",
"0.6884121",
"0.68412817",
"0.6833268",
"0.6829136",
"0.6829136",
"0.6825573",
"0.67682415",
"0.6751204",
"0.6746805",
"0.67373997",
"0.6734926",
"0.67324173",
"0.6729625",
"0.67296034",
"0.6717127",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.67162347",
"0.6711027",
"0.6708645",
"0.67016673",
"0.6689045",
"0.66886824",
"0.668256",
"0.66758317",
"0.66743934",
"0.6673475",
"0.6670273",
"0.66642725",
"0.66640633",
"0.66639227",
"0.66639227",
"0.6659221",
"0.6654182",
"0.664723",
"0.66443145",
"0.66443145",
"0.66443145",
"0.66443145",
"0.66443145",
"0.66443145",
"0.66443145",
"0.6632621",
"0.66318965",
"0.66099054",
"0.66099054",
"0.65951043",
"0.6592032",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589799",
"0.6589701",
"0.65724707",
"0.6566039",
"0.65500194",
"0.6549883",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526",
"0.6549526"
] | 0.82552415 | 0 |
TODO: check the order. there must be a mistake! | def show
@preliminaries = Match.preliminary.group_by { |m| m.group.to_s }.sort_by { |group, m| group }
@finals = Match.final.group_by { |m| m.round }
@tips = current_user.tips
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def refutal()\n end",
"def offences_by; end",
"def formation; end",
"def verdi; end",
"def operations; end",
"def operations; end",
"def stderrs; end",
"def anchored; end",
"def order; end",
"def order; end",
"def berlioz; end",
"def sitemaps; end",
"def zuruecksetzen()\n end",
"def terpene; end",
"def identify; end",
"def implementation; end",
"def implementation; end",
"def who_we_are\r\n end",
"def trd; end",
"def custom; end",
"def custom; end",
"def weber; end",
"def villian; end",
"def malts; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def required_positionals; end",
"def internship_passed; end",
"def missing; end",
"def extra; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def used?; end",
"def relatorios\n end",
"def processor; end",
"def checks; end",
"def strategy; end",
"def ignores; 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 operation; end",
"def intensifier; end",
"def celebration; end",
"def feruchemist; end",
"def incomplete\r\n\r\n end",
"def isolated; end",
"def isolated; end",
"def schumann; end",
"def first; end",
"def first; end",
"def internal; end",
"def r; end",
"def r; end",
"def rest_positionals; end",
"def bs; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def same; end",
"def original_result; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def issn; end",
"def rossini; end",
"def upc_e; end",
"def next() end",
"def next() end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def hd\n \n end",
"def eplore\n end",
"def gounod; end",
"def common\n \n end",
"def from; end",
"def from; end"
] | [
"0.747789",
"0.6767733",
"0.6710782",
"0.64697677",
"0.64697677",
"0.64697677",
"0.64697677",
"0.6323662",
"0.61580604",
"0.609032",
"0.60478675",
"0.6039025",
"0.59935194",
"0.59935194",
"0.59913284",
"0.59497976",
"0.59312123",
"0.59312123",
"0.5914885",
"0.58985066",
"0.5866083",
"0.5829897",
"0.58266604",
"0.58228457",
"0.58228457",
"0.5766937",
"0.57633907",
"0.5737544",
"0.5737544",
"0.5712746",
"0.56687784",
"0.56562525",
"0.5647541",
"0.5647541",
"0.5630488",
"0.5629851",
"0.5629393",
"0.56289804",
"0.56210935",
"0.56210935",
"0.56210935",
"0.561199",
"0.56070334",
"0.5605928",
"0.56048006",
"0.5599926",
"0.5597302",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.55896354",
"0.55883944",
"0.5587126",
"0.5582013",
"0.55750984",
"0.5567862",
"0.5567862",
"0.556572",
"0.55450934",
"0.55450934",
"0.55383503",
"0.5536587",
"0.5536587",
"0.5528174",
"0.55125165",
"0.5510048",
"0.5510048",
"0.5510048",
"0.5502251",
"0.549844",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.5494589",
"0.5482911",
"0.5481732",
"0.548003",
"0.548003",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.54709595",
"0.5470672",
"0.54696405",
"0.5447054",
"0.54430264",
"0.54430264"
] | 0.0 | -1 |
TODO: check the order. there must be a mistake! | def edit
@user = current_user
Match.all.each do |match|
logger.info "''''''''''''''''''''''''inlcude match? #{@user.tips.select{ |t| t.match_id == match.id }.empty?}"
@user.tips.build :match => match if @user.tips.select{ |t| t.match_id == match.id }.empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def refutal()\n end",
"def offences_by; end",
"def formation; end",
"def verdi; end",
"def operations; end",
"def operations; end",
"def stderrs; end",
"def anchored; end",
"def order; end",
"def order; end",
"def berlioz; end",
"def sitemaps; end",
"def zuruecksetzen()\n end",
"def terpene; end",
"def identify; end",
"def implementation; end",
"def implementation; end",
"def who_we_are\r\n end",
"def trd; end",
"def custom; end",
"def custom; end",
"def weber; end",
"def villian; end",
"def malts; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def required_positionals; end",
"def internship_passed; end",
"def missing; end",
"def extra; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def used?; end",
"def relatorios\n end",
"def processor; end",
"def checks; end",
"def strategy; end",
"def ignores; 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 operation; end",
"def intensifier; end",
"def celebration; end",
"def feruchemist; end",
"def incomplete\r\n\r\n end",
"def isolated; end",
"def isolated; end",
"def schumann; end",
"def first; end",
"def first; end",
"def internal; end",
"def r; end",
"def r; end",
"def rest_positionals; end",
"def bs; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def same; end",
"def original_result; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def issn; end",
"def rossini; end",
"def upc_e; end",
"def next() end",
"def next() end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def hd\n \n end",
"def eplore\n end",
"def gounod; end",
"def common\n \n end",
"def from; end",
"def from; end"
] | [
"0.747789",
"0.6767733",
"0.6710782",
"0.64697677",
"0.64697677",
"0.64697677",
"0.64697677",
"0.6323662",
"0.61580604",
"0.609032",
"0.60478675",
"0.6039025",
"0.59935194",
"0.59935194",
"0.59913284",
"0.59497976",
"0.59312123",
"0.59312123",
"0.5914885",
"0.58985066",
"0.5866083",
"0.5829897",
"0.58266604",
"0.58228457",
"0.58228457",
"0.5766937",
"0.57633907",
"0.5737544",
"0.5737544",
"0.5712746",
"0.56687784",
"0.56562525",
"0.5647541",
"0.5647541",
"0.5630488",
"0.5629851",
"0.5629393",
"0.56289804",
"0.56210935",
"0.56210935",
"0.56210935",
"0.561199",
"0.56070334",
"0.5605928",
"0.56048006",
"0.5599926",
"0.5597302",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.5593518",
"0.55896354",
"0.55883944",
"0.5587126",
"0.5582013",
"0.55750984",
"0.5567862",
"0.5567862",
"0.556572",
"0.55450934",
"0.55450934",
"0.55383503",
"0.5536587",
"0.5536587",
"0.5528174",
"0.55125165",
"0.5510048",
"0.5510048",
"0.5510048",
"0.5502251",
"0.549844",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.54947627",
"0.5494589",
"0.5482911",
"0.5481732",
"0.548003",
"0.548003",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.5474194",
"0.54709595",
"0.5470672",
"0.54696405",
"0.5447054",
"0.54430264",
"0.54430264"
] | 0.0 | -1 |
used primarily to return a collection of comments to display on the notes/show page that does NOT contain the new | def persisted
select(&:persisted?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n pull_comments\n @comments_list\n end",
"def comments\n c = Comment.where(:resource_id => self.id).all\n if c\n return c\n end\n end",
"def show_comments\r\n @comments = Comment.find_by_sql(\"select * from comments where subject_id order by created_at DESC\")\r\n @replies = []\r\n @comments.each do|c| \r\n Comment.find_all_by_reply(c.id).each do|r|\r\n @replies << r\r\n end\r\n end \r\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def comments\r\n @comments = Comment.active.belonging_to(@entry).paginate(:all,\r\n :order => \"#{Comment.right_column_name} DESC\", \r\n :page => params[:page], :per_page => setpagesize)\r\n end",
"def comments\n Comment.where(:article => @id)\n end",
"def comments\n Comment.query({item_id: _id}, {sort: [[:created_at, -1]]})\n end",
"def get_comments\n return Comment.where(design_problem_id: self.id).sort_by! { |x| x.created_at }.sort! { |a,b| b.created_at <=> a.created_at }\n end",
"def comments\n @comments\n end",
"def comments\n \tComment.where(commentable: commentable, parent_id: id)\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def comments\n\t\t\t@comments ||= read_comments\n\t\tend",
"def comments\n object.comments.where(:user_id => current_user)\n end",
"def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend",
"def get_comments_only\n self.comments.includes(:comments, :user).where(parent_comment_id: nil)\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def note\n comment_list = []\n return @notes if [email protected]?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def comments\n if has_comments?\n @repository.load(:comments, number).map do |item|\n Github::Issue::Comment.new(item)\n end\n else \n []\n end\n end",
"def list_comments\n hc = if has_comments_valided?\n comments(valided: true).collect do |dcom|\n next unless dcom[:ok]\n (\n (dcom[:ps] + ', le ' + dcom[:at].as_human_date).in_div(class: 'c_info') +\n traite_comments(dcom[:c]).in_div(class: 'c_content') + \"\".in_div(class: 'clear')\n ).in_div(class: 'comment')\n end.join('')\n else\n \"Aucun commentaire sur cet article pour le moment.\".in_div(class: 'italic small')\n end\n hc.prepend('<a name=\"lire_comments\"></a>')\n return hc\n end",
"def comments\n comments = []\n posts = Post.all\n posts.each { |p| comments += p.comments.where(user_id: self.id) }\n return comments\n end",
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def list \n @comment = Comment.all\n end",
"def comments\n if @comment_feed.comments.nil?\n @comment_feed.fetch\n end\n\n @comment_feed.comments\n end",
"def comments\n @comments = @subject.blinded_comments(current_user).includes(:user, :sheet)\n .order(created_at: :desc).page(params[:page]).per(20)\n end",
"def comments\n @mapped_comments ||= Basecamp3::Comment.all(bucket.id, id)\n end",
"def show\n @comment = Comment.new\n @comments = @todo.comments.order(\"created_at DESC\")\n end",
"def index\n @comments = @commentable.comments\n end",
"def new_replies\n last_comment_view.nil? ? replies : replies.find(:all, :conditions => [\"thing_comments.created_at > ?\", last_comment_view])\n end",
"def more\n @comments = Comment.all\n\n end",
"def saved_comments\n self.comments.reject{ |c| !c.persisted?}\n end",
"def regular_comments\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type < ?\", id, 'Screen', 5])\n end",
"def return_comment\n @comments\n end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments\n @uni_module = UniModule.find(params[:id])\n @comments = @uni_module.comments\n \n if params[:per_page].present? && params[:per_page].to_i > 0\n @per_page = params[:per_page].to_i\n else\n @per_page = 20\n end\n\n if params[:sortby].present? && params[:order].present? \n @sort_by = params[:sortby]\n @order = params[:order]\n @comments = sort(Comment, @comments, @sort_by, @order, @per_page, \"created_at\")\n @comments = Kaminari.paginate_array(@comments).page(params[:page]).per(@per_page)\n\n\n else\n @comments = @comments.order('created_at ASC').page(params[:page]).per(@per_page)\n end\n\n\n end",
"def show\n @comments = @question.root_comments.order('cached_votes_total DESC, created_at DESC')\n @new_comment = Comment.build_from(@question, current_user, \"\")\n end",
"def show\n @comments = Comment.where(\"submission_id=\" + (params[:id])).order(\"created_at DESC\")\n end",
"def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end",
"def commentsBy\n c = comments.where(:user_id => self.id).all\n if c\n c\n end\n end",
"def get_comments\n comments = self.comments.order(:created_at).to_a\n comments_hash = {}\n while comments.any? do\n comment = comments.shift\n comment_comments = comment.comments.order(:created_at)\n comments_hash[\"#{comment.id}\"] = comment_comments\n comments.concat(comment_comments)\n end\n comments_hash\n end",
"def comments\n # event_ids = events(@user).pluck(:id)\n # Comment.where(commentable_type: \"Event\", commentable_id: event_ids, program_favorite: true)\n # events(@user).unscope(:order).order(start_date_time: :asc).each { |event| event.map { |event| event.favorite_comments.first } }\n events(@user).map { |e| e.comments.select { |c| c.event_favorite == true }.first(2) }.flatten\n end",
"def get_comments\n @public_comments = @user_key.comments.public_only.chronological\n @private_comments = @user_key.comments.private_only.chronological\n @comment = @user_key.comments.build\n end",
"def index\r\n @comments = Comment.all\r\n\r\n @commentsArray ||= Array.new\r\n @comments.each do |comment|\r\n if comment.filtered == true\r\n @commentsArray.push(\"<h3><b>#{comment.name}</b></h3><p style=\\\"margin-top: 5px; color:black\\\">#{comment.comment}</p>\".html_safe)\r\n end\r\n end\r\n end",
"def show\n @comments = @news.comments.where.not(user_id: nil)\n @comment = @news.comments.build\n end",
"def show\n @comment = Comment.new\n @comments = @lection.comments.order( \"updated_at DESC\")\n end",
"def show\n @comment = @holla.comments.new user_id: @user.id\n @comments = @holla.comments.sorted.limit(20)\n end",
"def show\n @user_creator = User.find(@issue.userCreator)\n @user = User.find(current_user.id);\n @comments = Comment.all\n \n @comments = @comments.select{|comment| comment.issue_id == @issue.id}\n @comment = Comment.new\n @comment.issue_id = @issue.id\n @comment.user_id = @user.id\n \n end",
"def comments(options = {})\n @comments_list ||= CommentList.new(@id)\n return @comments_list.top_level(options)\n end",
"def received_comments\n my_comments = []\n self.pictures.each do |picture|\n picture.comments.each do |comment|\n if comment.user_id != self.id\n my_comments.push(comment)\n end\n end\n end\n my_comments\n end",
"def show\n @new_comment = Comment.new\n @comments = @book.comments.order(\"updated_at DESC\")\n end",
"def index\n @comment = current_user.comments.new\n if params[:idea_id] != 0\n @idea = Idea.find(params[:idea_id])\n @comments = @idea.comments\n elsif params[:project_id] != 0\n @project = Project.find(params[:project_id])\n @comments = @project.comments\n end\n @comments = @comments.limit(10)\n end",
"def comments\n @comments.values\n end",
"def getComments\n\t\tself.root_comments\n\tend",
"def getComments\n\t\tself.root_comments\n\tend",
"def index\n @comments = @snippet.comments\n end",
"def show\n @comments = @blog.comments.order(created_at: :desc)\n @new_comment = @blog.comments.new(blog_id: @blog.id)\n end",
"def show\n dis = @case.disbursments.order(id: :desc)\n comments = @case.comments\n @disbursments = dis+comments\n @disbursments = @disbursments.sort_by(&:created_at)\n end",
"def comments\n @comments = @user.comments.list.page(params[:page])\n render partial: \"comments/comment\", layout: false,\n collection: @comments, locals: {with_posted_in: true}\n end",
"def comments_history\n self.comments.map { |comment| comment.content }.reverse\n end",
"def comments\n @presentation = Presentation.in_conference(current_conference).\n find(params[:id])\n end",
"def comments(options={})\n @comments ||= self.class.parse_comments(request(singular(question_id) + \"/comments\", options))\n end",
"def _get_comments_from_gh()\n comments = []\n page = 1\n done = false\n until done\n puts \"Comment Page #{page}\"\n newcomments = self.client.issues_comments( REPO, { :page => page} )\n comments += newcomments\n done = newcomments == []\n page = page + 1\n end\n return comments\n end",
"def get_replies_only\n self.comments.includes(:user).where.not(parent_comment_id: nil)\n end",
"def show\n @comments = Comment.all\n @comment = Comment.new\n end",
"def show\n @comment = Comment.new\n @comments = @need.comments\n end",
"def comments_ordered_by_submitted\n Comment.find_comments_for_commentable(self.class.name, id)\n end",
"def show\n @comments = @idea.comments\n\n end",
"def comments_ready\n @comments = Comment.all.order(\"created_at DESC\")\n end",
"def comments_given(user_id)\n comments = Comment.where(user_id: user_id)\n end",
"def unreviewed_comments\n comments.select {|comment| comment.approved.nil? }\n end",
"def list_tasks_with_comments\n all_tasks = Task.all\n all_tasks.each do |task|\n puts \"Task: \" + task.title\n task.comments.each {|c| puts \"Comment: \" + c.comment}\n end\nend",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def show\n @comments= Comment.all\n end",
"def show\n @comment = Comment.new\n @comments = if params[:comment]\n @post.comments.where(id: params[:comment])\n else\n @post.comments.where(parent_id: nil)\n end\n\n @comments = @comments.order('created_at asc').paginate(page: params[:page], per_page: 2)\n\n end",
"def index\n @project_todo_comments = @project_todo.project_todo_comments.all\n end",
"def index\n @comments = CommentsArticle.all\n end",
"def getIssueComments(issueNumber)\n\t\t# issuesWithComments = @coll.find({\"comments\" => {\"$gt\" => 0}}, \n\t\t# \t\t\t\t\t\t\t\t{:fields => {\"_id\" => 0, \"number\" => 1}}\n\t\t# \t\t\t\t\t\t\t\t).to_a\n\t\t \t\t\t\n\t\tissueComments = @ghClient.issue_comments(@repository.to_s, issueNumber.to_s)\n\t\tissueCommentsRaw = JSON.parse(@ghClient.last_response.body)\n\t\t\n\t\tghLastReponse = @ghClient.last_response\n\n\t\twhile ghLastReponse.rels.include?(:next) do\n\t\t\tghLastReponse = ghLastReponse.rels[:next].get\n\t\t\tissueCommentsRaw.concat(JSON.parse(ghLastReponse.body))\n\t\tend\n\n\t\tissueCommentsRaw.each do |x|\n\t\t\t\tx[\"organizaion\"] = @organization\n\t\t\t\tx[\"repo\"] = @repository\n\t\t\t\tx[\"downloaded_at\"] = Time.now\n\t\t\t\tx[\"issue_number\"] = issueNumber\n\t\t\tself.convertIssueCommentDatesInMongo(x)\n\t\tend\n\t\treturn issueCommentsRaw\n\t\t# @coll.update(\n\t\t# \t\t\t{ \"number\" => x[\"number\"]},\n\t\t# \t\t\t{ \"$push\" => {\"comments_Text\" => self.convertIssueCommentDatesInMongo(commentDetails)}}\n\t\t# \t\t\t)\t\n\tend",
"def get_comments\n xml_doc = @vimeo.get_xml(@vimeo.generate_url({\"method\" => \"vimeo.videos.comments.getList\",\n \"video_id\" => @id, \"api_key\" => @vimeo.api_key}, \"read\"))\n\n (xml_doc/:comment).each do |comment|\n @comments << build_comment(comment)\n end\n return self\n end",
"def discussion\n Comment.where(\"article_id = ?\", id)\n end",
"def new_comments comments_data, context\n top_level_comments = comments_data.select { |comment_data| comment_data[:parent_id] == \"0\" }\n comment_replies = comments_data.reject { |comment_data| comment_data[:parent_id] == \"0\" }\n\n top_level_comments.map do |comment_data|\n comment = new_comment comment_data, context\n\n comment_reply_datas_to_this_comment = comment_replies.select { |comment_reply_data| comment_reply_data[:parent_id] == comment_data[:id] }\n\n comment.comments = comment_reply_datas_to_this_comment.map do |comment_reply_data|\n new_comment comment_reply_data, context\n end\n\n comment\n end\n end",
"def index\n @recent_change_comments = RecentChangeComment.all\n end",
"def show\n @comments = Comment.where(task_id: @task.id).order(id: :desc)\n @comment = Comment.new\n end",
"def show\n @comments = @rfx.get_all_comments\n end",
"def index\n @comments = Comment.all.order('created_at DESC').first(8)\n end",
"def index\n @lecture_comments = LectureComment.all\n end",
"def comments(user)\n self.design_review_comments.to_ary.find_all { |comment| comment.user == user }\n end",
"def show\n @comment = Comment.new( :inspiration => @inspiration )\n @comments = Comment.where(inspiration_id: @inspiration.id)\n end",
"def news_topics_comments\r\n @story = hacker_news_client.item(params[:id])\r\n @comments = (@story['kids'] || []).map do |comment|\r\n hacker_news_client.item(comment)\r\n end\r\n end",
"def show\n @comments = @item.comments\n end"
] | [
"0.7203484",
"0.7025203",
"0.6994349",
"0.696327",
"0.69566864",
"0.6915436",
"0.68940264",
"0.6866209",
"0.6836639",
"0.6799224",
"0.6791873",
"0.6772854",
"0.6772854",
"0.673972",
"0.6733322",
"0.67041814",
"0.66987246",
"0.6682594",
"0.66804934",
"0.66804934",
"0.6663787",
"0.6650914",
"0.6650914",
"0.6637116",
"0.660346",
"0.6571171",
"0.65669364",
"0.65640974",
"0.6548854",
"0.65208465",
"0.6513123",
"0.6498238",
"0.6492666",
"0.6475539",
"0.64740163",
"0.64720076",
"0.6470986",
"0.6461534",
"0.64511603",
"0.64511603",
"0.64511603",
"0.64511603",
"0.64511603",
"0.64511603",
"0.64409107",
"0.6415852",
"0.6411619",
"0.64091814",
"0.63956004",
"0.63924414",
"0.6391177",
"0.6390602",
"0.638888",
"0.63849735",
"0.6377672",
"0.6374303",
"0.6346154",
"0.6341856",
"0.6334349",
"0.6327853",
"0.6296255",
"0.6295909",
"0.62919784",
"0.62919784",
"0.6273952",
"0.6261807",
"0.6261626",
"0.6260738",
"0.62555915",
"0.62492424",
"0.62444925",
"0.62290215",
"0.622819",
"0.62248796",
"0.622108",
"0.62135875",
"0.62082195",
"0.6194551",
"0.6187418",
"0.618594",
"0.6183441",
"0.6167943",
"0.6167943",
"0.6167943",
"0.6166488",
"0.6164419",
"0.61588556",
"0.6154255",
"0.6151684",
"0.6146707",
"0.6141052",
"0.614051",
"0.61367023",
"0.61308825",
"0.6129652",
"0.61262476",
"0.61161846",
"0.61021376",
"0.61012065",
"0.6100461",
"0.60983765"
] | 0.0 | -1 |
for correct ordering TODO (vl): refactor this | def similar_ids=(similar_ids = [])
similar_ids.each_with_index do |id, index|
similar_courses.find_by(similar_id: id).try(:update_column, :position, index + 1)
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order; end",
"def order; end",
"def original_order\n end",
"def ordered_values; end",
"def arrange\n\t\t\n\tend",
"def offences_by; end",
"def order=(_arg0); end",
"def entry_order; end",
"def ordered_list; end",
"def order\n end",
"def by_priority; end",
"def sort_entries; end",
"def normalize_order(order); end",
"def private; end",
"def collection_order(items) #nicer collection method - the unnecessary loops and arrays. (task 6)\n\n item_indexes = []\n collection_order = []\n\n for item in items\n item_indexes << find_index_at_value(item)\n end\n\n sorted_indexes = item_indexes.sort\n\n for index in sorted_indexes\n collection_order = collection_order << WAREHOUSE[index].keys[0].to_s\n end\n\nreturn collection_order\n\nend",
"def processOrder\n \n end",
"def proefssorted\n \tproefs.order(:position)\n end",
"def entry_order=(_arg0); end",
"def railties_order=(_arg0); end",
"def railties_order=(_arg0); end",
"def offences_by=(_arg0); end",
"def test_retuns_ordered_jobs_considering_all_dependecies\n sequence = Sequence.new()\n sequence.add(\"a =>\n b => c\n c => f\n d => a\n e => b\n f =>\")\n sequence.ordered.each do |job|\n assert (%w[a b c d e f].include?(job))\n end\n assert sequence.ordered.index(\"f\") < sequence.ordered.index(\"c\")\n assert sequence.ordered.index(\"c\") < sequence.ordered.index(\"b\")\n assert sequence.ordered.index(\"b\") < sequence.ordered.index(\"e\")\n assert sequence.ordered.index(\"a\") < sequence.ordered.index(\"d\")\n end",
"def sort_entries=(_arg0); end",
"def reorder_info(info) \n if (info[0][-1][-1]).is_i? == true \n order = [0, 1, 2, 4, 3]\n info.map! do |element|\n order.map {|x| element[x]}\n end\n else \n info \n end\nend",
"def sorted_keys; end",
"def anchored; end",
"def ordered(field, o1, o2) \n o1[field.name].each do |left|\n different_insert(o2, field, left)\n end\n end",
"def cur_ordering\r\n @orderings\r\n end",
"def order_multi ()\n raise Exception, 'not implemented'\n end",
"def ordering_query; end",
"def ordered_topologically\n @ordered_topologically ||= super\n end",
"def sort_params; end",
"def sort_params; end",
"def sort_order\n super\n end",
"def schubert; end",
"def reorder_info\n fixed_array.map! do |element|\n if element[-1][-1].is_i? == true\n order = [0, 1, 2, 4, 3]\n order.map {|x| element[x]}\n else\n element\n end\n end\nend",
"def first; end",
"def first; end",
"def default; return DefaultOrder; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def required_positionals; end",
"def probers; end",
"def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end",
"def sort_params=(_arg0); end",
"def sort_params=(_arg0); end",
"def rearrange_docs!; end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def rest_positionals; end",
"def sort_order\n 0\n end",
"def s_idsort; det.link(:text, 'ID'); end",
"def caar; first.first end",
"def is_sorted\r\n false\r\n end",
"def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend",
"def sorted_labels; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def merge; end",
"def order_of_visit(item1, item2, item3)\n \nend",
"def starting_position; end",
"def default_list_order\n return nil\n end",
"def lines\n old_order_lines\n end",
"def includes_for_sorting\n []\n end",
"def e5115_sublinear_sort(values)\n end",
"def deco_pos; end",
"def test_insert_first_family_in_second_order\n f = Family.new\n f.latin_name = 'blah2'\n f.english_name = 'blah2'\n f.order = Order.find_by_latin_name('blah2')\n insert_first(f)\n gen_sort_orders\n assert_equal 1, Family.find_by_latin_name('blah').sort_order\n assert_equal 2, Family.find_by_latin_name('blah2').sort_order\n end",
"def test_order; end",
"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 get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend",
"def default_order\n raise NotImplementedError\n end",
"def statuses_ordered\n statuses.all(:order => 'position ASC')\n end",
"def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end",
"def bigSorting(unsorted)\n\nend",
"def sort_genes\n \[email protected]!{|x,y| x.start <=> y.start}\n end",
"def grand_sorting_machine(array)\n\n\n\nend",
"def sort_name\n sort_constituent\n end",
"def __sort_pair__\n { first => Mongoid::Criteria::Translator.to_direction(last) }\n end",
"def hows_by_alphabetical_order\nend",
"def rset; end",
"def move_diffs\n \n end",
"def previous_autolist; end",
"def stderrs; end",
"def from_left; end",
"def from_left; end",
"def sort\n _in_order(@root, @@id_fun) # use Id function\n end",
"def earliest; all(:order => [:started_at.asc, :id.asc ]) end",
"def sort_by_alg_header(algs); end",
"def ordenar_for\n\t @lista = self.map{ |a| a }\n\t \tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif j+1 != @lista.count\n if @lista[j+1] < @lista[j]\n\t\t\t\t\t\t@lista[j],@lista[j+1] = @lista[j+1],@lista[j]\n \t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@lista\n end"
] | [
"0.7231808",
"0.7231808",
"0.6543743",
"0.6360671",
"0.6334258",
"0.62163144",
"0.6199087",
"0.612103",
"0.6107077",
"0.5971253",
"0.5855722",
"0.57995784",
"0.57680655",
"0.5757197",
"0.57554954",
"0.5754048",
"0.57365704",
"0.56071424",
"0.55809206",
"0.55809206",
"0.55250084",
"0.54854417",
"0.5440823",
"0.5428356",
"0.54182875",
"0.54126227",
"0.5384097",
"0.53741103",
"0.5362006",
"0.5352317",
"0.53466386",
"0.5328156",
"0.5328156",
"0.53172857",
"0.53105813",
"0.5310181",
"0.5292419",
"0.5292419",
"0.5290761",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52808267",
"0.52628785",
"0.5252734",
"0.5249061",
"0.5216737",
"0.5216737",
"0.52057976",
"0.5204663",
"0.5204663",
"0.5204663",
"0.5204663",
"0.51945436",
"0.5191779",
"0.5188705",
"0.5184372",
"0.5166058",
"0.51588607",
"0.5143695",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5135118",
"0.512373",
"0.51202154",
"0.51096654",
"0.5099376",
"0.50985",
"0.5091321",
"0.5078304",
"0.5071012",
"0.50655556",
"0.5058748",
"0.5057354",
"0.5042986",
"0.5041513",
"0.5033914",
"0.5031727",
"0.5029956",
"0.5027516",
"0.5022674",
"0.49997762",
"0.49980167",
"0.49928668",
"0.4988903",
"0.49752143",
"0.49719882",
"0.4971794",
"0.4971794",
"0.49716535",
"0.4963439",
"0.49584246",
"0.49573475"
] | 0.0 | -1 |
Smoke test to make sure we aren't doing any additional and unnecessary queries | def check_collection_loaded!
raise "Collection wasn't loaded?" if @collection.is_a?(ActiveRecord::Relation) && [email protected]?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_single_item_result\n while_logged_in do\n with_queries do\n pass\n #assert_nothing_raised{ @conn.tasks(query:@single_page_query) }\n end\n end\n end",
"def test_for_empty_DB\n\t\tputs \"TEST 1\"\n\t\tassert( @db.empty? , \"DB is not empty\")\n\tend",
"def test_empty_result\n while_logged_in do\n empty_query = Query.new.filter(id:'>50000')\n assert_nothing_raised{ @conn.tasks(query:empty_query) }\n end\n end",
"def test_connection\n assert_nothing_raised() { User.count }\n end",
"def test_friendly_fields_false\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:false)[:entities]\n entities.first.keys.include? \"creation-time\"\n end\n end\n end\n end",
"def test_query_runner\n assert( @data_source )\n qrun = QueryRunner.new( @data_source )\n\n url = VisitURL.normalize( \"http://gravitext.com/test\" )\n\n qrun.update( \"TRUNCATE urls;\" )\n\n c = qrun.update( \"INSERT into urls (uhash, url, domain, type ) \" +\n \"VALUES (?,?,?,?);\",\n url.uhash, url.url, url.domain, \"PAGE\" )\n assert_equal( 1, c )\n\n out_domain = nil\n qrun.query( \"SELECT * FROM urls WHERE uhash = ?\", url.uhash ) do |rs|\n while rs.next\n out_domain = rs.get_string( 'domain' )\n end\n end\n assert_equal( url.domain, out_domain )\n\n assert_equal( 1, qrun.update( \"DELETE from urls;\" ) )\n end",
"def test_users_searches\n do_users_all\n do_simple_query\n do_tag_query\n do_profile_query\n end",
"def test_article_all\n assert_query(Article.all, :Article, :all)\n end",
"def test_friendly_fields_true\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:true)[:entities]\n entities.first.keys.include? \"Created By\"\n end\n end\n end\n end",
"def test_should_not_crash_selects_in_the_double_read_only_window\n ActiveRecord::Base.connection\n $mysql_master.set_rw(false)\n $mysql_slave.set_rw(false)\n assert_equal $mysql_master, master_connection\n 100.times do\n User.first\n end\n end",
"def test_unlogged_in_test_environment_when_unlogged_setting_enabled\n ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables = true\n\n @connection.create_table(TABLE_NAME) do |t|\n end\n assert_equal @connection.execute(LOGGED_QUERY).first[LOGGED_FIELD], LOGGED\n end",
"def test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end",
"def skip_schema_queries; end",
"def test_037\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n\n # you have no relevance\n filtering('3')\n assert !is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n assert is_text_present(_('A PU does not exist.'))\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def skip_test_inmutable\n #they come fully loaded\n Status.load_inmutable_instances\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 4\n assert status2.length == 4\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end\n\n #create a new object\n stt = Status.new(code: \"xx\", description: (\"xx\" + \" some desc\"))\n stt.save\n\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 5\n assert status2.length == 5\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end \n\n status1.each do |st|\n assert st.code\n assert st.description\n end\n\n marr = Status.find(\"divorced\").first\n assert marr.code == \"divorced\"\n assert marr.description\n assert marr.object_id == status1.first.object_id\n\n people = Person.where.include(:name, status: [ :code, :description ]).all\n people.each do |p|\n assert p.status.object_id == status1.select { |st| st.id == p.status.id }.first.object_id\n assert p.status.code\n assert p.status.description\n end\n end",
"def test_basedata\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Run\"]))\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Swim\"]))\n assert_not_nil(Cardiotype.find(:first, :conditions => [\"description = ?\", \"Cycle\"]))\n end",
"def clean\n super\n\n with_connection { |connection| connection.execute(SQL_DELETE_TESTS) }\n end",
"def test_039\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n #Open PU management page\n open_pu_management_page_1\n\n filtering(\"\")\n assert is_text_present('sample_pu1')\n assert is_text_present('sample_pu2')\n\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def assert_optimized_queries\n assert_nothing_raised { Prosopite.scan { yield } }\n end",
"def test_connection\n end",
"def setup\n\t\t# If there's no test database, we'll use the return statement to stop\n\t\t# executing the rest of this code block.\n\t\treturn unless File.exists?('test.sqlite3')\n\t\t# We'll delete everything in our database so that the results of one\n\t\t# test don't affect other tests.\n\t\tdb = SQLite3::Database.new('test.sqlite3')\n\t\tdb.execute \"DELETE FROM guestbook WHERE 1;\"\n\tend",
"def simpletest_tests(bs)\n #check to see if our internal description is correct.\n assert_equal [:simpletest], bs.tables.keys\n assert_equal [:id, :test], bs.tables[:simpletest].columns.keys\n #check to see if our database description is correct\n bs.connect do |db|\n assert_equal [:simpletest], db.tables\n assert_equal [:id, :test], db[:simpletest].columns\n end\n end",
"def test_038\n\n login\n\n # Create some PUs\n\n for i in 1..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to date.\n select \"find_box\", \"label=#{_('Registration date')}\"\n assert_equal _(\"Registration date\"), get_selected_label(\"find_box\")\n\n # filtering\n filtering(@@year)\n assert is_text_present(\"2009-05-08\")\n assert !is_text_present(\"2008-05-08\")\n # you have no relevance\n filtering(@@year+'a')\n assert !is_text_present(\"2009-05-08\")\n assert !is_text_present(\"2008-05-08\")\n filtering(@@hour)\n assert is_text_present(\"2008-05-08\")\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def test_import\n Log.remove(ArtworkDataPlugin.log_name)\n \n query = 'SELECT * FROM artwork'\n sth = $dbh_pg.execute(query)\n\n while row = sth.fetch\n ArtworkDataPlugin.new('data', row)\n end\n \n ArtworkDataPlugin.flush_logs\n Log.test_regression(ArtworkDataPlugin.log_name)\n ArtworkDataPlugin.write_report\n IdStore.write_report\n end",
"def test_find_is_empty_without_scope\n User.current = nil\n assert_equal [], Thing.find(:all)\n end",
"def test_query\n add_test_judgement\n assert(@gold_standard.contains_query? :querystring => \"query1\")\n end",
"def test_delete_with_global_nils\n User.current = User.find(1)\n\n assert Feature.delete_all\n assert_equal 2, Feature.find(:all).size\n end",
"def test_035\n\n login\n\n # Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Selection for filtering\n assert_equal [_(\"PU name\"), _(\"Registration date\")], get_select_options(\"find_box\")\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n\n end",
"def test_stories_find_all\n assert_not_nil @rdigg.stories.find_all(:count => 3)\n end",
"def test_add_1food\n\t\tputs \"TEST 2\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\[email protected](\"Potato\", \"123\")\n\t\tassert( @db.size == 1, \"Size of DB != 1\")\n\t\tassert( [email protected]?, \"DB should not be empty\")\n\tend",
"def test_user_find_all\n assert_not_nil @rdigg.user.find_all(:count => 3)\n end",
"def create_some_data\n\t\tSunspot.remove_all!\t\t\t\t\t#\tisn't always necessary\n\t\tStudySubject.solr_reindex\n\t\tassert StudySubject.search.hits.empty?\n\t\tsubject1 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject1,\n\t\t\t:sample_type => SampleType['marrowdiag'])\n\t\tsubject2 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject2,\n\t\t\t:sample_type => SampleType['periph'])\n\t\tStudySubject.solr_reindex\n\t\tassert !StudySubject.search.hits.empty?\n\tend",
"def test_036\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n filtering('1')\n assert is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def test_nonexistence\n record_not_found = false\n begin\n not_there = User.find(999999999)\n rescue ActiveRecord::RecordNotFound\n record_not_found = true\n end\n assert record_not_found\n end",
"def test_counting_through_other_database_using_relation_with_scope\n assert_equal 2, @company.broken_whistles.count\n end",
"def run_tests(query_type)\n test_data = load_test_data(query_type)\n num_tests = test_data.length\n\n @per_test_insert = test_data[0].key?(\"insert\")\n \n if !@per_test_insert and @insert_sql_data\n insertion_data = load_test_data(query_type, suffix=\"_insert\")\n insertion_data.each do |insert_command|\n @client.insert(insert_command)\n end\n\n sleep @sleep_time\n end\n\n test_data.each_with_index do |test, i|\n _query_type = query_type\n empty_column_translation\n\n puts \"(#{i + 1}/#{num_tests}) Executing test \\\"#{test['name']}\\\"\"\n\n if test.include? 'description'\n puts \" Description: #{test['description']}\"\n end\n puts \" Query type: #{query_type}\"\n\n begin\n if @per_test_insert\n create_columns test\n insert_data test\n sleep @sleep_time\n end\n if query_type == \"update\" or query_type == \"delete\"\n result_additional = run_additional_operations(query_type, test)\n if !result_additional\n next\n end\n _query_type = \"count_entity\"\n end\n\n result = execute_query(_query_type, test)\n rescue StandardError => e\n result = {\"result\" => {\"error\" => e.to_s}}\n if query_type == \"update\" or query_type == \"delete\"\n @num_fails += 1\n @failed_tests.push(test['name'])\n\n puts \" Result: #{result}\"\n puts \" Status: Failed\"\n end\n end\n\n compare_result(test, result)\n puts\n end\n end",
"def testing\n # ...\n end",
"def test_entire_table\n $BS = Basie.new :name => \"testdb\"\n $BS.enable_full_access\n\n create :simpletest\n assert_equal [{:id=>1, :test=>\"one\"},{:id=>2, :test=>\"two\"},{:id=>3, :test=>\"two\"}],\n $BS.tables[:simpletest].entire_table(:override_security => true)\n end",
"def test_product_database_integration\n product_id = @product.create_new_product\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n test_nil_product = db.execute(\"DELETE FROM products WHERE id = #{product_id};\")\n assert_empty test_nil_product\n # assert_equal \"53\", delete_product_integration[0][2]\n db.close\n end",
"def test_media_find_all\n assert_not_nil @rdigg.media.find_all\n end",
"def data_complextest(db); end",
"def test_find_with_global_nils\n User.current = User.find(1)\n assert_equal 3, Feature.find(:all).size\n assert_equal features(:feature_3), Feature.find_by_name('Hybrid')\n end",
"def test_get_food\n @fdb = setup\n @food = @fdb.get_food(\"Jelly\")\n assert(@food != nil, \"basicFood not gotten\")\n assert(@food.name == \"Jelly\", \"wrong food gotten\")\n\n @food = @fdb.get_food(\"Ice cream\")\n assert(@food == nil, \"Food gotten when food doesn't exist in database\")\n end",
"def test_01_fresh_basquet_is_empty\n muffinland_fresh_DB.should == \"New basquet w 0 items.\"\n end",
"def test_user_handling\n (user1 = User.named(\"me\")).save\n (user2 = User.named(\"you\")).save\n\n assert(User.exists?(user1.name), \"user doesn't exist\")\n assert_equal(User.all, [user1, user2], \"users not in list\")\n\n user2.delete\n assert(!User.exists?(\"you\"), \"user doesn't exist\")\n end",
"def test_initializing_new_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 1, \"Record should not be added to table - record already exists\") do\n PrivilegeSet.add :test_initializing_new_privilege_set, \"Something\"\n end\n end\n end",
"def should_not_log_query(input)\n queries = sql(input)\n\n expect(queries).to be_empty\n\n valid_output = sql(\"SELECT 1\").any? { |line| line.include? \"SELECT 1\" }\n\n expect(valid_output).to eq(true)\n end",
"def test_some_invalid_columns\n process :nasty_columns_1\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', %w(name id) }\n end",
"def test_032\n # login\n login\n\n # Two PUs are created\n Pu.destroy_all\n create_pu('SampleA')\n create_pu('SampleB')\n\n # Count all records\n pus = Pu.find(:all)\n @@no_pu = pus.length\n\n # Open PU management page\n open_pu_management_page_1\n\n for i in 1..@@no_pu\n assert_equal pus[i-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{i}.1\")\n end\n\n # Sort by name\n pus = Pu.find(:all,:order => 'name')\n\n # Click PU name\n\n click $xpath[\"misc\"][\"name_link\"]\n sleep 2\n\n if pus[0].id.to_s == get_table(\"//div[@id='right_contents']/div[1]/table[2].1.0\")\n pus = Pu.find(:all,:order => 'name')\n pus_second = Pu.find(:all,:order => 'name DESC')\n else\n pus = Pu.find(:all,:order => 'name DESC')\n pus_second = Pu.find(:all,:order => 'name')\n end\n\n for l in 1..@@no_pu\n assert_equal pus[l-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{l}.1\")\n end\n # secondly, sort by PU's name\n click $xpath[\"misc\"][\"name_link\"]\n sleep 2\n for m in 1..@@no_pu\n assert_equal pus_second[m-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{m}.1\")\n end\n\n # Delete created data\n @@pu= Pu.find_by_name('SampleA')\n @@pu2= Pu.find_by_name('SampleB')\n @@pu.destroy\n @@pu2.destroy\n\n # Logout\n logout\n make_original_pus\n end",
"def test_find_random_should_return_different_collections\n assert User.find(:random, :limit => 10) != User.find(:random, :limit => 10)\n end",
"def setup\n DBHandler.establish_test_connection\n end",
"def teardown\n teardown_db\n end",
"def test_initializing_existing_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 0, \"Record should have been added to table\") do\n PrivilegeSet.add :existing_privilege_set, \"Something\"\n end\n end\n end",
"def initial_query; end",
"def test_033\n # login\n login\n\n # Two PUs are created\n Pu.destroy_all\n create_pu('SampleA')\n create_pu('SampleB')\n\n # Count all records\n pus = Pu.find(:all)\n @@no_pu = pus.length\n\n #Open PU management page\n open_pu_management_page_1\n\n\n for i in 1..@@no_pu\n assert_equal pus[i-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{i}.1\")\n end\n\n # firtly, sort by PU's registration date\n pus = Pu.find(:all,:order => 'created_at')\n\n #Click registration date link\n click $xpath[\"misc\"][\"registration_link\"]\n\n sleep 2\n\n if pus[0].id.to_s == get_table(\"//div[@id='right_contents']/div[1]/table[2].1.0\")\n pus = Pu.find(:all,:order => 'created_at')\n pus_second = Pu.find(:all,:order => 'created_at DESC')\n else\n pus = Pu.find(:all,:order => 'created_at DESC')\n pus_second = Pu.find(:all,:order => 'created_at')\n end\n\n for n in 1..@@no_pu\n assert_equal pus[n-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{n}.1\")\n end\n\n # secondly, sort by PU's registration date\n click $xpath[\"misc\"][\"registration_link\"]\n sleep 2\n for p in 1..@@no_pu\n assert_equal pus_second[p-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{p}.1\")\n end\n\n # Delete created data\n @@pu= Pu.find_by_name('SampleA')\n @@pu2= Pu.find_by_name('SampleB')\n @@pu.destroy\n @@pu2.destroy\n\n # Logout\n logout\n make_original_pus\n end",
"def test_load_failure\n # Check for load failure\n assert_raises(ActiveRecord::RecordNotFound) { Source.find(\"xxxx\") }\n end",
"def test_add_to_wishlist #test pass\n wishlist = Wishlist.new(\"name\" => \"testlist\")\n wishlist.insert(\"wishlists\")\n wishlist.add_to_wishlist(1)\n check = DATABASE.execute(\"SELECT * FROM characters_to_wishlists WHERE\n character_id=1 AND wishlist_id=#{wishlist.id}\")\n refute_equal([], check)\n end",
"def test_non_existing_tables\r\n assert_raise(NoMethodError) { @slice.not_existing_tables }\r\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def before_setup\n Account.connection.drop_table :accounts, if_exists: true\n Account.connection.exec_query(\"CREATE SEQUENCE accounts_id_seq\")\n Account.connection.exec_query(\"\n CREATE TABLE accounts (\n id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),\n firm_id bigint,\n firm_name character varying,\n credit_limit integer\n )\n \")\n\n Company.connection.drop_table :companies, if_exists: true\n Company.connection.exec_query(\"CREATE SEQUENCE companies_nonstd_seq\")\n Company.connection.exec_query(\"\n CREATE TABLE companies (\n id BIGINT PRIMARY KEY DEFAULT nextval('companies_nonstd_seq'),\n type character varying,\n firm_id bigint,\n firm_name character varying,\n name character varying,\n client_of bigint,\n rating bigint,\n account_id integer,\n description character varying\n )\n \")\n\n Course.connection.drop_table :courses, if_exists: true\n Course.connection.exec_query(\"CREATE SEQUENCE courses_id_seq\")\n Course.connection.exec_query(\"\n CREATE TABLE courses (\n id INT PRIMARY KEY DEFAULT nextval('courses_id_seq'),\n name character varying,\n college_id integer\n )\n \")\n\n self.class.fixtures :accounts\n self.class.fixtures :companies\n self.class.fixtures :courses\n end",
"def setup_test_database\n connection = PG.connect(dbname: 'chitter_challenge_test')\n connection.exec(\"TRUNCATE peeps;\")\nend",
"def test_get_existing_user \n num_users0 = count_users\n proto = User.new('oauth_id' => '566213105', 'name' => 'Avilay Parekh') \n user = get_user('566213105')\n assert(user === @ds.add_or_get_user(proto))\n assert_equal(num_users0, count_users)\n assert_equal(user.id, @ds.user_id)\n end",
"def test_data_cleaning\n customer = rand(0..10)\n stream = rand(0..10)\n\n 10.times do\n post '/watch', {customer_id: customer, stream_id: stream}\n assert_equal 200, last_response.status\n end\n\n sleep 10\n\n trace_test 'data cleaning test', app.settings.customers, app.settings.streams\n\n assert_equal 0, app.settings.customers.length\n assert_equal 0, app.settings.streams.length\n\n end",
"def test_function_not_table\n # Should take params and add between brackets - retaining any existing params.\n skip \"SELECT storeopeninghours_tostring AS tmp from storeopeninghours_tostring('123');\"\n end",
"def test_10a\r\n db = build\r\n assert_equal [],db.groups\r\n end",
"def test_users_must_have_qualities\n u = User.new()\n refute u.save\n u2 = User.new(first_name: \"Ilan\", last_name: \"Man\")\n refute u2.save\n end",
"def cs_starter\n # make_batched_queries\n make_standard_queries\n end",
"def test_autocomplete_searches\n do_find_all\n do_autocomplete_query\n end",
"def setup\n DatabaseCleaner.start\n end",
"def setup\n DatabaseCleaner.start\n end",
"def test_getting_herbarium_records\n params = { method: :get, action: :herbarium_record }\n\n recs = HerbariumRecord.where(HerbariumRecord[:created_at].year == 2012)\n assert_not_empty(recs)\n assert_api_pass(params.merge(created_at: \"2012\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(HerbariumRecord[:updated_at].year == 2017)\n assert_not_empty(recs)\n assert_api_pass(params.merge(updated_at: \"2017\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(user: mary)\n assert_not_empty(recs)\n assert_api_pass(params.merge(user: \"mary\"))\n assert_api_results(recs)\n\n herb = herbaria(:nybg_herbarium)\n recs = herb.herbarium_records\n assert_not_empty(recs)\n assert_api_pass(params.merge(herbarium: \"The New York Botanical Garden\"))\n assert_api_results(recs)\n\n obs = observations(:detailed_unknown_obs)\n recs = obs.herbarium_records\n assert_not_empty(recs)\n assert_api_pass(params.merge(observation: obs.id))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(HerbariumRecord[:notes].matches(\"%dried%\"))\n assert_not_empty(recs)\n assert_api_pass(params.merge(notes_has: \"dried\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(HerbariumRecord[:notes].blank)\n assert_not_empty(recs)\n assert_api_pass(params.merge(has_notes: \"no\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(HerbariumRecord[:notes].not_blank)\n assert_not_empty(recs)\n assert_api_pass(params.merge(has_notes: \"yes\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(initial_det: \"Coprinus comatus\")\n assert_not_empty(recs)\n assert_api_pass(params.merge(initial_det: \"Coprinus comatus\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(\n HerbariumRecord[:initial_det].matches(\"%coprinus%\")\n )\n assert_not_empty(recs)\n assert_api_pass(params.merge(initial_det_has: \"coprinus\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(accession_number: \"1234\")\n assert_not_empty(recs)\n assert_api_pass(params.merge(accession_number: \"1234\"))\n assert_api_results(recs)\n\n recs = HerbariumRecord.where(\n HerbariumRecord[:accession_number].matches(\"%23%\")\n )\n assert_not_empty(recs)\n assert_api_pass(params.merge(accession_number_has: \"23\"))\n assert_api_results(recs)\n end",
"def create_some_bogus_benign_database_entries\n s = FactoryGirl.create(:sale_with_1_book_unpaid)\n line_item = s.line_items.first\n line_item.update_attributes(qty: 90)\n # FactoryGirl.create(:line_item)\n FactoryGirl.create(:address)\n \n @expectedly_unassociated_address_id = Address.last.id\n \n @spoof_address_count = Address.count - @retailer_address_count\n \n Sale.find_by_address_id(@expectedly_unassociated_address_id).should be_nil\n @expectedly_unassociated_address_id\n end",
"def test_unranked_recall\n\n add_test_judgements \n add_unranked_query_result\n assert_equal(1.0, @query_result.statistics[:recall])\n \n end",
"def test_connection_exists\n assert_not_nil @conn\n end",
"def run_additional_operations(query_type, test)\n query_data = translate_column_names(test['additional_operation'])\n if query_type == 'delete'\n puts \" Deleting\"\n else\n puts \" Updating\"\n end \n\n if @verbose\n puts \" - #{query_data}\"\n end\n \n result = nil\n\n if query_type == 'delete'\n result = @client.delete(query_data)\n elsif query_type == 'update'\n result = @client.update(query_data)\n end\n\n expected = translate_column_names(test['result_additional'])\n expected.each do |key, value|\n if value == 'ignore'\n next\n end\n\n if !compare_values(value, result[key])\n @num_fails += 1\n @failed_tests.push(test['name'])\n\n puts \" Expected: \\\"#{key}\\\": #{value}\"\n puts \" Result: \\\"#{key}\\\": #{result[key]}\"\n puts \" Status: Failed\"\n return false\n end\n end\n \n self.num_successes += 1\n print(' Status: Passed')\n return true\n end",
"def test_get_mixedup_user\n proto = User.new('oauth_id' => '566213105', 'name' => 'Avilay Parekh') \n num_users0 = count_users\n proto.name = 'I An Other'\n assert_raises(RuntimeError) { @ds.add_or_get_user(proto) }\n assert_equal(num_users0, count_users)\n assert_nil(@ds.user_id) \n proto.name = 'Avilay Parekh'\n end",
"def test_basic_functionality\n u = DefaultSettings.create!\n end",
"def skip_schema_queries=(_arg0); end",
"def test_stats_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM stats WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM stats WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend",
"def should_log_scrubbed_query(input:, output:)\n queries = sql(input)\n\n expect(queries.join(\"\\n\")).to_not include(input)\n expect(queries.join(\"\\n\")).to include(output)\n end",
"def test_run_method\n return\n s = SearchQueryParser.build_ferret_query(\"T\")\n s = SearchQueryParser.build_ferret_query(\"\")\n assert true\n end",
"def setup\n @bigquery = $bigquery\n @prefix = $prefix\n @storage = $storage\n @bucket = $bucket\n @samples_bucket = $samples_bucket\n @samples_public_table = $samples_public_table\n @kms_key = $kms_key\n @kms_key_2 = $kms_key_2\n\n refute_nil @bigquery, \"You do not have an active bigquery to run the tests.\"\n refute_nil @prefix, \"You do not have an bigquery prefix to name the datasets and tables with.\"\n refute_nil @storage, \"You do not have an active storage to run the tests.\"\n refute_nil @bucket, \"You do not have a storage bucket to run the tests.\"\n refute_nil @samples_bucket, \"You do not have a bucket with sample data to run the tests.\"\n refute_nil @samples_public_table, \"You do not have a table with sample data to run the tests.\"\n refute_nil @kms_key, \"You do not have a kms key to run the tests.\"\n refute_nil @kms_key_2, \"You do not have a second kms key to run the tests.\"\n\n super\n end",
"def test_find_order\n assert_nothing_raised {\n Order.find(@order.id)\n }\n end",
"def query; end",
"def test_unranked_precision\n \n add_test_judgements\n add_unranked_query_result\n assert_equal(0.4, @query_result.statistics[:precision])\n \n end",
"def test_031\n # login\n login\n\n # Two PUs are created\n Pu.destroy_all\n pu_name_a = 'puA'\n pu_name_b = 'puB'\n create_pu(pu_name_a)\n create_pu(pu_name_b)\n\n\n # Count all records\n pus = Pu.find(:all)\n @@no_pu = pus.length\n\n # Open PU management page\n open_pu_management_page_1\n\n\n for i in 1..@@no_pu\n assert_equal pus[i-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{i}.1\")\n end\n\n # firtly, sort by ID\n pus = Pu.find(:all,:order => 'id')\n\n # click ID link\n click $xpath[\"misc\"][\"id_link\"]\n sleep 2\n\n if pus[0].id.to_s == get_table(\"//div[@id='right_contents']/div[1]/table[2].1.0\")\n pus = Pu.find(:all,:order => 'id')\n pus_second = Pu.find(:all,:order => 'id DESC')\n else\n pus = Pu.find(:all,:order => 'id DESC')\n pus_second = Pu.find(:all,:order => 'id')\n end\n for j in 1..@@no_pu\n assert_equal pus[j-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{j}.1\")\n end\n # Click PU ID\n click $xpath[\"misc\"][\"id_link\"]\n sleep 2\n for k in 1..@@no_pu\n assert_equal pus_second[k-1].name, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{k}.1\")\n end\n\n # Delete created data\n\n @@pu= Pu.find_by_name('puA')\n @@pu2= Pu.find_by_name('puB')\n @@pu.destroy\n @@pu2.destroy\n\n\n # Logout\n logout\n make_original_pus\n end",
"def test_cant_find_single_item\n\n result=find_single_item(@warehouse_data, :zz)\n assert_equal(nil,result)\n \nend",
"def __dummy_test__\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def test_nothing\n end",
"def load_default_test_data_to_db_before_test\n community1 = Community.where(ident: \"test\").first\n community2 = Community.where(ident: \"test2\").first\n community3 = Community.where(ident: \"test3\").first\n\n person1 = FactoryGirl.create(:person,\n community_id: community1.id,\n username: \"kassi_testperson1\",\n emails: [\n FactoryGirl.build(:email, community_id: community1.id, :address => \"[email protected]\") ],\n is_admin: 0,\n locale: \"en\",\n encrypted_password: \"$2a$10$WQHcobA3hrTdSDh1jfiMquuSZpM3rXlcMU71bhE1lejzBa3zN7yY2\", #\"testi\"\n given_name: \"Kassi\",\n family_name: \"Testperson1\",\n phone_number: \"0000-123456\",\n created_at: \"2012-05-04 18:17:04\")\n\n person2 = FactoryGirl.create(:person,\n community_id: community1.id,\n username: \"kassi_testperson2\",\n emails: [\n FactoryGirl.build(:email, community_id: community1.id, :address => \"[email protected]\") ],\n is_admin: false,\n locale: \"en\",\n encrypted_password: \"$2a$10$WQHcobA3hrTdSDh1jfiMquuSZpM3rXlcMU71bhE1lejzBa3zN7yY2\", #\"testi\"\n given_name: \"Kassi\",\n family_name: \"Testperson2\",\n created_at: \"2012-05-04 18:17:04\")\n\n FactoryGirl.create(:community_membership, :person => person1,\n :community => community1,\n :admin => 1,\n :consent => \"test_consent0.1\",\n :last_page_load_date => DateTime.now,\n :status => \"accepted\" )\n\n FactoryGirl.create(:community_membership, :person => person2,\n :community=> community1,\n :admin => 0,\n :consent => \"test_consent0.1\",\n :last_page_load_date => DateTime.now,\n :status => \"accepted\")\n\n FactoryGirl.create(:email,\n :person => person1,\n :address => \"[email protected]\",\n :send_notifications => true,\n :confirmed_at => \"2012-05-04 18:17:04\")\n\n FactoryGirl.create(:email,\n :person => person2,\n :address => \"[email protected]\",\n :send_notifications => true,\n :confirmed_at => \"2012-05-04 18:17:04\")\n\n FactoryGirl.create(:marketplace_configurations,\n community_id: community1.id,\n main_search: \"keyword\",\n distance_unit: \"metric\",\n limit_search_distance: 0)\n\n end",
"def test_multi_results\n rows = @connection.select_rows(\"CALL ten();\")\n assert_equal 10, rows[0][0].to_i, \"ten() did not return 10 as expected: #{rows.inspect}\"\n\n assert @connection.active?, \"Bad connection use by '#{@connection.class}.select_rows'\"\n end",
"def test_local_core_connection\n \n # Change username, password, host and port in order to test the connection with a different Ensembl db server\n assert_nothing_raised do \n Ensembl::Core::DBConnection.connect('Homo sapiens',56,:username => \"anonymous\",:host => \"ensembldb.ensembl.org\", :port => 5306)\n end\n end",
"def test_stories_find_upcoming\n assert_not_nil @rdigg.stories.find_upcoming(:count => 3)\n end",
"def test_002\n # delete all existed projects\n delete_all_pus\n begin\n # there is no project\n open_pu_management_page\n assert is_element_not_present(xpath[\"pu_management\"][\"search_box\"])\n assert is_element_not_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n # return the original data (2 pus)\n make_original_pus\n end",
"def test_manipulate_databases\n number=1000\n relation_name = \"Dog\"\n relation_schema = {\"name\" => \"string\", \"race\" => \"string\", \"age\" => \"integer\"}\n values = {\"name\" => \"Bobby\", \"age\" => 2, \"race\"=> \"labrador\"}\n @dbids.each do |id|\n database(id).create_relation(relation_name,relation_schema)\n assert_equal(\"Dog\",database(id).relation_classes[\"Dog\"].table_name)\n end\n \n @dbids.each do |id|\n puts \"insert into db : #{id}\"\n\n (0..number).each do |i|\n count_values = {\"name\" => \"Bobby#{i}\", \"age\" => i, \"race\"=> \"labrador\"}\n database(id).relation_classes[\"Dog\"].insert(count_values)\n end\n assert_equal(number+1,database(id).relation_classes[\"Dog\"].all.size)\n\n end\n \n @dbids.each do |id|\n number_of_tuples_to_delete = rand(number)\n (1..number_of_tuples_to_delete).each do |i|\n database(id).relation_classes[\"Dog\"].delete(i)\n end\n assert_equal(number+1-number_of_tuples_to_delete,database(id).relation_classes[\"Dog\"].all.size)\n end\n \n end",
"def test_add_user\n num_users0 = count_users\n proto = User.new('oauth_id' => SecureRandom.uuid, 'name' => 'Test User') \n new_user = @ds.add_or_get_user(proto)\n user = get_user(proto.oauth_id)\n assert(user === new_user)\n assert_equal(num_users0 + 1, count_users)\n assert_equal(user.id, @ds.user_id)\n delete_user(user.oauth_id)\n end",
"def prepare_test\n\n u = User.order(:id).first\n if u.nil?\n u = FactoryGirl.create(:valid_user, id: 1)\n end\n $user_id = u.id\n\n p = Project.order(:id).first\n if p.nil?\n p = FactoryGirl.create(:valid_project, id: 1)\n end\n $project_id = p.id\n\nend",
"def test_stories_find_upcoming_diggs\n assert_not_nil @rdigg.stories.find_upcoming_diggs(:count => 3)\n end",
"def test_stories_find_by_topic \n assert_not_nil @rdigg.stories.find_by_topic(\"apple\")\n end",
"def check_sql_before_running; tarif_optimizator.check_sql_before_running; end"
] | [
"0.6893275",
"0.6532672",
"0.6508345",
"0.643524",
"0.6320033",
"0.6311966",
"0.63020587",
"0.62561435",
"0.6253245",
"0.62308127",
"0.61367905",
"0.6124775",
"0.60921454",
"0.6061542",
"0.6059192",
"0.60482204",
"0.5998247",
"0.5985875",
"0.59646964",
"0.5953646",
"0.59485424",
"0.59478956",
"0.5905921",
"0.5899335",
"0.5891589",
"0.5881807",
"0.58721465",
"0.58579886",
"0.5852859",
"0.5840252",
"0.5826247",
"0.58056796",
"0.5791223",
"0.578905",
"0.5787436",
"0.5785897",
"0.57656604",
"0.57641065",
"0.5762715",
"0.575662",
"0.57524675",
"0.5752121",
"0.5737356",
"0.57288945",
"0.5711755",
"0.5706887",
"0.5706209",
"0.5700838",
"0.56772125",
"0.56749415",
"0.56747526",
"0.56716645",
"0.5670762",
"0.566418",
"0.56632507",
"0.56630534",
"0.5657579",
"0.5653603",
"0.56488454",
"0.56416905",
"0.5639271",
"0.56370527",
"0.5634472",
"0.5625715",
"0.5625463",
"0.5624346",
"0.56205714",
"0.56179804",
"0.5615098",
"0.5615098",
"0.56146467",
"0.5612882",
"0.5606683",
"0.5605865",
"0.5592845",
"0.5585574",
"0.5583066",
"0.55810827",
"0.55806243",
"0.5568229",
"0.55653495",
"0.5565315",
"0.5558071",
"0.5556129",
"0.5555907",
"0.5554635",
"0.55507034",
"0.5544482",
"0.5544245",
"0.55373144",
"0.55363125",
"0.55321056",
"0.5523002",
"0.55187833",
"0.5518653",
"0.5517756",
"0.55171597",
"0.55152124",
"0.5514546",
"0.5506357",
"0.5502547"
] | 0.0 | -1 |
App to be used | def app
@app ||= LiuLunch
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app; @app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def initialize(app); end",
"def main\n @app.main\n end",
"def app\n @app\n end",
"def initialize!(app); end",
"def app\n Airfoil.app\n end",
"def app\n Hanami.app\n end",
"def app\n App.load(self.app_id)\n end",
"def main_app\n @main_app\n end",
"def initialize( app )\n\t\t@app = app\n\tend",
"def app=(_arg0); end",
"def app\n @app\n end",
"def app\n defined?(@app) ? @app : build_app\n end",
"def application\n self\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def start_app\nend",
"def appFX\n appEM.app\nend",
"def app ; Publisher ; end",
"def handle(app)\n app\n end",
"def launch_app\n @bridge.launch_app\n end",
"def app\n @app || make_app\nend",
"def roby_app\n @roby_app ||= interface.app\n end",
"def appraisals; end",
"def appraisals; end",
"def app\n self\n end",
"def app\n self\n end",
"def run\n super\n _log \"Running 42matters mobile app search.\"\n \n entity_name = _get_entity_name\n api_key = _get_task_config(\"42matters_api_key\")\n \n unless api_key\n _log_error \"Failed to retrieve api key. Exiting\"\n return\n end\n \n # search for android app via apptweak api\n find_ios_apps(api_key, entity_name)\n find_android_apps(api_key, entity_name)\n \n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def initialize(app)\n @app = app\n end",
"def app\n TicTacToeAiNApp # most examples use App.new - reason why we don't need .new here? ?????\n end",
"def app data={}\n get '/app', data\n end",
"def app\n App\nend",
"def app\n \tCollaborator\n end",
"def app\n @slot.app\n end",
"def cfs_kit_launch_app(screen, app)\n\n\n if (app == \"UPDATE_TUTORIAL\")\n # An exception will report any errors \n if cfs_kit_create_tutorial_screen\n prompt (\"Successfuly created tutorial screen file #{tutorial_scr_file}\\nusing #{tutorial_def_file}\")\n end\n elsif (app == \"PROTO_APPP\")\n #TODO - Investigate generic text table editor or tutorial screen\n\t Cosmos.run_process(\"ruby lib/OskCfeFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/cfs_kit/file_server/cfe_es_syslog.dat'\")\n\t #Cosmos.run_process(\"ruby lib/OskTxtFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/test.json'\")\n #require 'osk_tbl_editor'\n #Cosmos.run_process(\"ruby lib/OskTblEditor\")\n\t #require 'cfs_fcx_cmdgen'\n #Cosmos.run_process(\"ruby lib/CfsFcxCmdGen\")\n #Cosmos.run_process(\"ruby tools/ConfigEditor\")\n #Cosmos::OskTblEditor.run\n #Cosmos.run_cosmos_tool('ConfigEditor')\n\n elsif (app == \"TUTORIAL\")\n cfs_kit_launch_tutorial_screen\n end\n\nend",
"def app\n parent.app\n end",
"def new\n\t\t@application = Application.new\t\t\n\tend",
"def app\n no_autostart\n puts \"Running Plezi version: #{::Plezi::VERSION}\"\n Plezi::Base::Router.call_method\n end",
"def execute_app(app)\n load app\n end",
"def app\n @options[:app]\n end",
"def appindex\n\n end",
"def show\n currentapp_initialize\n end",
"def app\n TestApp.new\n end",
"def app\n TicTacToeNApp # most examples use App.new - reason why we don't need .new here? ?????\n end",
"def app\n app_class.new\n end",
"def app\n MyApp.new\nend",
"def app\n gem_root = File.expand_path '../../../..', __FILE__\n\n render file: \"#{gem_root}/public/unsakini/app/index.html\", layout: false\n end",
"def app\n Spaceship::Portal::App.set_client(@client)\n end",
"def call(env)\n env['crossbeams.appname'] = @appname\n env['crossbeams.banner'] = @template if @template\n @app.call(env)\n end",
"def app\n I18n.enforce_available_locales = false\n PaintManager\n end",
"def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend",
"def appname\n @appname = \"Jazzify\"\n end",
"def initialize(app = nil)\n @app = app\n end",
"def applicationDidFinishLaunching(notification)\n @app_name = NSBundle.mainBundle.infoDictionary['CFBundleDisplayName']\n setupMainPanel\n end",
"def run\n end",
"def app\n @container.app\n end",
"def run\n super\n _log \"Running Apptweak mobile app search.\"\n \n entity_name = _get_entity_name\n api_key = _get_task_config(\"apptweak_api_key\")\n\n unless api_key\n _log_error \"Failed to retrieve api key. Exiting\"\n return\n end\n \n # search for android app via apptweak api\n find_ios_apps(api_key, entity_name)\n find_android_apps(api_key, entity_name)\n \n end",
"def main\n\n end",
"def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end",
"def appname\n \"Application\"\n end",
"def run\n end",
"def run\n end",
"def delegate\n @app.call(@env)\n end",
"def app\n StevenWilkinDotCom\nend",
"def application\n [email protected]? && @modes.has_key?(@settings[:mode]) ? @modes[@settings[:mode]][:app] : \"unknown\"\n end",
"def execute_app(app)\n $LOAD_PATH.unshift(Dir.pwd)\n Shoes.configuration.backend = :swt\n load app\n end",
"def setup(app)\n @app = app\n end",
"def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end",
"def main\n Cabar::Main.current\n end",
"def app_about\n end",
"def applicationDidFinishLaunching(notification)\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def application\n\t\t\tIowa.app\n\t\tend",
"def app=(name)\n end",
"def build_app!\n super\n ensure\n GC.start\n GC.disable\n end",
"def app\n IdeaGrid.tap { |app| }\n end",
"def initialize(app)\n super()\n\n @app = app\n @local_data = {}\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\n end",
"def app_with_name name\n AX::Application.new name\n end",
"def app_root; end",
"def enable_app(app)\n self.disable_app(app,'yes')\n end",
"def main\n end"
] | [
"0.7370201",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.7216344",
"0.69914156",
"0.68465066",
"0.66528857",
"0.6635969",
"0.6575808",
"0.6565965",
"0.6470923",
"0.6467761",
"0.6439747",
"0.6424906",
"0.6400177",
"0.6365147",
"0.63198453",
"0.63039887",
"0.63039887",
"0.63039887",
"0.63035196",
"0.62953174",
"0.62755746",
"0.6241431",
"0.62220764",
"0.6219299",
"0.6212422",
"0.6207613",
"0.6205334",
"0.6205334",
"0.6167588",
"0.6167588",
"0.61349225",
"0.6130992",
"0.6130992",
"0.6130992",
"0.60975844",
"0.60975844",
"0.60975844",
"0.60975844",
"0.60965025",
"0.6061163",
"0.605153",
"0.6050302",
"0.60335195",
"0.60272443",
"0.60034",
"0.59917533",
"0.5980856",
"0.5970287",
"0.59650695",
"0.59473735",
"0.59436876",
"0.5930765",
"0.59276706",
"0.5913204",
"0.59047157",
"0.5900022",
"0.58976805",
"0.5895804",
"0.5879545",
"0.5876815",
"0.5851291",
"0.5830746",
"0.5829577",
"0.58262694",
"0.58236533",
"0.580458",
"0.58008546",
"0.5798901",
"0.5798111",
"0.57962286",
"0.57962286",
"0.578939",
"0.5787657",
"0.5777323",
"0.57736653",
"0.5772928",
"0.57664955",
"0.5750537",
"0.5749428",
"0.5736031",
"0.57297766",
"0.571564",
"0.5713161",
"0.5700329",
"0.569376",
"0.5691424",
"0.5683825",
"0.56782913",
"0.5672454",
"0.5666851",
"0.5660201"
] | 0.6307323 | 24 |
Rails 5.2 moved from a unary Migrator class to MigrationContext, that can be scoped to a given path. Rails 6.0 requires the schema migration object as an argument. | def migration_context
klass = ActiveRecord::MigrationContext
case klass.instance_method(:initialize).arity
when 1
klass.new(migration_path)
else
klass.new(migration_path, schema_migration)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migration(&block)\n if caller[0].rindex(/\\/(?:[0-9]+)_([_a-z0-9]*).rb:\\d+(?::in `.*')?$/)\n m = Object.const_set $1.camelize, Class.new(ActiveRecord::Migration)\n m.class_eval(&block) # 3.1\n else\n raise ArgumentError, \"Could not create migration at: #{caller[0]}\"\n end\n end",
"def migrate(schema, to_version = nil)\n conn = ActiveRecord::Base.connection\n return false unless conn.schema_exists? schema\n current_search_path = conn.schema_search_path\n conn.schema_search_path = schema\n ActiveRecord::Migrator.migrate('db/migrate', to_version)\n conn.schema_search_path = current_search_path\n end",
"def migrate(path, version = nil)\n # Establish a connection for migration.\n ActiveRecord::Base.establish_connection(@connection_config)\n ActiveRecord::Migration.verbose = false\n # Namespace definition for the current database.\n # This will ensure that each database is migrated independently.\n ActiveRecord::Base.table_name_prefix = base_model.table_name_prefix\n ActiveRecord::Migrator.migrate(path, version)\n # Clean-up once done.\n ActiveRecord.send(:remove_const, :SchemaMigration)\n load 'active_record/schema_migration.rb'\n ActiveRecord::Base.table_name_prefix = ''\n ActiveRecord::Base.connection.close\n end",
"def migration\n end",
"def schema?(model_class)\n model_class.name == 'ActiveRecord::SchemaMigration'\n end",
"def migrate_plugin(migration_path)\n # Execute Migrations on engine load.\n ActiveRecord::Migrator.migrations_paths += [migration_path]\n begin\n ActiveRecord::Tasks::DatabaseTasks.migrate\n rescue ActiveRecord::NoDatabaseError\n end\n end",
"def migration_folder name\n migrations_path = File.dirname(__FILE__)\n name ? File.join(\"#{migrations_path}\" \"#{name}\") : \"#{migrations_path}/migrations\" # adding /migrations here is safer\nend",
"def with_migration(&block)\n migration_class = ActiveRecord::Migration[\n ActiveRecord::Migration.current_version\n ]\n\n Class.new(migration_class, &block).new\nend",
"def set_migration\n @migration = Migration.find(params[:id])\n end",
"def schema_version\n migration_context.current_version\n end",
"def migrate\n raise NotImplementedError\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def alter_table_generator_class\n Schema::AlterTableGenerator\n end",
"def activate(schema,verify_migration = false)\n base_path = self.initial_search_path\n self.create(schema) if verify_migration\n conn = ActiveRecord::Base.connection\n return false unless conn.schema_exists?(schema)\n conn.schema_search_path = [schema, base_path].compact.join(',')\n end",
"def to_class\n @migration_class ||= migration_class_name.constantize\n rescue NameError => e\n @name_error = true\n\n raise e unless e.missing_name.eql?(migration_class_name)\n\n puts \"WARNING: Migration-Class not found '#{migration_class_name}'\"\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def migration_class_name\n migration_name.camelize\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def in_migration?(node)\n dirname(node).end_with?('db/migrate', 'db/geo/migrate') || in_post_deployment_migration?(node)\n end",
"def migration?(migration)\n @migrations.include?(migration)\n end",
"def prefix_for_tables\n migration_version = ActiveRecord::Migrator.current_version\n end",
"def migration_dir\n return Roomer.shared_migrations_directory if shared?\n return Roomer.tenanted_migrations_directory\n end",
"def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end",
"def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end",
"def create_migration\n if invoked_attributes.present?\n args = [\"create_#{plural_name}\"] + (invokable(invoked_attributes) | timestamps)\n args += [\"--database\", options['database']] if options['database']\n Rails::Generators.invoke('migration', args)\n return\n end\n\n return if with_resource_tenant do\n table_name = resource.klass.table_name\n\n if ActiveRecord::Base.connection.table_exists?(table_name)\n say_status(:error, \"#{table_name} table already exist. We can't migrate (yet). Exiting.\", :red)\n true\n end\n end\n\n if resource.model_attributes.blank?\n say_status(:error, \"No model attributes present. Please add the effective_resource do ... end block and try again\", :red)\n return\n end\n\n args = [\"create_#{plural_name}\"] + invokable(resource.model_attributes) - timestamps\n args += [\"--database\", options['database']] if options['database']\n\n if options['database'].blank? && defined?(Tenant)\n args += [\"--database\", resource.klass.name.split('::').first.downcase]\n end\n\n Rails::Generators.invoke('migration', args)\n end",
"def check_schema_migrations\n return if column_family_exists?('schema_migrations')\n say 'Creating schema_migrations column family'\n DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').primary_key('cf')\n .columns(cf: :text, digest: :text, solrconfig: :text, stopwords: :text).execute\n end",
"def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end",
"def upgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running upgrade: #{m}\"\n m.execute_up(context, meta_node)\n end\n end",
"def migration_class\n if defined?(ActiveRecord::Migration::Compatibility)\n \"ActiveRecord::Migration[#{ActiveRecord::PGEnum.enabled_version}]\"\n else\n \"ActiveRecord::Migration\"\n end\n end",
"def require_migration\n @required ||= require file_path\n\n return true if Object.const_defined?(migration_class_name)\n\n raise MigrationNotFoundError\n rescue LoadError => _e\n @load_error = true\n\n puts \"WARNING: Migration-File not found '#{file_path}'\"\n end",
"def replace_migration(name, from)\n inside (\"db/migrate\") do\n run \"cat #{from}/#{name}.rb > temp.rb\"\n run \"find *_#{name}.rb | xargs mv temp.rb\"\n end\nend",
"def migrate(manifest_path)\n @manifest_path = manifest_path\n\n @conn = Util::get_conn(@connection_hash)\n\n # this is used to record the version of the 'migrator' in the pg_migrate table\n @conn.exec(\"SET application_name = 'pg_migrate_ruby-#{PgMigrate::VERSION}'\")\n\n # load the manifest, and version of the builder that made it\n process_manifest()\n\n # execute the migrations\n run_migrations(@manifest)\n end",
"def migration\n options[:migration] != false\n end",
"def migration_railties; end",
"def migration_railties; end",
"def schema_search_path\n 'dbo'\n end",
"def db_migration_dirname(export_type = nil)\n loc = app_type_name || db_migration_schema\n dirname = \"db/app_migrations/#{loc}\"\n dirname += \"--#{export_type}\" if export_type\n dirname\n end",
"def migrate(paths:, quiet:, &filter)\n verbose_was = ActiveRecord::Migration.verbose\n ActiveRecord::Migration.verbose = !quiet\n migrate =\n -> { ActiveRecord::MigrationContext.new(paths, ActiveRecord::SchemaMigration).migrate(nil, &filter) }\n if quiet\n silence_active_record(&migrate)\n else\n migrate.call\n end\n ensure\n ActiveRecord::Migration.verbose = verbose_was\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def copy_bucket_maker_migration\n if behavior == :invoke && store_in == 'active_record' && active_recordable_exists?\n migration_template \"active_recordable_migration.rb\", \"db/migrate/create_#{ACTIVE_RECORDABLE.pluralize}\"\n end\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def migrated_down(migration)\n column_family.delete({\n where: {\n version: migration.version.to_s,\n name: migration.name,\n },\n })\n end",
"def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end",
"def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def migrate(klass)\n # Validate\n raise \"Unable to perform migrations, class must be specified!\" unless klass.class == Class\n raise \"Unable to perform migrations for core class!\" if CORE.include?(klass)\n raise \"Class cannot be migrated!\" unless klass.respond_to?(:auto_migrate!)\n # Execute auto migrations for now\n klass.auto_migrate!\n end",
"def migration(version, fingerprint, name)\n SchemaMigration.create!(version: version, migrated_at: Time.now, fingerprint: fingerprint, name: name)\n end",
"def migration(options={})\n get_location\n # TODO: validate options\n @params[:migration] = FEATURE_DEFAULTS[:migration].merge(options)\n @params[:migration][:generate] = true\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def set_path_if_required(schema)\n return if @connection.schema_search_path == schema\n @connection.schema_search_path = schema\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def performed_migrations\n rows = column_family.select\n rows.map { |row|\n path = migrations_path.join(\"#{row['version']}_#{row['name']}.rb\")\n MigrationProxy.new(path)\n }.sort\n end",
"def migrate version = nil\n if @migrations\n schema = meta_schema\n version = __check_migration_version(version)\n __create_meta_data_table_for(schema)\n\n s = schema.first || schema.new(version: 0)\n unless s.version == version\n @migrations.sort_by { |migration| migration.version }.each do |m|\n m.migrate(:up) if s.version < m.version and m.version <= version\n\n if s.version >= m.version and m.version > version\n m.migrate(:down)\n else # Handle migrate(0)\n m.migrate(:down) if s.version >= m.version and version.zero?\n end\n end\n s.update_attribute :version, version\n end\n version = s.version\n end\n version\n end",
"def schema_generator_script(schema_name, mode = 'create', owner: DefaultSchemaOwner)\n cname = \"#{mode}_#{schema_name}_schema_#{migration_version}\".camelize\n\n <<~CONTENT\n require 'active_record/migration/app_generator'\n class #{cname} < ActiveRecord::Migration[5.2]\n include ActiveRecord::Migration::AppGenerator\n\n def change\n self.schema = '#{schema_name}'\n self.owner = '#{owner}'\n create_schema\n end\n end\n CONTENT\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def check_schema_migrations\n unless column_family_exists?('schema_migrations')\n say \"Creating schema_migrations column family\"\n connection.execute_cql_query(DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').key_type(:text).columns(:digest => :text, :solrconfig => :text, :stopwords => :text).to_cql)\n end\n \n check_key_name('schema_migrations')\n end",
"def update\n migrations = SchemaMigration.all.collect { |r| r.migration_name.to_sym }\n schema_updates.each do |name|\n next if migrations.include?(name)\n logger.debug { name }\n self.send(name)\n SchemaMigration.create!(migration_name: name)\n end\n end",
"def before_migrate(arg = nil, &block)\n arg ||= block\n set_or_return(:before_migrate, arg, kind_of: [Proc, String])\n end",
"def connect_to_migration_db\n ActiveRecord::Base.establish_connection(\n adapter: 'postgresql',\n encoding: 'unicode',\n pool: 10,\n url: ENV['MIGRATION_DB_URL']\n )\n ActiveRecord::Base.connection.execute(\n \"SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;\"\n )\n end",
"def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end",
"def create_migration_file\n f = File.open File.join(File.dirname(__FILE__), 'templates', 'schema.rb')\n schema = f.read; f.close\n \n schema.gsub!(/ActiveRecord::Schema.*\\n/, '')\n schema.gsub!(/^end\\n*$/, '')\n\n f = File.open File.join(File.dirname(__FILE__), 'templates', 'migration.rb')\n migration = f.read; f.close\n migration.gsub!(/SCHEMA_AUTO_INSERTED_HERE/, schema)\n \n tmp = File.open \"tmp/~migration_ready.rb\", \"w\"\n tmp.write migration\n tmp.close\n\n migration_template '../../../tmp/~migration_ready.rb',\n 'db/migrate/create_framey_tables.rb'\n remove_file 'tmp/~migration_ready.rb'\n end",
"def next_migration_number(dir)\n ActiveRecord::Generators::Base.next_migration_number(dir)\n end",
"def next_migration_number(dir)\n ActiveRecord::Generators::Base.next_migration_number(dir)\n end",
"def migrate(version = nil)\n ActiveRecord::ConnectionAdapters::SchemaStatements.class_eval do\n include Goldberg::SchemaStatements\n end\n\n version && (version = version.to_i)\n super(\"#{RAILS_ROOT}/vendor/plugins/#{plugin_name}/db/migrate\", version)\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def run(direction, database, version)\n Tenant.switch(database) do\n if activerecord_below_5_2?\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version)\n else\n ActiveRecord::Base.connection.migration_context.run(direction, version)\n end\n end\n end",
"def change_migration_content\n Dir.glob(\"#{plugin_path}/db/migrate/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n end\n mig_array = [\"To\", \"From\", \"Create\" ,\"Remove\"]\n model_name = \"\"\n mig_array.each do |m_a|\n reg_exp = %r{#{m_a}(.+)\\s+<}\n model_name = reg_exp.match(content)[1] unless reg_exp.match(content).nil?\n if !model_name.blank?\n break\n end\n end\n migrate_connection =\"\"\n if !model_name.blank?\n migrate_connection = \"def self.connection\n #{model_name.singularize}.connection\n end\"\n end\n if !model_name.blank?\n content.sub!(/ActiveRecord::Migration\\s{1}/,\"ActiveRecord::Migration\\n #{migrate_connection} \\n\")\n end\n file = File.open(f,\"w\")\n file.write(content)\n file.close\n end\n \n end",
"def migrations\n @migrations ||= begin\n paths = Dir[\"#{migrations_path}/*.rb\"]\n migrations = paths.map { |path| MigrationProxy.new(path) }\n migrations.sort\n end\n end",
"def functional_update_schema # abstract\n raise 'abstract'\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def migrate?\n raise NotImplementedError\n end",
"def generate_migration\n template migration_template, \"db/migrate/#{migration_file_name}.rb\" if options.migration?\n end",
"def schema_search_path=(schema_csv)\n if schema_csv\n existing_schemas = execute(\"select nspname from pg_catalog.pg_namespace;\").values\n unless existing_schemas.map{|x| x[0]}.include?(schema_csv)\n execute(\"CREATE SCHEMA #{schema_csv}\")\n end\n execute(\"SET search_path TO #{schema_csv}\", 'SCHEMA')\n @schema_search_path = schema_csv\n end\n end",
"def which_has_schema(schema)\n if schema.key? '$ref'\n ref = schema\n schema = resolve_ref(schema['$ref'])\n end\n\n self.baw_model_schema = defined?(ref) ? ref : schema\n let(:model_schema) {\n schema\n }\n end",
"def migrate(options = {})\n settings = options.select { |key| [:path, :logger].include? key }\n target = options.select { |key| key.equal? :version }\n\n Migrations::Migrator.new(session, settings).apply(target)\n end",
"def migrate\n ActiveRecord::Schema.define do\n self.verbose = true # or false\n\n enable_extension \"plpgsql\"\n #enable_extension \"pgcrypto\"\n\n create_table(:access_lines, force: true) do |t|\n t.string :line, null: false\n t.datetime :timestamp, null: false\n t.string :username, null: false\n t.string :peer_id, null: false\n end\n\n # A backup for the uniqueness validation in AccessLine\n add_index :access_lines, [:timestamp, :username], unique: true\n end\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def get_schematron_processor\n raise \"Implement me damn it\"\n end",
"def get_schematron_processor\n raise \"Implement me damn it\"\n end",
"def migration(number = nil, &block)\n klass = self.class.migration(&block)\n klass.new migration_options.merge(number: number || next_number)\n end",
"def create_table_generator_class\n Schema::CreateTableGenerator\n end",
"def supports_migrations?\n false\n end",
"def supports_migrations?\n false\n end",
"def up\n create_table TABLE_NAME do |t|\n #\n # Single Table Inheritance (STI)\n #\n\n t.string :type\n\n #\n # Columns\n #\n\n t.datetime :real_path_modified_at, null: false\n t.string :real_path_sha1_hex_digest, limit: 40, null: false\n t.text :relative_path, null: false\n\n #\n # References\n #\n\n t.references :parent_path, null: false\n end\n\n change_table TABLE_NAME do |t|\n #\n # Foreign Key Indices\n #\n\n t.index :parent_path_id\n\n #\n # Unique Indices\n #\n\n t.index :real_path_sha1_hex_digest, unique: true\n # relative_path is unique because all parent_paths must be able to be unified.\n t.index :relative_path, unique: true\n end\n end",
"def migration_storage_name\n nil\n end",
"def schema\n raise NotImplementedError\n end",
"def get_migration_folder(instance)\n File.join(@migration_nfs, 'migration', service_name, instance)\n end",
"def protected_context_methods\n %w(up down local_directory local_migration_file remote_directory remote_migration_file)\n end",
"def set_api_migration\n @api_migration = ApiMigration.find(params[:id])\n end",
"def is_current?\n ::Sequel.extension(:migration)\n ::Sequel::Migrator.is_current?(database, migration_directory)\n rescue => e\n raise ConnectionFailed, e\n end",
"def add_schema(export_type = nil)\n mig_text = schema_generator_script(db_migration_schema, 'create')\n write_db_migration mig_text, \"#{db_migration_schema}_schema\", export_type: export_type\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end",
"def complete_migration()\n return MicrosoftGraph::Me::JoinedTeams::Item::CompleteMigration::CompleteMigrationRequestBuilder.new(@path_parameters, @request_adapter)\n end"
] | [
"0.60223454",
"0.5730504",
"0.5651764",
"0.55012083",
"0.54448247",
"0.5438543",
"0.53481907",
"0.52664554",
"0.52230257",
"0.5205954",
"0.5120648",
"0.50873554",
"0.50873554",
"0.5083134",
"0.50599277",
"0.5045491",
"0.50440073",
"0.5040061",
"0.5036226",
"0.50357646",
"0.49932998",
"0.49757648",
"0.49683827",
"0.4884429",
"0.48791656",
"0.48749372",
"0.48520845",
"0.48287317",
"0.48177072",
"0.48085237",
"0.48034173",
"0.4798485",
"0.47750422",
"0.47749156",
"0.4764455",
"0.4764357",
"0.4764357",
"0.47614485",
"0.4757169",
"0.47546145",
"0.475241",
"0.475241",
"0.47491285",
"0.4719537",
"0.4719537",
"0.4719537",
"0.47029573",
"0.4700584",
"0.46940726",
"0.46755895",
"0.4664108",
"0.46562368",
"0.46559113",
"0.46559113",
"0.46559113",
"0.4652295",
"0.46461192",
"0.4603749",
"0.45906875",
"0.45891863",
"0.458251",
"0.45799667",
"0.4571114",
"0.4551274",
"0.45474303",
"0.45255646",
"0.45209432",
"0.45057142",
"0.45057142",
"0.45056623",
"0.44963658",
"0.44943655",
"0.44922101",
"0.44900876",
"0.44899505",
"0.44827232",
"0.44771126",
"0.44599766",
"0.44448662",
"0.44309732",
"0.44278586",
"0.44200304",
"0.44158912",
"0.43993166",
"0.43993166",
"0.43792298",
"0.43752712",
"0.43749166",
"0.43749166",
"0.43689373",
"0.43674472",
"0.43650213",
"0.43589938",
"0.43532312",
"0.43510824",
"0.434931",
"0.43480116",
"0.43476856",
"0.4340108",
"0.4335549"
] | 0.6889356 | 0 |
The base class for migrations moves around a lot | def migration_class
if defined?(ActiveRecord::Migration::Compatibility)
"ActiveRecord::Migration[#{ActiveRecord::PGEnum.enabled_version}]"
else
"ActiveRecord::Migration"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n raise NotImplementedError\n end",
"def migration\n end",
"def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate?\n raise NotImplementedError\n end",
"def migrations\n @migrations ||= {}\n end",
"def migration(&block)\n if caller[0].rindex(/\\/(?:[0-9]+)_([_a-z0-9]*).rb:\\d+(?::in `.*')?$/)\n m = Object.const_set $1.camelize, Class.new(ActiveRecord::Migration)\n m.class_eval(&block) # 3.1\n else\n raise ArgumentError, \"Could not create migration at: #{caller[0]}\"\n end\n end",
"def apply\n migration.up\n end",
"def migrate(_key, _options); end",
"def migrate(klass)\n # Validate\n raise \"Unable to perform migrations, class must be specified!\" unless klass.class == Class\n raise \"Unable to perform migrations for core class!\" if CORE.include?(klass)\n raise \"Class cannot be migrated!\" unless klass.respond_to?(:auto_migrate!)\n # Execute auto migrations for now\n klass.auto_migrate!\n end",
"def migrate version = nil\n if @migrations\n schema = meta_schema\n version = __check_migration_version(version)\n __create_meta_data_table_for(schema)\n\n s = schema.first || schema.new(version: 0)\n unless s.version == version\n @migrations.sort_by { |migration| migration.version }.each do |m|\n m.migrate(:up) if s.version < m.version and m.version <= version\n\n if s.version >= m.version and m.version > version\n m.migrate(:down)\n else # Handle migrate(0)\n m.migrate(:down) if s.version >= m.version and version.zero?\n end\n end\n s.update_attribute :version, version\n end\n version = s.version\n end\n version\n end",
"def migration_railties; end",
"def migration_railties; end",
"def migrate\n DataMapper.auto_migrate!\n end",
"def migrate(key, options); end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n %w{acts_as_follower_migration.rb\tadd_social_to_users.rb\t\tcreate_single_use_links.rb\tadd_ldap_attrs_to_user.rb\nadd_avatars_to_users.rb\t\tcreate_checksum_audit_logs.rb\tcreate_version_committers.rb\nadd_groups_to_users.rb\t\tcreate_local_authorities.rb\tcreate_trophies.rb}.each do |f|\n better_migration_template f\n end\n end",
"def migrate!(opts)\n raise NotSupportedError, \"Unable to migrate using `#{self}`\"\n end",
"def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_searches.rb\"\n better_migration_template \"create_bookmarks.rb\"\n better_migration_template \"remove_editable_fields_from_bookmarks.rb\"\n better_migration_template \"add_user_types_to_bookmarks_searches.rb\"\n end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end",
"def migration_context\n klass = ActiveRecord::MigrationContext\n\n case klass.instance_method(:initialize).arity\n when 1\n klass.new(migration_path)\n else\n klass.new(migration_path, schema_migration)\n end\n end",
"def up\n # Use self.class:: so constants are resolved in subclasses instead of this class.\n self.class::COLUMNS.each do |column|\n change_column_null(self.class::TABLE_NAME, column, false)\n end\n end",
"def set_previous_migrations\n GuidesGenerator::Migrator::previous_versions = version_class.all\n GuidesGenerator::Migrator::previous_sections = section_class.all\n GuidesGenerator::Migrator::previous_documents = document_class.all\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def up\n end",
"def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end",
"def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def up(&block)\n migration.up = block\n end",
"def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end",
"def find_migration_tuples # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n up_mts = []\n down_mts = []\n files.each do |path|\n f = File.basename(path)\n fi = f.downcase\n if target\n if migration_version_from_file(f) > target\n down_mts << [load_migration_file(path), f, :down] if applied_migrations.include?(fi)\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n end\n up_mts + down_mts.reverse\n end",
"def change_migration_content\n Dir.glob(\"#{plugin_path}/db/migrate/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n end\n mig_array = [\"To\", \"From\", \"Create\" ,\"Remove\"]\n model_name = \"\"\n mig_array.each do |m_a|\n reg_exp = %r{#{m_a}(.+)\\s+<}\n model_name = reg_exp.match(content)[1] unless reg_exp.match(content).nil?\n if !model_name.blank?\n break\n end\n end\n migrate_connection =\"\"\n if !model_name.blank?\n migrate_connection = \"def self.connection\n #{model_name.singularize}.connection\n end\"\n end\n if !model_name.blank?\n content.sub!(/ActiveRecord::Migration\\s{1}/,\"ActiveRecord::Migration\\n #{migrate_connection} \\n\")\n end\n file = File.open(f,\"w\")\n file.write(content)\n file.close\n end\n \n end",
"def supports_migrations?\n false\n end",
"def supports_migrations?\n false\n end",
"def auto_migrate_up!(repository_name = self.repository_name)\n assert_valid\n if base_model == self\n repository(repository_name).create_model_storage(self)\n else\n base_model.auto_migrate_up!(repository_name)\n end\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def migrate(version = nil)\n ActiveRecord::ConnectionAdapters::SchemaStatements.class_eval do\n include Goldberg::SchemaStatements\n end\n\n version && (version = version.to_i)\n super(\"#{RAILS_ROOT}/vendor/plugins/#{plugin_name}/db/migrate\", version)\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def migrate(task, *step_files)\r\n step_files = begin\r\n Dir[File.join(File.dirname(__FILE__),\"../../migrate/*.rb\")]\r\n end if step_files.empty?\r\n establish! do\r\n step_files.each do |step_file|\r\n require step_file\r\n File.basename(step_file) =~ /(.*)\\.rb$/\r\n migration = $1.camelize.constantize\r\n step = migration.new\r\n case task.to_s\r\n when \"up\"\r\n step.up unless step.migrated?\r\n when \"reset\"\r\n step.reset if step.migrated?\r\n when \"down\"\r\n step.down if step.migrated?\r\n when \"backup\"\r\n step.backup(options) if step.migrated?\r\n else\r\n raise \"Unsupported sub command: #{task}\"\r\n end\r\n end\r\n end\r\n end",
"def protected_context_methods\n %w(up down local_directory local_migration_file remote_directory remote_migration_file)\n end",
"def dbmigrate!\n ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)\n ActiveRecord::Migrator.up 'db/migrate'\n ActiveRecord::Base.clear_active_connections!\n nil\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def migrate( target_version = nil )\n base = File.join( LIB_DIR, '..', '..', 'db' )\n\n profiles = Hooker.apply( [ :iudex, :migration_profiles ], [] )\n\n ext = profiles.compact.map { |p| \"/#{p}\" }.join(',')\n base += \"{#{ext},}\" unless ext.empty?\n ActiveRecord::Migrator.migrate( base, target_version )\n end",
"def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end",
"def migrations\n @migrations ||= begin\n paths = Dir[\"#{migrations_path}/*.rb\"]\n migrations = paths.map { |path| MigrationProxy.new(path) }\n migrations.sort\n end\n end",
"def migrate_lazily(old_class_name, new_class_name, ruby_code)\n Maglev.abort_transaction\n\n old_class = remove_from_parent old_class_name\n\n compiler = RubyCompiler.new\n Maglev.persistent { compiler.compile ruby_code }\n new_class = get_path(new_class_name)[-1]\n raise \"Migrate: Can't find new version of #{new_class_name}\" unless new_class\n Maglev.commit_transaction # instance migration needs new txn context\n skip_methods = ['instance_variable_get', 'method_missing', 'puts']\n mclass = class << old_class; self end\n\n # Setup old class so that any method send, will trigger the\n # migration, and then resend on the new instance.\n Maglev.persistent do\n # If the instances have singleton classes, then those will still be\n # active under the current scheme....\n #\n # Don't override the class methods.???\n #\n old_class.module_eval do\n @@_target_class = new_class\n #puts \"Set #{self}'s target class to #{new_class}\"\n\n def method_missing(name, *args, &blk)\n new_instance = @@_target_class.allocate\n new_instance.migrate_from self\n new_instance.become self\n # At this point, self and new_instance have swapped identities, i.e.,\n # new_instance now points to the old instance. We want to execute\n # the method on the new instance, which is now self...\n self.send(name, *args, &blk)\n end\n end\n\n # Now we undefine all the methods we can on the class. Use\n # undef_method so we don't search superclasses. We'll need a few\n # methods during migration, so we skip a few.\n old_class.instance_methods(false).each { |m|\n unless skip_methods.include? m\n #puts \"-- #{old_class.inspect}: undef_method #{m.inspect} (#{m.to_sym})\"\n old_class.send(:undef_method, m.to_sym)\n end\n }\n # TODO: protect any methods needed by migration....\n mclass.instance_methods(true).each { |m|\n #puts \"-- #{self} undef_method (class) #{m.inspect}\"\n mclass.undef_method m.to_sym\n }\n end\n Maglev.commit_transaction\n end",
"def copy_migrations\n \n # get an array of the migrations in your engine's db/migrate/ \n # folder:\n \n migrations = Dir[Bulky::Engine.root.join(\"db/migrate/*.rb\")]\n migrations.each_with_index do |migration, i|\n \n # The migrations will be created with the same timestamp if you \n # create them all at once. So if you have more than one migration \n # in your engine, add one second to the second migration's file\n # timestamp and a third second to the third migration's timestamp \n # and so on:\n \n seconds = (DateTime.now.strftime(\"%S\").to_i + i).to_s\n seconds = seconds.to_s.length == 2 ? seconds : \"0#{seconds}\"\n timestamp = (DateTime.now.strftime \"%Y%m%d%H%M\") + seconds\n \n # get the filename from the engine migration minus the timestamp:\n name = migration.split(\"/\").last.split(\"_\")[1..-1].join(\"_\")\n # puts name\n \n # See if a the name of your engine migration is already in your\n # host app's db/migrate folder:\n \n if Rails.root.join(\"db/migrate/*#{name}\").exist?\n \n # do nothing:\n puts \"Migration #{name} has already been copied to your app\"\n else\n \n # copy your engine migration over to the host app with a new \n # timestamp:\n copy_file migration, \"db/migrate/#{timestamp}_#{name}\"\n end\n end\n end",
"def prefix_for_tables\n migration_version = ActiveRecord::Migrator.current_version\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def auto_migrate!(repository_name = self.repository_name)\n assert_valid\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end",
"def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end",
"def auto_migrate!\n DataMapper.auto_migrate!(name)\n end",
"def performed_migrations\n rows = column_family.select\n rows.map { |row|\n path = migrations_path.join(\"#{row['version']}_#{row['name']}.rb\")\n MigrationProxy.new(path)\n }.sort\n end",
"def migrate(path, version = nil)\n # Establish a connection for migration.\n ActiveRecord::Base.establish_connection(@connection_config)\n ActiveRecord::Migration.verbose = false\n # Namespace definition for the current database.\n # This will ensure that each database is migrated independently.\n ActiveRecord::Base.table_name_prefix = base_model.table_name_prefix\n ActiveRecord::Migrator.migrate(path, version)\n # Clean-up once done.\n ActiveRecord.send(:remove_const, :SchemaMigration)\n load 'active_record/schema_migration.rb'\n ActiveRecord::Base.table_name_prefix = ''\n ActiveRecord::Base.connection.close\n end",
"def upgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running upgrade: #{m}\"\n m.execute_up(context, meta_node)\n end\n end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def up\n method_proxy(:up)\n\n true\n end",
"def copy_migrations\n [\n 'change_audit_log_pid_to_generic_file_id.rb',\n 'change_proxy_deposit_request_pid_to_generic_file_id.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def create_migration\n if invoked_attributes.present?\n args = [\"create_#{plural_name}\"] + (invokable(invoked_attributes) | timestamps)\n args += [\"--database\", options['database']] if options['database']\n Rails::Generators.invoke('migration', args)\n return\n end\n\n return if with_resource_tenant do\n table_name = resource.klass.table_name\n\n if ActiveRecord::Base.connection.table_exists?(table_name)\n say_status(:error, \"#{table_name} table already exist. We can't migrate (yet). Exiting.\", :red)\n true\n end\n end\n\n if resource.model_attributes.blank?\n say_status(:error, \"No model attributes present. Please add the effective_resource do ... end block and try again\", :red)\n return\n end\n\n args = [\"create_#{plural_name}\"] + invokable(resource.model_attributes) - timestamps\n args += [\"--database\", options['database']] if options['database']\n\n if options['database'].blank? && defined?(Tenant)\n args += [\"--database\", resource.klass.name.split('::').first.downcase]\n end\n\n Rails::Generators.invoke('migration', args)\n end",
"def migrate\n # Create the directories\n vpc_dir = \"#{@migration_root}/vpc\"\n policies_dir = \"#{vpc_dir}/policies\"\n route_tables_dir = \"#{vpc_dir}/route-tables\"\n network_acls_dir = \"#{vpc_dir}/network-acls\"\n subnets_dir = \"#{vpc_dir}/subnets\"\n vpcs_dir = \"#{vpc_dir}/vpcs\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(vpc_dir)\n Dir.mkdir(vpc_dir)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n if !Dir.exists?(route_tables_dir)\n Dir.mkdir(route_tables_dir)\n end\n if !Dir.exists?(network_acls_dir)\n Dir.mkdir(network_acls_dir)\n end\n if !Dir.exists?(subnets_dir)\n Dir.mkdir(subnets_dir)\n end\n if !Dir.exists?(vpcs_dir)\n Dir.mkdir(vpcs_dir)\n end\n\n # Migrate the different assets\n migrate_policies(policies_dir)\n route_table_names = migrate_route_tables(route_tables_dir)\n network_acl_names = migrate_network_acls(network_acls_dir)\n subnet_names = migrate_subnets(subnets_dir, route_table_names, network_acl_names)\n migrate_vpcs(vpcs_dir, route_table_names, subnet_names, network_acl_names)\n end",
"def migratable\n migratable_since(default_migratable_date)\n end",
"def run_migration(&block)\n # Create a new migration class\n klass = Class.new(ActiveRecord::Migration[5.0])\n # Create a new `up` that executes the argument\n klass.send(:define_method, :up) { instance_exec(&block) }\n # Create a new instance of it and execute its `up` method\n klass.new.up\n end",
"def run_migrate\n manage_py_execute('migrate', '--noinput') if new_resource.migrate\n end",
"def migrate_from(old_instance)\n @x = old_instance.instance_variable_get :@x\n @y = @x * 3\n @migrated = true\n end",
"def up\n ActiveRecord::Base.transaction do\n migrate_cause\n migrate_messages\n end\n end",
"def migration_class_name\n migration_name.camelize\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def migration(number = nil, &block)\n klass = self.class.migration(&block)\n klass.new migration_options.merge(number: number || next_number)\n end",
"def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end",
"def migration_version\n @migration_version ||= DateTime.now.to_i.to_s(36)\n end",
"def migrate(version = nil)\n pending = ->(_) { File.pending.map(&:version).include?(_) }\n migrated = ->(_) { File.migrated.map(&:version).include?(_) }\n\n case version\n when nil\n files = File.pending\n Migrate::Up.new(files).perform\n\n when pending\n files = File.pending.select { |f| f.version <= version }\n Migrate::Up.new(files).perform\n\n when migrated\n files = File.migrated.select { |f| f.version > version }.reverse\n Migrate::Down.new(files).perform\n\n else\n out.puts(\"Invalid Version: #{version} does not exist.\")\n end\n end",
"def add_migrations\n \tmigrations = Dir.glob(SocialFramework::Engine.config.paths[\"db/migrate\"].first + \"/*\")\n\n if options[:migrations]\n options[:migrations].each do |migrate|\n file = \"social_framework_#{migrate.pluralize}.rb\"\n file = migrations.select { |m| m.include?(file) }.first\n unless file.nil? or file.empty?\n file_name = file.split(\"/\").last\n copy_file file, \"db/migrate/#{file_name}\"\n else\n puts \"Could not find migration: '#{migrate}'\"\n end\n end\n else\n migrations.each do |migrate|\n file = migrate.split(\"/\").last \n copy_file migrate, \"db/migrate/#{file}\"\n end\n end\n end",
"def with_migration(&block)\n migration_class = ActiveRecord::Migration[\n ActiveRecord::Migration.current_version\n ]\n\n Class.new(migration_class, &block).new\nend",
"def add_version(version); GuidesGenerator::Migrator::migrated_versions.push(version); version end",
"def migrate\n puts \"Migrating your database\"\n version = `ls db/migrate | wc -l`.to_i\n ActiveRecord::Base.establish_connection(Play.config['db'])\n ActiveRecord::Migrator.migrate(\"#{File.dirname(__FILE__)}/../db/migrate/\", version)\nend",
"def migrate_vm(_pool_name, _vm_name, _redis)\n raise(\"#{self.class.name} does not implement migrate_vm\")\n end",
"def auto_migrate!(repository_name = nil)\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end",
"def migrate\n ActiveRecord::Schema.define do\n self.verbose = true # or false\n\n enable_extension \"plpgsql\"\n #enable_extension \"pgcrypto\"\n\n create_table(:access_lines, force: true) do |t|\n t.string :line, null: false\n t.datetime :timestamp, null: false\n t.string :username, null: false\n t.string :peer_id, null: false\n end\n\n # A backup for the uniqueness validation in AccessLine\n add_index :access_lines, [:timestamp, :username], unique: true\n end\n end",
"def up\n Build.where(stage_id: nil).each_batch(of: BATCH_SIZE) do |relation, index|\n relation.each_batch(of: RANGE_SIZE) do |relation|\n range = relation.pluck('MIN(id)', 'MAX(id)').first\n\n BackgroundMigrationWorker\n .perform_in(index * 2.minutes, MIGRATION, range)\n end\n end\n end",
"def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"running\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"ran (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end",
"def assume_migrated_upto_version(version, migrations_paths = nil)\n unless migrations_paths.nil?\n ActiveSupport::Deprecation.warn(<<~MSG.squish)\n Passing migrations_paths to #assume_migrated_upto_version is deprecated and will be removed in Rails 6.1.\n MSG\n end\n\n version = version.to_i\n sm_table = quote_table_name(schema_migration.table_name)\n\n migrated = migration_context.get_all_versions\n versions = migration_context.migrations.map(&:version)\n\n unless migrated.include?(version)\n execute insert_versions_sql(version.to_s)\n end\n\n inserting = (versions - migrated).select { |v| v < version }\n if inserting.any?\n if (duplicate = inserting.detect { |v| inserting.count(v) > 1 })\n raise \"Duplicate migration #{duplicate}. Please renumber your migrations to resolve the conflict.\"\n end\n\n execute insert_versions_sql(inserting.map(&:to_s))\n end\n end",
"def migrate_is_a_class_method?\n (::ActiveRecord::VERSION::MAJOR <= 3 && ::ActiveRecord::VERSION::MINOR == 0)\n end",
"def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def model_attributes\n super.merge(\n viewmodel: ->(_v) {\n self.schema_version = 2\n migrates from: 1, to: 2 do\n down do |view, refs|\n view.delete('child')\n end\n end\n })\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n Neo4j.ref_node[:_db_version] = nil\n end\n end",
"def Version n\n @last_version = [n, @last_version.to_f].max # Assign or retrieves the last migration version number\n # migrations is a pointer to the instance variable\n migrations = (@migrations ||= [])\n Class.new(ActiveRecord::Migration) do\n singleton_class.send(:define_method, :version) do # def self.version\n n # n\n end # end\n\n # Callback invoked whenever a subclass of the current class is created\n singleton_class.send(:define_method, :inherited) do |s| # def self.inherited subclass\n migrations << s # migrations << subclass\n end # end\n end\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = nil\n end\n end",
"def migrate_database\n # Creating the new database\n ActiveRecord::Base.connection.execute(\"CREATE DATABASE `crowdvoice_installation_#{@new_install.name}`\")\n @default_config ||= ActiveRecord::Base.connection.instance_variable_get(\"@config\").dup\n\n # Connect to new database\n # TODO: Fix server name, shouldn't use the crowdvoice_installation prefix\n ActiveRecord::Base.establish_connection(@default_config.dup.update(:database => \"crowdvoice_installation_#{@new_install.name}\"))\n\n #Migrating database\n\n ActiveRecord::Migrator.migrate(\"db/migrate/\")\n @new_user = @old_user.clone\n @new_user.is_admin = true\n @new_user.save(:validate => false)\n @server_install = Installation.create(:email => @new_user.email, :name => \"crowdvoice-installation-#{@new_install.name}\")\n CustomAttribute.create(\n :name => @new_install.name,\n :logo => @new_install.name,\n :twitter => 'http://twitter.com/intent/tweet?source=webclient&text=Tracking+voices+of+protest+-+http%3A%2F%2Fwww.crowdvoice.org',\n :facebook => 'https://www.facebook.com/sharer.php?t=Tracking+voices+of+protest&u=http%3A%2F%2Fwww.crowdvoice.org',\n :title => @new_install.name,\n :message => \"Modify this message on your admin area!\")\n end"
] | [
"0.80467063",
"0.779476",
"0.6900259",
"0.6781609",
"0.6747884",
"0.6635985",
"0.66356254",
"0.65382075",
"0.6526705",
"0.6520311",
"0.6506896",
"0.64863575",
"0.6481912",
"0.6462839",
"0.6438326",
"0.6438326",
"0.6419203",
"0.6377266",
"0.637397",
"0.63457024",
"0.6300016",
"0.628421",
"0.62701946",
"0.62701946",
"0.626841",
"0.6226744",
"0.621488",
"0.6210993",
"0.6204072",
"0.6194768",
"0.6187894",
"0.6187894",
"0.6187894",
"0.61724705",
"0.61554664",
"0.6148997",
"0.6140761",
"0.6140761",
"0.6140174",
"0.6123415",
"0.6112954",
"0.61078215",
"0.610057",
"0.610057",
"0.6099348",
"0.6064507",
"0.6049911",
"0.6045893",
"0.6045893",
"0.60422117",
"0.6041323",
"0.601127",
"0.6002903",
"0.59776646",
"0.5975888",
"0.5950589",
"0.5946126",
"0.5936352",
"0.59318745",
"0.59290856",
"0.59290856",
"0.59203506",
"0.591727",
"0.5907081",
"0.5904719",
"0.588762",
"0.5874346",
"0.5858307",
"0.5834628",
"0.5829413",
"0.5817601",
"0.5811342",
"0.58036405",
"0.5793261",
"0.5791843",
"0.57726675",
"0.5769451",
"0.57569546",
"0.57535577",
"0.57359236",
"0.57320267",
"0.57249403",
"0.57209307",
"0.5705349",
"0.5697809",
"0.56924593",
"0.5681943",
"0.5661934",
"0.5650736",
"0.5647028",
"0.5646725",
"0.5642403",
"0.5642152",
"0.56372553",
"0.5633171",
"0.562967",
"0.5620887",
"0.5611969",
"0.56073946",
"0.5597466",
"0.5592361"
] | 0.0 | -1 |
Write a value array to multiple pwm ports (or a single port if the param is a hash) | def write(values)
if values.is_a? Hash # TODO: hacky - refactor
fail "wrong hash format, expected the keys 'port' and 'value'" unless values.key?(:port) && values.key?(:value)
write_to_port(values[:port], values[:value])
elsif values.is_a? Array
log.error('more values than configured lamps') && return if values.size > @ports.size
values.map! { |x| x.to_i > 255 ? 255 : x.to_i }
client.pwm_write_registers(start_index: @ports.sort.first, values: values)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_port(port, value)\n value = value.to_i\n @values[port.to_i] = value\n # log.debug \"write bar #{port} value #{value}\"\n client.pwm_write(@ports[port.to_i], value)\n end",
"def pwm(value)\n GPIO.write \"gpio#{@number}/value\", value\n end",
"def ports *ports\n @ports = *ports unless ports.length == 0\n @ports\n end",
"def write_multi(pairs)\n pairs.each do |name,value|\n write(name, value)\n end\n end",
"def write(*args)\n args.each do |a|\n @serial.write a.chr\n end\n end",
"def write_parameter_to_device(id, value)\n @ramps_arduino.execute_command(\"F22 P#{id} V#{value}\", false, false)\n end",
"def runner_output(*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_outputs[name] = send(key)\n end\n end",
"def ports\n # prevent original array from being changed\n @ports.dup\n end",
"def output_port_list\n output_ports.values\n end",
"def write_array(array)\n\t\twrite_byte(10)\n\t\twrite_word32_network(array.length)\n\t\tarray.each do |el| \n\t\t\twrite(el)\n\t\tend\n\tend",
"def write(value, options = {})\n # If an array is written it means a data value and an overlay have been supplied\n # in one go...\n if value.is_a?(Array) && !value.is_a?(BitCollection)\n overlay(value[1])\n value = value[0]\n end\n value = value.data if value.respond_to?('data')\n\n with_lsb0 do\n size.times do |i|\n self[i].write(value[i], options)\n end\n end\n self\n end",
"def add_output_ports(*names)\n create_port(:output, *names)\n end",
"def write(*commands)\n serial_port.write_nonblock(commands.map(&:chr).join)\n end",
"def each_output_port\n return output_ports.enum_for(:each_value) unless block_given?\n output_ports.each_value { |port| yield(port) }\n end",
"def setup\n RPi::GPIO.set_numbering(:board)\n\n if @motor_controller.motors.count == 2\n RPi::GPIO.setup(@pins[:enable_a], as: :output)\n @port_a_pwm = RPi::GPIO::PWM.new(@pins[:enable_a], @pwm_freq)\n @port_a_pwm.start(0)\n RPi::GPIO.setup(@pins[:in1], as: :output)\n RPi::GPIO.setup(@pins[:in2], as: :output)\n RPi::GPIO.setup(@pins[:enable_b], as: :output)\n @port_b_pwm = RPi::GPIO::PWM.new(@pins[:enable_b], @pwm_freq)\n @port_b_pwm.start(0)\n RPi::GPIO.setup(@pins[:in3], as: :output)\n RPi::GPIO.setup(@pins[:in4], as: :output)\n else\n if @pins[:enable_a]\n RPi::GPIO.setup(@pins[:enable_a], as: :output)\n @port_a_pwm = RPi::GPIO::PWM.new(@pins[:enable_a], @pwm_freq)\n @port_a_pwm.start(0)\n RPi::GPIO.setup(@pins[:in1], as: :output)\n RPi::GPIO.setup(@pins[:in2], as: :output)\n elsif @pins[:enable_b]\n RPi::GPIO.setup(@pins[:enable_b], as: :output)\n @port_b_pwm = RPi::GPIO::PWM.new(@pins[:enable_b], @pwm_freq)\n @port_b_pwm.start(0)\n RPi::GPIO.setup(@pins[:in3], as: :output)\n RPi::GPIO.setup(@pins[:in4], as: :output)\n else\n raise \"'#{@motor_controller.name}' has no PWM pin set for #{@motor_controller.type.to_s.upcase}\"\n end\n end\n end",
"def forwardSensorValues\n logger.debug \"This is my params: \"+params[\"data\"][\"temperature\"].to_s\n logger.debug \"This is my params: \"+params[\"data\"][\"temperature\"].to_s\n rp = params[\"data\"][\"temperature\"].to_i + 1\n respond_to do |format|\n format.json {render :json => { :value => rp }.to_json}\n end\n if !@@sockets[params[\"serialPort\"]]\n create_socket(params[\"serialPort\"])\n end\n @@sockets[params[\"serialPort\"]].write(params[\"data\"].to_json)\n end",
"def write(method, data)\n self.send(method.to_sym, convert_to_hash_array(data))\n end",
"def output_pins(nums)\n ar = Array(nums)\n ar.each {|n| output_pin(n)} \n end",
"def pwm(v)\n regdata = @@i2c.read(0x08, 1)\n @@i2c.write([0x08, regdata[0] | (1 << @id)])\n @@i2c.write([@ion, v])\n @@i2c.write([0x08, regdata[0]])\n end",
"def update(value)\n @serial_port.puts value\n end",
"def emit_values(values)\n values.each do |value|\n emit_self(value)\n end\n end",
"def input_port_list\n input_ports.values\n end",
"def []= name, value\n pin = GenericPinMap[name.to_sym]\n raise \"Unknown Pin '#{name}'\" unless pin\n self.send \"#{pin[0]}_write\", pin[1], value\n end",
"def write(*args)\n case args.count\n when 0\n raise ArgumentError, \"missing arguments\"\n when 1\n data = args.first\n else\n data = args\n end\n\n enable do\n case data\n when Numeric\n Rpio.driver.spi_transfer(data)\n when Enumerable\n Rpio.driver.spi_transfer_bytes(data)\n else\n raise ArgumentError, \"#{data.class} is not valid data. Use Numeric or an Enumerable of numbers\"\n end\n end\n end",
"def set_pins(motor, mode = :stop)\n pwm, forward, backward = nil, nil, nil\n if motor.port == :a\n pwm = @port_a_pwm\n forward = @pins[:in1]\n backward = @pins[:in2]\n elsif motor.port == :b\n pwm = @port_b_pwm\n forward = @pins[:in3]\n backward = @pins[:in4]\n end\n\n case mode\n when :stop\n pwm.duty_cycle = 0\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_low(backward)\n when :forward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_high(forward)\n RPi::GPIO.set_low(backward)\n when :backward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_high(backward)\n end\n # log(\"Motor #{motor.port}: POWER: #{motor.power}, PWM: #{pwm.duty_cycle}, forward: #{RPi::GPIO.high?(forward)}, backward: #{RPi::GPIO.high?(backward)}\")\n end",
"def write_parameter_to_device(id, value)\n execute_command(\"F22 P#{id} V#{value}\", false, false)\n end",
"def emit(token_name, data, target_array, ts, te)\n target_array << {:name => token_name.to_sym, :value => data[ts...te].pack(\"c*\") }\nend",
"def write(io)\n @values.each {|el|\n el.write io\n }\n end",
"def outputs\n ports_with_capabilities(:output)\n end",
"def write(file)\n value.each do |item|\n # always write int4 in network order (as per GDSII spec)\n file.write [item].pack('N')\n end\n end",
"def write(value_or_values)\n update(value_or_values)\n\n refresh\n end",
"def set_set_statements(name, action, seqno, value)\n raise ArgumentError, 'value must be an Array' unless value.is_a?(Array)\n\n cmds = [\"route-map #{name} #{action} #{seqno}\"]\n remove_set_statements(name, action, seqno, cmds)\n Array(value).each do |options|\n cmds << \"set #{options}\"\n end\n configure(cmds)\n end",
"def write(p0) end",
"def write(p0) end",
"def write(p0) end",
"def port_names\n (1..port_count).map {|i| \"Te 0/%s\" % i}\n end",
"def ports\n enum_for(:each_port).to_a\n end",
"def write(*data); end",
"def to(*numbers)\n @to.push(*numbers) unless numbers.empty?\n @to\n end",
"def signal(port, val)\n # The derived class needs to implement the value method.\n self.activate\n @inputs[port] = val\n newval = self.value\n if newval != @outval then\n @outval = newval\n @outputs.each { | c | c.signal(newval) }\n end\n self.deactivate\n end",
"def write_to(stream)\n stream.write_int(@my_index)\n stream.write_int(@current_tick)\n stream.write_int(@max_tick_count)\n stream.write_int(@players.length())\n @players.each do |players_element|\n players_element.write_to(stream)\n end\n stream.write_int(@planets.length())\n @planets.each do |planets_element|\n planets_element.write_to(stream)\n end\n stream.write_int(@flying_worker_groups.length())\n @flying_worker_groups.each do |flying_worker_groups_element|\n flying_worker_groups_element.write_to(stream)\n end\n stream.write_int(@max_flying_worker_groups)\n stream.write_int(@max_travel_distance)\n stream.write_int(@logistics_upgrade)\n stream.write_int(@production_upgrade)\n stream.write_int(@combat_upgrade)\n stream.write_int(@max_builders)\n stream.write_int(@building_properties.length())\n @building_properties.each do |building_properties_key, building_properties_value|\n stream.write_int(building_properties_key)\n building_properties_value.write_to(stream)\n end\n stream.write_bool(@specialties_allowed)\n if @view_distance.nil?\n stream.write_bool(false)\n else\n stream.write_bool(true)\n stream.write_int(@view_distance)\n end\n end",
"def register_autofilter_ports(ports=[])\n @autofilter_ports ||= []\n @autofilter_ports << ports\n @autofilter_ports.flatten!\n @autofilter_ports.uniq!\n end",
"def relay(array, data_type)\n array.map(&:\"to_#{data_type}\")\nend",
"def write(bytes)\n @serial_port.write(bytes)\n end",
"def entry_path_to_sw p\n puts \"P = #{p}\"\n p.each do | map |\n sw = map[:dpid]\n out_port = map[:out_port].to_i\n @outPorts[sw] = [] unless @outPorts.key?(sw)\n @outPorts[sw] << out_port unless @outPorts[sw].include?(out_port)\n end\n end",
"def set_values(*items)\r\n items = *items\r\n @value = [nil]\r\n items.each do |item|\r\n @value.push(item)\r\n end\r\n end",
"def digital_write(pin, value)\n port = (pin / 8).floor\n port_value = 0\n\n @pins[pin].value = value\n\n 8.times do |i|\n port_value |= (1 << i) unless @pins[8 * port + i].value.zero?\n end\n\n write(DIGITAL_MESSAGE | port, port_value & 0x7F, (port_value >> 7) & 0x7F)\n end",
"def runner_inout(*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_inouts[name] = send(key)\n end\n end",
"def write_multi(pairs)\n args = []\n pairs.each do |key,value|\n args << key\n args << Oj.dump(value, mode: :compat, time_format: :ruby)\n end\n @redis.mset(*args)\n end",
"def write(value)\n # pass\n end",
"def spidev_out(array)\n Rpio.driver.spidev_out(array)\n end",
"def write \n @histos.each{|h| h.Write}\n end",
"def put_switches(fd)\n @switches.each do |n, s|\n s.ports.each do |k,p|\n if p.remote_switch_name != nil && @switches[p.remote_switch_name] != nil && @switches[p.remote_switch_name].ports[p.port_number] == nil\n #puts \"#{p.remote_switch_name} #{p.port_number} #{p.remote_port_name}\"\n @switches[p.remote_switch_name].ports[p.port_number] = Port.new(p.port_number)\n @switches[p.remote_switch_name].ports[p.port_number].port_name = \"#{p.port_number}/#{p.remote_port_name}\"\n @switches[p.remote_switch_name].ports[p.port_number].remote_switch_name = s.name\n @switches[p.remote_switch_name].ports[p.port_number].remote_port_name = p.port_name\n @switches[p.remote_switch_name].ports[p.port_number].remote_port_number = p.port_number\n @switches[p.remote_switch_name].ports[p.port_number].remote_mac = s.mac\n end\n end\n end\n @switches.each do |n, s|\n fd.puts \"\\\"#{s.name}\\\" [\"\n fd.print \"label = \\\"\"\n out = []\n out << \"<h0> #{s.name}\"\n s.ports.each do |k,p|\n if p.remote_switch_name != nil && @switches[p.remote_switch_name] != nil && p.remote_port_name !~ /MGT[AB]/ && p.port_name !~ /MGT[AB]/\n out << \"<p#{p.port_number}> #{p.port_name}\"\n @links[\"#{s.name}:p#{p.port_number}\"] = \"\\\"#{s.name}\\\":p#{p.port_number} -> \\\"#{p.remote_switch_name}\\\":p#{p.remote_port_number}\" #if @links[\"#{p.remote_switch_name}:p#{p.remote_port_number}\"] == nil\n end\n end\n fd.puts \"#{out.join(' | ')}\\\"\"\n fd.puts \"shape = \\\"record\\\"\\n];\"\n end\n end",
"def pw(val, template)\n write([val].pack(template))\n end",
"def output_port_names\n output_ports.keys\n end",
"def prepare_ports(port_entries)\n ports = []\n\n if port_entries.nil?\n return nil\n end\n\n port_entries.each do |port_entry|\n ports.push(ComposeUtils.format_port(port_entry))\n end\n\n ports\n end",
"def __write_array(ary, io)\n ary.each_with_index do |el, i|\n io.puts \"result__[#{i}] = #{el.subs(@dict)};\"\n end \n end",
"def find_all_output_ports(type, port_name)\n find_all_ports(type,port_name).delete_if { |port| !port.respond_to?(:reader) }\n end",
"def send_dmx(channel, value)\n\n # Write the channel and value in the format for Arduino\n write(\"#{channel}c\")\n write(\"#{value}w\")\n end",
"def write( x )\n Array( x ).each {|e| @head[-1] << e }\n end",
"def write_many(writer, items, options = nil)\n writer.push_array\n items.each do |item|\n write_one(writer, item, options)\n end\n writer.pop\n end",
"def every=(val)\r\n\r\n self.every__index_was = self.every__index\r\n res = Array(val).compact.map{|i|\r\n case i\r\n when nil\r\n nil\r\n when 1..14 # index\r\n i\r\n when *EVERIES\r\n EVERIES.index(i) + 1\r\n when \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\" # index as string\r\n i.to_i\r\n end\r\n }.compact.join(',')\r\n write_attribute(:every, res)\r\nend",
"def each_input_port\n return input_ports.enum_for(:each_value) unless block_given?\n input_ports.each_value { |port| yield(port) }\n end",
"def write(server,msg,*option)\n if(server.nil?)\n @connectors.each_value{|conn|\n conn.write(msg,*option)\n }\n else\n unless(server.instance_of?(Array))\n server=[String(server)]\n end\n server.each{|s|\n if(@connectors.has_key?(s))\n @connectors[s].write(msg,*option)\n end\n }\n end\n end",
"def write(value)\n record.send(\"#{name}_data=\", value)\n end",
"def setalldata(inndata)\n size = @@numpixels * 3 # Number of LED's times the number of colours per LED (3)\n# puts \"size 1 =>\" + size.to_s\n puts \"Set all data to =>\" + inndata.to_s\n @@temp_packetdata = String.new\n @@temp_packetdata = \" \"\n temp = [0]\n @@temp_packetdata[0] = temp.pack(\"C\")\n @@temp_packetdata[1] = temp.pack(\"C\")\n @@temp_packetdata[2] = temp.pack(\"C\")\n packetlen = [size]\n @@temp_packetdata[3] = packetlen.pack(\"C\")\n i = 4\n t = -1\n temp = [inndata,inndata,inndata] \n# temp = [128,128,128] # something is wrong - this is a array\n puts \"Inndata ->\" + temp.inspect\n until t >= (size - 1) do \n t = t + 1\n puts t\n @@temp_packetdata[i + t] = temp.pack(\"C\")\n end\n puts \"Size =>\" + @@temp_packetdata.size.to_s\n puts \"setalldata =>\" + @@temp_packetdata.bytes.to_s\n @@output.print(@@temp_packetdata)\nend",
"def write_commands(list)\n raise 'list must be an array!' unless list.kind_of?(Array)\n\n File.open(nagios_command_file, 'a') do |fh|\n fh.write(list.join(\"\\n\"))\n end\n end",
"def outputParameters\n \ti=0\n \t\twhile i < @parameters.paramsArr.length do\n \t\t\ttemparameter = @parameters.paramsArr[i]\n \t\t\telementlen = temparameter.elementsArr.length\n print \"parameters name :\"\n puts @parameters.paramsArr[i].paramname\n \t\t\tj=0\n print \"value \"\n print \"times \"\n \t\t\twhile j<elementlen.to_i do\n puts \" \"\n \t\t\t\tprint @parameters.paramsArr[i].elementsArr[j].value\n print \" \"\n puts @parameters.paramsArr[i].elementsArr[j].times\n \t\t\t\tj+=1\n \t\t\tend \n \t\t\ti+=1\n \t\tend\n end",
"def write(new_value)\n raise \"#{to_s} cannot be used through Firmata\" if mode == Rufirmata::UNAVAILABLE\n raise \"#{to_s} is set up as an INPUT and therefore cannot be written to\" if mode == Rufirmata::INPUT\n if (new_value != value)\n self.value = new_value\n if mode == Rufirmata::OUTPUT\n port ? port.write() :\n board.write_command(Rufirmata::DIGITAL_MESSAGE, pin_number, value)\n elsif mode == Rufirmata::PWM\n val = (@value * 255).to_i\n board.write_command(Rufirmata::ANALOG_MESSAGE + pin_number, val % 128, val >> 7)\n end\n end\n end",
"def banners_on_ports(*params)\n slurp_stream(\"shodan/ports/#{params.join(\",\")}\") do |data|\n yield data\n end\n end",
"def array2command(dirname, name, data, duration=1)\n\tFile.open(dirname + \"/\" + name + \"_lb.h\", 'w') do |file| \n\t\tsum = 0\n\t\tdata_cum = data.collect do |v, d|\n\t\t\tsum += d \n\t\t\t[v, sum]\n\t\tend\n\t\t\t\n\t\t# GENERATE ARDUINO CPP HEADER FILE\n\t\t\t# last = data.pop\n\t\t\theader(name, file);\n\n\t\t\tfile.write \"\\tLogger *#{name.underscore};\\n\"\n\t\t\tfile.write \"\\tvoid getLog(){\\n\"\n\t\t\tfile.write \"\\t\\t #{name.underscore} = new Logger(#{\"%3.0f\" % data_cum.length}, 0, 255);\\n\"\n\n\t\t\tdata_cum.each do |v, d|\n\t\t\t\tfile.write \"\\t\\t#{name.underscore}->log(#{\"%3.0f\" % v}, #{\"%3.0f\" % d});\\n\"\n\t\t\tend\n\t\t\tfile.write \"\\t}\\n\"\n\t\t\tfooter(name, file);\n\t\t# END HEADER FILE\n\tend\nend",
"def put(values)\n return \"Should have exactly 5 arguments\" unless values.length == 5\n values = values.map(&:to_i)\n @state = @state.zip(values).map{|x| x[0] + x[1]}\n show\n end",
"def write_array(key)\n write_comma\n increment\n indent\n write_key(key)\n write_colon\n end",
"def write(io)\n io.write [@value].pack(format)\n end",
"def entries=(value)\n trace format('entries= %s', value.inspect)\n entries = value.join '\", \"'\n raise 'Array of entries can not be empty' if entries.empty?\n\n entries = format('[\"%s\"]', entries)\n setattr 'entries', entries\n end",
"def relay(array, data_type)\n # Write your code here\n array.map { |d| d.send(\"to_#{data_type}\")}\nend",
"def write\n bytes = []\n @projects.each_slice(NUM_REGISTERS) do |chunk|\n byte = 0\n chunk.each{|p| byte = (byte << 2) | (p.passing? ? PASS_MASK : (p.building? ? BUILD_MASK : FAIL_MASK)) }\n bytes.unshift(byte)\n end\n byte_str = bytes.map{|b| (b ^ 0xFF).chr }.join\n Blinky.log.debug('WRITING BYTES -> %s' % byte_str)\n Blinky.log.debug('WRITING BITS -> %s' % byte_str.unpack('B*'))\n @sp.write(byte_str)\n end",
"def each_aligned_port(&block)\n streams.map { |s| task_model.find_input_port(s.port_name) }.each(&block)\n end",
"def tcp_service_discovery_ports=(ports)\n service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/TCPPortScan')\n service_ports.attributes['mode'] = 'custom'\n service_ports.attributes['method'] = 'syn'\n REXML::XPath.first(service_ports, './portList').text = ports.join(',')\n end",
"def target_array=(targets)\n @target_array = targets\n @ori_targets = targets.clone\n end",
"def update_port(portName, attributes)\n @data['ports'].each do |port|\n next unless port['name'] == portName\n attributes.each { |key, value| port[key.to_s] = value }\n response = @client.rest_put(@data['uri'] + '/ports', 'body' => port)\n @client.response_handler(response)\n end\n end",
"def pattern_indexes=(indexes)\n p_bits = ('0' * step_count)\n indexes.each do |index|\n p_bits[index] = '1'\n end\n self.bits = p_bits.rjust(self.step_count, '0').to_i(2)\n end",
"def each_transform_port(&block)\n if !block\n return enum_for(:each_transform_port)\n end\n each_transform_input(&block)\n each_transform_output(&block)\n end",
"def array_to_wire(args={})\n\t\t\tpkt_array = args[:array] || args[:arr] || @array\n\t\t\tinterval = args[:int] || args[:sleep]\n\t\t\tshow_live = args[:show_live] || args[:live] || @show_live\n\n\t\t\t@stream = Pcap.open_live(@iface,@snaplen,@promisc,@timeout)\n\t\t\tpkt_count = 0\n\t\t\tpkt_array.each do |pkt|\n\t\t\t\[email protected](pkt)\n\t\t\t\tsleep interval if interval\n\t\t\t\tpkt_count +=1\n\t\t\t\tputs \"Sent Packet \\##{pkt_count} (#{pkt.size})\" if show_live\n\t\t\tend\n\t\t\t# Return # of packets sent, array size, and array total size \n\t\t\t[pkt_count, pkt_array.size, pkt_array.join.size]\n\t\tend",
"def sample port=-1\n data = run(:func => \"powerList\", :port => port)\n unless data.key?(\"value\")\n raise \"No data available\"\n end\n\n data[\"value\"].shift\n number = 0\n data[\"value\"].map { |value| MPowerReading.new(number += 1, value) }\n end",
"def datastreams=(array)\n return unless array.is_a?(Array)\n @datastreams = []\n array.each do |datastream|\n if datastream.is_a?(Datastream)\n @datastreams << datastream\n elsif datastream.is_a?(Hash)\n #@datastreams << Datastream.new(datastream)\n @datastreams << XivelyConnector::Datastream.new(:device => self,\n :data => datastream,\n :datapoint_buffer_size => datapoint_buffer_size,\n :only_save_changes => only_save_changes)\n end\n end\n end",
"def write( addr, val )\n row_idx, col_idx = address_to_indices( addr )\n ( row_idx - rows ).times { @data << [] }\n @data[ row_idx-1 ][ col_idx-1 ] = val\n calc_dimensions if row_idx > rows || col_idx > cols\n val\n end",
"def set_array!(values)\n @objects = []\n @memory = FFI::MemoryPointer.new(MsgObject,values.length)\n\n values.each_with_index do |value,index|\n @objects << MsgObject.new_object(value,@memory[index])\n end\n\n self[:type] = :array\n\n array = self[:values][:array]\n array[:size] = values.length\n array[:ptr] = @memory\n end",
"def set(value)\n if (value == 0) || (value == 1)\n IO.write(VALUE % @pin, \"%d\" % value)\n else\n raise \"invalid value #{value.inspect}\"\n end\n end",
"def send_multiple_mode(channel, pre, flag, targets)\n (0...targets.length).step(12) { |i|\n slice = targets[i,12]\n send_raw(MODE, channel, \"#{pre}#{flag*slice.length}\", *slice)\n }\n end",
"def finisher_output(*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_outputs[name] = send(key)\n end\n end",
"def set_port(port, value_mask)\n send_request(FUNCTION_SET_PORT, [port, value_mask], 'k C', 0, '')\n end",
"def make_amps(phase_settings, custom_prg = \"\")\n phase_settings.each_with_index.map { |phase_setting, i|\n if custom_prg.empty?\n vm = Intcode::VM.from_file(\"day7/input.txt\")\n else\n vm = Intcode::VM.from_string(custom_prg)\n end\n vm.name = \"Amp-#{i}\"\n vm.send_input(phase_setting)\n vm\n }\nend",
"def vouts_to_data(vouts)\n vouts.inject('') { |data,vout| data += vout_to_data(vout) }\nend",
"def write(series, tags:, values:)\n data = ::InfluxDB::PointValue.new(series: series, tags: tags, values: values).dump\n logger&.debug(\"Sending data to #{uri}: #{data}\")\n connection.write(data)\n rescue\n disconnect!\n end",
"def connect_thruster_control (port)\n @port = port\n @port.connect_to do |sample, _|\n @window.thruster_1.update(sample.elements[0].raw, \"Thruster 1\")\n @window.thruster_2.update(sample.elements[1].raw, \"Thruster 2\")\n @window.thruster_3.update(sample.elements[2].raw, \"Thruster 3\")\n @window.thruster_4.update(sample.elements[3].raw, \"Thruster 4\")\n end \n \n end",
"def switch_ports\r\n SwitchPortsController.instance\r\n end",
"def orig_servo_setup(num, opts)\n ArduinoPlugin.add_servo_struct\n @servo_pins << num\n refresh = opts[:refresh] ? opts[:refresh] : 200\n min = opts[:min] ? opts[:min] : 700\n max = opts[:min] ? opts[:max] : 2200\n @servo_settings << \"serv[#{num}].pin = #{num}, serv[#{num}].pulseWidth = 0, serv[#{num}].lastPulse = 0, serv[#{num}].startPulse = 0, serv[#{num}].refreshTime = #{refresh}, serv[#{num}].min = #{min}, serv[#{num}].max = #{max} \"\n end",
"def write( message )\n\t\t\t@array << message\n\t\tend",
"def write( message )\n\t\t\t@array << message\n\t\tend"
] | [
"0.7004192",
"0.5874171",
"0.5744025",
"0.5642534",
"0.5557398",
"0.5477633",
"0.5468817",
"0.54197204",
"0.5395847",
"0.53791815",
"0.53435653",
"0.5329575",
"0.53013176",
"0.5265486",
"0.52597994",
"0.5255402",
"0.51564205",
"0.51431113",
"0.5107263",
"0.5103409",
"0.5084731",
"0.5072124",
"0.50604075",
"0.5056559",
"0.5051372",
"0.5049195",
"0.5025058",
"0.50172955",
"0.49476478",
"0.49341267",
"0.48627025",
"0.48559746",
"0.4845901",
"0.4845901",
"0.48451406",
"0.4839281",
"0.483313",
"0.4808814",
"0.48043647",
"0.4804341",
"0.47911254",
"0.47680646",
"0.47651058",
"0.47638068",
"0.47532505",
"0.47479624",
"0.47172517",
"0.47154886",
"0.47152305",
"0.47130376",
"0.4709029",
"0.47030908",
"0.47022948",
"0.46997055",
"0.46906257",
"0.46891358",
"0.46814367",
"0.46572182",
"0.46525472",
"0.46525294",
"0.4638605",
"0.46340126",
"0.4624888",
"0.46172342",
"0.46095955",
"0.46075544",
"0.46055987",
"0.46045423",
"0.46002167",
"0.45912454",
"0.45882726",
"0.4583203",
"0.4577945",
"0.45601824",
"0.4553056",
"0.45457906",
"0.4533141",
"0.45199168",
"0.45192346",
"0.45187572",
"0.45138806",
"0.45129046",
"0.45118058",
"0.44981077",
"0.44928426",
"0.44921166",
"0.44865257",
"0.44861788",
"0.44857907",
"0.44824618",
"0.4481567",
"0.44737783",
"0.44675338",
"0.44660646",
"0.44651225",
"0.4459688",
"0.44555807",
"0.44514292",
"0.44453573",
"0.44453573"
] | 0.7972539 | 0 |
Write a value to a pwm port | def write_to_port(port, value)
value = value.to_i
@values[port.to_i] = value
# log.debug "write bar #{port} value #{value}"
client.pwm_write(@ports[port.to_i], value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pwm(value)\n GPIO.write \"gpio#{@number}/value\", value\n end",
"def pwm(v)\n regdata = @@i2c.read(0x08, 1)\n @@i2c.write([0x08, regdata[0] | (1 << @id)])\n @@i2c.write([@ion, v])\n @@i2c.write([0x08, regdata[0]])\n end",
"def update(value)\n @serial_port.puts value\n end",
"def write(new_value)\n raise \"#{to_s} cannot be used through Firmata\" if mode == Rufirmata::UNAVAILABLE\n raise \"#{to_s} is set up as an INPUT and therefore cannot be written to\" if mode == Rufirmata::INPUT\n if (new_value != value)\n self.value = new_value\n if mode == Rufirmata::OUTPUT\n port ? port.write() :\n board.write_command(Rufirmata::DIGITAL_MESSAGE, pin_number, value)\n elsif mode == Rufirmata::PWM\n val = (@value * 255).to_i\n board.write_command(Rufirmata::ANALOG_MESSAGE + pin_number, val % 128, val >> 7)\n end\n end\n end",
"def write_parameter_to_device(id, value)\n @ramps_arduino.execute_command(\"F22 P#{id} V#{value}\", false, false)\n end",
"def write(values)\n if values.is_a? Hash # TODO: hacky - refactor\n fail \"wrong hash format, expected the keys 'port' and 'value'\" unless values.key?(:port) && values.key?(:value)\n write_to_port(values[:port], values[:value])\n elsif values.is_a? Array\n log.error('more values than configured lamps') && return if values.size > @ports.size\n values.map! { |x| x.to_i > 255 ? 255 : x.to_i }\n client.pwm_write_registers(start_index: @ports.sort.first, values: values)\n end\n end",
"def write pin, value\n if value == 0\n set_int_at(GPCLR0 + PI_BANK(pin), PI_BIT(pin))\n else\n set_int_at(GPSET0 + PI_BANK(pin), PI_BIT(pin))\n end\n end",
"def on\n pwm(0xff)\n end",
"def pwm_set(frequency,on_ratio)\n r=on_ratio.to_i \n \n puts \"pwm #{@gpio} => set to f=#{frequency} pulse=#{r}%\" if @verbose\n async_spawn( \"fast-gpio\",\"pwm\",@gpio.to_s,frequency.to_s,(r < 0 ? 0 : (r > 100 ? 100 : r)).to_s) \n end",
"def on\n GPIO.write \"gpio#{@number}/value\", \"1\"\n end",
"def digital_write(value)\n set_mode('w') unless @mode == 'w'\n\n if value.is_a? Symbol\n value = (value == :high) ? 1 : 0\n end\n\n value = value.to_i\n\n raise StandardError unless ([HIGH, LOW].include? value)\n\n @status = (value == 1) ? 'high' : 'low'\n\n @pin_file.write(value)\n @pin_file.flush\n end",
"def set(value)\n if (value == 0) || (value == 1)\n IO.write(VALUE % @pin, \"%d\" % value)\n else\n raise \"invalid value #{value.inspect}\"\n end\n end",
"def analog_write(pin, value)\n @pins[pin].value = value\n write(ANALOG_MESSAGE | pin, value & 0x7F, (value >> 7) & 0x7F)\n end",
"def write_parameter_to_device(id, value)\n execute_command(\"F22 P#{id} V#{value}\", false, false)\n end",
"def set_pin(val)\n\n @pwm.duty_cycle = val ? @duty_cycle : 0 \n super(val)\n \n end",
"def write(pin, value)\n value ? set(pin) : clear(pin)\n end",
"def digital_write(pin, value)\n port = (pin / 8).floor\n port_value = 0\n\n @pins[pin].value = value\n\n 8.times do |i|\n port_value |= (1 << i) unless @pins[8 * port + i].value.zero?\n end\n\n write(DIGITAL_MESSAGE | port, port_value & 0x7F, (port_value >> 7) & 0x7F)\n end",
"def send_dmx(channel, value)\n\n # Write the channel and value in the format for Arduino\n write(\"#{channel}c\")\n write(\"#{value}w\")\n end",
"def pin_write(command_line)\n HardwareInterface.current.pin_std_set_value(command_line.pin_nr, command_line.pin_value_1, command_line.pin_mode)\n end",
"def write(value)\n # pass\n end",
"def signal(port, val)\n # The derived class needs to implement the value method.\n self.activate\n @inputs[port] = val\n newval = self.value\n if newval != @outval then\n @outval = newval\n @outputs.each { | c | c.signal(newval) }\n end\n self.deactivate\n end",
"def send_param(value)\n begin\n self.device.set_to(value)\n rescue Encoding::CompatibilityError => e\n puts \"Error: #{e}\"\n end\n # Update widget status\n @widget = self.class.find_by_id(self.id)\n @widget.status = value.to_i\n # Send the update to all running sessions\n unless ActionCable.server.logger.nil?\n ActionCable.server.broadcast 'widgets', {type: \"slider\", id: self.id, status: @widget.status}\n end\n end",
"def speed_set _value\n send_cmd(\"speed_set #{_value}\")\n end",
"def servo_std_move(pin, value)\n @ramps_arduino.execute_command(\"F61 P#{pin} V#{value}\", false, @status_debug_msg)\n end",
"def pin_std_set_value(pin, value, mode)\n @ramps_arduino.execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end",
"def switch_on port=-1\n run(:func => \"relayWrite\", :port => port, :value => 1)\n end",
"def servo_std_move(pin, value)\n execute_command(\"F61 P#{pin} V#{value}\", false, @status_debug_msg)\n end",
"def servo_std_move(pin, value)\n start_command(\"F61 P#{pin} V#{value}\", false, @status_debug_msg)\n end",
"def []= name, value\n pin = GenericPinMap[name.to_sym]\n raise \"Unknown Pin '#{name}'\" unless pin\n self.send \"#{pin[0]}_write\", pin[1], value\n end",
"def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on\n\tend",
"def write= w\n @write = (w == 1) ? 1 : 0\n end",
"def command(val)\n # record the valve's command state in the db\n update(cmd: val)\n mode = \"gpio -g mode #{gpio_pin} out\"\n system(mode)\n mode_set = 1\n write = \"gpio -g write #{gpio_pin} #{val}\"\n system(write)\n end",
"def write(val)\n @writer.call(@address, val)\n end",
"def servo_move(degree)\n duty_cycle = 7.5 # Duty cycle is 7.5% (1.5ms), which means position 90 (middle)\n case degree\n when 0\n duty_cycle = 5.0 # Duty cycle 5% (1ms), position 0 (left)\n when 90\n duty_cycle = 7.5 # Duty cycle 7.5% (1.5ms), position 90 (middle)\n when 180\n duty_cycle = 10.0 # Duty cycle 10% (2ms), position 180 (right)\n end\n \n # Set PWM signal to given pulse to go to specific degree.\n $pwm.duty_cycle = duty_cycle\n sleep(1)\nend",
"def clk_write\n \n case @clk_state\n\n when 0\n @address = @mar.content.bin_to_dez\n\n when 1\n @value = @mdr.content\n\n when 2\n @memory[@address] = @value\n\n end\n\n @clk_state += 1\n @clk_state %= 3\n\n end",
"def enable_write port=-1\n run(:func => \"enableWrite\", :port => port, :value => 1)\n end",
"def write(var, val)\r\n begin\r\n @serial.write \"#{var} #{val}\\r\\n\"\r\n puts \"#{var} #{val}\"\r\n rescue StandardError => e\r\n # Ruby does not implement write timeouts, so this exception\r\n # probably will never be raised.\r\n puts \"Cannot write (#{e.to_s}). Aborting.\"\r\n self.close\r\n end\r\n end",
"def set_port_monoflop(port, selection_mask, value_mask, time)\n send_request(FUNCTION_SET_PORT_MONOFLOP, [port, selection_mask, value_mask, time], 'k C C L', 0, '')\n end",
"def set_port(port, value_mask)\n send_request(FUNCTION_SET_PORT, [port, value_mask], 'k C', 0, '')\n end",
"def write_4016(_addr, val)\r\n @out = val & 7\r\n @device.write(@out)\r\n end",
"def value_for_port(number)\n return 0x00 if grounded_port?(number)\n level = @port_level[number]\n level &&= @latch_level[number] if latched_port?(number)\n level ? 0x80 : 0x00\n end",
"def pin_std_set_value(pin, value, mode)\n execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n #execute_command(\"F41 P#{pin} V#{value}\", false, true)\n end",
"def period=(p_value)\n @period = p_value < 1.0 ? p_value : (p_value / 1000.0)\n\n return unless @duty\n\n calc_resistors\n end",
"def pin_std_set_value(pin, value, mode)\n start_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end",
"def put_value aValue, aFormat = nil, aTime = nil, aDelay = VpiNoDelay\n if vpi_get(VpiType, self) == VpiNet\n aDelay = VpiForceFlag\n\n if driver = self.to_a(VpiDriver).find {|d| vpi_get(VpiType, d) != VpiForce}\n warn \"forcing value #{aValue.inspect} onto wire #{self} that is already driven by #{driver.inspect}\"\n end\n end\n\n aFormat =\n if aFormat\n resolve_prop_type(aFormat)\n else\n S_vpi_value.detect_format(aValue) ||\n get_value_wrapper(VpiObjTypeVal).format # let the simulator detect\n end\n\n if aFormat == VpiIntVal\n @size ||= vpi_get(VpiSize, self)\n\n unless @size < INTEGER_BITS\n aFormat = VpiHexStrVal\n aValue = aValue.to_i.to_s(16)\n end\n end\n\n aTime ||= S_vpi_time.new(:type => VpiSimTime, :integer => 0)\n\n wrapper = S_vpi_value.new(:format => aFormat)\n result = wrapper.write(aValue, aFormat)\n\n vpi_put_value(self, wrapper, aTime, aDelay)\n\n result\n end",
"def write!(value = nil)\n @changed = true if value != @value\n @value = value if value\n @ssm.put_parameter(\n name: @name, value: @value, type: @type,\n description: @description, key_id: @key_id, overwrite: @exists,\n # allowed_pattern: \"AllowedPattern\",\n )\n @value\n end",
"def set_pins(motor, mode = :stop)\n pwm, forward, backward = nil, nil, nil\n if motor.port == :a\n pwm = @port_a_pwm\n forward = @pins[:in1]\n backward = @pins[:in2]\n elsif motor.port == :b\n pwm = @port_b_pwm\n forward = @pins[:in3]\n backward = @pins[:in4]\n end\n\n case mode\n when :stop\n pwm.duty_cycle = 0\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_low(backward)\n when :forward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_high(forward)\n RPi::GPIO.set_low(backward)\n when :backward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_high(backward)\n end\n # log(\"Motor #{motor.port}: POWER: #{motor.power}, PWM: #{pwm.duty_cycle}, forward: #{RPi::GPIO.high?(forward)}, backward: #{RPi::GPIO.high?(backward)}\")\n end",
"def write(s)\n @port.write(s)\n sleep(@wait_after_send / 1000.0) if @wait_after_send\n end",
"def write(bytes)\n @serial_port.write(bytes)\n end",
"def set_pin(p, v)\n return if borked?\n cmd = \"#{p.upcase}=#{v}\\r\\n\"\n @sp.write cmd\n end",
"def write!(value = true)\n @write = value\n end",
"def setup\n RPi::GPIO.set_numbering(:board)\n\n if @motor_controller.motors.count == 2\n RPi::GPIO.setup(@pins[:enable_a], as: :output)\n @port_a_pwm = RPi::GPIO::PWM.new(@pins[:enable_a], @pwm_freq)\n @port_a_pwm.start(0)\n RPi::GPIO.setup(@pins[:in1], as: :output)\n RPi::GPIO.setup(@pins[:in2], as: :output)\n RPi::GPIO.setup(@pins[:enable_b], as: :output)\n @port_b_pwm = RPi::GPIO::PWM.new(@pins[:enable_b], @pwm_freq)\n @port_b_pwm.start(0)\n RPi::GPIO.setup(@pins[:in3], as: :output)\n RPi::GPIO.setup(@pins[:in4], as: :output)\n else\n if @pins[:enable_a]\n RPi::GPIO.setup(@pins[:enable_a], as: :output)\n @port_a_pwm = RPi::GPIO::PWM.new(@pins[:enable_a], @pwm_freq)\n @port_a_pwm.start(0)\n RPi::GPIO.setup(@pins[:in1], as: :output)\n RPi::GPIO.setup(@pins[:in2], as: :output)\n elsif @pins[:enable_b]\n RPi::GPIO.setup(@pins[:enable_b], as: :output)\n @port_b_pwm = RPi::GPIO::PWM.new(@pins[:enable_b], @pwm_freq)\n @port_b_pwm.start(0)\n RPi::GPIO.setup(@pins[:in3], as: :output)\n RPi::GPIO.setup(@pins[:in4], as: :output)\n else\n raise \"'#{@motor_controller.name}' has no PWM pin set for #{@motor_controller.type.to_s.upcase}\"\n end\n end\n end",
"def write(val)\n @file.seek(@address)\n @file.putc(val)\n @file.flush\n end",
"def send_pulse\n puts 'DEBUG: send_pulse'\n set_intensity :high\n sleep 0.4\n set_intensity :off\n end",
"def write(value)\n record.send(\"#{name}_data=\", value)\n end",
"def set(pin)\n Native.gpio_set(pin)\n end",
"def on!\n digital_write(:high)\n end",
"def set(value)\n @read.close\n @write.write value\n end",
"def react_port(port, energy)\n #\n try_vlog { |io| io.puts react_s(\"Rp=\", energy, port.id, port) }\n end",
"def setSpeed(value)\r\n @speed = value\r\n end",
"def write_attribute(name, value)\n run_callbacks(:before_update)\n @attributes[name] = fields[name].set(value)\n run_callbacks(:after_update)\n notify\n end",
"def output(pin)\n Native.gpio_function(pin, Native::GPIO_FSEL_OUTP)\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def write(value)\n update_buffer(value)\n\n render\n\n self\n end",
"def pin_std_pulse(pin, value1, value2, time, mode)\n execute_command(\"F44 P#{pin} V#{value1} W#{value2} T#{time} M#{mode}\", false, @status_debug_msg) \n end",
"def value_set_pin(pin, value)\n\n # Validate the pin\n pin_ = ValidatePin.new pin\n return pin_.error_message unless pin_.valid?\n\n # Set the value after translating to gpio\n value_set_gpio pin_.to_gpio, value\n end",
"def set_number_of_wheels(value)\n puts \"hello\"\n end",
"def as(dir=:out)\n @direction = dir.to_s\n GPIO.write \"gpio#{@number}/direction\", @direction\n end",
"def putc(c)\n @port.write(c)\n sleep(@wait_after_send / 1000.0) if @wait_after_send\n end",
"def set_power(watts)\n puts \"Setting Watts to #{watts.to_i} watts\" if $verbose\n w='PC'+(('000'+watts.to_i.to_s)[-3..-1])+';'\n puts w if $verbose\n ret=send_cmd(w,'PC;',w,0.25,1.0,3)\n if(ret)\n return(ret.gsub(/^PC/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def write(p0) end",
"def write(p0) end",
"def write(p0) end",
"def poweron(s, level)\n sleep 0.1\n s.puts \"PD#{level.to_i()};\"\nend",
"def RTS=(value)",
"def write(key, value)\n perform_update(:write, key, value.to_s)\n end",
"def set_value(number)\n @value = offset + (number.to_i - offset) % cycle\n value\n end",
"def value_set_gpio(gpio, value)\n\n # Validate the gpio\n gpio_ = ValidateGpio.new gpio\n return gpio_.error_message unless gpio_.valid?\n\n # Validate the value\n value_ = ValidateValue.new value\n return value_.error_message unless value_.valid?\n\n # Send the command and if no error return an OK result\n result = UdooNeoRest::Base.echo value, \"#{BASE_PATH}gpio#{gpio}/value\"\n return UdooNeoRest::Base.status_ok if result.empty?\n\n # Check for a common error and provide some advice\n if result =~ /not permitted/\n return UdooNeoRest::Base.status_error('Operation not permitted error occurred. Has the gpio been set to output mode?')\n end\n\n # Otherwise just return the error\n UdooNeoRest::Base.status_error result\n end",
"def mute _value=0\n send_cmd(\"mute #{_value}\")\n end",
"def react_port(port, energy)\n super(port, energy)\n emit(OUTPUT_ID, @state ? energy : emit_energy_null)\n state_depress if state_pressed?\n end",
"def pin_std_pulse(pin, value1, value2, time, mode)\n @ramps_arduino.execute_command(\"F44 P#{pin} V#{value1} W#{value2} T#{time} M#{mode}\", false, @status_debug_msg)\n end",
"def send(inc)\n @h.usb_control_msg(0x21, 0x09, 0x02, 0x01, (message_base << inc).bytes_to_string, 0)\n end",
"def set_value(event, value)\n\t @timepoints << [event, :set_value, value]\n\tend",
"def pitch_bend( channel, value )\n message( PB | channel, value )\n end",
"def ramp(value=nil)\n if value\n @ramp = value\n sync\n end\n @ramp\n end",
"def off\n GPIO.write \"gpio#{@number}/value\", \"0\"\n end",
"def set_pin(val)\n @on = val\n end",
"def run\n loop do\n new_value = @serial_port.gets\n unless (@value == new_value) \n @value = new_value\n changed\n notify_observers(@value) \n end\n end\n end",
"def pin_std_pulse(pin, value1, value2, time, mode)\n start_command(\"F44 P#{pin} V#{value1} W#{value2} T#{time} M#{mode}\", false, @status_debug_msg) \n end",
"def brightness _value, _abs=0\n send_cmd(\"brightness #{_value} #{_abs}\")\n end",
"def write(value, timestamp = Time.now, direct: false)\n ensure_type_available\n value = Typelib.from_ruby(value, type)\n do_write(@orocos_type_name, value, direct: direct)\n log_value(value, timestamp)\n value\n end",
"def write_dp(reg_or_val, options = {})\n write(0, reg_or_val, options)\n end",
"def set_pulse_on_pin(pin)\n @board.digital_write(pin, Firmata::Board::HIGH)\n sleep @sleep_after_pin_set\n @board.digital_write(pin, Firmata::Board::LOW)\n sleep @sleep_after_pin_set\n end",
"def set_port_configuration(port, selection_mask, direction, value)\n send_request(FUNCTION_SET_PORT_CONFIGURATION, [port, selection_mask, direction, value], 'k C k ?', 0, '')\n end",
"def []=( num, value )\n closed!\n if (num < 0 || num >= @leds.length)\n raise IndexError, \"index #{num} is outside of LED range: 0...#{@leds.length-1}\"\n end\n @leds[num] = to_color(value)\n end",
"def power=(value)\r\n raise ArgumentError, 'Value must be [0..100]' unless (0..100).include?(value)\r\n @access = flags + (value << 26)\r\n end",
"def write_int(value) \n @codegen.write_int(value)\n end",
"def save_pin_value(pin_id, pin_val)\n @bot_dbaccess.write_measuements(pin_val, @external_info)\n end",
"def send! count = @code_send_repeats\n usb_send_pulse_code(wValue: count)\n end"
] | [
"0.87874556",
"0.76924926",
"0.70983934",
"0.7093962",
"0.69010884",
"0.67103577",
"0.6678591",
"0.6648178",
"0.6571475",
"0.6500164",
"0.6472061",
"0.64682066",
"0.64077723",
"0.6370701",
"0.62217563",
"0.61374813",
"0.6110579",
"0.6110504",
"0.60622525",
"0.60194933",
"0.5957346",
"0.5947679",
"0.5920723",
"0.5880493",
"0.5819987",
"0.5754146",
"0.5738371",
"0.57067543",
"0.5706593",
"0.56843084",
"0.56680465",
"0.5664523",
"0.5632",
"0.56156826",
"0.5541173",
"0.5530074",
"0.5528643",
"0.55276257",
"0.5505023",
"0.5496415",
"0.549082",
"0.5484882",
"0.548422",
"0.5479565",
"0.54596084",
"0.54565364",
"0.54314584",
"0.53885627",
"0.53879786",
"0.53866667",
"0.53833055",
"0.53368604",
"0.5333203",
"0.5317401",
"0.52944034",
"0.52923936",
"0.5291647",
"0.5282193",
"0.5278399",
"0.5275128",
"0.52726567",
"0.5272518",
"0.5269257",
"0.5269257",
"0.5264505",
"0.52638394",
"0.5258945",
"0.5254481",
"0.5246168",
"0.5242367",
"0.52226835",
"0.5213563",
"0.5213277",
"0.5213277",
"0.5213256",
"0.519149",
"0.5188653",
"0.5171902",
"0.5162677",
"0.51578003",
"0.51574755",
"0.51408935",
"0.51395714",
"0.5131028",
"0.5128948",
"0.51278853",
"0.5126845",
"0.5125828",
"0.5120835",
"0.5106993",
"0.5099748",
"0.5098099",
"0.509109",
"0.5079288",
"0.5072476",
"0.5065221",
"0.50597376",
"0.50585675",
"0.5056232",
"0.50552243"
] | 0.8472275 | 1 |
GET /days/1 GET /days/1.xml | def show
@trip = Trip.find(params[:trip_id])
@day = Day.find(params[:id])
@unit_system = current_user ? current_user.unit_system : "IMPERIAL"
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @day }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@directory = Directory.find(params[:id])\n\t\t@days = params[:days].blank? ? 31 : params[:days].to_i\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @directory }\n\t\tend\n\tend",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end",
"def show\n @the_day = TheDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @the_day }\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def show\n @user_day = UserDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_day }\n end\n end",
"def days()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Days::DaysRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end",
"def daily\n object # Initializing to make sure that the passed in day is\n # acceptable. Else a 404 will be raised.\n render :template => \"weekly_digests/show\"\n rescue ActiveRecord::RecordNotFound\n rescue_404\n end",
"def show\n @commission_day = CommissionDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def loadDays(url,days,limit)\n \n previsoes ||= requestXml(url)\n \n previsoes.xpath('//cidade/previsao').each do |previsao|\n \n days << assign(previsao) if days.size < limit \n \n end\n \n days\n \n end",
"def load_daily\n response = HTTParty.get(DAILY_URI, format: :xml)\n load(response['Envelope']['Cube']['Cube'])\n end",
"def show\n @bday = Bday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bday }\n end\n end",
"def days(qtdDays)\n \n days = Array.new\n \n urlPadrao = \"http://servicos.cptec.inpe.br/XML/cidade/7dias/#{@codCity}/previsao.xml\"\n \n urlEstendida = \"http://servicos.cptec.inpe.br/XML/cidade/#{@codCity}/estendida.xml\"\n \n loadDays(urlPadrao,days,qtdDays)\n \n if(qtdDays > 4)\n \n loadDays(urlEstendida,days,qtdDays)\n \n end\n \n days\n \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 index\n\t\t@directories = Directory.where(\"status_flag='Y'\").order(\"position,path\")\n\t\t@directories_status_n = Directory.where(\"status_flag='N'\").order(\"position ASC, path ASC\")\n\t\t@days = params[:days].blank? ? 31 : params[:days].to_i\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @directories }\n\t\tend\n\tend",
"def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def show\n @availability_day = AvailabilityDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @availability_day }\n end\n end",
"def index\n @days = Day.all\n end",
"def show\n @vehicle_daily = VehicleDaily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end",
"def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def show\n respond_to do |format|\n format.html do\n @date = Date.parse(params[:date]) rescue Date.today\n @date = Date.today if [email protected]_gregorian_date?\n\n raise ActiveRecord::RecordNotFound if params[:date].present? && [email protected]_items.date_in_range?(@date)\n\n @calendar_items = @calendar.calendar_items.find_all_for_month_of(@date).group_by { |ci| ci.start_time.mday }\n end\n format.any(:rss, :atom) do\n @calendar_items = @calendar.calendar_items.accessible.all(:include => :node, :order => 'start_time', :conditions => [ 'nodes.ancestry = ? ', @calendar.node.child_ancestry ])\n render :layout => false\n end\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @workday = Workday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workday }\n end\n end",
"def show\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def show\n @dailyreport = Dailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end",
"def day()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Day::DayRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def show\n \t@conference = Conference.find(params[:conference_id])\n @day = Day.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @day }\n end\n end",
"def new\n @trip = Trip.find(params[:trip_id])\n @prev_day = @trip.days[-1]\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def day\n\t\t@date = convert_to_date(params[:date])\n\t\tif [email protected]?\n\t\t\t# if making pdf, get all events\n\t\t\tif params[:format] == \"pdf\"\n\t\t\t @events = Event.find_by_date(params[:date])\n\t\t\telse\n\t\t\t @events = Event.find_by_date(params[:date],true,params[:page])\n\t\t\tend\n\t\tend\n\n\t respond_to do |format|\n\t format.html # day.html.erb\n\t format.js\n\t format.json { render :json => @events }\n format.pdf {\n html = render_to_string(:layout => \"pdf.html.erb\" , :action => \"day.html.erb\", :formats => [:html], :handler => [:erb])\n kit = PDFKit.new(html)\n \tkit.stylesheets << get_stylesheet\n filename = clean_string(Utf8Converter.convert_ka_to_en(\"#{I18n.t('events.day.title', :date => l(@date, :format => :short))}\"))\n send_data(kit.to_pdf, :filename => \"#{filename}.pdf\", :type => 'application/pdf')\n return # to avoid double render call\n }\n end\n end",
"def show\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @days_since_visit }\n end\n end",
"def list_days\n puts \"This Week's Forecast:\"\n\n Scraper.scrape_cast \n\n days = Project1::Forecast.all\n days.map.with_index(1) do |day, i|\n puts \"#{i}. #{day.name}\"\n end\n end",
"def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end",
"def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end",
"def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end",
"def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"def calendar\n get '/gtfs/calendar'\n end",
"def index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end",
"def new\n @user_day = UserDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_day }\n end\n end",
"def day\n @yoga_sessions = YogaSession.on_day params[:day]\n respond_with @yoga_sessions\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 show\n @countdown = Countdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def find_by_date\r\n date = params[:year] + \"-\" + params[:month] + \"-\" + params[:day]\r\n @transfers = Transfer.find(:all, :conditions => [\"server_date =?\", date])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end",
"def show\n @viewdate = Viewdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viewdate }\n end\n end",
"def index\n @days = current_user.days.paginate(page: params[:page], per_page: 7)\n end",
"def daily_events_for_id(id, action, date = default_date_range)\n additional_params = {\n flat: 1,\n label: \"#{id} - #{action}\"\n }\n response = api_params('Events.getName', 'day', date, additional_params)\n results_array(response, 'nb_events')\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @viewdates = Viewdate.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @viewdates }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def index\n @date = params[:date].present? ? Date.parse(params[:date]) : Date.today\n beginning_of_day, end_of_day = @date.beginning_of_day, @date.end_of_day\n @feats = @person.feats.all(\n :include => :activity, \n :conditions => [\"activities.start_time > ? and activities.start_time < ?\", beginning_of_day, end_of_day])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end",
"def show\n @day_list = DayList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day_list }\n end\n end",
"def get_forecast_data\n result = RestClient.get(request_url)\n @xml = REXML::Document.new(result)\n end",
"def network_days()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::NetworkDays::NetworkDaysRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end",
"def show\n @date_break = DateBreak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @date_break }\n end\n end",
"def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end",
"def index\n @tournament_days = TournamentDay.all(:include => :tournament)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournament_days }\n end\n end",
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def get_word_of_the_day_lists_for_date(date, *args)\n http_method = :get\n path = '/words/wordOfTheDayLists/{date}'\n path.sub!('{date}', date.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\n @calendario = Calendario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def new\n @bday = Bday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bday }\n end\n end",
"def index\n @entries = Entry.order(\"created_at DESC\").includes(:user)\n @days_left = ( Date.new( 2013, 06, 23 ) - Date.today ).to_i\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @dinings = Dining.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dinings }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend",
"def create_uri\n \"http://www.wunderground.com/\" +\n \"weatherstation/WXDailyHistory.asp?\" + \n \"ID=#{weather_station.callsign}&\" +\n \"graphspan=month&\" + \n \"month=#{start_time.month}&day=1&year=#{start_time.year}\" +\n \"&format=1\"\n end",
"def xml\n xml = Builder::XmlMarkup.new(indent: 2)\n\n xml.instruct! :xml, encoding: 'UTF-8'\n xml.rss version: '2.0' do |rss|\n rss.channel do |channel|\n channel.title 'Haxpressen'\n\n last_ten_days.each do |day|\n summary = summary_for day\n\n if summary.present?\n channel.item do |item|\n item.title \"Sammanfattning för #{day}\"\n item.pubDate day\n item.description summary\n end\n end\n end\n end\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to(conference_days_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @availability_day = AvailabilityDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @availability_day }\n end\n end",
"def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end",
"def check_rest_days\n\n\t\temp=Employee.find(employee_id)\n\t\tcalendar=Calendar.where(:department_id => emp.department_id,:anio => Date.parse(desde.to_s).year.to_i).first\n if !calendar.nil?\n\n \t\tdias_requested=weekdays_in_date_range(desde..hasta,calendar)\n \t\trt=RequestType.find(request_type_id)\n \t\tdias=0\n \t\t#get all requests from employee\n requests=Request.joins(:request_type).where(:employee_id => employee_id,status: [1,2],:request_type_id => request_type_id).where('extract(year from desde)= ?',\"#{desde.year.to_i}\")\n\n \t #working days requested.\n \t requests.each do |rq| \n \t dias+=weekdays_in_date_range(rq.desde..rq.hasta,calendar)\n \t end\n\n \t #get rest days\n \t num_dias_max=Request.rest_days(desde.year.to_i,employee_id,rt.num_dias_max)\n\n \t if dias_requested>(num_dias_max-dias)\n \t errors.add(:desde,\"Debe seleccionar un periodo igual o inferior a los días restantes. (#{(num_dias_max-dias)} dias)\")\n \t end\n end\n\tend",
"def episode_daily_report show_id, episode_id, date_range, format\n \n params = {\n :show_id => show_id,\n :date_range => date_range,\n :id => episode_id,\n :format => format\n }\n \n response = connection.do_get(construct_url(\"analytics\", \"request_episode_daily_report\"), params)\n \n # Convert to a hash\n return parse_token_response(response)\n end",
"def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end",
"def show\n @day_week = DayWeek.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @day_week }\n end\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forecast }\n end\n end",
"def index\n #@course = Course.find(params[:course_id])\n @course_days = Course.find(params[:course_id]).course_days\n end",
"def show\n @deadline = Deadline.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deadline }\n end\n end",
"def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end",
"def show\n @weekday = Weekday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weekday }\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 \t@conference = Conference.find(params[:conference_id])\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end",
"def show\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inpatientdailyreport }\n end\n end",
"def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def index\n @wednesdays = Wednesday.all\n end",
"def show\n @menu_calendar = MenuCalendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def get_remaining_days(view_id, sprint_id)\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/gadgets/sprints/remainingdays?rapidViewId=#{view_id}&sprintId=#{sprint_id}\")\n\tresponse = http.request(request)\n\tJSON.parse(response.body)\nend",
"def index\n @reading_weeks = ReadingWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reading_weeks }\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end",
"def index\n @subways = Subway.find(:all, :order => \"day, hour\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subways }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datetime }\n end\n end",
"def show\n @tour_date = TourDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tour_date }\n end\n end",
"def show\n @tour_date = TourDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tour_date }\n end\n end"
] | [
"0.6683263",
"0.6506859",
"0.6258706",
"0.61942285",
"0.6165048",
"0.6161881",
"0.6141359",
"0.6044935",
"0.60158896",
"0.5989748",
"0.5987863",
"0.59637064",
"0.5928411",
"0.58782166",
"0.5869498",
"0.58694786",
"0.5866582",
"0.58652276",
"0.5859573",
"0.58589494",
"0.58333945",
"0.58138824",
"0.5792235",
"0.5789458",
"0.5783608",
"0.5777551",
"0.5776858",
"0.57629687",
"0.5758609",
"0.5706449",
"0.5682373",
"0.5672151",
"0.56580704",
"0.5656244",
"0.56535244",
"0.56492084",
"0.56437224",
"0.56397074",
"0.5634355",
"0.5617049",
"0.56133795",
"0.56081414",
"0.5590009",
"0.55858064",
"0.55773807",
"0.55770785",
"0.55697113",
"0.5542409",
"0.5534741",
"0.55274653",
"0.55234045",
"0.5515905",
"0.5510915",
"0.55071723",
"0.5491437",
"0.54876316",
"0.5483122",
"0.5470163",
"0.5464929",
"0.54429984",
"0.5440109",
"0.54391074",
"0.5428983",
"0.5412292",
"0.5408398",
"0.5408398",
"0.5383948",
"0.5378454",
"0.5378288",
"0.5374438",
"0.5370616",
"0.53658164",
"0.5354712",
"0.53431094",
"0.5340229",
"0.5327165",
"0.53256387",
"0.5324539",
"0.5322924",
"0.53202194",
"0.53190005",
"0.53157336",
"0.5309665",
"0.5306856",
"0.5298283",
"0.52892816",
"0.5286042",
"0.5283298",
"0.5283031",
"0.52778673",
"0.52708304",
"0.52682203",
"0.5268101",
"0.5267902",
"0.5267264",
"0.5262517",
"0.5261812",
"0.52615964",
"0.5257645",
"0.52478975",
"0.52478975"
] | 0.0 | -1 |
GET /days/new GET /days/new.xml | def new
@trip = Trip.find(params[:trip_id])
@prev_day = @trip.days[-1]
@day = Day.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @day }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @user_day = UserDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_day }\n end\n end",
"def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def new\n @bday = Bday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bday }\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def new\n @availability_day = AvailabilityDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @availability_day }\n end\n end",
"def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def new\n \t@conference = Conference.find(params[:conference_id])\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\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 @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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @potd = Potd.new\n @action = \"Create\"\n @active_school_day = SchoolDay.find(params[:day]) unless params[:day].nil? || params[:day].empty?\n load_prev_and_next_day\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potd }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @countdown = Countdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def set_new_day\n @new_day = NewDay.find(params[:id])\n end",
"def new\n @day_list = DayList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @day_list }\n end\n end",
"def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end",
"def new\n #@day = current_user.days.build\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @day }\n end\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def new\n @dining = Dining.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dining }\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 @day_week = DayWeek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @day_week }\n end\n end",
"def new\n @viewdate = Viewdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @viewdate }\n end\n end",
"def new\n @todo = Todo.new\n @active_school_day = SchoolDay.find(params[:day]) unless params[:day].nil? || params[:day].empty?\n load_prev_and_next_day\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @weekday = Weekday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weekday }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @dayoff = Dayoff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dayoff }\n end\n end",
"def new\n @diet = Diet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diet }\n end\n end",
"def new\n @days_since_visit = DaysSinceVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @days_since_visit }\n end\n end",
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @food }\n end\n end",
"def new\n @daytype = Daytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytype }\n end\n end",
"def new\n @closing_day = ClosingDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closing_day }\n end\n end",
"def new\n @daytime = Daytime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytime }\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 @workday = Workday.new\n 2.times do\n @workday.periods.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workday }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\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 @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @tournaments = Tournament.all\n @tournament_day = TournamentDay.new\n\n respond_to do |format|\n format.html # new.rb\n format.xml { render :xml => @tournament_day }\n end\n end",
"def new\n @calendario_entrega = CalendarioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @saved_food = SavedFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saved_food }\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 @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 @derivative = Derivative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @derivative }\n end\n end",
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new\n @day = params[:day].to_i\n @month = params[:month].to_i\n @year = params[:year].to_i\n @date = @day.to_s + \" \" + Date::MONTHNAMES[@month] + \" \" + @year.to_s\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 @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end",
"def new\n @todos = Todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todos }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @diaper_change = DiaperChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diaper_change }\n end\n end",
"def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def new\n @date_break = DateBreak.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @date_break }\n end\n end",
"def new\n @holidaymaster = Holidaymaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holidaymaster }\n end\n end",
"def new\n @menu_calendar = MenuCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end",
"def new\n @period = Period.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @period }\n end\n end",
"def new\n @calendar_event = CalendarEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar_event }\n end\n end",
"def new\n @datetime = Datetime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datetime }\n end\n end",
"def create\n @the_day = TheDay.new(params[:the_day])\n\n respond_to do |format|\n if @the_day.save\n format.html { redirect_to(@the_day, :notice => 'The day was successfully created.') }\n format.xml { render :xml => @the_day, :status => :created, :location => @the_day }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @the_day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\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 new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\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 @track_calendar = TrackCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_calendar }\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 @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 @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @meal }\n end\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end",
"def new\n @calification = Calification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calification }\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 @etd = Etd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etd }\n end\n end",
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\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 respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def new\n @reading_week = ReadingWeek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reading_week }\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 = 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 @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end",
"def new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end",
"def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finish }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end"
] | [
"0.7310398",
"0.69277835",
"0.6785754",
"0.67822",
"0.6775603",
"0.6694091",
"0.65848374",
"0.65452087",
"0.64741373",
"0.64677095",
"0.6448222",
"0.64481646",
"0.64406395",
"0.63979113",
"0.63979113",
"0.63979113",
"0.63979113",
"0.63979113",
"0.6370935",
"0.63697785",
"0.6355807",
"0.63483286",
"0.63240254",
"0.6304117",
"0.62972516",
"0.62935627",
"0.6289732",
"0.62841815",
"0.62744015",
"0.6273603",
"0.6262691",
"0.6256548",
"0.6256165",
"0.6243159",
"0.6224822",
"0.6222044",
"0.6213024",
"0.61898005",
"0.618721",
"0.61868227",
"0.6180221",
"0.6162027",
"0.6161248",
"0.61520475",
"0.6144073",
"0.6133845",
"0.61323875",
"0.61306036",
"0.61248344",
"0.6118711",
"0.6107947",
"0.61073893",
"0.6105942",
"0.6086227",
"0.6085116",
"0.6085116",
"0.6085116",
"0.6084658",
"0.60784143",
"0.6074753",
"0.606485",
"0.6059989",
"0.6059921",
"0.60580134",
"0.60571516",
"0.60530406",
"0.60463613",
"0.60452884",
"0.6042169",
"0.6033883",
"0.60338026",
"0.60250705",
"0.60205835",
"0.60155463",
"0.6015473",
"0.6006383",
"0.6006383",
"0.600628",
"0.60027546",
"0.6000869",
"0.5997402",
"0.5996386",
"0.59943885",
"0.5992355",
"0.5991707",
"0.5980713",
"0.5974878",
"0.5972258",
"0.59676605",
"0.5967532",
"0.59643793",
"0.59642327",
"0.59630483",
"0.5961091",
"0.59603363",
"0.5958153",
"0.5957055",
"0.59562194",
"0.5952371",
"0.59516007"
] | 0.70595556 | 1 |
PUT /days/1 PUT /days/1.xml | def update
@trip = Trip.find(params[:trip_id])
@day = Day.find(params[:id])
@day.assign(params[:day])
respond_to do |format|
if @day.save
format.html { redirect_to(trip_day_path(@trip, @day), :notice => 'Day was successfully updated.') }
format.xml { head :ok }
else
format.html { redirect_to(edit_trip_day_path(@trip, @day)) }
format.xml { render :xml => @day.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n offset = -1\n @trip.days.all.each do |day|\n offset += 1\n day.update_attribute(:date, @trip.beginning + offset)\n end\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @day = Day.find(params[:id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day])\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @the_day = TheDay.find(params[:id])\n\n respond_to do |format|\n if @the_day.update_attributes(params[:the_day])\n format.html { redirect_to(@the_day, :notice => 'The day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @the_day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n format.json { render :show, status: :ok, location: @day }\n else\n format.html { render :edit }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to days_path, notice: 'Day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @availability_day = AvailabilityDay.find(params[:id])\n\n respond_to do |format|\n if @availability_day.update_attributes(params[:availability_day])\n format.html { redirect_to(@availability_day, :notice => 'Availability day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @availability_day.errors, :status => :unprocessable_entity }\n end\n end\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 @commission_day = CommissionDay.find(params[:id])\n\n respond_to do |format|\n if @commission_day.update_attributes(params[:commission_day])\n format.html { redirect_to(@commission_day, :notice => 'CommissionDay was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @commission_day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n \t@conference = Conference.find(params[:conference_id])\n @day = Day.find(params[:id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day])\n format.html { redirect_to(conference_day_url, :notice => 'Day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end",
"def update\n @workday = Workday.find(params[:id])\n respond_to do |format|\n if @workday.update_attributes(params[:workday])\n format.html { redirect_to(@workday, :notice => 'Workday was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workday.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n if @work_day.update_attributes(params[:work_day])\n format.html { redirect_to(@work_day, :notice => 'Work day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @work_day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bday = Bday.find(params[:id])\n\n respond_to do |format|\n if @bday.update_attributes(params[:bday])\n format.html { redirect_to(@bday, :notice => 'Bday was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bday.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n if @days_since_visit.update_attributes(params[:days_since_visit])\n format.html { redirect_to @days_since_visit, :notice => 'Days since visit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @days_since_visit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @weekday = Weekday.find(params[:id])\n\n respond_to do |format|\n if @weekday.update_attributes(params[:weekday])\n format.html { redirect_to @weekday, notice: 'Weekday was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weekday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n if @dayoff.update_attributes(params[:dayoff])\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tournament_day = TournamentDay.find(params[:id])\n\n respond_to do |format|\n if @tournament_day.update_attributes(params[:tournament_day])\n flash[:notice] = 'TournamentDay was successfully updated.'\n format.html { redirect_to(@tournament_day) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tournament_day.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_day\n trip = Trip.find(params[:id])\n offset = 0\n trip.days.all.each do |day|\n offset += 1\n end\n @day = Day.new({\"date\" => trip.beginning + offset , \"trip\" => trip})\n trip.update_attribute(:duration, trip.attributes['duration'] + 1)\n trip.save\n respond_to do |format|\n if @day.save\n format.html { redirect_to trip, notice: 'Day was successfully created.' }\n format.json { render :show, status: :created, location: @day }\n else\n format.html { render home_path }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @day_week = DayWeek.find(params[:id])\n\n respond_to do |format|\n if @day_week.update_attributes(params[:day_week])\n format.html { redirect_to @day_week, :notice => 'Dia da semana atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @day_week.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_day.update(event_day_params)\n format.html { redirect_to events_path, notice: 'Event day was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_day }\n else\n format.html { render :edit }\n format.json { render json: @event_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n if @daytime.update_attributes(params[:daytime])\n format.html { redirect_to @daytime, notice: 'Daytime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\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 update\n @log = Log.create(:user_id => params[:uid], :action => 'update') \n @fridge_food = FridgeFood.find(params[:id])\n\n exp = Time.parse(\"#{params[:day]}/#{params[:month]}/#{params[:year]}\")\n \n @fridge_food.update_attributes(:desc => params[:desc], :expiration => exp)\n @fridge_food.save! \n \n redirect_to @fridge_food \n #respond_to do |format|\n # format.html { render :inline => \"\" + state }\n # format.xml { render :xml => @fridge_food }\n #end\n end",
"def update\n respond_to do |format|\n if @elective_day.update(elective_day_params)\n format.html { redirect_to 'index', notice: 'Elective day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @elective_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def update\n @day = DayAvailability.find(params[:id])\n @week = WeekAvailability.find(params[:week_availability_id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day_availability])\n format.html {redirect_to @week, notice: 'Successfully updated schedule.'}\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n params.permit!\n @vehicle_daily = VehicleDaily.find(params[:id])\n\n respond_to do |format|\n if @vehicle_daily.update_attributes(params[:vehicle_daily])\n format.html { redirect_to(@vehicle_daily, :notice => 'Vehicle daily was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle_daily.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @theory_day.update(theory_day_params)\n format.html { redirect_to @theory_day, notice: 'Theory day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theory_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n if @daily_exercise.update_attributes(params[:daily_exercise])\n format.html { redirect_to @daily_exercise, notice: 'Daily exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n if @closing_day.update_attributes(params[:closing_day])\n format.html { redirect_to @closing_day, notice: 'Closing day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @closing_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n if @daytype.update_attributes(params[:daytype])\n format.html { redirect_to @daytype, notice: 'Daytype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @off_day.update(off_day_params)\n format.html { redirect_to @off_day, notice: 'Off day was successfully updated.' }\n format.json { render :show, status: :ok, location: @off_day }\n else\n format.html { render :edit }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spec_day.update(spec_day_params)\n format.html { redirect_to spec_days_path, notice: '更新成功!' }\n format.json { render :show, status: :ok, location: @spec_day }\n else\n flash.now[:alert] = @spec_day.errors.full_messages\n format.html { render :edit }\n format.json { render json: @spec_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def set_day\n @day = Day.find(params[:id])\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\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n if @work_day.update_attributes(params[:work_day])\n flash[:notice] = 'Giornata di lavoro salvata con successo.'\n format.html { redirect_to action: 'index' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oncourse_exercise.update(oncourse_exercise_params)\n@tti_date = @oncourse_exercise.date + @oncourse_exercise.tti_days \n@oncourse_exercise.update(:tti_date => @tti_date)\n format.html { redirect_to @oncourse_exercise, notice: 'Oncourse exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @oncourse_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @daily_step.udpate(daily_step_params)\n format.html { redirect_to @daily_step, notice: 'Daily step was successfully update.' }\n format.json { render :show, status: :ok, location: @daily_step }\n else\n format.html { render :edit }\n format.json { render json: @daily_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch_day.update(batch_day_params)\n format.html { redirect_to @batch_day, notice: 'Batch day was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch_day }\n else\n format.html { render :edit }\n format.json { render json: @batch_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to(conference_days_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @timesheet = Timesheet.find(params[:id])\n @date = Date.parse params[:timesheet][:day]\n\n respond_to do |format|\n if @timesheet.update_attributes(params[:timesheet])\n format.html { redirect_to timesheets_month_path(:y => @date.year, :m => @date.month) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @day.update(meals: params[:meals])\n #respond_to do |format|\n #if @day.update(day_params)\n #format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n #format.json { render :show, status: :ok, location: @day }\n #else\n #format.html { render :edit }\n #format.json { render json: @day.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\n respond_to do |format|\n if @new_day.update(new_day_params)\n format.html { render text: '已经把反馈传给用户了,谢谢您' }\n format.json { render :show, status: :ok, location: @new_day }\n else\n format.html { render :edit }\n format.json { render json: @new_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @daily_intake.update(daily_intake_params)\n format.html { redirect_to @daily_intake, notice: 'Daily intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @daily_intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id:, url_variables:, body:)\n ensure_service_document\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update\n put :update\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\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 @essay = Essay.find(params[:id])\n\n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to @essay, notice: 'Essay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @essay.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 @shift = Shift.find(params[:id])\n\n respond_to do |format|\n if @shift.update_attributes(params[:shift])\n @shift.day = params[:day]\n\n format.html { redirect_to shifts_path, notice: 'Shift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shift.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 @day_list = DayList.find(params[:id])\n\n respond_to do |format|\n if @day_list.update_attributes(params[:day_list])\n format.html { redirect_to @day_list, notice: 'Day list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @day_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_day\n @day = Day.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @dow.update(dow_params)\n format.html { redirect_to @dow, notice: 'Dow was successfully updated.' }\n format.json { render :show, status: :ok, location: @dow }\n else\n format.html { render :edit }\n format.json { render json: @dow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @viewdate = Viewdate.find(params[:id])\n\n respond_to do |format|\n if @viewdate.update_attributes(params[:viewdate])\n flash[:notice] = 'Viewdate was successfully updated.'\n format.html { redirect_to(@viewdate) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @viewdate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day_of_week.update(day_of_week_params)\n format.html { redirect_to @day_of_week, notice: 'Day of week was successfully updated.' }\n format.json { render :show, status: :ok, location: @day_of_week }\n else\n format.html { render :edit }\n format.json { render json: @day_of_week.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @monday.update(monday_params)\n format.html { redirect_to @monday, notice: 'Monday was successfully updated.' }\n format.json { render :show, status: :ok, location: @monday }\n else\n format.html { render :edit }\n format.json { render json: @monday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @turn_scheme.transaction do\n @turn_scheme.exclusion_days.clear\n unless params[:day].nil?\n params[:day].each_with_index do |i, index|\n dates=i.split(',')\n\n dates.each do |d|\n dt=d.to_date\n ExclusionDay.find_or_create_by(day: dt, turn_type_id: params[:turn_type_id][index], turn_scheme_id: @turn_scheme.id)\n end\n end\n end\n\n end\n respond_to do |format|\n if @turn_scheme.update(turn_scheme_params)\n format.html { redirect_to turn_schemes_path, notice: 'Схема смен была обновлена.' }\n format.json { render :show, status: :ok, location: @turn_scheme }\n else\n format.html { render :edit }\n format.json { render json: @turn_scheme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @calendar_day.update(calendar_day_params)\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_day }\n else\n format.html { render :edit }\n format.json { render json: @calendar_day.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\n respond_to do |format|\n if @week_day.update(week_day_params)\n format.html { redirect_to @week_day, notice: 'Week day was successfully updated.' }\n format.json { render :show, status: :ok, location: @week_day }\n else\n format.html { render :edit }\n format.json { render json: @week_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n if @one_time_stop.update_attributes(params[:one_time_stop])\n format.html { redirect_to @one_time_stop, notice: 'One time stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_time_stop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @day_type.update(day_type_params)\n format.html { redirect_to @day_type, notice: 'Day type was successfully updated.' }\n format.json { render :show, status: :ok, location: @day_type }\n else\n format.html { render :edit }\n format.json { render json: @day_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cycle = Cycle.find(params[:id])\n\n add_terms(params[\"terms-id\"],@cycle)\n respond_to do |format|\n if @cycle.update_attributes(params[:cycle])\n format.html { redirect_to @cycle, notice: 'Cycle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cycle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @interventoriasfecha = Interventoriasfecha.find(params[:id])\n\n respond_to do |format|\n if @interventoriasfecha.update_attributes(params[:interventoriasfecha])\n format.html { redirect_to(@interventoriasfecha, :notice => 'Interventoriasfecha was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interventoriasfecha.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @everyday.update(everyday_params)\n format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }\n format.json { render :show, status: :ok, location: :back }\n else\n format.html { render :edit }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n if @classday.update_attributes(classday_params)\r\n render json: @classday, status: 200, location: group_classdays_url(@classday)\r\n else\r\n render json: @classday.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n respond_to do |format|\n if @day_week.update(day_week_params)\n format.html { redirect_to '/maestricos/prueba?titulo=Dias+de+la+Semana&tabla=DayWeek'}\n format.json { render :show, status: :ok, location: @day_week }\n else\n format.html { render :edit }\n format.json { render json: @day_week.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @travel_datum = TravelDatum.find(params[:id])\n respond_to do |format|\n if @travel_datum.update_attributes(params[:travel_datum])\n format.html { redirect_to @travel_datum, :notice => 'Travel datum 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 => @travel_datum.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @travel_datum.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n flash[:notice] = 'Actualizado.'\n format.html { redirect_to(@estudiante) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @diet = Diet.find(params[:id])\n\n respond_to do |format|\n if @diet.update_attributes(params[:diet])\n flash[:notice] = 'Diet was successfully updated.'\n format.html { redirect_to(@diet) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @diet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\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"
] | [
"0.6422212",
"0.6157",
"0.6116079",
"0.6007998",
"0.5909085",
"0.5905952",
"0.5859865",
"0.57983536",
"0.578816",
"0.576036",
"0.57457757",
"0.5732893",
"0.5727385",
"0.5689735",
"0.56728023",
"0.5625911",
"0.56028223",
"0.55909604",
"0.55894",
"0.55828106",
"0.5580935",
"0.5578855",
"0.5564804",
"0.5551361",
"0.55502146",
"0.554734",
"0.55360675",
"0.5528894",
"0.55285454",
"0.5526552",
"0.55229414",
"0.55150557",
"0.5506153",
"0.55004317",
"0.54925144",
"0.5478616",
"0.54750246",
"0.5455526",
"0.54524994",
"0.54524994",
"0.54524994",
"0.54524994",
"0.54524994",
"0.54524994",
"0.54159045",
"0.5413151",
"0.53966784",
"0.538378",
"0.5383354",
"0.5378274",
"0.53767246",
"0.5373758",
"0.5372166",
"0.53705794",
"0.53652245",
"0.5365088",
"0.53579396",
"0.5355223",
"0.5335246",
"0.53296536",
"0.5323352",
"0.53152215",
"0.5311727",
"0.5308547",
"0.53080726",
"0.53057426",
"0.5303921",
"0.5299121",
"0.5298865",
"0.5288184",
"0.5286125",
"0.5276413",
"0.52757823",
"0.52746534",
"0.5269364",
"0.5259574",
"0.52595127",
"0.5255155",
"0.5238893",
"0.52339435",
"0.52326024",
"0.52326024",
"0.52326024",
"0.52326024",
"0.52326024",
"0.52326024",
"0.52326024",
"0.52326024",
"0.5228838",
"0.5228838",
"0.5228838",
"0.5228014",
"0.5224464",
"0.52108973",
"0.52087945",
"0.5201005",
"0.52001834",
"0.519704",
"0.5195967",
"0.5193558"
] | 0.6023378 | 3 |
DELETE /days/1 DELETE /days/1.xml | def destroy
@trip = Trip.find(params[:trip_id])
@day = Day.find(params[:id])
prev_d = @day.prev_day
next_d = @day.next_day
if prev_d and next_d
prev_d.next_id = next_d.id
next_d.prev_id = prev_d.id
elsif prev_d
prev_d.next_id = nil
elsif next_d
next_d.prev_id = nil
else
# In this case we've deleted the last day
end
respond_to do |format|
if user_can_modify(@trip) and @day.destroy
prev_d.save if prev_d
next_d.save if next_d
format.html { redirect_to(trip_days_path) }
format.xml { head :ok }
format.json { head :ok }
else
flash[:error] = "It appears you attempted to delete a suggestion that you did not create. Perhaps you need to log in?"
format.html { redirect_to root_path }
format.xml { head :ok }
format.json { head :ok }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bday = Bday.find(params[:id])\n @bday.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to(conference_days_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 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 @workday = Workday.find(params[:id])\n @workday.destroy\n\n respond_to do |format|\n format.html { redirect_to(workdays_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 @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @availability_day = AvailabilityDay.find(params[:id])\n @availability_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(availability_days_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 @work_day = WorkDay.find(params[:id])\n @work_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(work_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end",
"def delete path\n make_request(path, \"delete\", {})\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 @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'today') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end",
"def delete\n @free_day = @free_days.first :date => params[:date]\n if @free_day && @free_day.destroy\n render_success \"Vacation at #{params[:date]} was removed\"\n else\n render_failure \"Couldn't remove vacation\"\n end\n end",
"def destroy\n @tournament_day = TournamentDay.find(params[:id])\n @tournament_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(tournament_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @commission_day = CommissionDay.find(params[:id])\n if @commission_day.verify_destroy\n flash[:notice] = \"Destroy successfully\"\n else\n flash[:error] = \"Commission day cannot be destroy\"\n end\n respond_to do |format|\n format.html { redirect_to(commission_days_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\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 @viewdate = Viewdate.find(params[:id])\n @viewdate.destroy\n\n respond_to do |format|\n format.html { redirect_to(viewdates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"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 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 @trip.days.all.each do |day|\n day.destroy\n end\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |format|\n format.html { redirect_to weekdays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @days_since_visit = DaysSinceVisit.find(params[:id])\n @days_since_visit.destroy\n\n respond_to do |format|\n format.html { redirect_to days_since_visits_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n request(:delete, path)\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 delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def destroy\n @elective_day.destroy\n respond_to do |format|\n format.html { redirect_to elective_days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url, notice: 'Day was successfully destroyed.' }\n format.json { head :no_content }\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(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @day_week = DayWeek.find(params[:id])\n @day_week.destroy\n\n respond_to do |format|\n format.html { redirect_to day_weeks_url, :notice => 'Dia da semana excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\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 @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url, notice: 'Day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @classday.destroy\r\n\r\n head :no_content\r\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @new_day.destroy\n respond_to do |format|\n format.html { redirect_to new_days_url, notice: 'New day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theory_day.destroy\n respond_to do |format|\n format.html { redirect_to theory_days_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\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 @day_week.destroy\n respond_to do |format|\n format.html { redirect_to day_weeks_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(dlogs_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete(path, params={})\n request(:delete, path, params)\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 @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 delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\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 delete(path)\n request(:delete, path)\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n 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 destroy\n @user_day = UserDay.find(params[:id])\n @allowance = @user_day.user.get_holiday_allowance_for_dates Date.today, Date.today\n @allowance.days_remaining -= @user_day.no_days\n @user_day.destroy\n @allowance.save\n respond_to do |format|\n format.html { redirect_to(user_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @daily_intake.destroy\n respond_to do |format|\n format.html { redirect_to daily_intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def destroy\n @everyday.destroy\n respond_to do |format|\n format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"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 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 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 delete\n end",
"def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def delete\n\n end"
] | [
"0.67869854",
"0.67378235",
"0.669461",
"0.65612894",
"0.64693326",
"0.6444572",
"0.637604",
"0.6345075",
"0.63399255",
"0.63117194",
"0.63059914",
"0.6303592",
"0.6298902",
"0.6284396",
"0.628365",
"0.6253887",
"0.62378323",
"0.62081444",
"0.62074393",
"0.6193774",
"0.61420053",
"0.6138566",
"0.61265755",
"0.611523",
"0.61144525",
"0.61040884",
"0.6100321",
"0.6088046",
"0.6079599",
"0.60738593",
"0.6073074",
"0.60692996",
"0.6058117",
"0.6050049",
"0.60454154",
"0.60384566",
"0.60359466",
"0.60305685",
"0.6030412",
"0.6029619",
"0.6025277",
"0.60247463",
"0.6013395",
"0.60133064",
"0.600792",
"0.6007728",
"0.5995522",
"0.5993255",
"0.5987933",
"0.598518",
"0.59791964",
"0.5977072",
"0.597306",
"0.5951269",
"0.5951269",
"0.5951269",
"0.5951269",
"0.5951269",
"0.5951269",
"0.5951269",
"0.5947756",
"0.5936944",
"0.5930129",
"0.5928983",
"0.59272623",
"0.5926918",
"0.59169906",
"0.59167576",
"0.591636",
"0.591636",
"0.591636",
"0.59156424",
"0.591138",
"0.59110785",
"0.59005547",
"0.58999926",
"0.5899437",
"0.58967227",
"0.58955795",
"0.58948064",
"0.5893052",
"0.5892655",
"0.5892655",
"0.58906615",
"0.5888132",
"0.5887315",
"0.5884894",
"0.5884894",
"0.5879473",
"0.5879473",
"0.58733004",
"0.58731765",
"0.5869602",
"0.5869602",
"0.5869602",
"0.5869602",
"0.5869014",
"0.5854544",
"0.5852953",
"0.58503634",
"0.584948"
] | 0.0 | -1 |
Query the API server for the root device | def root_device
begin
@root_device = open('http://instance-data/latest/meta-data/block-device-mapping/root').read
rescue
message.fatal 'Could not get the root device!'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_device_name\n data[:root_device_name]\n end",
"def root_device_type\n data[:root_device_type]\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\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 debug_if_root_device(bdms)\n return if bdms.nil? || bdms.empty?\n image_id = config[:image_id]\n image = ec2.resource.image(image_id)\n begin\n root_device_name = image.root_device_name\n rescue ::Aws::EC2::Errors::InvalidAMIIDNotFound\n # Not raising here because AWS will give a more meaningful message\n # when we try to create the instance\n return\n end\n bdms.find { |bdm|\n if bdm[:device_name] == root_device_name\n logger.info(\"Overriding root device [#{root_device_name}] from image [#{image_id}]\")\n end\n }\n end",
"def device\n xpath '.', 'device'\n end",
"def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devices = User.get_all_user_devices(current_user[:id])\n render json: @devices\n end",
"def device\n @client.get('VBD', :device, @uuid)\n end",
"def show\n json_response(@device)\n end",
"def server_devices_list\n if !ccl_active? or (session[:usertype] != \"admin\" and ccl_active?)\n dont_be_so_smart\n redirect_to :controller => \"callc\", :action => \"main\" and return false\n end\n @page_title = _('Server_devices')\n @page_icon = 'server.png'\n @help_link = \"http://wiki.kolmisoft.com/index.php/Multi_Server_support\"\n # ip_auth + server_devices.server_id is null + server_devices.server_id is not that server + not server device(which were created with server creation)\n @devices = Device.select(\"devices.*,server_devices.server_id AS serv_id\").joins(\"LEFT JOIN server_devices ON (server_devices.device_id = devices.id AND server_devices.server_id = #{params[:id].to_i}) LEFT JOIN users ON (users.id = devices.user_id)\").where(\"(host != 'dynamic' OR device_type != 'SIP') AND users.owner_id = #{current_user.id} AND server_devices.server_id is null AND user_id != -1 AND name not like 'mor_server_%'\").order(\"extension ASC\").all\n end",
"def devices; end",
"def get_synthetics_devices\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/browser/devices\", nil, nil, false)\n end",
"def devices\n\texecute(\"devices\").split(\"\\n\")[1..-1]\nend",
"def query_moon_api\n result = connection.query\n end",
"def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end",
"def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end",
"def get_root(options = {})\n object_from_response(GogoKit::Root,\n GogoKit::RootRepresenter,\n :get,\n api_root_endpoint,\n options)\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def check_devices\n\n\n end",
"def get_root_modules(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/root/\"\n _get(query_string)\nend",
"def get_device_data(param = false)\n\n # get the user-agent\n if param == false\n user_agent = ''\n if [email protected]?\n user_agent = @headers['HTTP_USER_AGENT']\n end\n elsif param == true\n\t\t\tuser_agent = @settings.test_useragent\n else\n if @request.nil?\n @request = {}\n end\n @headers = get_normalised_headers param # normalize the given header hash\n user_agent = (@headers.has_key?'user-agent')?@headers['user-agent']:''\n\t\tend\n\n # get the DeviceAtlas Client Side Component cookie if usage=on and exists\n cookie = nil\n\t\tif @settings.use_client_cookie && [email protected]? &&\n !@cookies[@settings.client_cookie_name].nil?\n\t\t\tcookie = @cookies[@settings.client_cookie_name]\n elsif @settings.use_client_cookie && \n [email protected]? &&\n @headers.has_key?('cookie')\n @headers['cookie'].gsub!(\" \", \"\")\n cookie_items = @headers['cookie'].split ';'\n cookie_items.each do |cookie_item|\n cookie_name_value = cookie_item.split '='\n if @settings.client_cookie_name == cookie_name_value[0]\n cookie = cookie_name_value[1].gsub(\" \", \"\")\n end\n end\n\t\tend\n\n # get device data from cache or cloud\n @last_used_cloud_url = nil\n @self_auto_ranking = 'n' # 'y' = the API called the ranking\n @ranking_status = nil # for debugging\n @called_servers = [] # for debugging\n\n\t\tbegin\n\t\t\t# check cache for cached data\n\t\t\tif @settings.use_cache\n source = SOURCE_CACHE\n results = get_cache user_agent, cookie\n\t\t\tend\n\t\t\t# use cloud service to get data\n\t\t\tif results.nil?\n source = SOURCE_CLOUD\n\t\t\t\tresults = get_cloud_service user_agent, cookie\n # set the caches for future queries\n if @settings.use_cache && source === SOURCE_CLOUD\n set_cache user_agent, cookie, results[KEY_PROPERTIES]\n end\n\t\t\tend\t\n\t\t# handle errors\n\t\trescue Exception => e\n if results.nil?\n results = {}\n end\n results[KEY_ERROR] = e.message\n if @settings.debug_mode\n raise Exception, e.message\n end\n\t\tend\n\n # In Ruby, we return properties as symbols\n if results.has_key?KEY_PROPERTIES\n results[KEY_PROPERTIES] = results[KEY_PROPERTIES].inject({}){\n |memo,(k,v)| memo[k.to_sym] = v; memo\n }\n end\n\n results[KEY_SOURCE] = source\n results[KEY_USERAGENT] = user_agent\n return results\n\n end",
"def show\n @device = Device.find(params[:id], :include => [:button, :picture])\n unless @device.application\n get_device_data(@device)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @device }\n end\n end",
"def list\n all.each { |device| puts(device.pretty_name) }\n end",
"def is_root_device?(volume_id)\n vols = @ec2_api.describe_volumes(:volume_id => volume_id)\n if vols['volumeSet']['item'][0]['attachmentSet'] == nil || vols['volumeSet']['item'][0]['attachmentSet']['item'].size == 0\n #not linked to any instance, cannot be a root-device\n return false\n end\n instance_id = vols['volumeSet']['item'][0]['attachmentSet']['item'][0]['instanceId']\n res = @ec2_api.describe_instance_attribute(:instance_id => instance_id, :attributes => {:rootDeviceName => true})\n if res[\"rootDeviceName\"] == nil\n return false\n end\n rdn = res['rootDeviceName']['value']\n res = @ec2_api.describe_instances(:instance_id => instance_id)\n if res['reservationSet']['item'][0]['instancesSet']['item'][0]['blockDeviceMapping']['item'].size == 0\n # volume unattached in the meantime\n return false\n end\n attached = res['reservationSet']['item'][0]['instancesSet']['item'][0]['blockDeviceMapping']['item']\n attached.each() {|ebs|\n volume = ebs['ebs']['volumeId']\n device_name = ebs['deviceName']\n if volume == volume_id && rdn == device_name\n return true\n end\n }\n return false\n end",
"def get_api_node(path_array)\n return JSON.parse(lxc(['query', '--wait', '-X', 'GET', return_api_path(path_array)]))\n end",
"def command_get_device(command)\n\t\tif @device then message(\"device: #{@device.name}\")\n\t\telse error(\"no device loaded\")\n\t\tend\n\tend",
"def index\n @devices = current_user.devices\n end",
"def root\n JenkinsApi::Client::Root.new(self)\n end",
"def ring_server\n return @ring_server ||= @ring_finger.lookup_ring_any\n end",
"def root; get(\"\"); end",
"def locate_device()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::LocateDevice::LocateDeviceRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_device\n p \"------------------------->>>>>>>>>>>>>>>>>>>>>.. #{params[:devise_id]}\"\n @device = Mobdevise.where(:devise_id => params[:devise_id]).first\n # @device = Mobdevise.find_by_devise_id(params[:device_id])\n end",
"def index\n @q = apply_scopes(Device).all.search(params[:q])\n @devices = @q.result(distinct: true).page(params[:page])\n\n respond_with(@devices)\n end",
"def ring_server\n return @ring_server unless @ring_server.nil?\n @ring_server = @ring_finger.lookup_ring_any\n end",
"def index\n if current_user\n if current_user.is_admin?\n @devices = Device.all\n else\n @devices = Device.where(:user_id => current_user.id)\n end\n else\n redirect_to login_url, :notice => \"Please login to manage your devices\"\n end\n end",
"def rest\n @rest ||= Chef::ServerAPI.new(server.root_url, {:api_version => \"0\"})\n end",
"def device\r\n logger.info(\"UserController::device:---#{params}\")\r\n end",
"def index\n @devices = current_user.devices\n end",
"def find_device\n @device = Device.find(params[:device_id])\n end",
"def ssdp_search\n log.info 'Trying SSDP discover...'\n try = 1\n while true do\n response = Frisky::SSDP.search SSDP_SEARCH_TARGET\n if response.present?\n break\n elsif try < SSDP_SEARCH_RETRY\n try += 1\n log.warn \"SSDP discover failed, retrying... (#{try}/#{SSDP_SEARCH_RETRY})\"\n sleep(SSDP_RETRY_INTERVAL)\n else\n raise DeviceNotFound, 'Cannot find camera API server. Please confirm network connection is correct.'\n end\n end\n log.info 'SSDP discover succeeded.'\n\n # get device description\n dd = HTTPClient.new.get_content(response[0][:location])\n # puts dd\n parse_device_description(dd)\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def server\n platform.server\n end",
"def get_free_root_space_from_CIB\n cmd = \"/usr/sbin/cibadmin --query --xpath \\\"//nvpair[@name='root_free']\\\"\"\n sleep(random(3,5))\n REXML::Document.new(Open3.popen3(cmd)[1].read).root.elements['/xpath-query'] rescue nil\n end",
"def load_current_resource\r\n require 'zenoss_client'\r\n @connection = Zenoss.connect( api_url(), \r\n @new_resource.api_user, @new_resource.api_password)\r\n \r\n \r\n @device = get_device()\r\n\r\n \r\nend",
"def asr_device(agent_host)\n elektron_networking.get(\"/asr1k/devices/#{agent_host}\").body\n end",
"def root\n fail \"The #{self.class} driver does not support the root method!\"\n end",
"def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end",
"def device\n device_name\n end",
"def index\n @devices = @user.devices\n end",
"def devices\r\n DevicesController.instance\r\n end",
"def db_device_access(data={})\n return nil if data.empty? || (!data.has_key?(:id) && !data.has_key?(:serial_number) && !data.has_key?(:mac_address) && !data.has_key?(:product_id) && !data.has_key?(:firmware_version))\n \n rows = Devices.where(data).first\n \n if !rows.nil? then\n return rows\n else\n return nil\n end\n end",
"def get_device_capabilities\n url = \"#{settings.FQDN}/1/devices/tel:#{session[:dc_address]}/info?\"\n\n # access_token\n url += \"access_token=#{session[:dc_access_token]}\"\n\n RestClient.get url do |response, request, code, &block|\n @r = response\n end\n \n if @r.code == 200\n @result = JSON.parse @r\n else\n @error = @r\n end\n\nrescue => e\n @error = e.message\nensure\n return erb :dc\nend",
"def queryOS(args)\n begin\n p = Hash.new\n uri = URI(args[:entrypoint])\n p[\"header\"] = {'Content-type'=>'application/json','Accept-type'=>'application/json','X-Auth-Token'=>args[:token]}\n case args[:component].to_s\n when \"Nova\"\n p[\"port\"] = uri.port || 8774\n\tp[\"path\"] = uri.path\n when \"Glance\"\n p[\"port\"] = uri.port || 9292\n p[\"path\"] = uri.path || \"/v1\"\n when \"Volume\"\n p[\"port\"] = uri.port || 8776\n\tp[\"path\"] = uri.path\n when \"Swift\" \n p[\"port\"] = uri.port || 8080\n\tp[\"path\"] = uri.path\n when \"Keystone\"\n p[\"port\"] = uri.port || 35357\n p[\"path\"] = uri.path || \"/v2/tokens\"\n when \"Cloud\"\n p[\"port\"] = uri.port || 8773\n p[\"path\"] = uri.path || \"/services/Cloud\"\n p[\"header\"] = {'Content-type'=>'application/xml','Accept-type'=>'application/xml'}\n else\n return false\n end\n p[\"location\"] = uri.host || \"\"\n p[\"path\"] = p[\"path\"] + args[:path] || uri.path\n p[\"request\"] = args[:request] || \"\"\n os = Net::HTTP.new(p[\"location\"],p[\"port\"])\n if uri.scheme == \"https\"\n os.use_ssl = true\n else\n os.use_ssl = false\n end\n resp = nil\n case args[:method].to_s\n when \"post\"\n resp = os.post(p[\"path\"], p[\"request\"], p[\"header\"])\n when \"get\"\n resp = os.get(p[\"path\"], p[\"header\"])\n when \"update\"\n resp = os.put(p[\"path\"], p[\"request\"], p[\"header\"])\n when \"delete\"\n resp = os.delete(p[\"path\"], p[\"header\"])\n end\n newdata = false\n if resp.code.to_i >= 200 and resp.code.to_i < 300\n if args[:component].to_s == \"Cloud\"\n newdata = resp.body\n else\n\t if args[:method].to_s == \"delete\"\n\t newdata = true\n else\n newdata = JSON resp.body\n end\n end\n end\n os = nil\n p = nil\n return newdata\n rescue Errno::EHOSTUNREACH\n false\n end\n end",
"def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end",
"def devices\n response = get('/listDevices')\n devices = []\n response.body['devices'].each do |d|\n devices << Device.from_json(d, @token, @logger)\n end\n devices\n end",
"def all_devices search = nil\n partitions = []\n devices = []\n device = nil\n has_extended = false\n if DEBUG_MODE or Platform.ubuntu? or Platform.fedora?\n command = \"lsblk\"\n params = \" #{search} -b -P -o VENDOR,MODEL,TYPE,SIZE,KNAME,UUID,LABEL,MOUNTPOINT,FSTYPE,RM\"\n end\n lsblk = CommandsExecutor.new command, params\n lsblk.execute\n raise \"Command execution error: #{lsblk.stderr.read}\" if not lsblk.success?\n\n lsblk.result.each_line do |line|\n data_hash = {}\n line.squish!\n line_data = line.gsub!(/\"(.*?)\"/, '\\1#').split \"#\"\n line_data.each do |data|\n data.strip!\n key, value = data.split \"=\"\n data_hash[key.downcase] = value\n end\n data_hash['rm'] = data_hash['rm'].to_i # rm = 1 if device is a removable/flash device, otherwise 0\n if data_hash['type'] == 'mpath'\n data_hash.except!('uuid', 'label', 'mountpoint', 'fstype')\n if device\n multipath_info = {'mkname' => data_hash['kname'], 'multipath' => true, 'size' => data_hash['size']}\n device.merge! multipath_info\n else\n data_hash['multipath'] = true\n device = data_hash\n devices.push device\n end\n next\n end\n if data_hash['type'] == 'disk'\n data_hash.except!('uuid', 'label', 'mountpoint', 'fstype')\n unless device.nil?\n device['partitions'] = partitions\n partitions = []\n devices.push device\n device = nil # cleanup the variable\n end\n device = data_hash\n next\n end\n if data_hash['type'] == 'part'\n data_hash.except!('model', 'vendor')\n data_hash.merge! self.usage data_hash['kname']\n\n partition_number = get_partition_number \"/dev/#{data_hash['kname']}\" # For reference: data_hash['kname'].match(/[0-9]*$/)[0].to_i\n extended_partition_types = ['0x05'.hex, '0x0F'.hex]\n if partition_type_hex(data_hash['kname']).in? extended_partition_types\n has_extended = true\n next\n end\n if has_extended and partition_number > 4\n data_hash['logical'] = true\n end\n # device['partitions'].nil? ? device['partitions'] = [data_hash] : device['partitions'].push(data_hash)\n partitions.push(data_hash)\n end\n end\n device['partitions'] = partitions if device\n devices.push device\n if search\n return devices.first || partitions.first\n else\n return devices\n end\n end",
"def root_mount_options\n\t\t\t\tfind_root[3].to_s\n\t\t\tend",
"def get()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('householddevice', 'get', 'KalturaHouseholdDevice', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def root\n get '/'\n end",
"def devices\n @devices\n end",
"def device_list\n @devices = Device.all\n end",
"def discovery\n resource ''\n end",
"def query_firmware\n write(FIRMWARE_QUERY)\n end",
"def check_devices\n\traise \"No connected device was found.\" if no_device?\nend",
"def index\n @devices = Device.where(:user_id, auth_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end",
"def get_mobile_device()\n res = self.send_request 'get_mobile_device'\n device_info_xml = REXML::Document.new(res.body).root\n rez ={}\n device_info_xml.elements.each do |el|\n rez.merge! Hash[el.name.to_s,el.text.to_s]\n end\n return rez\n end",
"def get_device( id_or_uid)\n \n # try to find with device id\n @device = Device.where(\"id = ? OR uid= ?\", id_or_uid.to_i, id_or_uid).take\n \n \n rescue ActiveRecord::RecordNotFound\n render json: {:message => \"Device not found\", :code => 404} , :status => :not_found\n return false\n \n end",
"def query_api(path)\n with_http_error_handling do\n res = RestClient.get(endpoint + path)\n h = Hash.from_xml(res.body)\n h[\"response\"]\n end\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def url\n if @test\n \"https://modolabs-device-test.appspot.com/api/\"\n else\n \"https://modolabs-device.appspot.com/api/\"\n end\n end",
"def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end",
"def show\n respond_with(@device)\n end",
"def show\n @device = Device.find(params[:id])\n end",
"def current_device\n @current_device ||= params[:device_id]\n end",
"def info\n get(\"/api-info\")\n end",
"def get_firmware\n ensure_client && ensure_uri\n response = @client.rest_get(@data['uri'] + '/firmware')\n @client.response_handler(response)\n end",
"def root\n get \"/\"\n end",
"def root\n get \"/\"\n end",
"def find_ring_server\r\n if @controller_uri\r\n @ring_server = DRbObject.new(nil, @controller_uri)\r\n else\r\n @ring_server = Rinda::RingFinger.new(\r\n @ring_server_host, @ring_server_port)\r\n @ring_server = @ring_server.lookup_ring_any\r\n @controller_uri = \"druby://#{@ring_server_host}:#{@ring_server_port}\"\r\n end\r\n @log.info(\"Controller found on : #{@controller_uri}\")\r\n end",
"def get_rails_root_info\r\n res = send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => normalize_uri(target_uri.path, 'rails', Rex::Text.rand_text_alphanumeric(32)),\r\n })\r\n\r\n fail_with(Failure::Unknown, 'No response from the server') unless res\r\n html = res.get_html_document\r\n rails_root_node = html.at('//code[contains(text(), \"Rails.root:\")]')\r\n fail_with(Failure::NotVulnerable, NO_RAILS_ROOT_MSG) unless rails_root_node\r\n root_info_value = rails_root_node.text.scan(/Rails.root: (.+)/).flatten.first\r\n report_note(host: rhost, type: 'rails.root_info', data: root_info_value, update: :unique_data)\r\n root_info_value\r\n end",
"def server_root \n @hash[\"ServerRoot\"]\n end",
"def test_connection\n response = send_api_request(:index)\n response[:returncode]\n end",
"def test_connection\n response = send_api_request(:index)\n response[:returncode]\n end",
"def show\n # @mydevice = Mydevice.find(params[:id])\n\t@user = User.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mydevice }\n end\n end",
"def check_device_exists\n render json: { error: 'device not found' }, status: :internal_server_error unless Device.exists?(params[:device_id])\n end",
"def nonroot_devices\n self.block_device_mappings.reject { |m| m.device_name == self.root_device_name }\n end",
"def index\n @terminal_devices = TerminalDevice.all\n end",
"def show\r\n @device = Device.find_by_id(params[:id])\r\n\r\n if @device.nil?\r\n @devices = Device.all\r\n flash[:alert] = \"Your device was not found!\"\r\n render \"index\"\r\n else\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @device }\r\n end\r\n end\r\n\r\n end",
"def devices\n url = \"me/player/devices\"\n response = RSpotify.resolve_auth_request(@id, url)\n\n return response if RSpotify.raw_response\n response['devices'].map { |i| Device.new i }\n end",
"def guestos\n config_response = conf_file_data\n return config_response unless config_response.successful?\n\n response = Response.new :code => 0, :data => {}\n response.data = config_response.data.fetch 'guestOS', ''\n response\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def show\n @device = Device.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @device }\n end\n end",
"def find_ring_server(params = {})\r\n if @controller_uri\r\n @ring_server = DRbObject.new(nil, @controller_uri)\r\n else\r\n @ring_server = Rinda::RingFinger.new(\r\n @ring_server_host, @ring_server_port)\r\n @ring_server = @ring_server.lookup_ring_any\r\n @controller_uri = \"druby://#{@ring_server_host}:#{@ring_server_port}\"\r\n end\r\n @log.info(\"Controller found on : #{@controller_uri}\")\r\n end",
"def get_current_devices(output)\n lines = output.split(\"\\n\")\n partitions = lines.drop(2).map do |line|\n line.chomp.split.last\n end\n partitions.reject! do |partition|\n partition =~ /^dm-\\d/\n end\n devices = partitions.select do |partition|\n partition =~ /[a-z]$/\n end\n devices.sort!.map! {|device| \"/dev/#{device}\"}\n if devices.empty?\n devices = partitions.select do |partition|\n partition =~ /[0-9]$/\n end.sort.map {|device| \"/dev/#{device}\"}\n end\n devices\n end",
"def api_keys\n rest_query(:api_key)\n end",
"def server\r\n\t\t@usr_server\r\n\tend",
"def index\n @catalog_devices = Catalog::Device.all\n end",
"def list\n Airplay.devices.each do |device|\n puts <<-EOS.gsub(/^\\s{12}/,'')\n * #{device.name} (#{device.info.model} running #{device.info.os_version})\n ip: #{device.ip}\n mac: #{device.id}\n password?: #{device.password? ? \"yes\" : \"no\"}\n type: #{device.type}\n resolution: #{device.info.resolution}\n\n EOS\n end\n end"
] | [
"0.6693326",
"0.6457548",
"0.61086637",
"0.59151244",
"0.5870444",
"0.5663838",
"0.5659754",
"0.56459373",
"0.56307954",
"0.5594551",
"0.55858386",
"0.5581615",
"0.55655944",
"0.55509573",
"0.55283517",
"0.5521352",
"0.5515588",
"0.5510941",
"0.5438437",
"0.5416547",
"0.54066736",
"0.5400792",
"0.53947663",
"0.5383187",
"0.5374459",
"0.53470546",
"0.5319292",
"0.53149086",
"0.53034407",
"0.5302441",
"0.52934444",
"0.5289845",
"0.52769464",
"0.5272532",
"0.52724284",
"0.5244249",
"0.52371436",
"0.5233175",
"0.522763",
"0.52239984",
"0.5219429",
"0.52115124",
"0.52099746",
"0.5207271",
"0.5203771",
"0.5179849",
"0.5178628",
"0.5177682",
"0.5159919",
"0.5158086",
"0.51520044",
"0.5133211",
"0.5130557",
"0.51261455",
"0.5118911",
"0.5116685",
"0.51153934",
"0.5113984",
"0.5108282",
"0.51024693",
"0.51013184",
"0.51000863",
"0.5099949",
"0.50994104",
"0.5098169",
"0.50914556",
"0.5083053",
"0.5072673",
"0.5071719",
"0.5071719",
"0.50392926",
"0.5037686",
"0.5035229",
"0.5034059",
"0.50334346",
"0.5031791",
"0.50272053",
"0.50211984",
"0.50211984",
"0.5020413",
"0.5012189",
"0.50118846",
"0.5003318",
"0.5003318",
"0.49988106",
"0.4992519",
"0.4988263",
"0.49760988",
"0.49752873",
"0.4959546",
"0.49583888",
"0.4955676",
"0.4955676",
"0.4955676",
"0.49521145",
"0.4945624",
"0.49381617",
"0.49361417",
"0.49177063",
"0.49137276"
] | 0.7180721 | 0 |
Autodetect Devise scope using +Devise.default_scope+. Used to make the linkhelpers smart if like in most cases only one devise scope will be used, e.g. "user" or "account". | def auto_detect_scope(*args)
options = args.extract_options!
if options.key?(:for)
options[:scope] = options[:for]
::ActiveSupport::Deprecation.warn("DEPRECATION: " <<
"Devise scope :for option is deprecated. " <<
"Use: facebook_*_link(:some_scope), or facebook_*_link(:scope => :some_scope)")
end
scope = args.detect { |arg| arg.is_a?(Symbol) } || options[:scope] || ::Devise.default_scope
mapping = ::Devise.mappings[scope]
if mapping.for.include?(:facebook)
scope
else
error_message =
"%s" <<
" Did you forget to devise facebook_connect in your model? Like this: devise :facebook_connectable." <<
" You can also specify scope explicitly, e.g.: facebook_*link :for => :customer."
error_message %=
if scope.present?
"#{scope.inspect} is not a valid facebook devise scope. " <<
"Loaded modules for this scope: #{mapping.for.inspect}."
else
"Could not auto-detect any facebook_connectable devise scope."
end
raise error_message
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_scope\n @default_scope ||= 'entitlements'\n end",
"def devise_scope(scope); end",
"def selected_scope\n (params[:scope] || :default).to_sym\n end",
"def default_search_scope\n @default_search_scope ||= default_search_scopes[controller_name.to_sym][:actions][action_name.to_sym] ||\n default_search_scopes[controller_name.to_sym][:default]\n end",
"def default_search_scope\n @default_search_scope ||= default_search_scopes[controller_name.to_sym][:actions][action_name.to_sym] ||\n default_search_scopes[controller_name.to_sym][:default]\n end",
"def available_scopes\n (default_scopes << Doorkeeper.config.optional_scopes.to_a).flatten.uniq\n end",
"def default_scope; end",
"def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end",
"def default_scopes\n Doorkeeper.config.default_scopes.to_a\n end",
"def default_scope\n Configuration::Scope.new(Configuration.new)\n end",
"def devise_scope(scope)\n constraint = lambda do |request|\n request.env[\"devise.mapping\"] = Devise.mappings[scope]\n true\n end\n\n constraints(constraint) do\n yield\n end\n end",
"def with_default_scope\n queryable.with_default_scope\n end",
"def downgrade_scopes!\n return unless Feature.enabled?(:omniauth_login_minimal_scopes, current_user,\n default_enabled: :yaml)\n\n auth_type = params.delete('gl_auth_type')\n return unless auth_type == 'login'\n\n ensure_read_user_scope!\n\n params['scope'] = Gitlab::Auth::READ_USER_SCOPE.to_s if application_has_read_user_scope?\n end",
"def default_search_scope(id, options = {})\n if actions = options[:only]\n actions = [] << actions unless actions.is_a?(Array)\n actions.each {|a| default_search_scopes[controller_name.to_sym][:actions][a.to_sym] = id.to_s}\n else\n default_search_scopes[controller_name.to_sym][:default] = id.to_s\n end\n end",
"def default_search_scope(id, options = {})\n if actions = options[:only]\n actions = [] << actions unless actions.is_a?(Array)\n actions.each {|a| default_search_scopes[controller_name.to_sym][:actions][a.to_sym] = id.to_s}\n else\n default_search_scopes[controller_name.to_sym][:default] = id.to_s\n end\n end",
"def default_param_group_scope\n @scope\n end",
"def default_discount_scope=(default_discount_scope)\n validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n unless validator.valid?(default_discount_scope)\n fail ArgumentError, \"invalid value for \\\"default_discount_scope\\\", must be one of #{validator.allowable_values}.\"\n end\n @default_discount_scope = default_discount_scope\n end",
"def define_default_scope(klass, conditions)\n if Rails.version.to_i < 4 # Rails 2/3\n klass.send :default_scope, conditions\n else\n klass.send :default_scope do\n klass.scoped(conditions)\n end\n end\n end",
"def define_default_scope(klass, conditions)\n if Rails.version.to_i < 4 # Rails 2/3\n klass.send :default_scope, conditions\n else\n klass.send :default_scope do\n klass.scoped(conditions)\n end\n end\n end",
"def process_application_default_auth(options)\n ::Google::Auth.get_application_default(options[:google_api_scope_url])\n end",
"def default_scopes(*scopes)\n @config.instance_variable_set(:@default_scopes, OAuth::Scopes.from_array(scopes))\n end",
"def _default_param_group_scope\n @param_group && @param_group[:scope]\n end",
"def apply_default_scope\n if klass.default_scoping && default_scopable?\n self.default_scopable = false\n fuse(klass.default_scoping)\n else\n self\n end\n end",
"def current_user_scope\n current_user\n end",
"def use_default\n Gist.scoped.includes(:profile)\n end",
"def default_object\n @_scope.respond_to?(:controller) ?\n instance_variable_get(\"@#{@_scope.controller.controller_name}\") :\n nil\n end",
"def select_scope(scope)\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC, nil].include?(scope)\n Scopes::SCOPE_PRIVATE\n else\n scope\n end\n end",
"def scope_from_params(params)\n return default_scope if params[:scope].blank?\n scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',')\n scope = scope.map(&:downcase).map(&:strip)\n return scope & default_scope\n end",
"def define_default_scope(klass, conditions)\n if default_scopes_accept_a_block?\n if conditions\n klass.instance_eval %{\n default_scope { where(#{conditions.inspect}) }\n}\n end\n else\n if conditions\n klass.instance_eval %{\n default_scope where(#{conditions.inspect})\n}\n end\n end\n end",
"def find_scope(filter_name)\n @model_decorator.filters[filter_name].try(:[], :scope) || filter_name\n end",
"def default_annotation_scope\n if self.default_options[:annotation].blank?\n nil\n else\n # last part of the annotation string\n self.default_options[:annotation].split('--')[2]\n end\n end",
"def scope_link(scope = nil)\n if scope\n as = scope[:as]\n name = as.to_s.humanize\n else\n as = nil\n name = \"All\"\n end\n \n link = current_filter_scopes.dup\n \n if as\n unless scope[:default]\n link[as] = true \n default_scopes.each { |dn, ds| link[ds[:as]] = false }\n end\n\n active = current_boolean_scopes.keys.include?(as)\n else\n active = current_boolean_scopes.empty?\n end\n \n# name = \"#{name}: #{scope_count(scope)}\"\n \n content_tag(:li, link_to(name, link), :class => active ? 'active' : nil)\n end",
"def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_route = :\"new_#{scope}_ichain_session_path\"\n opts[:format] = request_format unless skip_format?\n\n config = Rails.application.config\n opts[:script_name] = (config.relative_url_root if config.respond_to?(:relative_url_root))\n\n context = send(Devise.available_router_name)\n\n if context.respond_to?(route)\n context.send(route, opts)\n elsif context.respond_to?(alt_route)\n context.send(alt_route, opts)\n elsif respond_to?(:root_path)\n root_path(opts)\n else\n \"/\"\n end\n end",
"def add_default_scope\n add_scope(one_class.get_default_sphinx_scope) if one_class && one_class.has_default_sphinx_scope?\n end",
"def process_default_scope(value)\n if existing = default_scoping\n ->{ existing.call.merge(value.to_proc.call) }\n else\n value.to_proc\n end\n end",
"def scope_for(tag)\n set_scope(tag)\n yield\n set_scope(:default)\n end",
"def custom_scope_get scope_name\n\t\t\tThread.current[SESSION].custom_scope_get scope_name\n\t\tend",
"def default_visible_key_scope\n lambda { all }\n end",
"def authenticate_scope!\n super\n end",
"def scope\n @scope ||= Array(@root_scope) + [Inflector.underscore(name)]\n end",
"def scope\n finder_or_run(:scope)\n end",
"def require_no_authentication\n authenticate_scope!\n end",
"def scope scope = nil, &proc\n @scope = (proc || scope) if (scope || proc) && configurable?\n @setup[:scope] ||= @scope ||\n (@controller.ctrl.slice.view.scope if @controller)\n end",
"def scope_nav\n return unless boolean_scopes.count > 0\n \n if default_scopes.any?\n result = []\n else\n result = [scope_link]\n end\n \n boolean_scopes.each do |name, s|\n result << scope_link(s)\n end\n \n content_tag :ul, result.join(\"\\n\").html_safe, :class => 'nav nav-pills'\n end",
"def default_scope=(_arg0); end",
"def default(locale, object, subject, options = {})\n options = options.dup.reject { |key, value| key == :default }\n case subject\n when Array\n subject.count - 1\n subject.each do |item|\n result = resolve(locale, object, item, options) #and return result\n result = lookup(locale, result, options[:scope], options)\n return result if result.is_a?(String)\n return result = resolve(locale, object, item, options) if item == subject.last\n end and nil\n else\n resolve(locale, object, subject, options)\n end\n end",
"def scope\n @scope ||= {}\n end",
"def scope\n @scope ||= {}\n end",
"def all_scopes\n @all_scopes ||=\n {'identity' => (auth['scope'] || apps_permissions_users_list[user_id].to_h['scopes'].to_a.join(',')).to_s.split(',')}\n .merge(auth['scopes'].to_h)\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def translation_scope\n \"devise.#{controller_name}\"\n end",
"def dynamic_scopes\n self.scopes.select { |name, args| args.present? }\n end",
"def current_scope\n Thread.current[:webspicy_scope] || default_scope\n end",
"def evaluate_default_scope\n return if ignore_default_scope?\n\n begin\n self.ignore_default_scope = true\n yield\n ensure\n self.ignore_default_scope = false\n end\n end",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = StateComponentTypeTax.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def default_scope\n select_pact_columns_with_aliases\n .from_self(alias: :p)\n .left_outer_join_verifications\n .select_all_columns_after_join\n end",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = AssemblyComponent.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def apply_standard_scope\n each_sort do |attribute, direction|\n @scope = resource.adapter.order(@scope, attribute, direction)\n end\n @scope\n end",
"def apply_scopes(*)\n relation = super\n relation = relation.accessible_by(current_ability) if scope_accessible?\n relation\n end",
"def authorize_params\n\n # Trick shamelessly borrowed from the omniauth-facebook gem!\n super.tap do |params|\n %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }\n params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope\n end\n end",
"def scope\n @scope ||= \"study.#{app_name}\"\n end",
"def global_scope\n respond_to?(:scoped_object) && scoped_object ? scoped_object.taxonomies : Taxonomy\n end",
"def defaults(defaults = {})\n @scope = @scope.new(defaults: merge_defaults_scope(@scope[:defaults], defaults))\n yield\n ensure\n @scope = @scope.parent\n end",
"def try_to_set_scope\n #this is a commodity method\n if self.featurable.is_a?(Account)\n self.scope = \"AccountPlan\"\n end\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def default_param_group_scope\n class_scope\n end",
"def base_scope\n ApplicationRecord.none\n end",
"def current_user\n # if a user is logged in we just use devise's implementation.\n super || guest_user\n end",
"def favorites_scoped(options = {})\n if options.key?(:multiple_scopes) == false\n validate_scopes(__method__, options)\n elsif options[:multiple_scopes]\n results = {}\n options[:scope].each do |scope|\n results[scope] = favorites.unblocked.send(scope + '_list')\n .includes(:favoritable)\n end\n results\n else\n favorites.unblocked.send(options[:scope] + '_list')\n .includes(:favoritable)\n end\n end",
"def scoped\n self.default_scopable = true\n apply_default_scope\n end",
"def scope_options; end",
"def scope_options; end",
"def search_scope\n super\n end",
"def hiera(key, default = nil)\n @hiera.lookup(key, nil, @scope) || @scope.dig(*key.split('.')) || default\n end",
"def scope_name; end",
"def ransackable_scopes(auth_object = nil)\n []\n end",
"def scope\n if @family == Socket::AF_INET\n if IPAddr.new(\"0.0.0.0/8\").include? self\n \"CURRENT NETWORK\"\n elsif IPAddr.new(\"10.0.0.0/8\").include? self\n \"RFC1918 PRIVATE\"\n elsif IPAddr.new(\"127.0.0.0/8\").include? self\n \"LOOPBACK\"\n elsif IPAddr.new(\"168.254.0.0/16\").include? self\n \"AUTOCONF PRIVATE\"\n elsif IPAddr.new(\"172.16.0.0/12\").include? self\n \"RFC1918 PRIVATE\"\n elsif IPAddr.new(\"192.0.0.0/24\").include? self\n \"RESERVED (IANA)\"\n elsif IPAddr.new(\"192.0.2.0/24\").include? self\n \"DOCUMENTATION\"\n elsif IPAddr.new(\"192.88.99.0/24\").include? self\n \"6to4 ANYCAST\"\n elsif IPAddr.new(\"192.168.0.0/16\").include? self\n \"RFC1918 PRIVATE\"\n elsif IPAddr.new(\"198.18.0.0/15\").include? self\n \"NETWORK BENCHMARK TESTS\"\n elsif IPAddr.new(\"198.51.100.0/24\").include? self\n \"DOCUMENTATION\"\n elsif IPAddr.new(\"203.0.113.0/24\").include? self\n \"DOCUMENTATION\"\n elsif IPAddr.new(\"224.0.0.0/4\").include? self\n if IPAddr.new(\"239.0.0.0/8\").include? self\n \"LOCAL MULTICAST\"\n else\n \"GLOBAL MULTICAST\"\n end\n elsif IPAddr.new(\"240.0.0.0/4\").include? self\n \"RESERVED\"\n elsif IPAddr.new(\"255.255.255.255\") == self\n \"GLOBAL BROADCAST\"\n else\n \"GLOBAL UNICAST\"\n end\n elsif @family == Socket::AF_INET6\n if IPAddr.new(\"2000::/3\").include? self\n require 'scanf'\n if is_6to4?\n \"GLOBAL UNICAST (6to4: #{from_6to4})\"\n elsif is_teredo?\n \"GLOBAL UNICAST (Teredo #{from_teredo[:client].to_s}:#{from_teredo[:port].to_s} -> #{from_teredo[:server].to_s}:#{from_teredo[:port].to_s})\"\n elsif IPAddr.new(\"2001:10::/28\").include? self\n \"ORCHID\"\n elsif IPAddr.new(\"2001:db8::/32\").include? self\n \"DOCUMENTATION\"\n else\n \"GLOBAL UNICAST\"\n end\n elsif IPAddr.new(\"::/128\") == self\n \"UNSPECIFIED ADDRESS\"\n elsif IPAddr.new(\"::1/128\") == self\n \"LINK LOCAL LOOPBACK\"\n elsif IPAddr.new(\"::ffff:0:0/96\").include? self\n a,b,c,d = self.to_string.scanf(\"%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%4x:%4x:%4x:%4x\")\n \"IPv4 MAPPED (#{a.to_s}.#{b.to_s}.#{c.to_s}.#{d.to_s})\"\n elsif IPAddr.new(\"::/96\").include? self\n a,b,c,d = self.to_string.scanf(\"%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%*4x:%4x:%4x:%4x:%4x\")\n \"IPv4 TRANSITION (#{a.to_s}.#{b.to_s}.#{c.to_s}.#{d.to_s}, deprecated)\"\n elsif IPAddr.new(\"fc00::/7\").include? self\n \"UNIQUE LOCAL UNICAST\"\n elsif IPAddr.new(\"fec0::/10\").include? self\n \"SITE LOCAL (deprecated)\"\n elsif IPAddr.new(\"fe80::/10\").include? self\n \"LINK LOCAL UNICAST\"\n elsif IPAddr.new(\"ff00::/8\").include? self\n mscope,mdesta,mdestb = self.to_string.scanf(\"%*1x%*1x%*1x%1x:%*4x:%*4x:%*4x:%*4x:%*4x:%4x:%4x\")\n mdest = (mdesta << 16) + mdestb\n s = \"MULTICAST\"\n if MSCOPES[mscope]\n s += \" #{MSCOPES[mscope]}\"\n end\n if MDESTS[mdest]\n s += \" #{MDESTS[mdest]}\"\n end\n if multicast_from_prefix?\n s += \" (prefix = #{prefix_from_multicast.to_string_including_length})\"\n end\n s\n else\n \"RESERVED\"\n end\n end\n end",
"def custom_filters(scope)\n scope\n end",
"def default_filter\n if preferences && preferences[:default_filter_id] && ErrataFilter.exists?(:id=>preferences[:default_filter_id])\n ErrataFilter.find(preferences[:default_filter_id])\n else\n SystemErrataFilter.default\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n resource_or_scope.is_a?(User) ? dashboard_root_path : root_path\n end",
"def stats_scope\n redirect_to admin_dashboard_path, alert: \"Scope not available\" unless\n params[:scope].present? && %w(catalogs).include?(params[:scope])\n\n params[:scope]\n end",
"def application_credentials_for(scope)\n Google::Auth.get_application_default(scope)\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def oauth2_scope(value = nil)\n rw_config(:oauth2_scope, value, '')\n end",
"def default_groups\n @default_groups ||= begin\n if ENV['AUTHORIZED_NETWORK_GROUPS'].is_a?(String)\n group_list_from_env(ENV['AUTHORIZED_NETWORK_GROUPS'])\n else\n [:default]\n end\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User)\n if current_user.role == \"normal\"\n app_profiles_path\n else\n admin_home_path\n end\n else\n root_path\n end\n end",
"def scope\n @options[:scope]\n end",
"def standard_agency(scope, prefix, mandate)\n case scope\n when \"national\"\n NATIONAL&.dig(@lang, gb_mandate_suffix(prefix, mandate).to_sym,\n :admin) || nil\n when \"sector\"\n SECTOR&.dig(@lang, prefix.to_sym, :admin) || nil\n when \"local\"\n \"#{LOCAL&.dig(@lang, prefix.to_sym) || 'XXXX'}#{@labels[\"local_issuer\"]}\" \n when \"enterprise\", \"social-group\"\n @issuer || nil\n when \"professional\" then \"PROFESSIONAL STANDARD\" # TODO\n end\n end",
"def favorites_scoped options = {}\n if options.key?(:multiple_scopes) == false\n validate_scopes __method__, options\n elsif options[:multiple_scopes] == true\n results = {}\n options[:scope].each do |scope|\n results[scope] = favorites.unblocked.send(scope + '_list').includes :favoritable\n end\n return results\n else\n return favorites.unblocked.send(options[:scope] + '_list').includes :favoritable\n end\n end",
"def current_scope\n @scope\n end",
"def authorize_scopes\n @authorize_scopes ||= (env['omniauth.params']['scope'] || authorize_params['scope']).split(' ')\n end",
"def add_searchlogic_defaults!(options)\n options[:params_scope] = :search unless options.has_key?(:params_scope)\n options[:search_obj] ||= instance_variable_get(\"@#{options[:params_scope]}\")\n raise(ArgumentError, \"@search object could not be inferred, please specify: :search_obj => @search or :params_scope => :search_obj_name\") unless options[:search_obj].is_a?(Searchlogic::Search::Base)\n options\n end",
"def signed_in?(scope)\n warden.authenticate?(:scope => scope)\n end",
"def default_hidden_key_scope\n lambda { none }\n end",
"def default_discount_additional_cost_per_item_scope=(default_discount_additional_cost_per_item_scope)\n validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n unless validator.valid?(default_discount_additional_cost_per_item_scope)\n fail ArgumentError, \"invalid value for \\\"default_discount_additional_cost_per_item_scope\\\", must be one of #{validator.allowable_values}.\"\n end\n @default_discount_additional_cost_per_item_scope = default_discount_additional_cost_per_item_scope\n end",
"def user_scope\n User.includes(:notification_settings)\n end",
"def get_content_scope\n if !self.custom_scope.blank?\n File.join('/', self.custom_scope) # make sure the scope starts with a '/'\n elsif !self.contentable.blank?\n self.class.contentable_to_scope(self.contentable)\n else\n if self.uri_path\n self.uri_path\n else\n MuckContents::GLOBAL_SCOPE\n end\n end\n end",
"def check_user_default_profile\n if user.default_profile.nil?\n user.default_profile = self\n end\n end",
"def environment_filter\n if self.environment == 'default'\n nil\n else\n self.environment\n end\n end",
"def environment_filter\n if self.environment == 'default'\n nil\n else\n self.environment\n end\n end"
] | [
"0.66070735",
"0.6594775",
"0.6593576",
"0.63586944",
"0.63586944",
"0.63369197",
"0.62723523",
"0.62362134",
"0.59804624",
"0.59734815",
"0.59291697",
"0.5908682",
"0.58899844",
"0.5889887",
"0.5889887",
"0.5771757",
"0.57378805",
"0.57091737",
"0.57091737",
"0.5700931",
"0.5663392",
"0.56409794",
"0.5572558",
"0.55382377",
"0.5534423",
"0.54838514",
"0.5455937",
"0.5424222",
"0.5372902",
"0.5348958",
"0.5344572",
"0.5333007",
"0.53206545",
"0.5311634",
"0.5308299",
"0.5301136",
"0.5259396",
"0.52110225",
"0.52078223",
"0.5156537",
"0.5143314",
"0.5124927",
"0.50722003",
"0.5033299",
"0.50052166",
"0.50000405",
"0.4998187",
"0.4998187",
"0.49867237",
"0.49680698",
"0.49635822",
"0.49601713",
"0.4957307",
"0.49453282",
"0.49405318",
"0.492818",
"0.4914444",
"0.4914317",
"0.49101588",
"0.49084398",
"0.48963106",
"0.488818",
"0.4866073",
"0.4858792",
"0.48508078",
"0.48401883",
"0.48265633",
"0.48216802",
"0.4800567",
"0.47996083",
"0.47979665",
"0.47979665",
"0.47888693",
"0.4784327",
"0.4783051",
"0.4781149",
"0.4771653",
"0.47639868",
"0.4763236",
"0.47608963",
"0.4750589",
"0.47502333",
"0.4747116",
"0.47403094",
"0.47381043",
"0.47371602",
"0.4735904",
"0.4727593",
"0.472523",
"0.4716105",
"0.47092584",
"0.47055525",
"0.47031334",
"0.47016934",
"0.4700455",
"0.4698561",
"0.46958157",
"0.46955547",
"0.4694579",
"0.4694579"
] | 0.73611414 | 0 |
Generate agnostic hidden sign in/out (connect) form for Facebook Connect. | def facebook_connect_form(scope, options = {})
sign_out_form = options.delete(:sign_out)
options.reverse_merge!(
:id => (sign_out_form ? 'fb_connect_sign_out_form' : 'fb_connect_sign_in_form'),
:style => 'display:none;'
)
scope = ::Devise::Mapping.find_by_path(request.path).name rescue scope
url = sign_out_form ? destroy_session_path(scope) : session_path(scope)
form_for(scope, :url => url, :html => options) { |f| }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fb_sign_out_tab\n %{\n <form action=\"/users/sign_out\" id=\"fb_connect_sign_out_form\" method=\"get\" style=\"display:none;\"></form>\n <li><a href=\"#\" onclick=\"FB.Connect.logoutAndRedirect('/users/sign_out')\"><span>Sign out</span></a></li>\n }\n end",
"def html_logout_form(cgi_dir)\n <<~HTML\n <form NAME=\"login\" ACTION=\"#{cgi_dir}/login.rbx\" METHOD=\"post\">\n <input TYPE=\"submit\" NAME=\"logout\" VALUE=\"logout\" >\n </form>\n HTML\n end",
"def fb_init(options = {})\n perms = (options[:perms] || %w{email publish_stream}).join(\",\")\n locale = options[:locale] || \"es_ES\"\n\n js = <<-DATA\n <div id=\"fb-root\"></div>\n <script type=\"text/javascript\">\n window.fbAsyncInit = function() {\n FB.init({\n appId: '#{Facebook::APP_ID.to_s}',\n status: true,\n cookie: true,\n xfbml: true\n });\n\n FB.Canvas.setAutoResize(100);\n\n #{options[:append_to_init]}\n };\n\n (function() {\n var e = document.createElement('script'); e.async = true;\n e.src = document.location.protocol +\n '//connect.facebook.net/#{locale}/all.js';\n document.getElementById('fb-root').appendChild(e);\n }());\n\n var login = function(targetUrl, perms) {\n if (perms == null) {\n perms = \"#{perms}\"\n }\n FB.login(function(response) {\n if (response.session) {\n fixSession(JSON.stringify(response.session), targetUrl);\n } else {\n //pending to do when not logged in\n }\n }, {perms: perms});\n }\n\n var fixSession = function(fbSession, targetUrl) {\n $(\"body\").prepend('<form id=\"fixSession\"></form>');\n\n var f = $('form')[0];\n f.method = 'POST';\n f.action = \"/cookie_fix\";\n var m = document.createElement('input');\n m.setAttribute('type', 'hidden');\n m.setAttribute('name', '_session_id');\n m.setAttribute('value', fbSession);\n f.appendChild(m);\n\n m = document.createElement('input');\n m.setAttribute('type', 'hidden');\n m.setAttribute('name', 'redirect_to');\n m.setAttribute('value', targetUrl);\n f.appendChild(m);\n\n f.submit();\n }\n </script>\n DATA\n \n js.html_safe\n end",
"def authButtonAction(sender)\n if FBSession.activeSession.open?\n appDelegate.closeSession\n else\n appDelegate.openSessionWithAllowLoginUI(true)\n end\n end",
"def show\n auth = Authentication.auth.from_cookie(cookies)\n authenticate Authentication.identify(auth.user)\n redirect_to Facebook.config[:app_url]\n end",
"def fb_auth\n session[:sign_up_reason] = nil\n\n if params[:return_to]\n set_after_sign_in_location(params[:return_to])\n elsif params[:spree_user_return_to]\n set_after_sign_in_location(params[:spree_user_return_to])\n elsif is_user_came_from_current_app\n set_after_sign_in_location(request.referrer)\n end\n\n if params[:redeem_via_fb_state]\n session[:redeem_via_fb_state] = params[:redeem_via_fb_state]\n end\n\n if params[:new_modal_fb_state]\n session[:new_modal_fb_state] = params[:new_modal_fb_state]\n end\n\n if params[:show_promocode_modal]\n session[:show_promocode_modal] = params[:show_promocode_modal]\n # reset current modal popup\n set_after_sign_in_location(root_path)\n end\n\n session[:auto_apply] = params[:auto_apply] if params.key?(:auto_apply)\n session[:auto_apply_promo] = params[:auto_apply_promo] if params.key?(:auto_apply_promo)\n\n # Capture PLEASE REMIND ME ABOUT MY SALE events to push onto customer.io later.\n session[:email_reminder_promo] = params[:email_reminder_promo] if params.key?(:email_reminder_promo)\n\n\n redirect_to spree.spree_user_omniauth_authorize_url(provider: :facebook, scope: 'email,public_profile,user_friends')\n end",
"def signin_get\n @mode = :signin\n \n if params[:req].present? && !ApplicationController::RequiredIdentity.payload(session)\n @mode = :signup\n kind = params[:req].to_sym\n back = request.env[\"HTTP_REFERER\"]\n \n ApplicationController::RequiredIdentity.set_payload(session, \n :on_success => back,\n :on_cancel => back,\n :kind => kind)\n end\n \n render! :action => \"new\", :layout => \"dialog\"\n end",
"def sign_in\n render inline: \"<html><head><script>window.close();</script></head><body></body></html>\".html_safe\n end",
"def new\n session[:user_return_to] ||= params[:user_return_to]\n @already_hoc_registered = params[:already_hoc_registered]\n @hide_sign_in_option = true\n if params[:providerNotLinked]\n if params[:useClever]\n # The provider was not linked, and we need to tell the user to sign in specifically through Clever\n flash.now[:alert] = I18n.t 'auth.use_clever', provider: I18n.t(\"auth.#{params[:providerNotLinked]}\")\n else\n # This code is only reached through the oauth flow when the user already has an email account.\n # Usually email would not be available for students, this is a special case where oauth fills it in.\n flash.now[:alert] = I18n.t 'auth.not_linked', provider: I18n.t(\"auth.#{params[:providerNotLinked]}\")\n @email = params[:email]\n end\n end\n super\n end",
"def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end",
"def login_popup\n session[:redirect_to_after_auth] = request.env['HTTP_REFERER']\n @login_form = LoginForm.new\n render :layout => \"blank\"\n end",
"def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend",
"def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end",
"def new\n @partner_sign_in = true\n render layout: 'sign_pages'\n end",
"def hide_passwords\n if params[:hide_passwords]\n session[:hide_passwords] = true\n else\n session[:hide_passwords] = false\n end\n redirect_to request.referrer\n end",
"def form_logout\n post '/goldberg/auth/logout'\n end",
"def before_connect(facebook_session)\n self.login = 'facebook_' + facebook_session.user.name\n self.facebook_name = facebook_session.user.name\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'facebook'\n end",
"def logout\r\n reset_session \r\n refreshLogout ##This will hide the logout button and display the login box\r\n \r\n end",
"def show_logout\n @show_logout = true\n end",
"def koala_logout_button(button_text = \"Logout\", logout_url = \"/\", options = {})\n options = { :unobtrusive => true, :onclick => \"FB.getLoginStatus(function(status){if(status.session){FB.logout(function(response){document.location.href='#{logout_url}'});}else{document.location.href='#{logout_url}'}})\" }.merge(options)\n link_to button_text, \"#\", options\n end",
"def before_connect(facebook_session)\n self.login = facebook_session.user.name\n self.facebook_name = facebook_session.user.name\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'facebook'\n end",
"def disconnect_facebook\n current_user.fb_uid = nil\n current_user.fb_access_token = nil\n current_user.save!\n redirect_to request.referer, notice: 'Disconnected from Facebook'\n end",
"def disconnect_facebook\n current_user.fb_uid = nil\n current_user.fb_access_token = nil\n current_user.save!\n redirect_to request.referer, notice: 'Disconnected from Facebook'\n end",
"def fill_out_form(email, password, password_confirmation)\n fill_in \"Email\", with: email\n fill_in \"Password\", with: password\n fill_in \"Password confirmation\", with: password_confirmation\n click_button \"Sign up\"\n end",
"def fill_out_form(email, password, password_confirmation)\n fill_in \"Email\", with: email\n fill_in \"Password\", with: password\n fill_in \"Password confirmation\", with: password_confirmation\n click_button \"Sign up\"\n end",
"def create_fb_url_with_creds(indv_u_id, ac_token, decoded_state: nil)\n url = FACEBOOK_URL + \"?individual_user_id=#{indv_u_id}&secret=#{ac_token}\"\n if decoded_state\n url += \"pathway=#{decoded_state['pathway']}\" +\n \"&gift_template_id=#{decoded_state['gift_template_id']}\" \n end\n \n #Creates facebook oauth dialog url\n #--PE 10/30/14\n def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end\n\n #########\n protected\n ######### \n\n #Renew the access_token after API failure --PE July 17, 2012\n def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end\n\n #Redirect to app index page after connection is reset --PE July 23, 2012\n def rescue_connection_reset\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (connection reset). \" +\n \"Please try again.\"\n end\n\n #Redirect to app index page after undefined method errors --PE July 23, 2012\n def rescue_undefined_method\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (undefined method). \" +\n \"Please try again.\"\n end\nend",
"def connect\n raise ArgumentError unless (params[:fname] == '_opener')\n raise ArgumentError unless connect = ActiveSupport::JSON.decode(params[:session])\n\n @user = User.find_by_facebook_uid(connect['uid'])\n\n if @user.nil?\n # create a new user for the Facebook User if not present\n @user = User.new\n @user.facebook_uid = connect['uid']\n\n # XXX this is crap: login, country and email should be fetched from the facebook. Why?\n # because: login clashes could occur (if an user names itself fb_123456), the \"unknown\"\n # country is BAD design, because it's a corner case to cope with in views, and the fake\n # email is USELESS to send mewsic e-mail notifications to the user.\n #\n @user.login = \"fb_#{@user.facebook_uid}\" # XXX\n @user.country = \"unknown\" # XXX\n @user.email = \"#{@user.facebook_uid}@users.facebook.com\" # XXX\n\n @user.password = @user.password_confirmation = rand(2**32).to_s\n @user.save!\n end\n\n session[:fb_connect] = true\n self.current_user = @user\n\n # render the cross-domain communication channel\n render :layout => false\n\n rescue ActiveRecord::ActiveRecordError\n debugger\n head :forbidden\n\n rescue ArgumentError\n head :bad_request\n end",
"def show_connect_form\n if params[:award].present?\n @connect_for_award = true\n end\n @user = User.find(params[:uid])\n render :partial => \"profile_connect_with\", :layout => false\n end",
"def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end",
"def feature_plain_sign_in(login, password, options = {})\n visit '/'\n fill_in 'educator_login_text', with: login\n fill_in 'educator_password', with: password\n if options[:login_code]\n fill_in 'educator_login_code', with: options[:login_code]\n end\n click_button 'Sign in'\n end",
"def login\n # show LOGIN form\n\n end",
"def signin_dropdown\n view_context.multiauth_dropdown(\"Sign In\")\n end",
"def facebook_authenticatable\n\t\t\troutes.with_options(:controller => 'facebook_auth', :name_prefix => nil) do |auth|\n\t auth.send(:\"new_#{mapping.name}_session\", mapping.path_names[:sign_in], :action => 'create', :conditions => {:method => :get})\n\t # auth.send(:\"#{mapping.name}_session\", mapping.path_names[:sign_in], :action => 'create', :conditions => {:method => :post})\n\t # auth.send(:\"destroy_#{mapping.name}_session\", mapping.path_names[:sign_out], :action => 'destroy', :conditions => { :method => :get })\n\t\t\tend\n\t\tend",
"def new\n next_url = AppConfig.facebook_app_url + \"facebook/callback\"\n #next_url += (\"?request_ids=\" + params[:request_ids]) unless params[:request_ids].nil?\n @auth_url = Authentication.auth.client.web_server.authorize_url(\n :redirect_uri => next_url, :scope => AppConfig.facebook_perms\n )\n end",
"def render_login_button(redirect_url = nil)\n case settings.browserid_login_button\n when :orange, :red, :blue, :green, :grey\n button_url = \"#{settings.browserid_url}/i/sign_in_\" \\\n \"#{settings.browserid_login_button.to_s}.png\"\n else\n button_url = settings.browserid_login_button\n end\n\n if session[:authorize_redirect_url]\n redirect_url = session[:authorize_redirect_url]\n session[:authorize_redirect_url] = nil\n end\n redirect_url ||= request.url\n\n template = ERB.new(Templates::LOGIN_BUTTON)\n template.result(binding)\n end",
"def sign_out\n click_link 'Sign out'\n end",
"def default_hidden_widget\n Widgets::HiddenInput\n end",
"def fbauthorize\n redirect_to fb_auth_login_url.to_s\n end",
"def new\n @url = url_for(:controller => \"connect\", :action => \"confirm\", :only_path => false)\n @connect_url = generate_login_url({\"redirect_uri\" => @url})\n end",
"def destroy\n if logged_in?\n self.current_user.forget_me\n self.current_user = nil\n session[:fb_connect] = false\n cookies.delete :auth_token\n flash[:notice] = \"You have been logged out\"\n end\n\n redirect_back_or_default('/')\n end",
"def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end",
"def signin\n end",
"def new\n \n fb_auth = FbGraph::Auth.new('155275974530339', '309d340d359061c890906926e8139e4a')\n fb_auth.client # => Rack::OAuth2::Client\n \n client = fb_auth.client\n client.redirect_uri = \"http://localhost:3000/config_keys\"\n\n # redirect user to facebook\n redirect_to client.authorization_uri(\n :scope => [:email, :read_stream, :offline_access]\n )\n\n # in callback\n client.authorization_code = params[:code]\n access_token = client.access_token! # => Rack::OAuth2::AccessToken\n FbGraph::User.me(access_token).fetch # => FbGraph::User\n \n end",
"def new\n session.delete('devise.omniauth_data')\n super\n end",
"def sign_out\n logout\n end",
"def hide_uoc_info_form\n logger.info 'Hiding the Use of Collections Info form'\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end",
"def sign_in\n end",
"def fb_login_button(*args)\n\n callback = args.first\n options = args[1] || {}\n options.merge!(:onlogin=>callback) if callback\n\n text = options.delete(:text)\n\n content_tag(\"fb:login-button\",text, options)\n end",
"def hide_secret\n @is_showing_secret = false\n # TODO secret should be using a JPanel or something, not a dialog.\n end",
"def index\n return render_logged_in if logged_in?\n return redirect_to_signup_flow_entry_point if connected? && !feature_enabled?('onboarding.create_profile_modal')\n render_logged_out\n end",
"def fb_login\n @driver.get(@login_url + 'login')\n email_field = @driver.find_element(:id, 'email')\n email_field.clear\n email_field.send_keys @fb_login['fb_user']\n password_field = @driver.find_element(:id, 'pass')\n password_field.clear\n password_field.send_keys @fb_login['fb_pass']\n @driver.find_element(:name, 'login').click\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until do\n @driver.find_element(:id, 'q')\n end\n end",
"def det_facebook_login_method\n @status, @msg, @data = UserValidator.det_facebook_login_method(params)\n end",
"def fill_in_credentials\n hide_soft_keyboard\n clear_text_in(\"#{WEB_VIEW} xpath:'#{USER_NAME_FORM_XPATH}'\")\n enter_text(\"#{WEB_VIEW} xpath:'#{USER_NAME_FORM_XPATH}'\", CREDENTIALS[:username])\n hide_soft_keyboard\n\n clear_text_in(\"#{WEB_VIEW} xpath:'#{PASSWORD_FORM_XPATH}'\")\n enter_text(\"#{WEB_VIEW} xpath:'#{PASSWORD_FORM_XPATH}'\", CREDENTIALS[:password])\n hide_soft_keyboard\n end",
"def facebook\n social_login(request.env['omniauth.auth'], current_user,\"Facebook\")\n end",
"def login\n\t#Login Form\n end",
"def new\n redirect_to user_saml_omniauth_authorize_path\n end",
"def redirection_form\n # Get redirection URL\n redirection_url = session[:post_last_location] || root_url\n session[:post_last_location] = nil\n\n # Get redirection params\n redirection_params = session[:params] || {}\n session[:params] = nil\n\n # Restore referer\n if session[:last_referer]\n session[:last_location] = session[:last_referer] \n session[:last_referer] = nil\n end \n\n form_id = \"redirection_form\"\n html = form_tag(redirection_url, :id => form_id) + \"\\n\"\n redirection_params.formify.each do |k, v|\n html += hidden_field_tag(k, v) + \"\\n\"\n end\n html + submit_tag(::AuthorizationHooks.redirection_submit_label) + \n \"</form>\" + javascript_tag(\"document.getElementById(\" +\n form_id.to_json + \").submit()\")\n end",
"def new\n client = Facebook.auth(callback_facebook_url).client\n redirect_to client.authorization_uri(\n :scope => Facebook.config[:scope]\n )\n end",
"def new\n client = Facebook.auth(callback_facebook_url).client\n redirect_to client.authorization_uri(\n :scope => Facebook.config[:scope]\n )\n end",
"def sign_in_link\n # note: could test to see if we aren't already signed in, but seems no point\n # TBD: make sure that all references to sign_in have it as a dialog\n link_to( \"#{iconify(:sign_in)} Sign In\".html_safe, new_person_session_path, 'data-rel' => 'dialog')\n end",
"def anonymous_form\n view_context.render \"users/anonymous_form\"\n end",
"def new\n @authentications = current_user.authentications if current_user\n if current_user\n # flash[:notice] = \"All signed in. Welcome back, #{current_user.handle}!\"\n redirect_to after_sign_in_path_for(current_user), notice: \"All signed in. Welcome back, #{current_user.handle}!\"\n end\n @auth_delete = true\n smartrender\n end",
"def logout \n sign_out\n# render :text => \"single sign off\" and return unless params[\"from_sso\"].nil?\n redirect_to \"#{my_addr}/#{app.name}/home\"\n end",
"def dialogue_url\n return \"https://www.facebook.com/dialog/oauth?client_id=\"+@app_id+\"&redirect_uri=\"+@canvas_url+\"&scope=\"+@permission\n end",
"def sign_in_button\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/ctl00_content_ctl00_fragment_4504_ctl01_ctl00_ctl02_ctl17_loginButton/\"), __method__)\n end",
"def nav_login_button\r\n \r\n end",
"def sign_in\n\n end",
"def create\n\t\tauth = request.env[\"omniauth.auth\"] #when press the link fb_login, response that is received from callback is stored in auth var\n\t\tsession[:omniauth] = auth.except('extra') #session var with info from response, except extra- info that we dont need\n\t\tcurrent_user = User.sign_in_from_omniauth(auth)\n\t\tsession[:user_id] = current_user.id\n\t\tredirect_to root_url, flash: { notice: \"#{current_user.name}, welcome to Like Machine.\"}\n\tend",
"def to_label\n login\n end",
"def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end",
"def signout\n self.oaw_signout\n redirect_to root_url\n end",
"def disconnect\n \tsocial = params[:social]\n \t\tcurrent_user.disconnect(social)\n \t\tredirect_to :back\n end",
"def dev_cancel_fb\n param! :signed_request, String, required: true\n\n #parsing flow referred to https://developers.facebook.com/docs/games/gamesonfacebook/login#parsingsr\n signed_request = params[:signed_request]\n encoded_sig, encoded_payload = signed_request.split('.')\n secret = ENV['FACEBOOK_APP_SECRET']\n\n sig = Base64.decode64(encoded_sig.tr('-_','+/')).unpack('H*')[0]\n data = JSON.parse(Base64.decode64(encoded_payload.tr('-_','+/')))\n\n expected_sig = OpenSSL::HMAC.hexdigest('SHA256', secret, encoded_payload)\n\n if expected_sig != sig\n raise 'Invalid signature'\n end\n\n @user = User.find_by!(fb_uid: data[\"user_id\"])\n @user.update(fb_uid: nil, fb_token: nil)\n\n return render json: {success: true}\n end",
"def configure_sign_in_params\n if !!current_end_user && current_end_user&.is_withdrawal != true #ユーザーが存在する場合(true)かつユーザーの退会フラグがfalseの時\n reset_session\n flash[:alert] = \"このアカウントは退会済みです。\"\n redirect_to request.referer\n end\n end",
"def sessionStateChanged(notification)\n puts \"session state changed called. Session open? #{FBSession.activeSession.open?}\"\n puts \"permision to post? #{FBSession.activeSession.permissions.include?(\"publish_stream\") && FBSession.activeSession.permissions.include?(\"publish_checkins\")}\"\n if FBSession.activeSession.open?\n showUserInfo\n authenticateWithServer\n # authButton.hidden = true\n else\n resetTextLabel\n # authButton.hidden = false\n end\n end",
"def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end",
"def get_login_url(options={})\n \n # handle options\n nextPage = options[:next] ||= nil\n popup = (options[:popup] == nil) ? false : true\n skipcookie = (options[:skipcookie] == nil) ? false : true\n hidecheckbox = (options[:hidecheckbox] == nil) ? false : true\n frame = (options[:frame] == nil) ? false : true\n canvas = (options[:canvas] == nil) ? false : true\n \n # url pieces\n optionalNext = (nextPage == nil) ? \"\" : \"&next=#{CGI.escape(nextPage.to_s)}\"\n optionalPopup = (popup == true) ? \"&popup=true\" : \"\"\n optionalSkipCookie = (skipcookie == true) ? \"&skipcookie=true\" : \"\"\n optionalHideCheckbox = (hidecheckbox == true) ? \"&hide_checkbox=true\" : \"\"\n optionalFrame = (frame == true) ? \"&fbframe=true\" : \"\"\n optionalCanvas = (canvas == true) ? \"&canvas=true\" : \"\"\n \n # build and return URL\n return \"http://#{WWW_SERVER_BASE_URL}#{WWW_PATH_LOGIN}?v=1.0&api_key=#{@api_key}#{optionalPopup}#{optionalNext}#{optionalSkipCookie}#{optionalHideCheckbox}#{optionalFrame}#{optionalCanvas}\"\n \n end",
"def fb_login_button(text, options = {})\n link_to(text, user_omniauth_callback_path(:facebook), { 'class' => 'fb-login', 'data-scope' => OAUTH_CONFIG['facebook']['options']['scope'] }.merge(options))\n end",
"def facebook_connect_user?\n facebook_user? and password.blank?\n end",
"def digimag_keep_signin_checkbox\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_content_digimagSignin_fragment_14992_ctl01_ctl00_ctl02_ctl17_autoLogin/\"), __method__)\n end",
"def login_logout_link(opts={})\n logout_opts = opts.delete(:logout) || {}\n login_opts = opts.delete(:login) || {}\n if user_signed_in?\n opts = opts.merge(logout_opts).merge(:method=>:delete, :title=>current_user.name)\n link_to(raw(\"<i class='icon-user icon-white'></i> #{current_user.name}\"), destroy_user_session_path, opts)\n else\n opts = opts.merge(login_opts).merge(:title=>\"Login or Register\")\n # link_to(raw(\"<i class='icon-user icon-white'></i> Login with Facebook\"), new_user_session_path, opts)\n link_to(raw(\"<i class='icon-user icon-white'></i> Login or Register\"), user_omniauth_authorize_path(:facebook), opts)\n end\n end",
"def facebook_request\n redirect_to facebook_authenticate_url\n end",
"def user_signin_signout_link\n if user_signed_in?\n link_to(\"[ Sign out ]\", destroy_user_session_path)\n else\n link_to(\"[ Sign in ]\", new_user_session_path)\n end\n end",
"def sign_in\n\tend",
"def form\n convention.then(&:user_con_profile_form)\n end",
"def complete_login_form\n raise \"UnimplementedFunctionality\"\n end",
"def authenticate(fb_user)\n \n \n end",
"def fb_login_and_redirect(url, options = {})\n js = update_page do |page|\n page.redirect_to url\n end\n\n text = options.delete(:text)\n \n content_tag(\"fb:login-button\",text,options.merge(:onlogin=>js))\n end",
"def new\n # render the login form\n end",
"def new #login page\n end",
"def javascript_include_koala\n \"<div id=\\\"fb-root\\\"></div>\n <script src=\\\"http://connect.facebook.net/en_US/all.js\\\"></script>\n <script>\n FB.init({\n appId:'#{Devise::koala_app_id}', cookie:true,\n status:true, xfbml:true\n });\n </script>\"\n end",
"def log_in_with_facebook?\n return false if %w[all facebook].include? ENV[\"DISABLE_LOG_INS\"]\n return true unless params[:log_in_with]\n return %w[any facebook].include? params[:log_in_with]\n end",
"def sign_out_link\n # note: could test to see if we aren't already signed in, but seems no point\n # note: icon is the vertical flip of the sign-in icon\n link_to( \n \"Sign Out #{iconify(:sign_out)}\".html_safe, \n destroy_person_session_path, \n method: :delete,\n 'class' => 'ui-btn-right' # force button to the right side of the header, leaving space for the back button\n )\n end",
"def koala_login_button(button_text = \"Login with Facebook\", login_url = \"/\", registration_url = nil)\n login_url += (login_url =~ /\\?/ ? '&koala=true' : '?koala=true')\n registration = (registration_url.present?) ? \"registration-url=\\\"#{registration_url}\\\"\" : \"\"\n \"<fb:login-button #{registration} on-login=\\\"window.location.href = '#{login_url}';\\\">#{button_text}</fb:login-button>\"\n end",
"def navbar_facebook_name\n if Rails.env.development?\n if current_user_facebook\n t('.menus.facebook.sign_out.name')\n end\n else\n ''\n end\n end",
"def sign_in_and_redirect!\n set_user_session_from_oauth\n set_user_cookie\n\n url = if params[:state] == \"popup\"\n Exvo::Helpers.auth_uri + \"/close_popup.html\"\n elsif params[:state] # if not popup then an url\n params[:state]\n else\n session[:user_return_to] || \"/\"\n end\n\n redirect_to url\n end",
"def facebook\n\n end",
"def login_page\n prompt.select(\"Login or Sign up\") do |menu|\n menu.choice \"Login\", -> {login_helper}\n menu.choice \"Sign up\", -> {sign_up_helper}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def sign_out\n post \"api/logout\"\n @me = nil\n end",
"def keep_signedin_checkbox\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_content_ctl00_fragment_4504_ctl01_ctl00_ctl02_ctl17_autoLogin/\"), __method__)\n end"
] | [
"0.6992346",
"0.5685852",
"0.5656324",
"0.5525541",
"0.53849596",
"0.5353388",
"0.5326352",
"0.53056586",
"0.5285196",
"0.5282517",
"0.5274615",
"0.5268719",
"0.5264819",
"0.52586305",
"0.52490914",
"0.5213328",
"0.52072877",
"0.5185584",
"0.5177293",
"0.5154246",
"0.51484555",
"0.5140725",
"0.5140725",
"0.5123044",
"0.5123044",
"0.51203245",
"0.510129",
"0.50986624",
"0.5090323",
"0.50788164",
"0.50742644",
"0.50728047",
"0.50548935",
"0.5054218",
"0.50527656",
"0.50423914",
"0.5033563",
"0.5001821",
"0.49981812",
"0.49742228",
"0.49721888",
"0.4967684",
"0.49667028",
"0.49656248",
"0.49571595",
"0.4956759",
"0.49558234",
"0.4954045",
"0.4948005",
"0.49454543",
"0.49223214",
"0.49128267",
"0.4912754",
"0.49077716",
"0.49064752",
"0.49047822",
"0.49036568",
"0.4900375",
"0.4900375",
"0.48975503",
"0.4895169",
"0.4886014",
"0.48858947",
"0.4871801",
"0.48652756",
"0.48619923",
"0.4857621",
"0.4846999",
"0.48408633",
"0.4839026",
"0.4837899",
"0.48343286",
"0.48342964",
"0.48321024",
"0.48300174",
"0.48294616",
"0.48280546",
"0.48274526",
"0.48200577",
"0.48070878",
"0.480477",
"0.47999173",
"0.4795965",
"0.479198",
"0.47907373",
"0.47897324",
"0.47882724",
"0.47879112",
"0.47800043",
"0.477657",
"0.47743452",
"0.47650883",
"0.4761071",
"0.47595587",
"0.47433206",
"0.47398108",
"0.47370464",
"0.47360057",
"0.47314674",
"0.47307393"
] | 0.75580984 | 0 |
Test data: (;PB[Honinbo Shusaku]BR[6d]PW[Honinbo Shuwa]WR[8d]) | def test_data_hash
[{
'PB' => 'Honinbo Shusaku',
'BR' => '6d',
'PW' => 'Honinbo Shuwa',
'WR' => '8d',
'GC' => 'game from Hikaru no Go chapter 2, this version only in the anime',
'RE' => 'W+4'
}]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_DR_PDB\n data = \"DR PDB; 1NB3; X-ray; A/B/C/D=116-335, P/R/S/T=98-105.\"\n sp = SPTR.new(data)\n assert_equal([[\"1NB3\", \"X-ray\", \"A/B/C/D=116-335, P/R/S/T=98-105\"]],\n sp.dr['PDB'])\n end",
"def strand; @data[8]; end",
"def process_data(data)\n print_headline\n tmp = data.dup\n\n # TELNETコマンドを抽出しダンプする.\n tmp.gsub!(/#{IAC}(\n [#{DONT}#{DO}#{WONT}#{WILL}].|\n #{SB}.(#{IAC}#{IAC}|[^#{IAC}])*#{IAC}#{SE}|\n [#{NOP}-#{GA}#{0.chr}-#{239.chr}]\n )/xon){\n case $1[0].chr\n when DONT; print \"> IAC DONT #{$1[1]}\\n\"\n when DO ; print \"> IAC DO #{$1[1]}\\n\"\n when WONT; print \"> IAC WONT #{$1[1]}\\n\"\n when WILL; print \"> IAC WILL #{$1[1]}\\n\"\n when SB ; print \"> IAC SB #{$1[1]} #{$1[2..-3].dump} IAC SE\\n\"\n else ; print \"> IAC #{$1[1]}\\n\"\n end\n }\n\n # 残りの部分を出力.\n tmp.each { |line| print line.dump, \"\\n\" } if tmp.size > 0\n end",
"def test_nested_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*810*0001~\n BIG*19700101*test*19700101*00000007397108*004010~\n REF*IO*define-this-value~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n DTM*011*19700101~\n IT1*1*1*EA*59.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*59.95~\n PID*F****CBD Topical Cream 400mg THC Free~\n SAC*C*ZZZZ***0~\n IT1*2*2*EA*49.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*49.95~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n SAC*C*ZZZZ***0~\n TDS*17985~\n CAD*****define-this-value~\n SAC*C*ZZZZ***5995~\n SAC*C*ZZZZ***9990~\n CTT*2~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS810::TS.new(store)\n ts.BIG do |big|\n big.BIG01 = @epoch\n big.BIG02 = \"test\"\n big.BIG03 = @epoch\n big.BIG04 = \"00000007397108\"\n big.BIG05 = \"004010\"\n end\n ts.REF.REF01 = \"IO\"\n ts.REF.REF02 = \"define-this-value\"\n ts.L_N1 do |n1|\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n ts.DTM.DTM01 = \"011\"\n ts.DTM.DTM02 = @epoch\n ts.L_IT1 do |rep|\n rep.IT1 do |it1|\n it1.AssignedIdentification = \"1\"\n it1.QuantityInvoiced = 1\n it1.IT103 = \"EA\"\n it1.UnitPrice = 59.95\n it1.IT106 = \"UP\"\n it1.IT107 = \"860001662184\"\n it1.IT108 = \"VP\"\n it1.IT109 = \"860001662184\"\n it1.IT110 = \"A3\"\n it1.IT111 = \"860001662184\"\n it1.IT112 = \"ZZ\"\n it1.IT113 = \"860001662184\"\n it1.IT114 = \"EN\"\n it1.IT115 = \"860001662184\"\n end\n # CTP\n rep.CTP do |ctp|\n ctp.CTP02 = \"DPR\"\n ctp.CTP03 = 0\n ctp.CTP04 = 0\n ctp.CTP06 = \"DIS\"\n ctp.CTP07 = 0\n ctp.CTP08 = 59.95\n end\n # PID\n rep.L_PID do |pid|\n pid.PID.PID01 = \"F\"\n pid.PID.PID05 = \"CBD Topical Cream 400mg THC Free\"\n end\n # SAC\n rep.L_SAC do |sac|\n sac.SAC.SAC01 = \"C\"\n sac.SAC.SAC02 = \"ZZZZ\"\n sac.SAC.SAC05 = 0\n end\n end\n ts.L_IT1 do |rep|\n # IT1\n rep.IT1.AssignedIdentification = \"2\"\n rep.IT1.QuantityInvoiced = 2\n rep.IT1.IT103 = \"EA\"\n rep.IT1.UnitPrice = 49.95\n rep.IT1.IT106 = \"UP\"\n rep.IT1.IT107 = \"860001662184\"\n rep.IT1.IT108 = \"VP\"\n rep.IT1.IT109 = \"860001662184\"\n rep.IT1.IT110 = \"A3\"\n rep.IT1.IT111 = \"860001662184\"\n rep.IT1.IT112 = \"ZZ\"\n rep.IT1.IT113 = \"860001662184\"\n rep.IT1.IT114 = \"EN\"\n rep.IT1.IT115 = \"860001662184\"\n # CTP\n rep.CTP.CTP02 = \"DPR\"\n rep.CTP.CTP03 = 0\n rep.CTP.CTP04 = 0\n rep.CTP.CTP06 = \"DIS\"\n rep.CTP.CTP07 = 0\n rep.CTP.CTP08 = 49.95\n # PID\n rep.L_PID do |rep|\n rep.PID.PID01 = \"F\"\n rep.PID.PID05 = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n # SAC\n rep.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 0\n end\n end\n ts.TDS.TDS01 = 179.85\n ts.CAD.CAD05 = \"define-this-value\"\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 59.95\n end\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 49.95 * 2\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end",
"def test_OH_lines\n data = 'OS Tomato black ring virus (strain E) (TBRV).\nOC Viruses; ssRNA positive-strand viruses, no DNA stage; Comoviridae;\nOC Nepovirus; Subgroup B.\nOX NCBI_TaxID=12277;\nOH NCBI_TaxID=4681; Allium porrum (Leek).\nOH NCBI_TaxID=4045; Apium graveolens (Celery).\nOH NCBI_TaxID=161934; Beta vulgaris (Sugar beet).\nOH NCBI_TaxID=38871; Fraxinus (ash trees).\nOH NCBI_TaxID=4236; Lactuca sativa (Garden lettuce).\nOH NCBI_TaxID=4081; Lycopersicon esculentum (Tomato).\nOH NCBI_TaxID=39639; Narcissus pseudonarcissus (Daffodil).\nOH NCBI_TaxID=3885; Phaseolus vulgaris (Kidney bean) (French bean).\nOH NCBI_TaxID=35938; Robinia pseudoacacia (Black locust).\nOH NCBI_TaxID=23216; Rubus (bramble).\nOH NCBI_TaxID=4113; Solanum tuberosum (Potato).\nOH NCBI_TaxID=13305; Tulipa.\nOH NCBI_TaxID=3603; Vitis.'\n\n res = [{'NCBI_TaxID' => '4681', 'HostName' => 'Allium porrum (Leek)'},\n {'NCBI_TaxID' => '4045', 'HostName' => 'Apium graveolens (Celery)'},\n {'NCBI_TaxID' => '161934', 'HostName' => 'Beta vulgaris (Sugar beet)'},\n {'NCBI_TaxID' => '38871', 'HostName' => 'Fraxinus (ash trees)'},\n {'NCBI_TaxID' => '4236', 'HostName' => 'Lactuca sativa (Garden lettuce)'},\n {'NCBI_TaxID' => '4081', 'HostName' => 'Lycopersicon esculentum (Tomato)'},\n {'NCBI_TaxID' => '39639', 'HostName' => 'Narcissus pseudonarcissus (Daffodil)'},\n {'NCBI_TaxID' => '3885', \n 'HostName' => 'Phaseolus vulgaris (Kidney bean) (French bean)'},\n {'NCBI_TaxID' => '35938', 'HostName' => 'Robinia pseudoacacia (Black locust)'},\n {'NCBI_TaxID' => '23216', 'HostName' => 'Rubus (bramble)'},\n {'NCBI_TaxID' => '4113', 'HostName' => 'Solanum tuberosum (Potato)'},\n {'NCBI_TaxID' => '13305', 'HostName' => 'Tulipa'},\n {'NCBI_TaxID' => '3603', 'HostName' => 'Vitis'}]\n sp = SPTR.new(data)\n assert_equal(res, sp.oh)\n end",
"def sample_data\n %w(A,B,1 A,C,2 B,C,3 B,D,3 C,D,1 B,E,2 D,F,3 D,E,3 E,G,3 F,G,1)\n end",
"def test_855\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*855*0001~\n BAK*00*AC*00000007397108*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n PO1*1*1*EA*59.95**UP*860001662184*VP*860001662184~\n PID*F****CBD Topical Cream 400mg THC Free~\n ACK*IA*1*EA****UP*860001662184*VP*860001662184~\n PO1*2*2*EA*49.95**UP*860001662108*VP*860001662108~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n ACK*IA*2*EA****UP*860001662108*VP*860001662108~\n CTT*2~\n SE*13*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS855::TS.new(store)\n ts.BAK do |bak|\n bak.TransactionSetPurposeCode = \"00\"\n bak.AcknowledgmentType = \"AC\"\n bak.PurchaseOrderNumber = \"00000007397108\"\n bak.Date = @epoch\n end\n ts.L_N1 do |rep|\n # N1\n rep.N1.EntityIdentifierCode = \"ST\"\n rep.N1.Name = \"Sweeney Todd\"\n # N3\n rep.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n rep.N4.CityName = \"Birmingham\"\n rep.N4.StateOrProvinceCode = \"AL\"\n rep.N4.PostalCode = \"35226\"\n rep.N4.CountryCode = \"US\"\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"1\"\n rep.PO1.QuantityOrdered = 1\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 59.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662184\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662184\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"CBD Topical Cream 400mg THC Free\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 1\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662184\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662184\"\n end\n end\n ts.L_PO1 do |rep|\n rep.PO1.AssignedIdentification = \"2\"\n rep.PO1.QuantityOrdered = 2\n rep.PO1.UnitOrBasisForMeasurementCode = \"EA\"\n rep.PO1.UnitPrice = 49.95\n rep.PO1.ProductServiceIdQualifier1 = \"UP\"\n rep.PO1.ProductServiceId1 = \"860001662108\"\n rep.PO1.ProductServiceIdQualifier2 = \"VP\"\n rep.PO1.ProductServiceId2 = \"860001662108\"\n rep.L_PID do |rep|\n rep.PID.ItemDescriptionType = \"F\"\n rep.PID.Description = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n rep.L_ACK do |rep|\n rep.ACK.LineItemStatusCode = \"IA\"\n rep.ACK.Quantity = 2\n rep.ACK.UnitOrBasisForMeasurementCode = \"EA\"\n rep.ACK.ACK07 = \"UP\"\n rep.ACK.ACK08 = \"860001662108\"\n rep.ACK.ACK09 = \"VP\"\n rep.ACK.ACK10 = \"860001662108\"\n end\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end",
"def test_parsing_from_syntheyes_2dp\n fixture = File.open(File.dirname(__FILE__) + '/sy_subpix_2dpaths.txt')\n trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 720, :height => 576).to_a\n \n bl_kf = trackers[2][0]\n assert_in_delta 0.0, bl_kf.abs_x, DELTA\n assert_in_delta 0.0, bl_kf.abs_y, DELTA\n\n tr_kf = trackers[3][0]\n assert_in_delta 720.0, tr_kf.abs_x, DELTA\n assert_in_delta 576.0, tr_kf.abs_y, DELTA\n end",
"def test_RG_line\n data = \"\nRN [1]\nRG The C. elegans sequencing consortium;\nRG The Brazilian network for HIV isolation and characterization;\"\n sp = SPTR.new(data)\n assert_equal(['The C. elegans sequencing consortium', \n 'The Brazilian network for HIV isolation and characterization'],\n sp.ref.first['RG'])\n end",
"def test_parse_hapmap_snp_data\n column_headings = []\n snp_data = []\n File.open(\"#{RAILS_ROOT}/test/mocks/#{@hapmap_filename}\",\"r\") do |file|\n while (f = file.gets)\n\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^rs#/\n column_headings = f.split(/\\s/)\n next\n end\n\n # Split the hapmap file based on spaces\n snp_data = f.split(/\\s/)\n\n # load_hapmap_snp_data(column_headings,snp_data)\n break\n end # end of file_array.each loop\n\n # test that we're parsing the headings and the SNP data correctly\n assert_equal \"SNPalleles\",column_headings[1]\n assert_equal \"rs7754266\",snp_data[0]\n assert_equal \"ncbi_b35\",snp_data[5]\n end\n end",
"def extrst(data)\n io = StringIO.new(data)\n\n _, cb = io.read(4).unpack('vv')\n # reserved (2 bytes): MUST be 1, and MUST be ignored.\n result = { cb: cb } # cb (2 bytes): An unsigned integer that specifies the size, in bytes, of the phonetic string data.\n\n result[:phs] = phs(io.read(4)) # phs (4 bytes): A Phs that specifies the formatting information for the phonetic string.\n result[:rphssub] = rphssub(io) # rphssub (variable): An RPHSSub that specifies the phonetic string.\n\n result[:rphssub][:crun].times do # See 2.5.219 RPHSSub\n result[:rgphruns] ||= []\n result[:rgphruns] << rgphruns(io)\n end\n\n result\n end",
"def process_data(data)\n puts '=' * 100\n puts data.class\n hash = {}\n data.split('&').each do |kv|\n key, value = kv.split('=')\n hash[key] = value\n end\n puts hash\n puts hash['glass'].chars.each_slice(10).to_a.reverse.map(&:join).join(\"\\n\")\n puts '-' * 100\n puts empty = hash['glass'].index(' ')\n puts hash['glass'][hash['x'].to_i+1]\n if hash['y'].to_i == 17\n @result = 'drop'\n return\n end\n if hash['figure'] = 'I'\n if hash['x'].to_i == empty\n @result = 'drop'\n else\n @result = \"left=#{hash['x'].to_i-empty}\"\n end\n else\n if (hash['x'].to_i == empty) && (hash['glass'][hash['x'].to_i + 1] == ' ')\n @result = 'drop'\n else\n @result = \"left=#{hash['x'].to_i-empty}\"\n end\n end\n\n # @result = 'drop'\n end",
"def test_dolla_squiggle\n m = match_data_example\n assert_equal m[0], $~[0]\n\n mismatch_data_example\n assert_nil $~\n end",
"def test_parsing_from_pftrack\n fixture = File.open(File.dirname(__FILE__) + '/julik_pftrack.txt')\n trackers = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 720, :height => 576).to_a\n \n bl_kf = trackers[0][0]\n assert_in_delta 0.5, bl_kf.abs_x, DELTA\n assert_in_delta 0.5, bl_kf.abs_y, DELTA\n \n tr_kf = trackers[1][0]\n assert_in_delta 715.5, tr_kf.abs_x, DELTA\n assert_in_delta 571.514, tr_kf.abs_y, DELTA\n end",
"def test_parse_mdc_snp_data\n column_headings = []\n snp_data = []\n File.open(\"#{RAILS_ROOT}/test/mocks/#{@mdc_filename}\",\"r\") do |file|\n while (f = file.gets)\n\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^a1_External_ID/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the mdc file based on tabs\n snp_data = f.split(/\\t/)\n\n # load_hapmap_snp_data(column_headings,snp_data)\n break # jump out after first line as we're just testing the parsing\n end # end of file_array.each loop\n\n # test that we're parsing the headings and the SNP data correctly\n assert_equal 235, snp_data.size\n assert_equal \"a2_RGSCv3.4_chr\",column_headings[1]\n assert_equal \"rat105_009_k11.p1ca_226\",snp_data[0]\n assert_equal \"2283252\",snp_data[2]\n assert_equal '6',snp_data[233] # penultimate entry\n assert_equal '6',snp_data[234] # last entry\n assert_equal nil,snp_data[235] # shouldnt exist\n end\n end",
"def parse_parameters(raw)\n ret = Array.new\n i = 0\n while raw.size > 0\n case raw[0]\n when 'Z', 'B', 'C', 'S', 'F', 'I', 'D', 'J'\n ret[i] = ['P']\n i += 1\n raw = raw[1..-1]\n when 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[1..t-1]]\n i += 1\n raw = raw[t+1..-1]\n if raw.size == 0\n return ret\n end\n when '['\n if raw[1] == 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[2..t-1]]\n i += 1\n raw = raw[t+1..-1]\n else\n ret[i] = ['P']\n i += 1\n raw = raw[2..-1]\n end\n end\n end\n return ret\nend",
"def test_parse_headword\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n assert_equal(\"\",entry.headword_trad)\n assert_equal(\"工作\",entry.headword_simp)\n end",
"def question_split\n arr_of_strings = []\n single_question = []\n @data.each do |str|\n if str.length == 3 || str.length == 2\n if str[0].numeric? && str[-1] == '.'\n arr_of_strings << single_question\n single_question = []\n single_question << str\n else\n single_question << str\n end\n else\n single_question << str\n end\n end\n arr_of_strings << single_question\n @data = arr_of_strings\n end",
"def testParseLine\n ep = EiBiScheduleParser.new\n\n line = \"7490;2300-0455;;;WBCQ;E;NA;;;;\"\n bc = ep.parseEiBiTextLine(line)\n assert_equal 7490, bc[:frequency]\n assert_equal \"WBCQ\", bc[:broadcaster]\n assert_equal 23, bc[:startHour]\n assert_equal 0, bc[:startMinute]\n assert_equal 4, bc[:endHour]\n assert_equal 55, bc[:endMinute]\n assert_equal \"NA\", bc[:targetRegion]\n end",
"def pre_operation\n reportICE_tmp = Array.new\n printf(\"@I:Pre-Operation\\n\")\n # line operation\n line_s = Array.new\n @Report_Data.each do |line|\n if /^\\|/ =~ line # for \"1\" \n line = line.sub(\"\\n\",\"\") # erase \"\\n\"\n line_s = line.split(/\\|/) # sub \"|\" charactor\n line_s.delete_at(0)\n reportICE_tmp << line_s\n end\n end\n\n # word operation for each line\n # - modify structrure for multi line description\n size = reportICE_tmp.size-1 \n while( size >= 0 )\n reportICE_tmp[size][@PinNo] = reportICE_tmp[size][@PinNo].gsub(\" \",\"\") # delete space char for 1-st column\n reportICE_tmp[size][@PinName] = reportICE_tmp[size][@PinName].gsub(\" \",\"\") # delete space char for 2-nd column\n reportICE_tmp[size][@ConnectionList] = reportICE_tmp[size][@ConnectionList].gsub(\" \",\"\") # delete space char for 3-rd column\n reportICE_tmp[size][@Attribute] = \"\" # for attribute\n if ( reportICE_tmp[size][@PinNo] == \"\" )\n reportICE_tmp[size-1][@ConnectionList] = reportICE_tmp[size-1][@ConnectionList] + reportICE_tmp[size][@ConnectionList] # combile multi lines\n reportICE_tmp.delete_at(size) \n end\n size -= 1\n end\n\n #\n # modify each data\n #\n if $VERBOSE == true; printf(\"@I:Print Attribute\\n\"); end;\n reportICE_tmp.each do |word|\n pininfo = ReportPinInfo.new\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[out\\/ioshort\\]\",\"\") # delete unsuported comment\n #\n # PULLDOWN\n #\n if /\\[pulldown\\]/ =~ word[@ConnectionList]\n# if $VERBOSE == true; puts word[@PinNo] + \":\" + word[@PinName] + \" is Pull Down signal\"; end;\n word[@Attribute] = \"pulldown\"\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[pulldown\\]\",\"\")\n\n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n \n # connection list\n pininfo.ConnectInfo, @PullDown, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n @List[\"#{pininfo.No}\"] = pininfo\n \n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n\n #\n # PULLUP\n #\n elsif /\\[pullup\\]/ =~ word[@ConnectionList]\n# if $VERBOSE == true; puts word[@PinNo] + \":\" + word[@PinName] + \" is Pull Up signal\"; end;\n word[@Attribute] = \"pullup\"\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[pullup\\]\",\"\")\n \n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n\n # connection list\n pininfo.ConnectInfo, @PullUp, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n @List[\"#{pininfo.No}\"] = pininfo\n\n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n\n elsif /\\[opennet\\]/ =~ word[@ConnectionList]\n# if $VERBOSE == true; puts word[@PinNo] + \":\" + word[@PinName] + \" is Open Net signal\"; end;\n word[@Attribute] = \"opennet\"\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[opennet\\]\",\"\")\n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n\n # connection list\n pininfo.ConnectInfo, @OpenNet, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n @OpenNetList[\"#{pininfo.NetName}\"] = pininfo\n @List[\"#{pininfo.No}\"] = pininfo\n\n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n \n\n elsif /\\[nofanin\\]/ =~ word[@ConnectionList]\n# if $VERBOSE == true; puts word[@PinNo] + \":\" + word[@PinName] + \" is No Fanin signal\"; end;\n word[@Attribute] = \"nofanin\"\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[nofanin\\]\",\"\")\n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n\n # connection list\n pininfo.ConnectInfo, @NoFanin, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n @NoFaninList[\"#{pininfo.NetName}\"] = pininfo\n @List[\"#{pininfo.No}\"] = pininfo\n\n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n elsif /\\[out\\/ioshort\\]/ =~ word[@ConnectionList]\n word[@Attribute] = \"ioshort\"\n word[@ConnectionList] = word[@ConnectionList].sub(\"\\[out\\/ioshort\\]\",\"\")\n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n\n # connection list\n pininfo.ConnectInfo, @NoFanin, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n @IOShortList[\"#{pininfo.NetName}\"] = pininfo\n @List[\"#{pininfo.No}\"] = pininfo\n\n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n else\n # make data\n pininfo.No,pininfo.NetName,pininfo.Attribute,pininfo.PIN = make_pininfo(word)\n\n # connection list\n pininfo.ConnectInfo, @Other, pininfo.Type = make_connection_data(word[@ConnectionList],pininfo)\n\n @ConnectList[\"#{pininfo.No}\"] = pininfo\n @List[\"#{pininfo.No}\"] = pininfo\n @NetNameList[\"#{pininfo.NetName}\"] = pininfo\n \n end\n end\n # Update Original-Data Structure\n @Report_Data = reportICE_tmp\n \n printf(\"@I:Pre-Operation Done\\n\")\n end",
"def call_input_data\n if creates && input\n input[/a165627a7a72305820\\w{64}0029(\\w*)/,1]\n elsif input && input.length>10\n input[10..input.length]\n else\n []\n end\n end",
"def call_input_data\n if creates && input\n input[/a165627a7a72305820\\w{64}0029(\\w*)/,1]\n elsif input && input.length>10\n input[10..input.length]\n else\n []\n end\n end",
"def test_hash_end_and_start\n\t\ttest_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\tassert_equal test_array2[1], test_array1[4]\n\tend",
"def test_a_vertical_pipe_means_or\n grays = /(James|Dana|Summer) Gray/\n assert_equal 'James Gray', \"James Gray\"[grays]\n assert_equal 'Summer', \"Summer Gray\"[grays, 1]\n assert_equal nil, \"Jim Gray\"[grays, 1]\n end",
"def table_data(data)\n left, middle, right = [@chars[:ldb], @chars[:idb], @chars[:rdb]]\n a = []\n data.each_with_index do |item, x|\n a << (' ' + item.to_s.send(@align[x] || :ljust, @widths[x]) + ' ')\n end\n s = @chars.wrap(left) + a.join(@chars.wrap(middle)) + @chars.wrap(right) + \"\\n\"\n s\n end",
"def populate(data)\n @content.gsub(/\\[\\[ (\\S*) \\]\\]/) { |x| data[$1] }\n end",
"def separate_tubes(outname, ops, test_str, stamp_columns)\n stop_cycles_tab = display_stop_cycles(outname, ops, stamp_columns)\n wells_tab = display_plate(outname, ops, stamp_columns)\n coll = ops.first.output(outname).collection # get collection item\n\n show do\n title \"Separate #{test_str} stripwell tubes\"\n note \"During the <b>#{REAL}</b> qPCR run, you will need to remove single wells when different cycles are reached, according to the following:\"\n table stop_cycles_tab\n check \"Get a scissors and carefully separate the wells of <b>#{coll}-#{test_str}</b>\"\n check \"Verify that the separated wells are in the correct order:\"\n table wells_tab\n end\n end",
"def phs(data)\n ifnt, attrs = data.unpack('vv')\n attrs = Unxls::BitOps.new(attrs)\n\n ph_type = attrs.value_at(0..1)\n ph_type_d = {\n 0x0 => :narrow_katakana,\n 0x1 => :wide_katakana,\n 0x2 => :hiragana,\n 0x3 => :any # Use any type of characters as phonetic string\n }[ph_type]\n\n alc_h = attrs.value_at(2..3)\n alc_h_d = {\n 0x0 => :general, # General alignment\n 0x1 => :left, # Left aligned\n 0x2 => :center, # Center aligned\n 0x3 => :distributed # Distributed alignment\n }[alc_h]\n\n {\n ifnt: ifnt, # ifnt (2 bytes): A FontIndex structure that specifies the font.\n phType: ph_type, # A - phType (2 bits): An unsigned integer that specifies the type of the phonetic information.\n phType_d: ph_type_d,\n alcH: alc_h, # B - alcH (2 bits): An unsigned integer that specifies the alignment of the phonetic string.\n alcH_d: alc_h_d\n # unused (12 bits): Undefined and MUST be ignored.\n }\n end",
"def create_run_code\n @index = self.short_description.index(\"ip\")\n @end_index = self.short_description.index(\"and bin_id\")\n @result = self.short_description[@index + 1, @end_index - @index]\n @string = @result.gsub(/[ipa:,]/,' ')\n @array = @string.split(/\\s*/)\n @prod_run_code =\"\"\n @array.each do |char|\n if(char==\":\")\n @prod_run_code.concat(\"\")\n elsif(char==\"\")\n @prod_run_code.concat(\"\")\n elsif(char==\",\")\n @prod_run_code.concat(\"\")\n else\n @prod_run_code.concat(char)\n end\n end\n self.run_code = @prod_run_code.strip()\nend",
"def initLog(data)\n n = data[:names].join(\"; \")\n l = data[:data].length\n p = (l === 1) ? \"y\" : \"ies\"\n return %Q_- NAME: #{n}\\n #{l} matching entr#{p}\\n_\nend",
"def read_wire_points(str)\n points = []\n point_dists = {}\n x, y, len = 0, 0, 0\n\n str\n .split(',')\n .map { |s| m=s.match(/([LRUD])(\\d+)/); point(m[1], m[2].to_i) }\n .each do |dir, dist|\n while dist > 0\n case dir\n when \"L\" then x -= 1\n when \"R\" then x += 1\n when \"U\" then y -= 1\n when \"D\" then y += 1\n end\n dist -= 1\n len += 1\n p = point(x,y)\n points << p\n point_dists[p] = len\n end\n end\n\n Wire.new(points, point_dists)\nend",
"def bgnstr() @records.get_data(GRT_BGNSTR); end",
"def answer_split\n arr_of_strings = []\n single_answer = []\n @data.each do |str|\n if str[-1] == '.'\n single_answer << str\n arr_of_strings << single_answer\n single_answer = []\n else\n single_answer << str\n end\n end\n arr_of_strings << single_answer\n @data = arr_of_strings\n end",
"def test_complex_example\n text = 'Ruth 2,1-11.15; 3,7.9-12; Markus 4; 5,3.18-21'\n t1, t2, t3, t4, t5, t6, t7 = text.split(/; |\\./)\n ast = [\n pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 11), dot,\n pass(text: t2, b1: :Ruth, c1: 2, v1: 15, b2: :Ruth, c2: 2, v2: 15), semi,\n pass(text: t3, b1: :Ruth, c1: 3, v1: 7, b2: :Ruth, c2: 3, v2: 7), dot,\n pass(text: t4, b1: :Ruth, c1: 3, v1: 9, b2: :Ruth, c2: 3, v2: 12), semi,\n pass(text: t5, b1: :Mark, c1: 4, b2: :Mark, c2: 4), semi,\n pass(text: t6, b1: :Mark, c1: 5, v1: 3, b2: :Mark, c2: 5, v2: 3), dot,\n pass(text: t7, b1: :Mark, c1: 5, v1: 18, b2: :Mark, c2: 5, v2: 21)\n ]\n assert_formated_text_for_ast text, ast\n end",
"def mta\n {\n\t:line_N => [ \"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\" ],\n\t:line_L => [ \"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\" ],\n\t:line_6 => [ \"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\" ]\n }\nend",
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end",
"def parse_sqft\n end",
"def parse_sqft\n end",
"def _parse_pow_tgh row\n pt_str = row./('td[2]').children.first.to_s.strip\n return nil if pt_str.empty?\n pt_str =~ /\\((.*?)\\/(.*?)\\)/\n [$1, $2]\n end",
"def preprocess_data data\n if data[0] == \"'\" || data[0] == '\"'\n \"say \" + data[1,data.length]\n else\n data\n end\n end",
"def split_by_keywords(affi_string)\n # get the indexes of each element found\n # separate the string using the indexes\n kw_indexes = {} #kewrds array of indexes and lengths\n found_inst = found_country = nil\n\n found_inst = get_institution(affi_string)\n if found_inst != nil then\n kw_indexes[affi_string.index(found_inst)] = found_inst.length\n end\n\n if found_inst == nil then\n found_inst = get_institution_synonym(affi_string)\n if found_inst != nil then\n kw_indexes[affi_string.index(found_inst)] = found_inst.length\n end\n end\n\n found_country = get_country(affi_string)\n if found_country != nil then\n kw_indexes[affi_string.index(found_country)] = found_country.length\n end\n\n found_country_synonym = get_country_synonym(affi_string)\n if found_country_synonym != nil then\n cleared_affi_string = country_exclude(affi_string)\n kw_indexes[cleared_affi_string.index(found_country_synonym)] = found_country_synonym.length\n end\n\n found_faculty = get_faculty(affi_string)\n if found_faculty != nil then\n kw_indexes[affi_string.index(found_faculty)] = found_faculty.length\n end\n\n found_workgroup = get_workgroup(affi_string)\n if found_workgroup != nil then\n kw_indexes[affi_string.index(found_workgroup)] = found_workgroup.length\n end\n\n found_department = get_department(affi_string)\n print \"\\n**\"+found_department.to_s\n if found_department != nil then\n kw_indexes[affi_string.index(found_department)] = found_department.length\n end\n\n affiliation_array = []\n prev_split = 0\n if kw_indexes.count > 0 then\n temp_affi = affi_string\n # Order the indexes to break the affistring in its original order\n kw_indexes = kw_indexes.sort.to_h\n kw_indexes.keys.each do |kw_idx|\n # if the first index 0 make it the first element of the return array\n if affiliation_array == [] and kw_idx == 0 then\n affiliation_array = [temp_affi[kw_idx, kw_indexes[kw_idx]]]\n elsif affiliation_array == [] then\n affiliation_array = [temp_affi[..kw_idx-1]]\n affiliation_array.append(temp_affi[kw_idx, kw_indexes[kw_idx]])\n elsif prev_split < kw_idx then\n affiliation_array.append(temp_affi[prev_split..kw_idx-1].strip)\n affiliation_array.append(temp_affi[kw_idx,kw_indexes[kw_idx]])\n else\n affiliation_array.append(temp_affi[kw_idx,kw_indexes[kw_idx]])\n end\n prev_split = kw_idx + kw_indexes[kw_idx] + 1\n end\n end\n # strip and remove trailing commas in one place instead of with every\n # assignment\n indx = 0\n while indx < affiliation_array.count do\n affiliation_array[indx] = affiliation_array[indx].strip.chomp(\",\").chomp(\";\")\n indx +=1\n end\n # remove leftover nulls\n affiliation_array.delete(\"\")\n return affiliation_array\nend",
"def make_substs(str)\r\n t = str\r\n t = dosub(t, ':client-name:', @data[:client_name])\r\n t = dosub(t, ':client-email:', @data[:client_email])\r\n t = dosub(t, ':client-phone:', @data[:client_phone])\r\n t = dosub(t, ':aref:', @data[:aref]) if @data[:aref]\r\n t = dosub(t, ':propid:', @data[:propid]) if @data[:propid]\r\n t = dosub(t, ':price:', @data[:price]) if @data[:price]\r\n t = dosub(t, ':cagent-firstname:', @data[:cagent].firstname)\r\n t = dosub(t, ':magent-firstname:', @data[:magent].firstname)\r\n t = dosub(t, ':advertiser-email:', @data[:advertiser_email]) if @e.privad\r\n t = dosub(t, ':advertiser-name:', @data[:advertiser_name]) if @e.privad\r\n t = dosub(t, ':agent-firstname:', @data[:agent].firstname) if @data[:agent]\r\n t = dosub(t, ':reglink:', @data[:reglink]) if @data[:reglink]\r\n t = dosub(t, ':enqdata:', @data[:enqdata]) if @data[:enqdata]\r\n t = dosub(t, ':deptreg:', @data[:region]) if @data[:region]\r\n t = dosub(t, ':fffp:', \"1st-for-French-Property.co.uk\") \r\n t = dosub(t, ':hkf:', \"Howard Farmer\")\r\n t = dosub(t, ':louisa:', \"Louisa Allen\")\r\n \r\n t\r\n end",
"def split(data, string_to_split)\n word = data.scan(/\"#{string_to_split}\"\\] = \"([\\S\\s]*?)\"/)\n string = word.split('\"]').join('').split('[\"').join('')\n return string\n end",
"def split(data, string_to_split)\n word = data.scan(/\"#{string_to_split}\"\\] = \"([\\S\\s]*?)\"/)\n string = word.split('\"]').join('').split('[\"').join('')\n return string\n end",
"def get_test_cases()\n test_cases = []\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|X|O|X|O|*\n X|O|O|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|X\n O|O|X|X|O|X|X\n \"\"\"\n )\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|X|*|*|*|*\n *|O|X|*|*|*|X\n O|O|O|O|*|*|X\n O|O|X|X|X|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n O|X|*|*|*|*|*\n X|X|*|O|*|*|O\n O|X|*|O|*|*|X\n X|O|X|X|*|O|O\n X|O|O|X|*|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|O|O|O|O|*\n \"\"\")\n\n return test_cases\n\n end",
"def parse_data(data, check_parity)\n last_command = [0, 0]\n\n data.split(' ').each do |word_string|\n begin\n # Decode hexadecimal word into two-byte string\n word = [word_string].pack('H*')\n # Check parity\n fail ParityError, \"At least one byte in word #{word_string} has even parity, odd required\" unless !check_parity || (correct_parity?(word[0]) && correct_parity?(word[1]))\n # Remove parity bit for further processing\n word = word.bytes.collect { |byte|\n # Unset 8th bit\n (byte & ~(1 << 7))\n }\n\n hi, lo = word\n\n # First check if the word contains characters only\n if hi >= 0x20 && hi <= 0x7f\n # Skip characters if last command was on different channel\n if @data_channel != 0\n puts 'Skipping characters on channel 2'\n next\n end\n\n [hi, lo].each do |byte|\n handle_character(byte)\n end\n\n # Reset last command\n last_command = [0, 0]\n else\n if word == last_command\n # Skip commands transmitted twice for redundancy\n # But don't skip the next time, too\n last_command = [0, 0]\n next\n end\n\n # Channel information is encoded in the 4th bit, read it out\n @data_channel = (hi >> 3) & 1\n if @data_channel != 0\n puts 'Skipping command on channel 2'\n next\n # If channel 2 processing is needed, parse the file two times and\n # change the above condition as needed, then unset the channel bit\n # for further processing.\n end\n\n if hi == 0x11 && lo >= 0x30 && lo <= 0x3f\n # Special character\n handle_special_character(lo)\n elsif hi >= 0x10 && hi <= 0x17 && lo >= 0x40\n # Premable address code\n handle_preamble_address_code(hi, lo)\n elsif (hi == 0x14 || hi == 0x17) && lo >= 0x20 && lo <= 0x2f\n handle_control_code(hi, lo)\n elsif hi == 0x11 && lo >= 0x20 && lo <= 0x2f\n handle_mid_row_code(hi, lo)\n elsif hi == 0x00 && lo == 0x00\n # Ignore filler\n else\n puts \"Ignoring unknown command #{hi}/#{lo}\"\n end\n\n last_command = word\n end\n\n ensure\n # Advance one frame for each word read\n @now += 1\n end\n end\n end",
"def test_2022_batch_values\n hash = extract_result\n\n assert_includes hash[2][6], \"Daris\"\n assert_includes hash[3][5], \"Aurika\"\n assert_includes hash[3][17], \"Gerhards\"\n assert_includes hash[4][6], \"Dzintis\"\n assert_includes hash[4][20], \"Meija\"\n assert_includes hash[4][23], \"Jurgita\"\n assert_includes hash[9][17], \"Vaiva\"\n assert_includes hash[9][29], \"Jumis\"\n assert_includes hash[11][7], \"Pērle\"\n assert_includes hash[12][3], \"Ako\"\n end",
"def band_structure\n freq_lines = @raw_data.scan(/freqs:, (.*)/).join \"\\n\"\n CSV.parse(freq_lines, :converters => :numeric).map do |nums|\n ::MEEP::KPoint.new nums[1..3], nums[4..-1]\n end\n end",
"def test_hierarchical_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*856*0001~\n BSN*00*??*19700101*00000000*0001~\n DTM*011*19700101~\n HL*1**S~\n TD1*CTN*1****G*0.1773127753*LB~\n TD5*Z*2*??*ZZ*UPS3~\n REF*PK*?~\n DTM*011*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n HL*2*1*O~\n PRF*00000007397108***19700101~\n HL*3*2*P~\n MAN*SM*?~\n HL*4*3*I~\n LIN*1*UP*860001662184*VP*860001662184~\n SN1*1*1*EA**1*EA~\n SLN*1**O*1*EA*59.95*PE~\n CTT*2*159.85~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS856::TS.new(store)\n ts.BSN do |bsn|\n bsn.BSN01 = \"00\"\n bsn.BSN02 = \"??\"\n bsn.BSN03 = @epoch\n bsn.BSN04 = @epoch\n bsn.BSN05 = \"0001\"\n end\n ts.DTM do |dtm|\n dtm.DateTimeQualifier = \"011\" # Shipped\n dtm.Date = @epoch\n end\n ts.HL_SHIPMENT do |hl_s|\n hl_s.HL.HL01 = \"1\"\n hl_s.HL.HL03 = \"S\"\n hl_s.TD1.TD101 = \"CTN\"\n hl_s.TD1.TD102 = 1\n hl_s.TD1.TD106 = \"G\"\n hl_s.TD1.TD107 = (80.5 / 454) # 0.1773127753\n hl_s.TD1.TD108 = \"LB\"\n hl_s.TD5.TD501 = \"Z\"\n hl_s.TD5.TD502 = \"2\"\n hl_s.TD5.TD503 = \"??\"\n hl_s.TD5.TD504 = \"ZZ\"\n hl_s.TD5.TD505 = \"UPS3\"\n hl_s.REF.REF01 = \"PK\"\n hl_s.REF.REF02 = \"?\"\n hl_s.DTM.DTM01 = \"011\" # Shipped\n hl_s.DTM.DTM02 = @epoch\n hl_s.L_N1 do |n1|\n # N1\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n # N3\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n hl_s.HL_ORDER do |hl_o|\n hl_o.HL.HL01 = \"2\"\n hl_o.HL.HL02 = \"1\"\n hl_o.HL.HL03 = \"O\"\n hl_o.PRF.PRF01 = \"00000007397108\"\n hl_o.PRF.PRF04 = @epoch\n end\n hl_s.HL_TARE do |hl_t|\n hl_t.HL.HL01 = \"3\"\n hl_t.HL.HL02 = \"2\"\n hl_t.HL.HL03 = \"P\"\n hl_t.MAN.MAN01 = \"SM\"\n hl_t.MAN.MAN02 = \"?\"\n end\n hl_s.HL_ITEM do |hl_i|\n hl_i.HL.HL01 = \"4\"\n hl_i.HL.HL02 = \"3\"\n hl_i.HL.HL03 = \"I\"\n hl_i.LIN.LIN01 = \"1\"\n hl_i.LIN.LIN02 = \"UP\"\n hl_i.LIN.LIN03 = \"860001662184\"\n hl_i.LIN.LIN04 = \"VP\"\n hl_i.LIN.LIN05 = \"860001662184\"\n hl_i.SN1.SN101 = \"1\"\n hl_i.SN1.SN102 = 1\n hl_i.SN1.SN103 = \"EA\"\n hl_i.SN1.SN105 = 1\n hl_i.SN1.SN106 = \"EA\"\n hl_i.L_SLN do |rep|\n rep.SLN.SLN01 = \"1\"\n rep.SLN.SLN03 = \"O\"\n rep.SLN.SLN04 = 1\n rep.SLN.SLN05 = \"EA\"\n rep.SLN.SLN06 = 59.95\n rep.SLN.SLN07 = \"PE\"\n end\n end\n end\n ts.CTT do |ctt|\n ctt.CTT01 = 2\n ctt.CTT02 = 159.85\n end\n result = ts.render()\n assert_equal(want, result)\n end",
"def test_two_books\n text = 'Ruth; Markus'\n t1, t2 = text.split(semi)\n assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, b2: :Ruth), semi, pass(text: t2, b1: :Mark, b2: :Mark)]\n end",
"def test_hash_valid_block\n\t\tString test_str = '0|0|SYSTEM>Henry(100)|1518892051.737141000|1c12'\n\t\tassert test_str =~ /.*\\|[a-zA-Z0-9]*\\|.*\\|.*\\|[a-zA-Z0-9]*/\n\tend",
"def break_up\n\t@pass_arr = @pass.chars.each_slice(4).map(&:join)\nend",
"def do_process(ps )\n word = nil\n buf = \"\"\n tokens = ps.sentence.split(/[ \\t]/)\n \n for word in tokens do\n #문자열의 길이가 최대 허용치보다 길다면...\n if word.length() > REPEAT_CHAR_ALLOWED then\n repaedCnt = 0\n checkChar = word[0]\n \n buf << checkChar\n \n for i in 1..(word.length-1) do\n if checkChar == word[i] then\n if repaetCnt == (REPEAT_CHAR_ALLOWED-1) then\n buf << \" \"\n buf << word[i]\n repeatCnt = 0\n else\n buf << word[i]\n repeadCnt +=1\n end\n else\n if checkChar == \".\" then\n buf << \" \"\n end\n \n buf << word[i]\n checkChar = word[i]\n repeadCnt = 0\n end\n end\n else\n buf << word\n end\n buf << \" \"\n end\n ps.sentence=buf\n return ps\n end",
"def test_2_text_after_first_corinthians\n sample_text = \"1 Cor. 1:1 testing for new pericopes.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"Pericope found.\"\n end",
"def read_ukp_instance(f)\n all_words = f.read.scan(/\\w+/)\n ukpi = {\n n: all_words[0].to_i,\n c: all_words[1].to_i,\n items: []\n }\n fail \"ukp instance format wrong - n: #{ukpi[:n]} - all_words.length: #{all_words.length} \" unless (ukpi[:n]*2)+2 == all_words.length\n\n i = 2\n size = all_words.length\n while i+1 <= size do\n item = { \n w: all_words[i].to_i,\n p: all_words[i+1].to_i\n }\n ukpi[:items] << item\n i += 2\n end\n\n ukpi\nend",
"def test_complex_example\n text = 'Ruth 2,1-11.15; 3,7.9-12; Markus 4; 5,3.18-21'\n t1, t2, t3, t4, t5, t6, t7 = text.split(/; |\\./)\n ast = [\n pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 11), dot,\n pass(text: t2, b1: :Ruth, c1: 2, v1: 15, b2: :Ruth, c2: 2, v2: 15), semi,\n pass(text: t3, b1: :Ruth, c1: 3, v1: 7, b2: :Ruth, c2: 3, v2: 7), dot,\n pass(text: t4, b1: :Ruth, c1: 3, v1: 9, b2: :Ruth, c2: 3, v2: 12), semi,\n pass(text: t5, b1: :Mark, c1: 4, b2: :Mark, c2: 4), semi,\n pass(text: t6, b1: :Mark, c1: 5, v1: 3, b2: :Mark, c2: 5, v2: 3), dot,\n pass(text: t7, b1: :Mark, c1: 5, v1: 18, b2: :Mark, c2: 5, v2: 21)\n ]\n assert_parsed_ast_for_text ast, text\n end",
"def parse(data); end",
"def setup_abst_info(record)\n text = []\n record.find_all{|f| f.tag === \"520\" }.each do |field|\n textstr = ''\n field.each do |sf|\n textstr << sf.value + ' ' unless [\"c\", \"2\",\"3\",\"6\"].include?(sf.code)\n end\n text << textstr\n end\n Rails.logger.debug \"********es287_dev #{__FILE__} #{__LINE__} #{__method__} #{text[0]}\"\n text\n end",
"def sniff(data_row)\n return nil unless data_row\n return \"|\" unless !data_row.strip.include? \" | \"\n\n sniff = {}\n\n COMMON_DELIMITERS.each do |delim| \n sniff[delim]=data_row.count(delim)\n end\n sniff = sniff.sort {|a,b| b[1]<=>a[1]}\n sniff.size > 0 ? sniff[0][0]: nil\n end",
"def load (data)\n if data.size != @maze_table.size * @maze_table[0].size\n print \"the string has incorrect lenghth\\n\"\n return\n else\n i = 0\n @maze_table.each do |row|\n (0..row.size-1).each do |index|\n row[index] = data[i]\n i += 1\n end\n end\n end\n if valid\n print \"valid maze\\n\"\n else\n print \"invalid maze\\n\"\n end\n end",
"def proccess\n # data = get_data\n separate_bets\n end",
"def read_group_data(snp, group, data)\n\n if data[group.pcol] =~ /\\d/ and data[group.pcol].to_f > 0.0\n betaval = nil\n mafval = nil\n sampsizeval = nil\n orval = lowerci = upperci = cases = controls = studynum = nil\n powernum = cafcases = cafcontrols = betauci = betalci = rankval = nil\n add_columns = Hash.new\n \n betaval = data[group.betacol] if group.betacol > -1\n mafval = data[group.mafcafcol] if group.mafcafcol > -1\n sampsizeval = data[group.Ncol] if group.Ncol > -1\n orval = data[group.orcol] if group.orcol > -1\n lowerci = data[group.lcicol] if group.lcicol > -1\n upperci = data[group.ucicol] if group.ucicol > -1\n cases = data[group.casescol] if group.casescol > -1\n controls = data[group.controlscol] if group.controlscol > -1\n cafcases = data[group.cafcasescol] if group.cafcasescol > -1\n cafcontrols = data[group.cafcontrolscol] if group.cafcontrolscol > -1\n studynum = data[group.studycol] if group.studycol > -1\n powernum = data[group.powercol] if group.powercol > -1\n betauci = data[group.betaucicol] if group.betaucicol > -1\n betalci = data[group.betalcicol] if group.betalcicol > -1\n\t\trankval = data[group.rankcol] if group.rankcol > -1\n\n group.additional_cols.each_pair {|key,index| add_columns[key]=data[index] if data[index]}\n \n snp.add_result(group.name, data[group.pcol], betaval, mafval, sampsizeval, orval, lowerci, upperci,\n cases, controls, cafcases, cafcontrols, studynum, powernum, betauci, betalci, add_columns,\n\t\t\trankval)\n\n end\n\nend",
"def process_data\n\t\tarr = data.split(\"\\n\")\n\t\t@processed_data = []\n\t\tarr.each_with_index do |string,a|\n\t\t\ttime_index = string.index( /[0-9]min|lightning/ )\n\t\t\tif time_index != nil \n\t\t\t\ttime_arr = []\n\t\t\t\t(0..2).each do |n|\n\t\t\t\t\ttime = string[time_index-n]\n\t\t\t\t\ttime_arr << time if ( time != \" \" && time.index(/[a-z]/)==nil )\n\t\t\t\tend\n\t\t\t\ttime = time_arr.reverse.join(\"\").strip.to_i\n\t\t\t\ttitle = string.gsub(/#{time}min|#{time}lightning/,\"\").strip\n\t\t\t\tif string.index( /lightning/ )==nil\n\t\t\t\t time \n\t\t\t\telse\n\t\t\t\t time = (time == 0? 5 : (time*5))\n\t\t\t\tend\n\t\t\t\tsession = Session.new(a,title,time)\n\t\t\t\t@processed_data << session\n\t\t\tend\n\t\tend\n\tend",
"def test_parser_handles_single_delim_with_text_email_array\n text = 'To Name'\n delim = ApiParser.email_delim\n\n email_array_assert [text, text], \"#{text}#{delim}#{text}\"\n end",
"def format_data data\r\n\tresult = []\r\n\t#split entry to array\r\n\tarr = data.read.split '>'\r\n\tarr.each do |item|\r\n\t\tname = item.split('|')[0]\r\n\t\tnext if !name\r\n\r\n\t\tprotein = []\r\n\t\t#format name\r\n\t\tname.delete! ' '\r\n\t\tname.tr! '|', ''\r\n\r\n\t\t#format sequence\r\n\t\ttmp = item.split \"\\n\"\r\n\t\ttmp.shift\r\n\t\tsequence = tmp.join\r\n\r\n\t\tprotein.push name, sequence\r\n\r\n\t\tresult.push protein\r\n\tend\t\r\n\tresult\r\n\r\nend",
"def test_postcode_upcase\n data = WordFormatter.new( @data )\n result = data.postcode_upcase\n assert_equal(\"E13 ZQF\", result)\n end",
"def load_test(data_set)\n\t\tFile.open(data_set, \"r\") do |f|\n\t\t\tf.each_line do |line|\n\t\t\t\t@@line_array = line.split(' ')\n\t\t\t\t@test_set.push([@@line_array[0].to_i, @@line_array[1].to_i, @@line_array[2].to_i])\n\t\t\tend\n\t\tend\n\tend",
"def extract_data(str)\n p str.scan(/(?<=\\?|&).+?(?=\\&)/).join(', ')\nend",
"def split pattern=$;, *more\n arr = super\n i = 0\n interval = 0\n interval = (self.length - arr.join.length) / (arr.length - 1) if\n arr.length > 1\n\n arr.map do |str|\n ds = self.class.new str\n ds.meta = @meta[i,str.length]\n i += str.length + interval\n ds\n end\n end",
"def raw_characters\n data.split(//)\n end",
"def string_to_internal(preposition)\n\t\ttemp_kb =Array.new\n\t\t#string input of format literal_name LOGICAL_PREPOSISTION\n\t\tpreposition_array = preposition.split\n\t\n\t\tnext_negated = false\n\n\t\tsentence = []\n\t\tpreposition_array.each do |word|\n#####################################3\t\n\t\t#\tputs \" word: \" + word\n\t\t\t#don't need to handle \"or\" as long as it is in right format, will look to \"and\" and the end as limiters\n\t\t\tif (word == \"AND\" || word == \"and\")\n\t\t\t\ttemp_kb << sentence\n\t\t\t\tsentence = []\n\t\t\telsif(word == \"NOT\" || word == \"not\")\n\t\t\t\tnext_negated = true\n\t\t\telsif(word == \"OR\" || word ==\"or\")\n\n\t\t\telse\n\t\t\t\ttemp = @name_hash[word]\n\t\n\t\t\t\t#add variable if doesnt exist\n\t\t\t\tif(temp == nil)\n\t\t\t\t\ttemp_var = Literalzs.new(word,@total_variables)\n\t\t\t\t\t@id_array.push(temp_var)\n\t\t\t\t\t@name_hash[word] = @total_variables\n\t\t\t\t\ttemp = @total_variables\t\n\t\t\t\t\t@total_variables+=1\n\t\t\t\t end\n\t\t\n\t\t\t\tif(next_negated)\n\t\t\t\ttemp = temp.to_i * -1\n#########################################################3333\t\t\t\t\n\t\t\t\t#puts \" temp negated, now is: \" + temp.to_s\n\t\t\t\t\n\t\t\t\tnext_negated = false\n\t\t\t\tend\n\t\t\t\tsentence << temp\n\t\t\tend\n\t\tend\n\t\t#need to grab last sentence since it wont be ended with and\n\t\ttemp_kb << sentence\n\t\treturn temp_kb\n\tend",
"def kap_test\n kap = KAPHeader.new\n kap.readheader(\"!Copyright 1999, Maptech Inc. All Rights Reserved.\nCRR/CERTIFICATE OF AUTHENTICITY\n This electronic chart was produced under the authority of the National\n Oceanic and Atmospheric Administration (NOAA). NOAA is the hydrographic\n office for the United States of America. The digital data provided by NOAA\n from which this electronic chart was produced has been certified by NOAA\n for navigation. 'NOAA' and the NOAA emblem are registered trademarks of\n the National Oceanic and Atmospheric Administration. 'Maptech' and the\n Maptech emblem are registered trademarks of Maptech, Inc. Copyright 1999\n Maptech, Inc. All rights reserved.\nVER/3.0\nBSB/NA=CHESAPEAKE BAY ENTRANCE,NU=558,RA=11547,9767,DU=254\nKNP/SC=80000,GD=NAD83,PR=MERCATOR,PP=37.083,PI=10.000,SP=,SK=0.0000000\n TA=90.0000000,UN=FEET,SD=MEAN LOWER LOW WATER,DX=8.00,DY=8.00\nKNQ/EC=RF,GD=NARC,VC=UNKNOWN,SC=MLLW,PC=MC,P1=UNKNOWN,P2=37.083\n P3=NOT_APPLICABLE,P4=NOT_APPLICABLE,GC=NOT_APPLICABLE,RM=POLYNOMIAL\nCED/SE=70,RE=01,ED=09/12/1998\nNTM/NE=70.00,ND=10/30/1999,BF=ON,BD=10/26/1999\nOST/1\nIFM/4\nRGB/1,0,0,0\nRGB/2,255,255,255\nRGB/3,209,221,239\nRGB/4,221,234,247\nRGB/5,244,232,193\nRGB/6,214,219,201\nRGB/7,219,181,242\nRGB/8,114,114,114\nRGB/9,188,188,188\nRGB/10,150,176,155\nRGB/11,94,153,193\nRGB/12,219,73,150\nDAY/1,0,0,0\nDAY/2,255,255,255\nDAY/3,185,210,240\nDAY/4,214,227,245\nDAY/5,238,223,161\nDAY/6,181,181,123\nDAY/7,219,181,242\nDAY/8,114,114,114\nDAY/9,188,188,188\nDAY/10,38,212,84\nDAY/11,37,138,191\nDAY/12,219,73,150\nDSK/1,0,0,0\nDSK/2,128,128,128\nDSK/3,93,105,120\nDSK/4,107,114,123\nDSK/5,119,112,81\nDSK/6,91,91,62\nDSK/7,110,91,121\nDSK/8,57,57,57\nDSK/9,94,94,94\nDSK/10,19,106,42\nDSK/11,19,69,96\nDSK/12,110,37,75\nNGT/1,55,55,55\nNGT/2,0,0,0\nNGT/3,0,0,38\nNGT/4,0,0,28\nNGT/5,30,21,13\nNGT/6,0,23,12\nNGT/7,17,0,0\nNGT/8,35,35,35\nNGT/9,25,25,25\nNGT/10,1,50,1\nNGT/11,0,55,55\nNGT/12,64,0,64\nNGR/1,0,0,0\nNGR/2,255,0,0\nNGR/3,204,0,0\nNGR/4,230,0,0\nNGR/5,220,0,0\nNGR/6,175,0,0\nNGR/7,213,0,0\nNGR/8,114,0,0\nNGR/9,188,0,0\nNGR/10,120,0,0\nNGR/11,104,0,0\nNGR/12,145,0,0\nGRY/1,0,0,0\nGRY/2,255,255,255\nGRY/3,199,199,199\nGRY/4,226,226,226\nGRY/5,215,215,215\nGRY/6,175,175,175\nGRY/7,203,203,203\nGRY/8,114,114,114\nGRY/9,188,188,188\nGRY/10,120,120,120\nGRY/11,104,104,104\nGRY/12,138,138,138\nPRC/1,0,0,0\nPRC/2,255,255,255\nPRC/3,181,206,240\nPRC/4,213,230,250\nPRC/5,247,239,181\nPRC/6,181,191,123\nPRC/7,219,181,242\nPRC/8,114,114,114\nPRC/9,188,188,188\nPRC/10,38,212,84\nPRC/11,37,138,191\nPRC/12,219,73,150\nPRG/1,0,0,0\nPRG/2,255,255,255\nPRG/3,204,204,204\nPRG/4,230,230,230\nPRG/5,222,222,222\nPRG/6,175,175,175\nPRG/7,213,213,213\nPRG/8,114,114,114\nPRG/9,188,188,188\nPRG/10,120,120,120\nPRG/11,104,104,104\nPRG/12,145,145,145\nREF/1,374,8790,36.8166861111,-76.4500000000\nREF/2,374,695,37.4000111111,-76.4500000000\nREF/3,4505,695,37.4000111111,-76.0783222222\nREF/4,4505,579,37.4083444444,-76.0783222222\nREF/5,4912,579,37.4083444444,-76.0416638889\nREF/6,4912,695,37.4000111111,-76.0416638889\nREF/7,5209,695,37.4000111111,-76.0149944444\nREF/8,5209,668,37.4019444444,-76.0149944444\nREF/9,5283,668,37.4019444444,-76.0083222222\nREF/10,5283,695,37.4000111111,-76.0083222222\nREF/11,7042,695,37.4000111111,-75.8499972222\nREF/12,7042,490,37.4147250000,-75.8499972222\nREF/13,7413,490,37.4147250000,-75.8166555556\nREF/14,7413,695,37.4000111111,-75.8166555556\nREF/15,11118,695,37.4000111111,-75.4833222222\nREF/16,11118,8790,36.8166861111,-75.4833222222\nREF/17,8080,8790,36.8166861111,-75.7566444444\nREF/18,8080,8813,36.8150138889,-75.7566444444\nREF/19,8006,8813,36.8150138889,-75.7633166667\nREF/20,8006,8790,36.8166861111,-75.7633166667\nREF/21,5153,8790,36.8166861111,-76.0199777778\nREF/22,5153,8836,36.8133416667,-76.0199777778\nREF/23,5060,8836,36.8133416667,-76.0283194444\nREF/24,5060,8790,36.8166861111,-76.0283194444\nREF/25,10933,8790,36.8166861111,-75.4999833333\nREF/26,10933,8560,36.8333500000,-75.4999833333\nREF/27,10933,6253,37.0000111111,-75.4999833333\nREF/28,10933,3941,37.1666694444,-75.4999833333\nREF/29,10933,1624,37.3333416667,-75.4999833333\nREF/30,10933,695,37.4000111111,-75.4999833333\nREF/31,9080,8790,36.8166861111,-75.6666500000\nREF/32,9080,8560,36.8333500000,-75.6666500000\nREF/33,9080,6253,37.0000111111,-75.6666500000\nREF/34,9080,3941,37.1666694444,-75.6666500000\nREF/35,9080,1624,37.3333416667,-75.6666500000\nREF/36,9080,695,37.4000111111,-75.6666500000\nREF/37,7228,8790,36.8166861111,-75.8333138889\nREF/38,7228,8560,36.8333500000,-75.8333138889\nREF/39,7228,6253,37.0000111111,-75.8333138889\nREF/40,7228,3941,37.1666694444,-75.8333138889\nREF/41,7228,1624,37.3333416667,-75.8333138889\nREF/42,7228,490,37.4147250000,-75.8333138889\nREF/43,5375,8790,36.8166861111,-75.9999805556\nREF/44,5375,8560,36.8333500000,-75.9999805556\nREF/45,5375,6253,37.0000111111,-75.9999805556\nREF/46,5375,3941,37.1666694444,-75.9999805556\nREF/47,5375,1624,37.3333416667,-75.9999805556\nREF/48,5375,695,37.4000111111,-75.9999805556\nREF/49,3523,8790,36.8166861111,-76.1666472222\nREF/50,3523,8560,36.8333500000,-76.1666472222\nREF/51,3523,6253,37.0000111111,-76.1666472222\nREF/52,3523,3941,37.1666694444,-76.1666472222\nREF/53,3523,1624,37.3333416667,-76.1666472222\nREF/54,3523,695,37.4000111111,-76.1666472222\nREF/55,1671,8790,36.8166861111,-76.3333138889\nREF/56,1671,8560,36.8333500000,-76.3333138889\nREF/57,1671,6253,37.0000111111,-76.3333138889\nREF/58,1671,3941,37.1666694444,-76.3333138889\nREF/59,1671,1624,37.3333416667,-76.3333138889\nREF/60,1671,695,37.4000111111,-76.3333138889\nREF/61,11118,8560,36.8333500000,-75.4833222222\nREF/62,374,8560,36.8333500000,-76.4500000000\nREF/63,11118,6253,37.0000111111,-75.4833222222\nREF/64,374,6253,37.0000111111,-76.4500000000\nREF/65,11118,3941,37.1666694444,-75.4833222222\nREF/66,374,3941,37.1666694444,-76.4500000000\nREF/67,11118,1624,37.3333416667,-75.4833222222\nREF/68,374,1624,37.3333416667,-76.4500000000\nPLY/1,36.8166666667,-76.4500000000\nPLY/2,37.4000000000,-76.4500000000\nPLY/3,37.4000000000,-76.0783333333\nPLY/4,37.4083333333,-76.0783333333\nPLY/5,37.4083333333,-76.0416666667\nPLY/6,37.4000000000,-76.0416666667\nPLY/7,37.4000000000,-76.0150000000\nPLY/8,37.4019444444,-76.0150000000\nPLY/9,37.4019444444,-76.0083333333\nPLY/10,37.4000000000,-76.0083333333\nPLY/11,37.4000000000,-75.8500000000\nPLY/12,37.4147222222,-75.8500000000\nPLY/13,37.4147222222,-75.8166666667\nPLY/14,37.4000000000,-75.8166666667\nPLY/15,37.4000000000,-75.4833333333\nPLY/16,36.8166666667,-75.4833333333\nPLY/17,36.8166666667,-75.7566666667\nPLY/18,36.8150000000,-75.7566666667\nPLY/19,36.8150000000,-75.7633333333\nPLY/20,36.8166666667,-75.7633333333\nPLY/21,36.8166666667,-76.0200000000\nPLY/22,36.8133333333,-76.0200000000\nPLY/23,36.8133333333,-76.0283333333\nPLY/24,36.8166666667,-76.0283333333\nDTM/0.0000000000,0.0000000000\nCPH/0.0000000000\nWPX/2,863264.4957,11420.23114,-85.46756208,1.913941167,-0.4081181078\n 0.7362163163\nWPY/2,390032.0953,69.56409751,-6745.589267,0.4669253601,0.0367153316\n -96.0547565\nPWX/2,-76.48368342,8.999135076e-005,5.758392982e-009,-1.392859319e-012\n -2.377189159e-013,-3.432372134e-013\nPWY/2,37.44988807,-3.111799225e-009,-7.171936009e-005,2.694372983e-013\n -1.725045227e-014,-3.594145418e-011\nERR/1,0.0395099814,0.1453734568,0.0000106128,0.0000035393\nERR/2,0.2568631181,0.1909729033,0.0000135084,0.0000230797\nERR/3,0.2741345061,0.0861261497,0.0000060346,0.0000246567\nERR/4,0.2686635828,0.0312145515,0.0000025324,0.0000241637\nERR/5,0.1452865095,0.0345549325,0.0000027703,0.0000130843\nERR/6,0.1399402606,0.0827745526,0.0000057959,0.0000126025\nERR/7,0.4574537708,0.0811248175,0.0000056780,0.0000411483\nERR/8,0.4562435934,0.1430947875,0.0000100925,0.0000410389\nERR/9,0.3011454875,0.1427864003,0.0000100706,0.0000270834\nERR/10,0.3023504002,0.0808159566,0.0000056561,0.0000271924\nERR/11,0.3723051299,0.0856845822,0.0000060026,0.0000335090\nERR/12,0.3806629821,0.0522721431,0.0000033386,0.0000342629\nERR/13,0.0373658667,0.0562993191,0.0000036259,0.0000033487\nERR/14,0.0455235020,0.0896937462,0.0000062887,0.0000040845\nERR/15,0.0838977644,0.1868453183,0.0000132139,0.0000075364\nERR/16,0.0966772515,0.1205425621,0.0000088179,0.0000086710\nERR/17,0.0824056347,0.0390765628,0.0000030177,0.0000074121\nERR/18,0.0818353321,0.1509363346,0.0000111398,0.0000073614\nERR/19,0.2449596538,0.1498203351,0.0000110606,0.0000220367\nERR/20,0.2455254028,0.0379601536,0.0000029384,0.0000220870\nERR/21,0.0428919326,0.0265733996,0.0000021336,0.0000038726\nERR/22,0.0436772242,0.2497880776,0.0000183422,0.0000039423\nERR/23,0.3327634719,0.2504511931,0.0000183899,0.0000299530\nERR/24,0.3319895661,0.0272354908,0.0000021812,0.0000298842\nERR/25,0.1121062566,0.1135798831,0.0000083225,0.0000101088\nERR/26,0.1193099468,0.2279827579,0.0000166458,0.0000107518\nERR/27,0.1688627289,0.1144423425,0.0000074904,0.0000151927\nERR/28,0.1775175278,0.1594268132,0.0000118409,0.0000159778\nERR/29,0.1452711190,0.3247700367,0.0000227542,0.0000130831\nERR/30,0.1209193080,0.1795258089,0.0000126926,0.0000108875\nERR/31,0.2409699573,0.0581966085,0.0000043778,0.0000216726\nERR/32,0.2348997396,0.2834680027,0.0000205979,0.0000211309\nERR/33,0.1966831937,0.0579372615,0.0000034646,0.0000177062\nERR/34,0.1993644420,0.1019019128,0.0000077412,0.0000179396\nERR/35,0.2429478428,0.3833148414,0.0000269279,0.0000218549\nERR/36,0.2718344884,0.1205730390,0.0000084892,0.0000244597\nERR/37,0.2687489734,0.0287539061,0.0000022840,0.0000241722\nERR/38,0.2736857376,0.3130126734,0.0000226990,0.0000246127\nERR/39,0.3005662362,0.0273727714,0.0000012898,0.0000270217\nERR/40,0.2865491295,0.0703176204,0.0000054925,0.0000257704\nERR/41,0.2316289257,0.4159190210,0.0000292507,0.0000208351\nERR/42,0.1899498524,0.0541574746,0.0000034733,0.0000170764\nERR/43,0.2969855982,0.0252507946,0.0000020389,0.0000267342\nERR/44,0.2931823065,0.3166177549,0.0000229515,0.0000263951\nERR/45,0.2776380441,0.0227478536,0.0000009636,0.0000250023\nERR/46,0.3029911981,0.0646728832,0.0000050923,0.0000272720\nERR/47,0.3692483939,0.4225836626,0.0000297248,0.0000332279\nERR/48,0.4072046331,0.0804882944,0.0000056329,0.0000366510\nERR/49,0.0309497656,0.0476879809,0.0000036427,0.0000027738\nERR/50,0.0336195848,0.2942825386,0.0000213551,0.0000030116\nERR/51,0.0378276110,0.0440632335,0.0000024863,0.0000033887\nERR/52,0.0011384097,0.0849684439,0.0000065412,0.0000001012\nERR/53,0.0764557781,0.4033080063,0.0000283500,0.0000068748\nERR/54,0.1189468519,0.0993559855,0.0000069781,0.0000107069\nERR/55,0.2525550645,0.0960654650,0.0000070947,0.0000227270\nERR/56,0.2540914112,0.2460070246,0.0000179103,0.0000228636\nERR/57,0.2469632012,0.0913189113,0.0000058574,0.0000222250\nERR/58,0.1989379527,0.1312043023,0.0000098384,0.0000179196\nERR/59,0.1100067729,0.3580920522,0.0000251268,0.0000099235\nERR/60,0.0629808645,0.1441639745,0.0000101715,0.0000056825\nERR/61,0.0893602518,0.2210098854,0.0000161497,0.0000080179\nERR/62,0.0387671976,0.1967704237,0.0000143974,0.0000034736\nERR/63,0.0386742240,0.1215171647,0.0000079940,0.0000034756\nERR/64,0.0538320955,0.1398415078,0.0000093186,0.0000048235\nERR/65,0.0288861982,0.1666035833,0.0000123517,0.0000025889\nERR/66,0.1097938997,0.1790129063,0.0000132479,0.0000098418\nERR/67,0.0599992857,0.3174913101,0.0000222359,0.0000053816\nERR/68,0.2066622965,0.3109975002,0.0000217692,0.0000185522\")\n\n puts kap\nend",
"def split; end",
"def km_get_reacid(data)\n return data.map{|d| d.scan(/(?<r>R\\d{5})/)}.flatten.sort\nend",
"def test_parsing_from_shake_script\n fixture = File.open(File.dirname(__FILE__) + '/shake_subpix_v01.shk')\n \n trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 720, :height => 576).to_a\n assert_equal 2, trackers.length\n \n bl_kf = trackers[0][0]\n assert_in_delta 0.5, bl_kf.abs_x, DELTA\n assert_in_delta 0.5, bl_kf.abs_y, DELTA\n \n tr_kf = trackers[1][0]\n assert_in_delta 715.5, tr_kf.abs_x, DELTA\n assert_in_delta 571.514, tr_kf.abs_y, DELTA\n end",
"def test_ut_da10b_t1_15\n p \"Test 15\"\n # gets a list of pjs belong to selected pu\n pjs = @pu.get_pjs_belong_to_pu\n expected_pj = [[\"\", 0], [\"SamplePJ1\", 1], [\"SamplePJ2\", 2]]\n assert_equal expected_pj, pjs\n end",
"def test_CC_biophysiochemical_properties\n data = \"CC -!- BIOPHYSICOCHEMICAL PROPERTIES:\nCC Absorption:\nCC Abs(max)=395 nm;\nCC Note=Exhibits a smaller absorbance peak at 470 nm. The\nCC fluorescence emission spectrum peaks at 509 nm with a shoulder\nCC at 540 nm;\"\n sp = SPTR.new(data)\n assert_equal({\"Redox potential\" => \"\", \n \"Temperature dependence\" => \"\", \n \"Kinetic parameters\" => {}, \n \"Absorption\" => {\"Note\" => \"Exhibits a smaller absorbance peak at 470 nm. The fluorescence emission spectrum peaks at 509 nm with a shoulder at 540 nm\", \n \"Abs(max)\" => \"395 nm\"}, \n \"pH dependence\" => \"\"},\n sp.cc(\"BIOPHYSICOCHEMICAL PROPERTIES\"))\n\ndata = \"CC -!- BIOPHYSICOCHEMICAL PROPERTIES:\nCC Kinetic parameters:\nCC KM=62 mM for glucose;\nCC KM=90 mM for maltose;\nCC Vmax=0.20 mmol/min/mg enzyme with glucose as substrate;\nCC Vmax=0.11 mmol/min/mg enzyme with maltose as substrate;\nCC Note=Acetylates glucose, maltose, mannose, galactose, and\nCC fructose with a decreasing relative rate of 1, 0.55, 0.20, 0.07,\nCC 0.04;\"\n sp = SPTR.new(data)\n assert_equal({\"Redox potential\" => \"\", \n \"Temperature dependence\" => \"\", \n \"Kinetic parameters\" => {\"KM\" => \"62 mM for glucose; KM=90 mM for maltose\", \n \"Note\" => \"Acetylates glucose, maltose, mannose, galactose, and fructose with a decreasing relative rate of 1, 0.55, 0.20, 0.07, 0.04\", \n \"Vmax\" => \"0.20 mmol/min/mg enzyme with glucose as substrate\"},\n \"Absorption\" => {},\n \"pH dependence\" => \"\"},\n sp.cc(\"BIOPHYSICOCHEMICAL PROPERTIES\"))\n\ndata = \"CC -!- BIOPHYSICOCHEMICAL PROPERTIES:\nCC Kinetic parameters:\nCC KM=1.76 uM for chlorophyll;\nCC pH dependence:\nCC Optimum pH is 7.5. Active from pH 5.0 to 9.0;\nCC Temperature dependence:\nCC Optimum temperature is 45 degrees Celsius. Active from 30 to 60\nCC degrees Celsius;\"\n sp = SPTR.new(data)\n assert_equal({\"Redox potential\" => \"\", \n \"Temperature dependence\" => \"Optimum temperature is 45 degrees Celsius. Active from 30 to 60 degrees Celsius\", \n \"Kinetic parameters\" => {},\n \"Absorption\" => {},\n \"pH dependence\" => \"Optimum pH is 7.5. Active from pH 5.0 to 9.0\"},\n sp.cc(\"BIOPHYSICOCHEMICAL PROPERTIES\"))\n end",
"def test_if_output_splits_elements_into_strings\n assert_equal [[\"A\", \"A\"], [\"1\", \"2\"]], @board.parse_coordinates([\"A1\", \"A2\"])\n end",
"def test\n sentence = \"(S (NP (NNP John)) (VP (V runs)))\"\n test = Tree.new(sentence)\n end",
"def test_notes_parts_values\n obs = observations(:template_and_orphaned_notes_scrambled_obs)\n assert_equal(\"red\", obs.notes_part_value(\"Cap\"))\n assert_equal(\"pine\", obs.notes_part_value(\"Nearby trees\"))\n end",
"def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\ /,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end",
"def board\n # split_letters = @board_string.partition { |group| }\n # p split_letters\n # @empty_board.each { |row| puts row }\n @game_board.each_with_index {|row| p row}\n # end\n end",
"def test_score_a_word_having_multiple_different_tiles\n\t\t\"LEWIS\".each_char { |x| @word.append x.to_sym }\n\t\tassert_equal 8, @word.score\n\tend",
"def test_five\n input = 'input_tes4.txt'\n translate = UniversalTranslator.new\n assert_equal('There is an error in a initial metric unit', translate.get_data(input))\n end",
"def test_read_file\n begin\n File.open('test.txt', 'w') { |f| f.write('0|0|SYSTEM>569274(100)|1553184699.650330000|288d') }\n end\n assert_equal [['569274', 100]], @verify.read('test.txt')\n end",
"def parse(rawdata)\n end",
"def mta\n {\n :N => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], \n :L => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n :L6 => [\"Grand Station\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\nend",
"def parse(data)\n\n # convert to utf-8\n data_utf8 = data.encode('UTF-8', :invalid => :replace, :replace => \"\")\n\n # split into nice rows\n rows = data_utf8.split(/\\r\\n?|\\n/)\n\n # to store units info\n units = {}\n\n # read values, store each doc in array\n docs = []\n\n rows.each do |row|\n doc = {}\n row.split(/\\s+|\\\\t+/).each_with_index do |value, index|\n if index < @@header.length\n name = @@header[index]\n if !value.nil? and !value.empty?\n # try to see if this can be a float\n begin\n value = Float(value.gsub(',', '.'))\n rescue ArgumentError\n end\n\n doc[name] = value\n end\n end\n end\n\n # point to our schema\n doc[\"schema\"] = \"http://api.npolar.no/schema/radiation-zeppelin-1.0-rc1\"\n\n docs << doc\n end\n\n docs\n end",
"def checkLengths(inputStr,lengthStr)\n ops_by_row = Hash.new { |hash, key| hash[key] = [] } # will hold Y/N length ok data\n operations.each do |op| # group by row\n ops_by_row[\"#{op.get(:qc_row)}\"].push op\n end\n ops_by_row.each do |row, ops|\n data = show do\n title \"Row #{row.to_i + 1}: verify that each lane matches expected size\"\n note \"Look at the gel image, and match bands with the lengths listed on the side of the gel image.\"\n note \"For more accurate values, select each well under <b>analyze</b> -> <b>electropherogram</b> to see peaks for fragments found with labeled lengths.\"\n note \"Select No if there is no band or band does not match expected size,\n select N/A if expected length is N/A and there is a band.\"\n ops.each do |op|\n select [\"Yes\", \"No\",\"N/A\"], \n var: \"verify[#{op.get(:qc_row)}][#{op.get(:qc_column)}]\", \n label: \"Does gel lane in column #{op.get(:qc_column) + 1} match the expected length of #{op.input(lengthStr).val} bp?\"\n end \n end \n # associate Y/N answers for row - to plan or to sample?\n ops.each do |op|\n item_id = op.input(inputStr).item.id\n op.plan.associate \"qc_result_#{item_id}_row_#{op.get(:qc_row)}column_#{op.get(:qc_column)}\", data[\"verify[#{op.get(:qc_row)}][#{op.get(:qc_column)}]\".to_sym]\n op.input(inputStr).item.associate \"qc_result_#{item_id}_row_#{op.get(:qc_row)}column_#{op.get(:qc_column)}\", data[\"verify[#{op.get(:qc_row)}][#{op.get(:qc_column)}]\".to_sym]\n end\n end\n end",
"def prep_tubes(input_str, output_str, cell_lysis_str, method_str) \n y_overnights = operations.select {|op| op.input(input_str).object_type.name == \"Yeast Overnight Suspension\" }\n log_info 'y_overnights', y_overnights.each {|op| op.input(input_str).object_type.name}\n \n # Select which operations have specific extraction parameters in order to account for tubes needed in protocol\n zymo_tubes = operations.select {|op| op.input(cell_lysis_str).val == 'Enzymatic'}\n scrw_caps = operations.select {|op| op.input(input_str).object_type.name == 'Yeast Overnight Suspension'}.select {|op| op.input(cell_lysis_str).val == 'Mechanical'}\n ext_tubes = operations.select {|op| op.input(method_str).val == 'miRNeasy_Kit'}\n rneasy_cols = operations.select {|op| op.input(method_str).val == 'RNeasy_Kit'}\n mi_rneasy_cols = operations.select {|op| op.input(method_str).val == 'miRNeasy_Kit'}\n final_tubes = operations.length\n \n # Gathers and labels tubes for samples \n show do\n title 'Preparing Tubes'\n separator\n note 'Gather the following materials:'\n (!scrw_caps.empty?) ? (note \"<b>#{scrw_caps.length}</b> - 2mL Screw Cap tubes and label <b>#{scrw_caps.map { |op| op.temporary[:tube]}}</b>\" ) : nil\n (!zymo_tubes.empty?) ? (note \"<b>#{zymo_tubes.length}</b> - 1.5mL microfuge tubes and label <b>#{zymo_tubes.map { |op| \"ZD#{op.temporary[:tube]}\"}}</b>\" ) : nil\n (!rneasy_cols.empty?) ? (note \"<b>#{rneasy_cols.length}</b> - RNeasy Kit Columns and label <b>#{rneasy_cols.map {|op| op.temporary[:tube]}}</b>\" ) : nil\n separator\n (!ext_tubes.empty? || !mi_rneasy_cols.empty?) ? (note \"Place the following in a tube rack in the fume hood when ready:\" ): nil\n (!ext_tubes.empty?) ? (note \"<b>#{ext_tubes.length * 2}</b> - 1.5mL RNase Free tubes and label each pair <b>#{ext_tubes.map {|op| op.temporary[:tube]}}</b>\" ) : nil\n (!mi_rneasy_cols.empty?) ? (note \"<b>#{mi_rneasy_cols.length}</b> - miRNeasy Kit Columns and label <b>#{mi_rneasy_cols.map {|op| op.temporary[:tube]}}</b>\" ) : nil\n note \"<b>#{final_tubes}</b> - 1.5mL RNase-Free Tubes and use sticker dots to label <b>#{operations.map {|op| op.output(output_str).item.id}}</b>\"\n end\n \n \n \n # Table format of gathering tubes and allows for a visual mapping of which sample will go into what tubes\n headers = [\"Item ID\", \"Zymolase Digest\", \"2mL Screw Cap\", \"1st Extract\", \"2nd Extract\", \"RNeasy Columns\", \"miRNeasy Columns\", \"Final Tube ID\"]\n show do\n title 'Preparing Tubes Table'\n separator\n note \"<b>This table shows the previous slide in a table format</b>\"\n table operations.start_table\n .custom_column(heading: headers[0]) { |op| op.input(input_str).item.id}\n .custom_column(heading: headers[1]) { |op| (op.input(cell_lysis_str).val == 'Enzymatic') ? op.temporary[:tube] : '--'}\n .custom_column(heading: headers[2]) { |op| (op.input(cell_lysis_str).val == 'Mechanical' && op.input(input_str).object_type.name == 'Yeast Overnight Suspension') ? op.temporary[:tube] : '--'}\n .custom_column(heading: headers[3]) { |op| (op.input(method_str).val == 'miRNeasy_Kit') ? op.temporary[:tube] : '--'}\n .custom_column(heading: headers[4]) { |op| (op.input(method_str).val == 'miRNeasy_Kit') ? op.temporary[:tube] : '--' }\n .custom_column(heading: headers[5]) { |op| (op.input(method_str).val == 'RNeasy_Kit') ? op.temporary[:tube] : '--' }\n .custom_column(heading: headers[6]) { |op| (op.input(method_str).val == 'miRNeasy_Kit' ) ? op.temporary[:tube] : '--' }\n .custom_column(heading: headers[7], checkable: true) { |op| op.output(output_str).item.id}\n .end_table\n end\n \n # Gathers falcon tubes for quenching overnight suspension and/or falcon tubes for organic reagents used in miRNeasy method\n (!y_overnights.empty?) ? falcons = y_overnights.map {|o| o.input(input_str).item.id} : falcons = []\n (!mi_rneasy_cols.empty?) ? falcons = falcons.concat(['QIAzol', '100% Ethanol', 'Chloroform']) : falcons\n if (!falcons.empty?) \n show do \n title \"Labeling and Preparing Tubes\"\n separator\n note \"Gather <b>#{falcons.length}</b> 15mL falcon tubes and label:\"\n falcons.each {|i| check \"<b>#{i}</b>\"}\n end\n end\n end",
"def test_normalization_data\n skip if jruby?\n failures = []\n\n normalization_file = File.join(File.dirname(__FILE__), \"NormalizationTest.txt\")\n File.open(normalization_file, \"r\") do |file|\n file.each_line do |line|\n # Skip line if it's only a comment or header\n next if line =~ /^(?:\\#|\\@)/\n\n # Determine where the comment portion of the line starts, and split.\n split_point = line.index(\" # \")\n tests = line[0..split_point]\n comment = line[(split_point + 3)..-1]\n\n # Break comment portion into listed chars and description\n desc_chars, description = comment.split(/(?<=[\\)])\\s/)\n\n # Trim/split description characters and remove illustrative circles.\n desc_chars = desc_chars.gsub!(/^\\(|\\u{25CC}|\\)$/, \"\").split(/;\\s/)\n\n # Unescape test sequences into unicode characters.\n tests = tests.split(/;\\s?/).map! do |test|\n test.gsub!(/([\\h]{4,6}\\s?)+/) do |m|\n eval(%(\"\\\\u{#{m}}\")) # rubocop:disable Eval\n end\n end\n\n # Be verbose maybe.\n tputs([description, desc_chars.inspect], STDERR) if $DEBUG\n\n # Ensure unescaped characters match description characters\n assert_equal tests, desc_chars\n\n tries = [::UTF8Proc.NFC(tests[0]), ::UTF8Proc.NFD(tests[0]),\n ::UTF8Proc.NFKC(tests[0]), ::UTF8Proc.NFKD(tests[0])]\n\n failures << \"#{tries.inspect} != #{tests[1..-1]}\" if tries != tests[1..-1]\n end\n end\n failures.each { |f| STDERR.puts \"Failure: #{f}\" } if $DEBUG\n\n assert_empty failures\n end",
"def test_initialize\n assert_equal([\"test\", \"tested\"], @tester.array_to_split)\n end",
"def to_training_data(pl = @phrase_length)\n raise \"Too short\" if to_a.size < pl + 1\n\n @training_data ||= {}.tap do |io|\n words.each_index do |ndx|\n ins = words[ndx..(ndx + (pl - 1))].map {|w| self[w] }\n outs = [words[ndx + pl]].compact.map {|w| self[w] }\n\n if ins.size == pl && !outs.empty?\n io[ins] = outs\n end\n end\n end\n end",
"def data\n data = Jhead.call(@match, @pattern).split(\"\\n\\n\").map { |p| p.split(\"\\n\") }\n data.map! do |p|\n h = Hash.new\n p.each do |l|\n #OPTIMIZE for the moment, ignore line:\n # \"======= IPTC data: =======\" and its following lines.\n break if l == \"======= IPTC data: =======\"\n if l =~ /(.+?)\\s*:\\s*(.+)/\n h[parse_tag $1] = parse_value $2\n end\n end\n h\n end\n\n data.size == 1 ? data.first : data\n end",
"def song_decoder(song)\n p song.gsub(\"WUB\", \" \").split * \" \"\nend",
"def kettle_data\n vals = {}\n text = read_text\n match = Regexp.new('Wood: ([0-9]+)').match(text)\n vals[:wood] = match[1].to_i if match\n match = Regexp.new('Water: ([0-9]+)').match(text)\n vals[:water] = match[1].to_i if match\n vals[:done] = (text =~ /The recipe is complete/)\n \n vals\n end",
"def toptag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n([A-Za-z\\/\\*])/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def set_data_from(strt_index,raw_arr)\n $test_logger.log(\"Set data from location #{strt_index}\")\n @data.fill(strt_index,raw_arr.size) {|i|\n \n @data[i] = BioPacket.swap_dword(raw_arr[i-strt_index]) \n }\n #@data.concat(raw_arr)\n build_cmd\n end",
"def test_p2a_not_found\n alpha = \"FOXMART ALFA INDIGO LARGE\"\n assert_raise(RuntimeError) { Phonetic.from_phonetic(alpha) }\n assert_equal \"Invalid phonetic: FOXMART\", Phonetic.translate(\"P2A \" + alpha)\n end",
"def getData(monArray)\n\t\tmyIndex = 0\n\t\tindex = 0\n\n\t\t@product = @html.xpath(X_PATH_DATA)\n\t\twhile(index<@product.length)\n\t\t\tmyIndex = index/4\n\t\t\t\n\t\t\t(monArray.at(myIndex)).check_rate = ((@product.at(index)).text).gsub(/[^\\d]/, '')\t\n\t\t\tindex +=1\n\t\t\t\n\t\t\t(monArray.at(myIndex)).history = ((@product.at(index)).text).gsub(/[^\\d]/, '')\t\n\t\t\tindex +=1\n\n\t\t\t(monArray.at(myIndex)).multiple_notifications = (@product.at(index)).text\n\t\t\tindex +=1\n\n\t\t\t(monArray.at(myIndex)).push_notifications = (@product.at(index)).text\n\t\t\tindex +=1\n\t\t\n\t\tend\n\t\n\tend"
] | [
"0.55512685",
"0.53138405",
"0.52826405",
"0.5220785",
"0.5218726",
"0.5201712",
"0.5189527",
"0.5176986",
"0.51764995",
"0.5163787",
"0.5154532",
"0.5125206",
"0.506041",
"0.5060026",
"0.5042854",
"0.50314355",
"0.50238216",
"0.49907583",
"0.49907136",
"0.4989221",
"0.49692002",
"0.49692002",
"0.49521437",
"0.4940619",
"0.49358022",
"0.493186",
"0.49291098",
"0.4927614",
"0.49264306",
"0.49246097",
"0.49177653",
"0.49066618",
"0.49025437",
"0.48745978",
"0.48727852",
"0.48401088",
"0.4837949",
"0.4837949",
"0.48319727",
"0.48091945",
"0.48032925",
"0.48031932",
"0.4796767",
"0.4796767",
"0.4796638",
"0.47741005",
"0.47685415",
"0.47660097",
"0.4752231",
"0.47347492",
"0.4728045",
"0.47107232",
"0.47080705",
"0.46999115",
"0.4691028",
"0.46907663",
"0.4678793",
"0.46690455",
"0.4668847",
"0.46667108",
"0.46615082",
"0.46517864",
"0.46450403",
"0.4626096",
"0.46153378",
"0.46072918",
"0.46035883",
"0.459616",
"0.45900297",
"0.45884803",
"0.45859548",
"0.45822388",
"0.4581217",
"0.4580968",
"0.45794702",
"0.457754",
"0.45752618",
"0.45739406",
"0.4567182",
"0.45638564",
"0.4561631",
"0.45591468",
"0.45563808",
"0.45543802",
"0.45416936",
"0.45411777",
"0.4537908",
"0.45367903",
"0.45343274",
"0.45294517",
"0.4527551",
"0.4526982",
"0.45256472",
"0.45248386",
"0.45219204",
"0.45218813",
"0.45189434",
"0.45159936",
"0.45159537",
"0.45144793"
] | 0.60254514 | 0 |
Append 'phrase' and 'translation'. If this 'phrase' already exists as key, then simply append 'translation' to the value array. | def append(phrase, translation)
phrase.strip!
translation.strip!
if @value_hash[phrase].nil?
@value_hash[phrase] = [translation]
else
@value_hash[phrase] << translation
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_translation(first, second)\r\n @dictionary[second] = first\r\n @dictionary[first] = second\r\n end",
"def add_translation(from, to)\n @dictionary[to] = from\n @dictionary[from] = to\n end",
"def add_word word #Function shovels individual strings into the dictionary array\n @dictionary << word\n end",
"def upsert(locale, key, value) # rubocop:disable Metrics/MethodLength\n I18n.with_locale(locale) do\n # when an array has to be inserted with a default value, it needs to\n # be done like:\n # I18n.t('foo', default: [['bar', 'baz']])\n # because without the double array, array items are treated as fallback keys\n # - then, the last array element is the final fallback; so in this case we\n # don't specify fallback keys and only specify the final fallback, which\n # is the array\n val = value.is_a?(Array) ? [value] : value\n I18n.t(key, default: val)\n\n # this indicates that this translation already exists\n existing_translation =\n Lit::Localization.joins(:locale, :localization_key)\n .find_by('localization_key = ? and locale = ?', key, locale)\n\n return unless existing_translation\n\n if @raw\n existing_translation.update(default_value: value)\n else\n existing_translation.update(translated_value: value, is_changed: true)\n lkey = existing_translation.localization_key\n lkey.update(is_deleted: false) if lkey.is_deleted\n end\n end\n end",
"def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end",
"def add_translation(translation)\n translations.add(translation)\n end",
"def append(key, value); end",
"def append(key, value); end",
"def add(word)\n\t\tif word.class == String\n\t\t\tword = {word => nil}\n\t\tend\n\n\t\tword.each do |key, value|\n\t\t\t@entries[key] = value\n\t\tend\n\tend",
"def add entry\n existing_entry = @entries[entry.msgid]\n if existing_entry\n entry = existing_entry.merge(entry)\n end\n @entries[entry.msgid] = entry\n end",
"def append2_to_hash (key, intermediatekey, value )\n if not self.has_key?(key)\n self[key] = Hash.new(Array.new)\n end\n self[key].append(intermediatekey,value)\n end",
"def merge_texts!(hash, element)\n unless element.has_text?\n hash\n else\n # must use value to prevent double-escaping\n texts = +\"\"\n element.texts.each { |t| texts << t.value }\n merge!(hash, CONTENT_KEY, texts)\n end\n end",
"def append(row,text)\n\t\t@text[row] = @text[row].dup\n\t\t@text[row] += text\n\tend",
"def create_phrases\n pinwheel = %w{ | / - \\\\ }\n puts \"Creating keys for locale : #{@locale}\"\n _keys_and_values = yml_to_keys_and_values\n _keys_and_values.each_with_index do |(key, value), index|\n percentage = ((index + 1).to_f / _keys_and_values.length * 100).to_i\n print \"\\b\" * 50, \"Progress: #{percentage}% - #{index + 1}/#{_keys_and_values.length} \", pinwheel.rotate!.first\n\n _key = key.to_s.split('.')[1..-1] * '.'\n next if whitelisted?(_key)\n phrasing_phrases.find_or_initialize_by(key: _key).tap do |pp|\n pp.value = value\n pp.save\n end\n end\n puts 'Done.'\n end",
"def add_v1_translations dictionary\n\n ['eligibility', 'accommodation', 'purpose'].each do |trans_type|\n\n trans = dictionary.keys.select { |key| key.to_s.match(/^#{trans_type}_/) }\n trans.each do |tran|\n new_key = tran.sub(\"#{trans_type}_\", \"\")\n dictionary[new_key] = dictionary[tran]\n end\n end\n\n dictionary\n\n end",
"def add(key, value)\n update_array(key, value, :add)\n end",
"def append(value, hash, array)\n key = array[1]\n hash[value[:key]] = { flags: value[:flags], exptime: value[:exptime], value: hash[key][:value] + value[:value], cas_unique: value[:cas_unique] }\n value[:reply] != 'false' ? (self.result = \"\\r\\nSTORED\") : (self.result = '')\n end",
"def append_metadata\n terms = self.characterization_terms\n Sufia.config.fits_to_desc_mapping.each_pair do |k, v|\n if terms.has_key?(k)\n # coerce to array to remove a conditional\n terms[k] = [terms[k]] unless terms[k].is_a? Array\n terms[k].each do |term_value|\n proxy_term = self.send(v)\n if proxy_term.kind_of?(Array)\n proxy_term << term_value unless proxy_term.include?(term_value)\n else\n # these are single-valued terms which cannot be appended to\n self.send(\"#{v}=\", term_value)\n end\n end\n end\n end\n end",
"def append_metadata\n terms = self.characterization_terms\n Sufia.config.fits_to_desc_mapping.each_pair do |k, v|\n if terms.has_key?(k)\n # coerce to array to remove a conditional\n terms[k] = [terms[k]] unless terms[k].is_a? Array\n terms[k].each do |term_value|\n proxy_term = self.send(v)\n if proxy_term.kind_of?(Array)\n proxy_term << term_value unless proxy_term.include?(term_value)\n else\n # these are single-valued terms which cannot be appended to\n self.send(\"#{v}=\", term_value)\n end\n end\n end\n end\n end",
"def add locale, key, value\n entry = self[key] ||= Entry.new\n entry[locale] = value\n end",
"def append(key, value)\n perform(:append, key, value.to_s)\n end",
"def test_add_two_xlates\n @dict.add_translation(\"book\", \"boek\")\n @dict.add_translation(\"house\", \"huis\")\n assert [email protected]?\n assert_equal \"book\", @dict.translate(\"boek\")\n assert_equal \"house\", @dict.translate(\"huis\")\n end",
"def build_variant_replacements(variant_words)\n # first check if the number of words in a given set is not 7\n # (meaning doesn't include all source/target for each locale + source)\n invalid_variant_words = variant_words.select { |words| words.count != 7 }\n unless invalid_variant_words.empty?\n pp \"Found Invalid Variants: #{invalid_variant_words}\"\n raise Exception.new(\"Found Invalid Variants: #{invalid_variant_words.count}\")\n end\n locale_words = { 'en-GB' => [], 'en-CA' => [], 'en-AU' => [], }\n variant_words.each do |source, gb_source, gb_target, ca_source, ca_target, au_source, au_target|\n puts \"A single row below:\"\n puts \"#{source}, #{gb_source}, #{gb_target}, #{ca_source}, #{ca_target}, #{au_source}, #{au_target}\"\n locale_words['en-GB'] << { origin: source, source: gb_source, target: gb_target }\n # puts locale_words['en-GB']\n locale_words['en-CA'] << { origin: source, source: ca_source, target: ca_target }\n pp locale_words\n # puts locale_words['en-CA']\n locale_words['en-AU'] << { origin: source, source: au_source, target: au_target }\n # puts locale_words['en-AU']\n end\n locale_words\nend",
"def append!(key, value); end",
"def append!(key, value); end",
"def test_add_two_xlates\r\n @dict.add_translation(\"book\", \"boek\")\r\n @dict.add_translation(\"house\", \"huis\")\r\n assert [email protected]?\r\n assert_equal \"book\", @dict.translate(\"boek\")\r\n assert_equal \"house\", @dict.translate(\"huis\")\r\n end",
"def to_h\n phrase.to_h.tap do |hash|\n hash[:old_key] = old_phrase.key if old_phrase\n end\n end",
"def record_longer_phrase\n compiled_phrase = compile_phrase\n compiled_phrase_length = compiled_phrase.word_count\n @phrases[compiled_phrase_length] ||= Hash.new(0)\n\n # The first duplicate we find needs to record both occurrances\n # TODO: Clean this up. Absolute mother to read.\n new_occurrances = @phrases[compiled_phrase_length][compiled_phrase] > 0 ? 1 : 2\n @phrases[compiled_phrase_length][compiled_phrase] += new_occurrances\n end",
"def append(name, val)\n name = name.to_sym\n val = val.to_s\n if @values.key?(name)\n @values[name] << val\n else\n self[name]= val\n end\n val\n end",
"def [] aPhrase, *aArgs\n s = aPhrase.to_s\n if key? s\n super(s)\n else\n s\n end.to_s % aArgs\n end",
"def add( toAdd )\n if toAdd.is_a?(Hash) # if toAdd is a hash\n toAdd.each do |keyWord, value|\n @entries[ keyWord ] = value # add as hash\n end\n else\n @entries[ toAdd ] = nil # if toAdd is NOT a hash, use keyword, as toAdd, to add a nil value\n end\n end",
"def phrase_params\n params.require(:phrase).permit(:locale, :i18n_key, :i18n_value, :flagged_at, :notes)\n end",
"def add_key(key,value) \n\t\tSCHOOL[key]=[value]\n\tend",
"def translations_hash; end",
"def store_original_as_translation\n unless self.original_text.nil?\n self.translations << self.original_text\n end\n end",
"def merge_result!(key, val)\n if key\n result[key] = massage_value(val)\n else\n result.merge!(massage_value(val))\n end\n end",
"def append value\n add_idx = empty? ? 0 : last_key + 1\n self[add_idx] = value\n end",
"def append(key, value)\n send_command([:append, key, value])\n end",
"def append!(errors, attr, key, val)\n return unless val.present?\n\n errors ||= {}\n errors[attr] ||= {}\n errors[attr][key] = val\n end",
"def add_extra(key, value)\n @extras[key] = value\n end",
"def store_translation(locale, key, text, count=nil)\n if count.nil?\n data = text\n else\n pluralization_index = pluralizer(locale).call(count)\n data = { pluralization_index => text }\n end\n Translation.create_or_update(locale, key, data)\n # merge the stored translation back to the memory collection\n reload!\n end",
"def add(entry) \r\n if entry.is_a? String\r\n @@words[entry] = nil\r\n else \r\n learn = entry.to_a \r\n learnit = learn[0]\r\n @@words[learnit[0]] = learnit[1]\t\r\n end\r\nend",
"def translate(details)\n self.translations = Hash[details.map { |k,v| [k.to_s, v.to_s] }].reverse_merge(self.translations)\n end",
"def translate(details)\n self.translations = Hash[details.map { |k, v| [k.to_s, v.to_s] }].reverse_merge(translations)\n end",
"def composite_keys \n api_keys = get_translation_keys \"spree_api\"\n auth_keys = get_translation_keys \"spree_auth\"\n core_keys = get_translation_keys \"spree_core\"\n dash_keys = get_translation_keys \"spree_dash\"\n promo_keys = get_translation_keys \"spree_promo\"\n\n api_keys.merge(auth_keys).merge(core_keys).merge(dash_keys).merge(promo_keys)\nend",
"def push *texts\n self.parts.concat texts\n end",
"def insert_translation yml_path, k, v\n # TODO quote key if ':' in series\n series = k.to_series\n lines = File.readlines(yml_path).to_a\n\n # construct new_key (Array)\n i, id = seek_pos lines, series\n new_key = []\n series = series[(id || 0)..-1]\n if series.empty?\n if I18n.t(k) !~ /translation\\ missing/\n TextMate::UI.tool_tip \"translation key and value exists\"\n else\n print v\n TextMate::UI.tool_tip \"translation key exists, but value different\"\n end\n return\n end\n series.each do |e|\n new_key << (e[0] + e[1] + ':')\n end\n v = v.inspect if v.index(\"\\n\")\n new_key.last << ' ' << v\n new_key.map! {|l| l + \"\\n\" }\n\n # insert new_key (String) into file\n new_key = new_key.join\n if i\n lines.insert i, new_key\n else\n # remove trailing space\n while lines.last =~ /^\\s*$/\n lines.pop\n end\n if !lines.last.end_with?(\"\\n\")\n lines << \"\\n\"\n end\n lines << new_key.rstrip\n end\n\n # write\n lines = lines.join\n File.open yml_path, 'w' do |f|\n f << lines\n end\nend",
"def add_keyword\n @item.keywords = @bib.keyword.map(&:content).join(\", \") if @bib.keyword.any?\n end",
"def add_translation(text, lang_code)\n translation = Translation.create(:text => text, :lang_code => lang_code)\n\n translations << translation\n end",
"def test_multi_xlate\r\n assert @dict.empty?\r\n @dict.add_translation(\"book\", \"boek\")\r\n assert [email protected]?\r\n assert_equal \"book\", @dict.translate(\"boek\")\r\n assert_equal \"boek\", @dict.translate(\"book\")\r\n end",
"def addExtraURITag(key,value) \n\t\tself._querytext.push([key,value])\t\n\tend",
"def add_word(word)\n sym = word.to_sym\n wdup = word.dup\n for i in 0...word.length\n wdup[i] = 0\n @steps[wdup] << sym\n wdup[i] = word[i]\n end\n @words[word] = sym # for allow_shorter and each_word\n end",
"def add_word(word)\n if word.length == 0\n @isend = true\n else\n @childs[word[0]] ||= WordDictionary.new\n @childs[word[0]].add_word(word[1..-1])\n end\n nil\n end",
"def +(other_word)\n CombinedNoun.new([word, other_word])\n end",
"def register\n ensure_post\n ensure_application\n ensure_valid_signature\n\n unless params[:source].blank?\n source = Tr8n::TranslationSource.find_or_create(params[:source], application)\n end\n\n phrases = []\n if params[:phrases]\n begin\n phrases = HashWithIndifferentAccess.new({:data => JSON.parse(params[:phrases])})[:data]\n rescue Exception => ex\n raise Tr8n::Exception.new(\"Invalid request. JSON parsing failed: #{ex.message}\")\n end\n elsif params[:label]\n phrases << {:label => params[:label], :description => params[:description]}\n end\n\n keys = []\n phrases.each do |phrase|\n phrase = {:label => phrase} if phrase.is_a?(String)\n next if phrase[:label].strip.blank?\n opts = {:source => source, :locale => (language || Tr8n::Config.default_language).locale, :application => application}\n keys << Tr8n::TranslationKey.find_or_create(phrase[:label], phrase[:description], opts).to_api_hash(:translations => false)\n end\n\n render_response(keys)\n end",
"def handle_key_append(key, value, cfg_dir, list_keys, path_keys, cfg)\n this_value = handle_key(key, value, cfg_dir, list_keys, path_keys, cfg)\n cfg[key] = [] unless cfg.has_key?(key)\n\n begin\n cfg[key].concat(this_value).uniq!\n rescue NoMethodError\n end\n end",
"def merge!(hash, key, value)\n if hash.has_key?(key)\n if hash[key].instance_of?(Array)\n hash[key] << value\n else\n hash[key] = [hash[key], value]\n end\n elsif value.instance_of?(Array)\n hash[key] = [value]\n else\n hash[key] = value\n end\n hash\n end",
"def add(key, value)\n @hash[key] = value\n @reverse[value] ||= []\n @reverse[value] << key\n end",
"def add(key, value); end",
"def add(key, value)\n end",
"def add_s(array)\n array.map do |word|\n if word == word\n word \n else \n word + \"s\"\n end\n end \nend",
"def one_translation_per_lang_per_key\n translation_exists = Translation.exists?(\n lang: self.lang,\n translator_id: self.translator.id,\n translator_type: self.translator.class.name,\n translation_key_id: self.key.id\n )\n\n unless translation_exists\n true\n else\n false\n self.errors.add(:lang, I18n.t('.one_translation_per_lang_per_key'))\n end\n end",
"def addword(word)\n if @graph.words[word].nil? then\n @graph.words[word] = {}\n end\n end",
"def phrase(phrase)\n @query[:phrase] = phrase\n self\n end",
"def phrase(phrase)\n @query[:phrase] = phrase\n self\n end",
"def add_templated_error(key, message)\n record.setting_errors ||= {}\n record.setting_errors[template.to_s] ||= {}\n record.setting_errors[template.to_s][key] ||= []\n record.setting_errors[template.to_s][key].push(message)\n end",
"def store_translations(locale, data, options = {})\n locale = locale.to_sym\n translations[locale] ||= {}\n data = data.deep_symbolize_keys\n translations[locale].deep_merge!(data)\n end",
"def create_translation(other)\n end",
"def save_translations\n cache.each_value do |translation|\n next unless present?(translation.__send__ value_column)\n translation.id ? translation.save : model.send(\"add_#{singularize(association_name)}\", translation)\n end\n end",
"def process_data(lang, key, data)\n if data.is_a?(Hash)\n data.each do |subkey, subdata|\n subkey_fullname = key + (key == '' ? '' : '.') + subkey\n process_data(lang, subkey_fullname, subdata)\n end\n elsif data.is_a?(String)\n if $CURRENT_TRANSLATIONS[lang].key?(key)\n # Potential change to an existing translation\n this_current_translation = $CURRENT_TRANSLATIONS[lang][key]['target'].rstrip\n new_translation = data.rstrip\n if this_current_translation != new_translation\n # Translation has changed!\n id = $CURRENT_TRANSLATIONS[lang][key]['id']\n puts \"CHANGE TRANSLATION #{lang} KEY \\\"#{key}\\\"\"\n puts \" \\\"#{this_current_translation}\\\"\"\n puts \"=> id: #{id}\"\n puts \" \\\"#{new_translation}\\\"\"\n puts\n if !change_translation(id, new_translation)\n STDERR.puts \"Failed to update #{key} - halting\"\n exit 1\n end\n end\n else\n # Entirely NEW entry.\n new_translation = data\n if !$SOURCE.key?(key)\n STDERR.puts \"Source does not have key #{key}\"\n exit 1\n end\n source = $SOURCE[key]\n puts \"ADD TRANSLATION #{lang} KEY \\\"#{key}\\\":\"\n puts \" \\\"#{source}\\\"\"\n puts ' =>'\n puts \" \\\"#{new_translation}\\\"\"\n puts\n if !post_translation(key, lang, source, new_translation)\n STDERR.puts \"Failed to insert new translation for #{key} - halting\"\n exit 1\n end\n end\n elsif data.nil?\n # Ignore nil values\n else\n # Crash, something went wrong\n STDERR.puts \"Error: Bad class. Value '#{data}' has type #{data.class}\"\n exit 1\n end\nend",
"def lpush(key, value); end",
"def lpush(key, value); end",
"def add_prod_data(sym, value)\n case @prod_data.last[sym]\n when nil\n @prod_data.last[sym] = value\n when Array\n @prod_data.last[sym] << value\n else\n @prod_data.last[sym] = [@prod_data.last[sym], value]\n end\n end",
"def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end",
"def add(word)\n @words[@words.size] = word\n end",
"def save_translations\n cache.each_translation do |translation|\n next unless translation.value.present?\n translation.id ? translation.save : model.send(\"add_#{association_name.to_s.singularize}\", translation)\n end\n end",
"def add_parsed(key, value); end",
"def add_param(params:, key:, value: nil)\n if params[key].is_a?(Array)\n params[key] << (value.to_s)\n else\n params[key] = [value.to_s]\n end\n end",
"def append_with(name)\n prepare do\n document[field] = [] unless document[field]\n docs = document.send(field).concat(value.__array__)\n execute(name)\n docs\n end\n end",
"def create_or_update(locale, key, data, pluralization_index=\"\")\n\n locale, key = locale.to_s, key.to_s\n\n # create/update all of the pluralization forms\n if data.is_a? Hash\n data.each do |pluralization_index, text|\n if record = find_by_locale_and_key_and_pluralization_index(locale, key, pluralization_index)\n record.update_attribute(:text, text)\n else\n create :locale => locale, :key => key, :pluralization_index =>pluralization_index.to_s, :text => text\n end\n end\n\n # create/update without pluralization\n else\n if record = find_by_locale_and_key_and_pluralization_index(locale, key, pluralization_index)\n record.update_attribute(:text, data)\n else\n create :locale => locale, :key => key, :text => data, :pluralization_index=>pluralization_index\n end\n end\n\n end",
"def test_adding_xlate\r\n @dict.add_translation(\"book\", \"boek\")\r\n assert [email protected]?\r\n end",
"def test_adding_xlate\n @dict.add_translation(\"book\", \"boek\")\n assert [email protected]?\n end",
"def append(key, value)\n node_for(key).append(key, value)\n end",
"def phrase_fields(*fields)\n boosted_fields = fields.pop if fields.last.is_a?(Hash)\n fields.each do |field_name|\n @setup.text_fields(field_name).each do |field|\n @query.add_phrase_field(field)\n end\n end\n if boosted_fields\n boosted_fields.each_pair do |field_name, boost|\n @setup.text_fields(field_name).each do |field|\n @query.add_phrase_field(field, boost)\n end\n end\n end\n end",
"def insert( word, words )\n if words == [] # if words is empty ...\n return [ word ] # ... return array solely containing word\n else # else ...\n if word.downcase < words.first.downcase # ... if word is dictionary-larger than first element of words ...\n return [ word ] + words # ... concatenate [word] and words\n else # else ...\n return [ words.first ] + insert( word, words.drop(1) ) # ... concatenate words.first and word inserted in rest of words\n end\n end\nend",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def store_translations(locale, data)\n flatten_data(locale => data).each do |key, value|\n self[key] = value\n end\n end",
"def add_word!(a_string_param, an_array_param)\n a_string_param << \" rutabaga\"\n an_array_param << \"rutabaga\"\nend",
"def store_translations(locale, data)\n data = flatten data\n data.each { |key, data| store_translation(locale, key, data) }\n end",
"def do_merge(env, key, value)\n\n if value.is_a?(Hash)\n env.attributes[key].merge(value)\n else\n if env.attributes[key].blank?\n # Add to_s to value to stop solr storing values \n # as ints and then refusing other types at a \n # later date (e.g. long)\n env.attributes[key] = Array.wrap(value)\n else\n env.attributes[key].concat(Array.wrap(value))\n end\n end\n env\n end",
"def add(field, value)\n (@headers[downcased(field)] ||= []) << String(value)\n end",
"def phrase_params\n params.permit(:phrase, :language, :user_id)\n end",
"def append_to_hash (key, intermediatekey, value )\n if not self.has_key?(key)\n self[key] = Hash.new(false)\n end\n (self[key])[intermediatekey] = value\n end",
"def _addElement( key, value )\n @token.addElement( key, value )\n end",
"def insert(value)\n records << value\n record_id = records.count - 1\n\n trigrams = hash(value)\n trigrams.each do |tri|\n index[tri] ||= []\n index[tri] << record_id\n end\n end",
"def add(keyvalue)\n if keyvalue.is_a? String\n @hash[keyvalue] = nil\n else\n keyvalue.each do |key, value|\n @hash[key] = value #create key-value pair in @hash\n end\n end\n end",
"def word_substituter(tweet)\n new_arr = []\n tweet_arr = tweet.split\n keys_arr = dictionary.keys\n tweet_arr.each do |word|\n if keys_arr.include?(word)\n new_arr << dictionary[word]\n else\n new_arr << word\n end\n end\n return new_arr.join(\" \")\nend",
"def extend_dictionary(dict)\n build_trie(dict)\n end"
] | [
"0.6549509",
"0.58722985",
"0.58677083",
"0.5681713",
"0.5624002",
"0.5559441",
"0.55037403",
"0.55037403",
"0.55036044",
"0.54069334",
"0.5338864",
"0.5314179",
"0.5296966",
"0.526507",
"0.5226372",
"0.5176444",
"0.5171205",
"0.5166237",
"0.5166237",
"0.5161603",
"0.51430196",
"0.51397514",
"0.5123802",
"0.51122147",
"0.51122147",
"0.5070646",
"0.50695294",
"0.5055909",
"0.50366306",
"0.5028229",
"0.50163066",
"0.5002662",
"0.49956995",
"0.49885893",
"0.4977586",
"0.49767777",
"0.49750477",
"0.4961673",
"0.49411774",
"0.4921495",
"0.4915102",
"0.49044946",
"0.48957786",
"0.48915303",
"0.48866045",
"0.48714334",
"0.48623502",
"0.4861584",
"0.48608384",
"0.48585707",
"0.48387027",
"0.4834343",
"0.48336506",
"0.48284444",
"0.48080838",
"0.48049372",
"0.4789459",
"0.4777515",
"0.47748756",
"0.47725475",
"0.47601277",
"0.4757283",
"0.47522536",
"0.47485405",
"0.47479767",
"0.47478384",
"0.47462806",
"0.47442695",
"0.47427368",
"0.4733171",
"0.47261673",
"0.47261673",
"0.47224304",
"0.47121736",
"0.4711132",
"0.47051007",
"0.47025734",
"0.4701881",
"0.46959156",
"0.46945426",
"0.46933383",
"0.46852845",
"0.46664262",
"0.46598488",
"0.46462795",
"0.46448228",
"0.46448228",
"0.46448228",
"0.46427655",
"0.46411595",
"0.463698",
"0.46302748",
"0.46284178",
"0.4627475",
"0.46119556",
"0.46041337",
"0.45970568",
"0.45955247",
"0.4593547",
"0.4588216"
] | 0.83789486 | 0 |
Encodes this RDictCcEntry as string which is used to store entries as values of the DBM database. | def to_s
s = ""
# The results should be listed from shortest (exact) to longest match. So
# we store it that way.
ary = @value_hash.sort { |a, b| a[0].size <=> b[0].size }
ary.each do |elem|
s << "#{elem[0]}=<>"
elem[1].each do |val|
s << "#{val}:<>:"
end
s.gsub!(/:<>:$/, '#<>#')
end
s << "\n"
s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end",
"def to_s\n \"#<#{self.class}:0x%016x index=%d, id=%d, codec_type=:%s>\" %\n [ object_id, self[:index], self[:id], self[:codec][:codec_type] ]\n end",
"def to_json_string\n MARC::JSONLWriter.encode(self)\n end",
"def encode_string; end",
"def to_s\n output = \"\"\n self.to_a.each do |r|\n r.each do |c|\n output += \"#{Grid.encode_index(@encoded_hexcodes.key(c.to_s))} \"\n end\n output += \"\\n\"\n end\n output\n end",
"def to_s\n \"\\\"#{@key}\\\": #{@value}\"\n end",
"def encode\n @content.serialize_to_string\n end",
"def encode\n s = \"#{@value}\\000\"\n\n n = 0\n @lengths.each do |l|\n s << [@types[n]].pack(\"#{punpack_string(l)}\")\n n += 1\n end\n s\n end",
"def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end",
"def to_s\n '\\\\A' << h_to_s(@h) << '\\\\Z'\n end",
"def encode\n type_byte + encode_data\n end",
"def encode_end(state)\n state.encoded << [state.key].pack('C') + @dictionary\n end",
"def dump\n zeroes = ZEROBYTE * 32\n raw = ZEROBYTE * ID3::ID3v1tagSize\n raw[0..2] = 'TAG'\n\n self.each{ |key,value|\n\n range = ID3::Symbol2framename['1.1'][key]\n\n if range.class == Range \n length = range.last - range.first + 1\n paddedstring = value + zeroes\n raw[range] = paddedstring[0..length-1]\n elsif range.class == Fixnum\n raw[range] = value.to_i.chr # supposedly assigning a binary integer value to the location in the string\n else\n # this can't happen the way we defined the hash..\n next\n end\n }\n\n return raw\n end",
"def to_s\n @value.dup.force_encoding(Encoding.default_external)\n end",
"def encoded \n @command.to_mikrotik_word + @options.collect { |key, value|\n case value.class.name\n when 'Array' \n [key, value.collect { |item| \"#{item}\" }.join(',')].join '=' \n else\n \"#{key}=#{value}\"\n end\n }.map { |option| option.to_mikrotik_word }.join + 0x00.chr\n end",
"def encode\n ECDSA::Format::IntegerOctetString.encode(r, 32) + ECDSA::Format::IntegerOctetString.encode(s, 32)\n end",
"def encode(value)\n value.to_s(BASE)\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def to_s\n [(self.v || self.d)].pack(\"C\")\n end",
"def toEncodedString()\n s = \"<\" + @name.to_s\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.toEncodedString()\n end\n cont = @content.to_s\n cont = NaElement::escapeHTML(cont)\n s = s + cont\n s = s + \"</\" + @name.to_s + \">\"\n s\n end",
"def to_s\n return \"{ channel_order: #{self.channel_order}, channel_data_type: #{self.channel_data_type} }\"\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_base64\n Base64.strict_encode64 to_escp\n end",
"def to_s\n\t\t\treturn self.each_byte.to_a.pack( 'C*' )\n\t\tend",
"def encode\n Logger.debug \"encoding #{self.inspect}\"\n class_mapper = RocketAMF::ClassMapper.new\n ser = RocketAMF::Serializer.new class_mapper\n\n if amf3?\n ser.stream << \"\\x00\"\n end\n\n ser.serialize 0, command\n ser.serialize 0, transaction_id\n\n if amf3?\n ser.stream << \"\\x05\"\n ser.stream << \"\\x11\"\n ser.serialize 3, values.first\n else\n values.each do |value|\n ser.serialize 0, value\n end\n end\n\n ser.stream\n end",
"def encode\n # no op\n end",
"def encode\n index = e_byte(@idx)\n e_byte(NEW_CACHE)[email protected]\n end",
"def wddx_serialize # :nodoc:\n \"<binary length='#{self.length}'>#{self.encode}</binary>\"\n end",
"def to_s\n @real_key\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n \"value: #{@value}\\n\"+\n \"options: #{@options.inspect}\\n\"+\n \"encodable: #{@encodable ? @encodable : '#encode not run yet'}\\n\"+\n \"code: #{@code}\\n\"\n end",
"def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end",
"def encode_string(value)\n [value.bytesize, value].pack(\"L>A*\")\n end",
"def encode\n ed = encode_edata\n if not ed.reloc.empty?\n puts 'W: encoded string has unresolved relocations: ' + ed.reloc.map { |o, r| r.target.inspect }.join(', ')\n end\n ed.fill\n ed.data\n end",
"def encode_end(state)\n\t\tstate.encoded += [ state.key.to_i ].pack('N')\n\tend",
"def encode(object)\n engine.encode(object)\n end",
"def to_s\n\t\trval = \"%s=%s\" % [ self.name, self.make_valuestring ]\n\n\t\trval << make_field( \"Version\", self.version ) if self.version.nonzero?\n\t\trval << make_field( \"Domain\", self.domain )\n\t\trval << make_field( \"Expires\", make_cookiedate(self.expires) ) if self.expires\n\t\trval << make_field( \"Max-Age\", self.max_age )\n\t\trval << make_field( \"Path\", self.path )\n\n\t\trval << '; ' << 'HttpOnly' if self.httponly?\n\t\trval << '; ' << 'Secure' if self.secure?\n\n\t\treturn rval\n\tend",
"def to_s\n to_h.to_s\n end",
"def entry_to_str(entry)\n entry.to_s\n end",
"def encode(obj); end",
"def to_s\n out = ''\n @data.each_pair do |key, value|\n out += \"#{key}\\t#{value}\\n\"\n end\n out\n end",
"def write_entry(key, entry, raw: false, **options)\n write_serialized_entry(key, serialize_entry(entry, raw: raw, **options), raw: raw, **options)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"customKeyIdentifier\", @custom_key_identifier)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"hint\", @hint)\n writer.write_guid_value(\"keyId\", @key_id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_string_value(\"secretText\", @secret_text)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_additional_data(@additional_data)\n end",
"def encode_quoted_printable\n result = [self].pack(\"M*\")\n # Ruby's quoted printable encoding uses soft line breaks to buffer spaces\n # at the end of lines, rather than encoding them with =20. We fix this.\n result.gsub!(/( +)=\\n\\n/) { \"=20\" * $1.length + \"\\n\" }\n # Ruby's quoted printable encode puts a soft line break on the end of any\n # string that doesn't already end in a hard line break, so we have to\n # clean it up.\n result.gsub!(/=\\n\\Z/, '')\n result\n end",
"def to_s\n key.to_s\n end",
"def to_bencode\n BEncode.dump(self)\n end",
"def to_s\r\n to_hash.to_s\r\n end",
"def to_s\n @hash.inject(+'') do |memo, (k, v)|\n memo << k << '=' << v << ','\n end.chop! || ''\n end",
"def force_convert_to_tnetstring\n ::TNetstring.dump(self.to_hash)\n end",
"def meta_encode(meta)\n Base64.encode64(Marshal.dump(meta))\n end",
"def to_s\n raw\n end",
"def encoder; end",
"def encoder; end",
"def to_raw_data\n @letters.join(SEPARATOR)\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end"
] | [
"0.61991245",
"0.6130495",
"0.60597193",
"0.60180986",
"0.59948546",
"0.5968452",
"0.5955391",
"0.5950876",
"0.5893985",
"0.5850701",
"0.57998234",
"0.57888377",
"0.57490796",
"0.5737047",
"0.57274705",
"0.56926113",
"0.56893575",
"0.56762636",
"0.5676261",
"0.5636676",
"0.56332994",
"0.56322026",
"0.56322026",
"0.56274605",
"0.5614417",
"0.56116027",
"0.56084645",
"0.5608038",
"0.5570881",
"0.5522664",
"0.5501759",
"0.5501759",
"0.5501759",
"0.5501759",
"0.5501759",
"0.5501759",
"0.5501759",
"0.5499187",
"0.54933023",
"0.5473728",
"0.5472812",
"0.5471031",
"0.5465214",
"0.5461534",
"0.5456393",
"0.54551744",
"0.54533786",
"0.54404056",
"0.54337823",
"0.54328007",
"0.54315025",
"0.54226375",
"0.5420844",
"0.54200274",
"0.5412804",
"0.541163",
"0.540329",
"0.54004663",
"0.53991926",
"0.53991926",
"0.53943485",
"0.53891635",
"0.538808",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946",
"0.53879946"
] | 0.0 | -1 |
Imports the dict.cc file given in the constructor and builds/writes the database files. | def import
read_dict_file(:langA)
write_database(:langA)
read_dict_file(:langB)
write_database(:langB)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(file)\n\t\t#Initializes superclass -- creates database.\n\t\tsuper\n\t\t#Creates tables if they not exist\n\t\tTABLES.each do |table|\n\t\t\tsql = \"CREATE TABLE IF NOT EXISTS #{table.header} (\"\n\t\t\ttable.columns.each {|column| sql += \"#{column.header} \" +\n\t\t\t\t\"#{column.type_constraint}, \"}\n\t\t\tsql = table.constraint.nil? ?\n\t\t\t\t\"#{sql.slice(0, sql.length - 2)})\" :\n\t\t\t\t\"#{sql}#{table.constraint})\"\n\t\t\tself.transaction {|tdb| tdb.execute(sql)}\n\t\tend\n\tend",
"def initialize(file='corpus.db')\n @path = File.join(default_path, file)\n @filename = file\n FileUtils.mkdir_p(default_path) unless File.exists?(default_path)\n create_database\n end",
"def load_db\n input_data = File.read($fn)\n $cd_arr = YAML.load(input_data)\nend",
"def initialize(path)\n @dictionary_path = path\n @index_path = File.dirname(@dictionary_path)\n @pos_hash = {}\n\n raise \"No dictionary found at path #{@dictionary_path}\" unless File.exists? @dictionary_path\n\n @db_file = File.join(@index_path, \"jdict.db\")\n initialize_db(@db_file)\n end",
"def dbs_init\n @dbs_hash = Dir[\"#{dbs_store}/*.db\"]\n .map do |dbfile|\n File.open(dbfile){|f| JSON.parse(f.read, symbolize_names: true)}\n end\n .inject({}) do |h, db|\n h.update({\n db[:name].to_sym => LaPack::const_get(db[:clazz]).new(self, db[:params])\n })\n end\n end",
"def initialize(file = File.expand_path(File.join(File.dirname(__FILE__), '../../../db/ush.sqlite.db')))\n FileUtils.touch(file) unless File.exist?(file) # create the db if it doesnt already exist\n puts \"Database is being stored at #{file}\"\n @db = SQLite3::Database.new(file)\n @db.execute 'CREATE TABLE IF NOT EXISTS pairings(url TEXT, code TEXT)'\n end",
"def initialize(*dictfiles)\n @searchmode = 0\n Dir.mkdir(dictDir) unless File.exist?(dictDir)\n\n # 固定辞書初期化\n @dc = DictCache.new\n if !@dc[\"kanji\"] then\n DictCache.createCache(dictfiles)\n end\n\n # 個人辞書を読出し\n @localdict = loadDict(localDictFile) \n\n # 学習辞書を読出し\n @studydict = loadDict(studyDictFile)\n end",
"def initialize(file_name='persistance.db')\n require 'gdbm'\n # Creates database file if it doesn't exist\n @file_name = file_name\n unless File.directory?('db')\n Dir.mkdir('db/')\n end\n @db = GDBM.new('db/' + file_name)\n @wallet_db = GDBM.new('db/wallets_' + file_name)\n end",
"def load_from_file(path = nil)\n path ||= \"db/#{table_name}.yml\"\n\n self.destroy_all\n\n if connection.respond_to?(:reset_pk_sequence!)\n connection.reset_pk_sequence!(table_name)\n end\n\n records = YAML.load(File.open(File.expand_path(path, Rails.root)))\n records.each do |record|\n record_copy = self.new(record.attributes)\n record_copy.id = record.id\n\n # For Single Table Inheritance\n klass_col = record.class.inheritance_column.to_sym\n if record[klass_col]\n record_copy.type = record[klass_col]\n end\n\n record_copy.save\n end\n\n if connection.respond_to?(:reset_pk_sequence!)\n connection.reset_pk_sequence!(table_name)\n end\n end",
"def initialize\n self.db = YAML::Store.new(DB_FILE)\n end",
"def initialize(database, file_path)\n @file_path = file_path\n @entries = database.entries\n validate_csv_header\n end",
"def initialize(db, name, filename)\r\n @db = db\r\n @name = name\r\n @filename = filename\r\n @encrypted = false\r\n @lookup_key = :recno\r\n @idx_timestamps = {}\r\n @idx_arrs = {}\r\n\r\n # Alias delete_all to clear method.\r\n alias delete_all clear\r\n\r\n update_header_vars\r\n create_indexes\r\n create_table_class unless @db.server?\r\n end",
"def import_dict_from_file_hnd(dict_name, dict_folder)\n puts \"start importing dictionary\"\n\n base_path = @file_dir+\"/\"+dict_folder\n dict_idx_path = base_path + \"/\" + \"#{dict_folder}.index\"\n dict_data_path = base_path + \"/\" +\"#{dict_folder}.dict\"\n\n dict_table = @DB[@dict_table_name];\n dict_id = -1\n begin\n dict_id = dict_table.insert(:name=>dict_name.force_encoding(\"UTF-8\"),\n :string_id=>dict_folder.force_encoding(\"UTF-8\"))\n rescue\n #dict_id = @DB['SELECT * FROM ? WHERE string_id = ?',@dict_table_name, dict_folder].first\n dict_id = dict_table[:string_id=>dict_folder][:id]\n #puts \"count not insert dict #{dict_id}\"\n end\n\n if (dict_id<0)\n puts \"unknown error, could not find dict_id\"\n return\n end\n\n word_table = @DB[@word_table_name];\n meaning_table = @DB[@meaning_table_name];\n\n\n count = 0\n File.open(dict_data_path, \"r\") do |data_file|\n File.open(dict_idx_path, \"r\") do |idx_file|\n while (line = idx_file.gets)\n count+=1\n pos1 = line.index(\"\\t\")\n pos2=line.index(\"\\t\",pos1+1)\n\n keyword = line[0..pos1-1]\n str_entry_offset = line[pos1+1..pos2-1]\n str_entry_len = line[pos2+1..line.length-2]\n\n entry_offset = dec_val(str_entry_offset)\n entry_len = dec_val(str_entry_len)\n data_file.seek(entry_offset, IO::SEEK_SET)\n meaning = data_file.read(entry_len)\n\n word_id = -1\n existed_meaning = nil\n begin\n ch = keyword[0].upcase\n kind = 0\n if (ch<='Z' and ch >= 'A')\n kind = ch.getbyte(0) - 64\n end\n word_id = word_table.insert(:word=>keyword.force_encoding(\"UTF-8\"), :kind=>kind)\n rescue Exception => e\n word_id = word_table[:word=>keyword][:id]\n existed_meaning = meaning_table[:word=>word_id, :dict=>dict_id]\n if !existed_meaning.nil?\n existed_meaning = existed_meaning[:meaning]\n end\n end\n\n if (word_id<0)\n puts \"unknown error, could not get word id\"\n return\n end\n\n begin\n if (!existed_meaning.nil?)\n meaning = existed_meaning + \"\\n\\n\" + meaning.force_encoding(\"UTF-8\");\n meaning_table[:dict=>dict_id, :word=>word_id] = {:meaning=>meaning}\n else\n meaning_table.insert(:dict=>dict_id,:word=>word_id, :meaning=>meaning)\n end\n rescue Exception => e\n puts \"could not insert meaning #{keyword} e: #{e}\"\n end\n\n if count%1000==0\n puts \"count: #{count}\"\n #return\n end\n\n end\n end\n end\n\n puts \"importing done\"\n\nend",
"def init(dir)\n dir = File.expand_path(dir)\n db_file = db(dir)\n raise \"Database #{db_file} already exists\" if File.exist?(db_file)\n FileUtils.mkdir_p(File.dirname(db_file))\n # create database\n monotone(\"db init\", db_file)\n # TODO: do a genkey\n monotone(\"read\", db_file) do |io|\n io.write(File.open(@keys_file).read)\n io.close_write\n end\n end",
"def load_db\n basic_foods = {} # store BasicFood objects\n recipes = {} # store Recipe objects\n File.readlines('FoodDB.txt').each do |line|\n line = line.chomp.split(\",\")\n if line[1] == \"b\"\n basic_food = BasicFood.new(line[0], line[2])\n basic_foods[basic_food.name] = basic_food\n elsif line[1] == \"r\"\n recipe = Recipe.new(line[0], line[2..line.size])\n recipes[recipe.name] = recipe\n end\n end\n [basic_foods, recipes]\n end",
"def initialize(database_file)\n @database_file = database_file\n @data = get_all()\n end",
"def initialize filename = 'db.yaml'\n FileUtils.touch(filename)\n @db = YAML::Store.new(filename)\n end",
"def import\n\n output = ''\n\n country_src = 'tmp/Countries.txt'\n \n rs = File.open(country_src)\n rs.gets # <-- remove first line (columns header) \"CountryID:Title\"\n countries = {}\n City.delete_all\n Region.delete_all\n Country.delete_all\n\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n countries[row[0]] = {:name => row[1], :regions => {}, :model => nil}\n c = Country.new\n c.iso = row[0]\n c.name = row[1]\n c.save\n countries[row[0]][:model] = c\n end\n\n regions_src = 'tmp/Regions.txt'\n \n rs = File.open(regions_src)\n rs.gets # <-- remove the 1st line (header row) #CountryID:RegionID:Title\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n c = countries[row[0]][:model]\n r = Region.new\n r.iso = row[1]\n r.country_id = c.id\n\n # magic trick to ignore UTF-8 chars for now.\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n r.name = ic.iconv(row[2] + ' ')[0..-2]\n r.save\n countries[row[0]][:regions][row[1]] = r\n\n end\n\n cities_src = 'tmp/Cities.txt'\n \n rs = File.open(cities_src)\n rs.gets # <-- remove 1st row (header) #CountryID:RegionID:Title:Latitude:Longitude\n while(row = rs.gets)\n row = row.split(':')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n row[3].gsub!(/\\n/, '')\n row[4].gsub!(/\\n/, '')\n \n r = countries[row[0]][:regions][row[1]]\n if (!r.nil?) \n c = City.new\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n c.name = ic.iconv(row[2] + ' ')[0..-2] \n c.region_id = r.id\n c.lat = row[3]\n c.lng = row[4]\n c.save\n end\n end\n\n output += '<h1>Import complete</h1>'\n render(:text => output, :layout => false)\n end",
"def import_cities\n City.destroy_all\n print_title('importing cities')\n File.open 'db/2_sql_insert_city.sql', 'r' do |file|\n while row = file.gets\n row.strip!\n columns = /.+\\(\\d+,'(\\d+)','(.+)','(\\d+)'\\)/.match(row)\n code = columns[1]\n name = columns[2]\n province_code = columns[3]\n city = City.create(code: code, name: name, province_code: province_code)\n print_content \"imported city: #{city.id}, #{city.code}, #{city.name}, #{city.province_code}\"\n end\n end\n print_summary \"total imported cities count: #{City.count}\"\nend",
"def init # should eventually take configuration options (hash || block)\n if ActiveRecord::Base.connection.tables.include? 'aux_codes'\n aux_codes_yml = File.join 'config', 'aux_codes.yml'\n if File.file? aux_codes_yml\n load_file aux_codes_yml\n create_classes!\n end\n end\n end",
"def import_file! file\n # if given a file name, try opening it\n if file.instance_of? String\n _file = File.open file\n elsif file.instance_of? File\n _file = file\n else\n raise \"type not recognized: #{file.class.name}\"\n end\n\n puts \"- Iterating over keys in #{_file.inspect}\" if @verbose\n \n # iterate over keys\n YAML::load(_file).each do |env, env_hash|\n env_hash.each do |app, app_hash|\n app_hash.each do |namespace, namespace_hash|\n namespace_hash.each do |identifier, value|\n k = \"#{namespace}:#{identifier}\"\n set! k, value, app, env\n end\n end\n end\n end\n end",
"def import\n Map.import(params[:file])\n end",
"def main\n # Does the SQLite File already exist? Exit or delete based on option\n if RECREATE_SQLITE_DB && File.exist?(SQLITE_FILE)\n File.delete(SQLITE_FILE)\n end\n return \"Error - File [#{SQLITE_FILE}] already exists\" if File.exist?(SQLITE_FILE)\n\n # Connect to Db and Create Tables.\n # Several PRAGMA statements are used for optimization, however\n # the primary optimization for SQLite is Transactions otherwise\n # this script could take hours. Using prepared statements on\n # insert increases script performance by about 100%.\n db = SQLite3::Database.new(SQLITE_FILE)\n db.execute 'PRAGMA synchronous = OFF'\n db.execute 'PRAGMA journal_mode = MEMORY'\n db.transaction\n db.execute %{\n CREATE TABLE countries (\n iso TEXT,\n iso3 TEXT,\n iso_numeric INT,\n fips TEXT,\n country TEXT,\n capital TEXT,\n area_km INT,\n population INT,\n continent TEXT,\n tld TEXT,\n currency_code TEXT,\n currency_name TEXT,\n phone TEXT,\n postal_code_format TEXT,\n postal_code_regex TEXT,\n languages TEXT,\n geoname_id TEXT,\n neighbours TEXT,\n equivalent_fips_code TEXT\n )\n }\n db.execute %{\n CREATE TABLE geonames (\n geonames_id INT PRIMARY KEY,\n name TEXT,\n ascii_name TEXT,\n alternate_names TEXT,\n latitude DOUBLE,\n longitude DOUBLE,\n feature_class TEXT,\n feature_code TEXT,\n country_code TEXT,\n cc2 TEXT,\n admin1_code TEXT,\n admin2_code TEXT,\n admin3_code TEXT,\n admin4_code TEXT,\n population LONG,\n elevation INT,\n dem INT,\n timezone TEXT,\n modification_date TEXT\n )\n }\n\n # Insert Records for [countries] Table\n record_count = 0\n path = File.join(CUR_DIR, COUNTRIES_FILE)\n sql = 'INSERT INTO countries (iso, iso3, iso_numeric, fips, country, capital, area_km, population, continent, tld, currency_code, currency_name, phone, postal_code_format, postal_code_regex, languages, geoname_id, neighbours, equivalent_fips_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'\n stmt = db.prepare(sql)\n File.open(path, 'r') do |f|\n f.each_line do |line|\n if line.strip != '' && line.index('#') != 0\n values = line.split(\"\\t\")\n stmt.execute values\n record_count += 1\n end\n end\n end\n stmt.close\n puts \"Added #{record_count} Records to [countries] Table\"\n\n # Insert Records for [geonames] Table\n record_count = 0\n path = File.join(CUR_DIR, PLACES_FILE)\n sql = 'INSERT INTO geonames (geonames_id, name, ascii_name, alternate_names, latitude, longitude, feature_class, feature_code, country_code, cc2, admin1_code, admin2_code, admin3_code, admin4_code, population, elevation, dem, timezone, modification_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'\n stmt = db.prepare(sql)\n File.open(path, 'r:utf-8') do |f|\n f.each_line do |line|\n if line.strip != ''\n values = line.split(\"\\t\")\n stmt.execute values\n record_count += 1\n end\n end\n end\n stmt.close\n puts \"Added #{record_count} Records to [geonames] Table\"\n\n # Add Indexes\n db.execute 'CREATE INDEX country_feature ON geonames (country_code, feature_class, feature_code)'\n db.execute 'CREATE INDEX country_admin1_feature ON geonames (country_code, admin1_code, feature_class, feature_code)'\n db.execute 'CREATE INDEX place_names ON geonames (name , country_code, feature_class, feature_code, population)'\n\n # Commit Transactions and return\n db.commit\n db.close\n 'Success Database Created'\nend",
"def createDB(filename)\n db = Hash.new()\t\n csvfile = File.open(filename, \"r\")\n csvfile.each_line do |line|\n arr = line.split(\",\")\n if arr[1] == \"b\"\n\tdb[arr[0]] = BasicFood.new(arr[0], arr[2].to_i)\n end\n\n # if object is a recipe it adds up the calories of all\n #items in the foods list\n if arr[1] == \"r\"\n\tr = Recipe.new (arr[0])\n\ttotal =0\n\tarr.shift\n\tarr.shift\n\tarr.each do |elt|\n\t if (db.has_key?(elt))\n\t r.foods << db[elt]\n\t total += db[elt].calories\n\t end\t\t\n\tend\n\tr.setcalories(total)\n\tdb[r.name] = r\n end\n end\n db\n end",
"def initialize \n @Attributes = Hash.new \n @ConfigurationFilename = \"configuration.txt\" \n load_attributes \n end",
"def dictionary\n begin\n YAML.load_file(@@abbrevs_file) || initialize_dictionary\n rescue Errno::ENOENT\n initialize_dictionary\n end\n end",
"def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend",
"def load!(input_dir = MODEL_DIR)\n if Rails.env.production?\n raise RuntimeError.new(\"You can't run this in production!\") unless self.i_am_absolutely_positive\n end\n\n Dir.glob( File.join(input_dir.split(\"/\"), \"*.#{ FILE_EXT }\") ).each do |filename|\n model_class = File.basename( filename, \".#{ FILE_EXT }\").gsub(\"-\", \"/\").classify.constantize\n print \"Importing table data for #{ model_class.name.pluralize }... \"\n\n File.open( filename, \"r\" ) do |file|\n next unless File.size?(file)\n\n JSON.parse(file.read).each do |attributes|\n record = model_class.new\n\n # This approach unfortunately appears not to increment any sequences. That\n # means that the next INSERT will try to use a pkey that's been used already.\n record.assign_attributes(attributes)\n record.save\n end\n end\n\n # Here's the problem: STI models share a common table name, so even though\n # there are separate data dumps for each model, they really all go in\n # one table. The sequence number needs to be restarted for each *table*,\n # not each *model*.\n table_name = model_class.table_name\n\n if table_name == model_class.name.tableize.gsub(\"/\", \"_\") && model_class.any?\n\n # This model has its own table, so fix its sequence.\n sequence_name = \"#{ table_name }_id_seq\"\n next_seq_num = model_class.last.id + 1\n ActiveRecord::Base.connection.execute(\"ALTER SEQUENCE #{ sequence_name } RESTART WITH #{ next_seq_num };\")\n end\n\n puts \"done!\"\n end\n\n true\n end",
"def initialize\n Dir.chdir(File.dirname(__FILE__))\n super('questions.db')\n self.type_translation = true\n self.results_as_hash = true\n end",
"def initialize(config, *args)\n file_type = config[:file_type]\n @symmetric_key = config[:symmetric_key]\n @schemas = ::NmDatafile::SCHEMA[:schemas]\n set_file_type(file_type)\n \n load_data(args)\n \n setup_object_for_schema\n end",
"def initialize\n @data = {}\n @data_file = $config[:billing_data][:connection]\n\n @data = YAML.load_file(@data_file) if File.exist?(@data_file)\n\n @data[\"bindings\"] = {} unless @data.has_key?(\"bindings\")\n end",
"def import_countries(file)\n Country.transaction do\n while (line = file.gets)\n next if line.match(/^#/)\n line = line.split(/\\t/)\n \n c = Country.create(\n :iso2 => line[0], :iso3 => line[1], :ison => line[2],\n :name => line[4], :capital => line[5], :area => line[6],\n :continent => line[8], :currency_code => line[10], :currency_name => line[11],\n :phone => line[12], :geoname_id => line[16]\n )\n @@countries[line[0]] = c.id\n end\n end\n end",
"def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end",
"def initialize(file)\n @data = { :students => [] }\n @file = file\n load_data\n end",
"def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend",
"def import_provinces\n Province.destroy_all\n print_title('importing provinces')\n File.open 'db/1_sql_insert_province.sql', 'r' do |file|\n while row = file.gets\n row.strip!\n columns = /.+\\(\\d+,'(\\d+)','(.+)'\\)/.match(row)\n code = columns[1]\n name = columns[2]\n province = Province.create(code: code, name: name)\n print_content \"imported province: #{province.id}, #{province.code}, #{province.name}\"\n end\n end\n print_summary \"total imported provinces count: #{Province.count}\"\nend",
"def import(cnf)\n #\n # Connect to databases\n #\n begin\n $dbh_pg = DBI.connect(\n \"dbi:Pg:#{cnf[:from_db_name]}:\",\n cnf[:from_db_user],\n cnf[:from_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\\ncnf:#{cnf.inspect}\")\n exit\n end\n begin\n $dbh_ms = DBI.connect(\n \"dbi:Mysql:#{cnf[:to_db_name]}:\",\n cnf[:to_db_user],\n cnf[:to_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\")\n exit\n end\n $dbh_ms.do(\"SET sql_mode='TRADITIONAL,ANSI'\")\n $dbh_ms.do(\"SET NAMES 'utf8'\")\n \n $reaktor_insert_count = 0\n $import_log = 'import'\n $debug = cnf[:debug]\n \n #\n # Initialize plugins\n #\n ArtworkDataPlugin::set_data_path(cnf[:path_data])\n \n #\n # Drop id_store table if it exists\n #\n begin\n sth = $dbh_pg.execute(\"SELECT relname FROM pg_class WHERE relname = 'id_store'\")\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n relname = sth.fetch\n \n if relname\n begin\n sth = $dbh_pg.execute(%Q{DROP TABLE id_store})\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n STDERR.puts \"Dropped id_store table from prototype.\"\n end\n \n #\n # Load the schema map\n #\n require 'schema_map'\n \n #\n # Process tables\n #\n $schema.each do |t|\n process_table(t)\n end\n \n #\n # Write reports\n #\n ArtworkDataPlugin.flush_logs\n ArtworkDataPlugin.write_report\n \n ArtworkTopicTaggingPlugin::flush_logs\n ArtworkTopicTaggingPlugin::write_report\n \n ArtworkInternalDiscussionPlugin::flush_logs\n ArtworkInternalDiscussionPlugin::write_report\n \n ReaktoruserArtworkgroupsPlugin::flush_logs\n ReaktoruserArtworkgroupsPlugin::write_report\nend",
"def initialize(filename)\n @data_source\n @metros = Hash.new\n if !File.file?(filename)\n puts \"Files does not exit. check your path\"\n exit\n end\n file = File.read(filename)\n dataset = JSON.parse(file)\n initialize_data_source(dataset['data sources'])\n initialize_metros(dataset['metros'])\n if (dataset.has_key?('single_route'))\n initialize_routes(dataset['routes'], 1)\n else\n initialize_routes(dataset['routes'], 0)\n end\n end",
"def load_macshapa_db(filename, write_to_gui)\n\n\n # Create a new DB for us to use so we don't touch the GUI... some of these\n # files can be huge.\n # Since I don't know how to make a whole new project, lets just load a blank file.\n if not write_to_gui\n #$db,$pj = load_db(\"/Users/j4lingeman/Desktop/blank.opf\")\n $db = MacshapaDatabase.new(1000)\n $pj = Project.new()\n end\n\n\n\n f = File.open(filename, 'r')\n\n # Read and split file by lines. '\\r' is used because that is the default\n # format for OS9 files.\n file = f.gets\n lines = file.split(/\\r/)\n\n # Find the variable names in the file and use these to create and set up\n # our columns.\n predIndex = lines.index(\"***Predicates***\")\n varIndex = lines.index(\"***Variables***\")\n spreadIndex = lines.index(\"***SpreadPane***\")\n predIndex += 2\n\n variables = Hash.new\n varIdent = Array.new\n\n while predIndex < varIndex\n l = lines[predIndex].split(/ /)[5]\n varname = l[0..l.index(\"(\") - 1]\n if varname != \"###QueryVar###\" and varname != \"div\" and varname != \"qnotes\"\n variables[varname] = l[l.index(\"(\")+1..l.length-2].split(/,/)\n varIdent << l\n end\n predIndex += 1\n end\n\n # Create the columns for the variables\n variables.each do |key, value|\n # Create column\n if !$db.col_name_in_use(key)\n col = DataColumn.new($db, key, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n end\n\n mve0 = $db.get_vocab_element(key)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n mve0.delete_formal_arg(0)\n value.each { |v|\n # Strip out the ordinal, onset, and offset. These will be handled on a\n # cell by cell basis.\n if v != \"<ord>\" and v != \"<onset>\" and v != \"<offset>\"\n #puts v\n farg = NominalFormalArg.new($db, v)\n mve0.append_formal_arg(farg)\n end\n }\n $db.replace_matrix_ve(mve0)\n end\n end\n\n # Search for where in the file the var's cells are, create them, then move\n # on to the next variable.\n varSection = lines[varIndex..spreadIndex]\n\n varIdent.each do |id|\n col = $db.get_column(id[0..id.index(\"(\")-1])\n mve = $db.get_matrix_ve(col.its_mve_id)\n matid = mve.get_id()\n\n # Search the variable section for the above id\n varSection.each do |l|\n line = l.split(/[\\t\\s]/)\n if line[2] == id\n #puts varname\n start = varSection.index(l) + 1\n\n stringCol = false\n\n if varSection[start - 2].index(\"strID\") != nil\n stringCol = true\n end\n\n #Found it! Now build the cells\n while varSection[start] != \"0\"\n varSection[start]\n if stringCol == false\n cellData = varSection[start].split(/[\\t]/)\n cellData[cellData.length - 1] = cellData[cellData.length-1][cellData[cellData.length-1].index(\"(\")..cellData[cellData.length-1].length]\n\n else\n cellData = varSection[start].split(/[\\t]/)\n end\n\n # Init cell to null\n cell = DataCell.new($db, col.get_id, mve.get_id)\n mat = Matrix.new($db, matid)\n\n # Convert onset/offset from 60 ticks/sec to milliseconds\n onset = cellData[0].to_i / 60.0 * 1000\n offset = cellData[1].to_i / 60.0 * 1000\n\n # Set onset/offset of cell\n cell.onset = TimeStamp.new(1000, onset.round)\n cell.offset = TimeStamp.new(1000, offset.round)\n\n # Split up cell data\n data = cellData[cellData.length - 1]\n if stringCol == false\n data = data[1..data.length-2]\n data = data.gsub(/[() ]*/, \"\")\n data = data.split(/,/)\n elsif data != nil #Then this is a string var\n data = data.strip()\n if data.split(\" \").length > 1\n data = data[data.index(\" \")..data.length] # Remove the char count\n data = data.gsub(\"/\", \" or \")\n data = data.gsub(/[^\\w ]*/, \"\")\n data = data.gsub(/ /,\" \")\n else\n data = \"\"\n end\n else\n data = Array.new\n data << nil\n end\n\n # Cycle thru cell data arguments and fill them into the cell matrix\n narg = 0\n data.each do |d|\n fargid = mve.get_formal_arg(narg).get_id()\n d = d.strip()\n if d == \"\" or d == nil or d.index(\"<\") != nil\n fdv = NominalDataValue.new($db, fargid)\n fdv.clearValue()\n else\n d = d.strip()\n fdv = NominalDataValue.new($db, fargid, d)\n end\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n\n # Put cell into database\n cell.set_val(mat)\n $db.append_cell(cell)\n start += 1\n end\n end\n end\n end\n\n f.close()\n\n return $db, $pj\nend",
"def initialize(blast_database_file_path)\n @database = blast_database_file_path\n @fastacmd = 'fastacmd'\n end",
"def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n next if cid < 1 # do not transform if id < 1 \n #@rkeys << k\n rhash = Hash.new \n v.each {|k2,v2|\n #p k2\n #p v2\n rhash[k2.to_sym] = v2\n }\n @rarray << rhash\n }\n rescue\n p 'no file now' \n self.insert({:id=>0})\n end\n end",
"def init_db\n db_filename = './coord_cache.db'\n puts \"Creating db file '#{db_filename}'\" unless File.exist?(db_filename)\n @coord_db = SQLite3::Database.new(db_filename)\n @coord_db.execute('CREATE TABLE IF NOT EXISTS coords ' \\\n '(id INTEGER PRIMARY KEY AUTOINCREMENT, ' \\\n ' osm_id BIGINT, ' \\\n ' lat REAL, ' \\\n ' lon REAL)')\nend",
"def create_database_configuration_file\n FileUtils.cp(database_configuration_sample, database_configuration_file)\n end",
"def initialize(args = {})\n @file = args[:file] if args[:file]\n @dictionary = args[:dictionary] if args[:dictionary]\n end",
"def initialize(filename, options = {})\n if options[:preload] || !IO.respond_to?(:pread)\n @mutex = Mutex.new\n end\n\n @use_pread = IO.respond_to?(:pread) && !options[:preload]\n\n @options = options\n @database_type = Edition::COUNTRY\n @record_length = STANDARD_RECORD_LENGTH\n @file = File.open(filename, 'rb')\n\n detect_database_type!\n\n preload_data if options[:preload]\n end",
"def load(handle, args={})\n File.open(handle) do |handle|\n db = DnaIO.new handle\n db.each do |record|\n self.add(record.sequence, record.name)\n end\n end\n end",
"def import_cities(file)\n City.transaction do\n while (row = file.gets)\n row = row.split(/\\t/)\n \n city = City.create(\n :geoname_id => row[0], :country_id => @@countries[row[8]], :region_id => @@regions[row[10]],\n :name => row[1], :name_ascii => row[2], :lat => row[4], :lng => row[5],\n :time_zone => row[17]\n )\n end\n end\n end",
"def load_file(file)\n buf = File.read(file)\n\n # parse the document into a Psych tree; we don't load here because we want\n # the file/line info while creating our entities.\n doc = YAML.parse(buf, filename: file)\n\n # Document should be an Array of Hashes\n seq = doc.children.first or return # ignore empty documents\n load_error!('not a yaml sequence (Array)', file, seq) unless seq.sequence?\n\n # Loop through each Hash\n seq.children.each do |map|\n\n # Make sure it's a mapping before we convert it to a ruby Hash\n load_error!('not a yaml mapping (Hash)', file, map) unless map.mapping?\n entity = YAML.send(:symbolize_names!, map.to_ruby)\n\n # Ensure they're not using some unknown keys\n unknown_keys = entity.keys - SUPPORTED_KEYS\n load_error!(\"unknown keys: #{unknown_keys}\", file, map) unless\n unknown_keys.empty?\n\n load_error!(\"id and update are mutually exclusive\", file, map) if\n entity[:id] and entity[:update]\n\n source = \"#{file}:#{map.start_line + 1}\"\n\n create = {}\n create[:id] = entity[:id] if entity.has_key?(:id)\n create[:update] = entity[:update] if entity.has_key?(:update)\n\n # Create an Array of the various base Entities that will be layered into\n # this Entity\n create[:base] = [entity[:base]].flatten.compact\n\n # Construct an Array of component arguments that will be sent to\n # Morrow::EntityManager#create_entity\n entity[:components] ||= []\n load_error!('The `components` field must be an Array; %s' %\n [ entity[:components].inspect ], file, map) unless\n entity[:components].is_a?(Array)\n\n create[:components] = entity[:components].map do |conf|\n case conf\n when Symbol\n conf\n when String\n conf.to_sym\n when Hash\n load_error!(<<~ERROR, file, map) unless conf.size == 1\n Multiple keys found in single component configuration. Note that\n the `components` field is an Array. Perhaps you missed a '-'\n before the next component after this one.\n ERROR\n\n # A Hash is a component with non-default values. The values may be\n # provided as a Hash, an Array (must have all elements), or a scalar\n # (for single field Components)\n comp, config = conf.first\n case config\n when Hash\n config.rekey! { |k| k.to_sym }\n when Array\n # don't make any changes\n else\n # turn this non-array value into an array of a single element\n config = [ config ]\n end\n { comp.to_sym => config }\n else\n load_error!('Unsupported component configuration type: %s' %\n [ conf.inspect ], file, map)\n end\n end\n\n create[:remove] = entity[:remove] || []\n\n # defer the action if we're not able to do it at the moment\n begin\n create_or_update(**create)\n rescue Morrow::UnknownEntity\n defer(source: source, entity: create)\n rescue Exception => ex\n raise Morrow::Error, <<~ERROR.chomp\n error in entity file: #{source}: #{entity.pretty_inspect\n .chomp.gsub(/\\n/, \"\\n\" + ' ' * 16)}\n ERROR\n end\n end\n\n # Attempt to flush any deferred actions now that we've loaded everything in\n # the file.\n flush\n end",
"def initialize(file, options = nil)\n @options = options || {}\n\t\t@index = {}\t\n\t\t@dbFile = file\n\t\tmakeIndex\n\tend",
"def load!\n MODEL_TO_OUTPUT_FILEMAPPING.each do |klass, filepath|\n load_table_from_file(klass, filepath)\n end\n end",
"def create_from_file\n end",
"def initialize\n #Opens a SQLite 3 database file\n @db = SQLite3::Database.new File.join(Dir.pwd,\"lib\",\"app\",\"TentsAndTrees\",\"Game\",\"Core\",\"DB\",\"db.sqlite\")\n end",
"def load_character account, filename\n end",
"def initialize(filename:, directory: '.')\n @directory = directory.gsub(/\\/$/, '')\n @qualified_filename = @directory + '/' + filename\n @filename = filename\n @obj_metadata = {} # If we failed to read file\n diphot_metadata_to_h if File.extname(filename) == '.dat'\n end",
"def init_file; end",
"def open_dictionary\n if File.exists?(@dictionarylocation)\n file = File.new(@dictionarylocation, 'rb').read\n @depth = file[0].to_i\n @dictionary = MessagePack.unpack(file[1..-1])\n else\n @dictionary = {}\n end\n end",
"def initialize(filename, logger=nil)\n @title_isbn_hash = Hash.new\n @isbn_dvd_hash = Hash.new\n @isbn_title_hash = Hash.new\n @filespec = filename\n @logger = OptionalLogger.new(logger)\n load\n save\n end",
"def build_database(filename)\n\tdb = []\n\tlines = get_file_lines(filename)\n\tlines.each { |x| db << parse_csv_line(x) }\n\t#create new instance of Onfidoer for each item in the array\n\tdb.each { |x| Onfidoer.new(*x) } #there was a problem with this line \nend",
"def initialize(filename=nil)\n self.load(filename) if filename\n @schema = nil\n end",
"def load_file(model)\n model.delete_all\n record_name = model.to_s.downcase.pluralize\n record_count = 0\n CSV.foreach(\"#{Rails.root}/db/data/#{record_name}.csv\", {headers: true}) do |line|\n model.create(line.to_hash)\n record_count += 1\n end\n puts \"Created #{record_count} #{model.to_s} records.\"\n end",
"def build_database(file, database_user_key,database_movie_key)\n file.each do |line| \n\t\t\ttokens=line.split(\"\\t\")\n\t\t\tuser_id=tokens[0]\n\t\t\tmovie_id=tokens[1]\n\t\t\trate_score=tokens[2]\n\t\t\tadd_entry(database_user_key,user_id,movie_id,rate_score)\n\t\t\tadd_entry(database_movie_key,movie_id,user_id,rate_score)\n end \n end",
"def initialize\n\t\t# Define the database connection to the dentist_book.db SQLite database.\n\t\t@dbConnection = SQLite3::Database.new( \"./../db/dentist_book.db\" )\n\tend",
"def create_dict(file)\n # Since wordlist is constant\n if File.file?(file)\n IO.readlines(file, chomp: true)\n else\n puts 'File not found!'\n end\n end",
"def tes_load_db\n setup_clean_accounts\n Movements.create('any', '2013-01-01', 10, @cash, @income)\n\n SQLite.dbs_close_all\n Accounts.delete_all(true)\n SQLite.dbs_open_load\n\n Accounts.dump true\n end",
"def import()\n # TODO\n end",
"def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what it is\n new_pathfile = s.mtime.strftime( \"%m/%d/%m%d%H%M\" ) + m[1]\n else \n puts \"couldn't find file extension for #{f}\\n\"\n next\n end\n\n md5_checksum = Digest::MD5.hexdigest( File.read( f ) )\n\n # make directories if needed\n testfile = tbd + s.mtime.strftime( \"/%m\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n testfile += s.mtime.strftime( \"/%d\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n # copy file to new location\n FileUtils.copy( f, \"#{tbd}/\" + new_pathfile )\n\n # save data for db push\n df.push( { :class => cl, :created_text_date => s.mtime, :created_epoch_seconds => s.mtime.to_i, :pathfile => new_pathfile, :md5_checksum => md5_checksum } )\nend",
"def import\n raise \"Could not find #{@opts.exec} in your PATH\" unless system(\"which #{opts.exec} > /dev/null\")\n\n file = File.join(@path, \"#{@name}.json\")\n cmd = \"#{opts.exec} --host #{opts.host} --port #{opts.port} --drop --db #{opts.db} --collection #{opts.collection} #{file}\"\n `#{cmd}`\n end",
"def initialize(file_path, backup, version)\n @file_path = file_path\n @backup = backup\n @database = SQLite3::Database.new(@file_path.to_s, {results_as_hash: true})\n @version = version\n @notes = Hash.new()\n @folders = Hash.new()\n @accounts = Hash.new()\n puts \"Guessed Notes Version: #{@version}\"\n end",
"def load_database_yaml; end",
"def load_database_yaml; end",
"def create\n bootstrap unless File.exist?(file)\n load_attributes\n end",
"def initialize\n bootstrap unless File.exist?(file)\n load_attributes\n end",
"def call\n log.info 'loading ..'\n validate_keys_are_correct\n\n # maintain key ordering\n json.keys.each { |entity| db.tables[entity] ||= {} } # JIT initialization\n\n # load in this order to validate playlists (users and songs need to be loaded first)\n EXPECTED_MODELS.each { |entity| insert_values_into_db_cache(entity, json[entity]) }\n end",
"def initialize(force = false) # rubocop:disable Lint/MissingSuper\n @storage_location = 'data/'\n @database_name = 'mapping.marshal'\n @database_path = absolute_db_path\n database_exists?\n @tls_map = []\n parse(force)\n end",
"def load_entries\n @lines = IO.readlines(@filename)\n @lines.each_with_index do |line,idx|\n if entry_klass.is_entry?(line) then\n entry = entry_klass.from_line(line)\n v = { 'entry' => entry, 'line_index' => idx }\n @entries[entry.key] = v\n end\n end\n end",
"def load_database\n password = nil\n if not File.exists?(@options.db_file) then\n hsay 'Creating initial database.', :information\n password = prompt(\"Initial Password for (#{@options.db_file})\", :echo => \"*\", :validate => true)\n else\n password = prompt(\"Password for (#{@options.db_file})\", :echo => \"*\")\n end\n @db = Keybox::Storage::Container.new(password,@options.db_file)\n end",
"def initialize(args)\n @mapping = parse_mapping(args[:mapping])\n\n @include_custom = args[:include_custom]\n @zip_output = args[:zip_output]\n\n SUPPORTED_HSDS_MODELS.each do |model|\n var_name = \"@\" + model\n instance_variable_set(var_name, [])\n end\n\n set_file_paths(args)\n end",
"def bulk_import \n location = \"./US_birth_name_frequencies/\"\n dir_contents = Dir.entries(location)\n dir_contents = dir_contents.sort!\n dir_contents = dir_contents[2..dir_contents.length-1]\n dir_contents.each do |file_name|\n add_to_dictionary(location,file_name)\n end\n end",
"def initialize(hash_or_file = self.class.source, section = nil)\n #puts \"new! #{hash_or_file}\"\n case hash_or_file\n when nil\n raise Errno::ENOENT, \"No file specified as Settingslogic source\"\n when Hash\n self.replace hash_or_file\n else\n file_contents = open(hash_or_file).read\n hash = file_contents.empty? ? {} : YAML.load(ERB.new(file_contents).result).to_hash\n if self.class.namespace\n hash = hash[self.class.namespace] or return missing_key(\"Missing setting '#{self.class.namespace}' in #{hash_or_file}\")\n end\n self.replace hash\n end\n @section = section || self.class.source # so end of error says \"in application.yml\"\n create_accessors!\n end",
"def fetch_and_import!(opts={})\n eve_table = opts[:eve_table]\n dest_table = opts[:dest_table]\n mapping = opts[:mapping]\n dbh = opts[:conn] || @dbh\n comment_label = opts[:label]\n \n # Fetch Data from crpActivities Table\n results = dbh.query(\"SELECT * FROM \"+eve_table)\n # Clear Destination Table to eliminate Redundancy\n dest_table.camelize.constantize.delete_all\n # Do some Meta programming FU magic\n results.each do |row|\n insert_map = {}\n mapping.each do |key,value|\n insert_map[key.to_sym] = row[value]\n end \n dest_table.camelize.constantize.create!(insert_map)\n # Just so you see something when running this script..\n p \"Creating Record for #{dest_table} : \" + row[comment_label].to_s\n end\nend",
"def update_db(cont)\n db = File.open('./database', 'w')\n db.write(Marshal.dump(cont))\n db.close\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def initialize( filename )\n @data = Hash.new\n parse( filename )\n end",
"def initialize(key, filename, content)\n @key = key\n @filename = filename\n @content = content\n end",
"def initialize( configFileDNE=Conf.filename_proposal )\n#p :xxx\n raise unless configFileDNE\n @configFileDNE = configFileDNE.dup.strip.gsub('\\\\', '/')\n @instant_save = false\n @section = nil\n \n if File.file?( @configFileDNE )\n dataFromFile = read\n self.replace( dataFromFile ) if dataFromFile\n end\n#exit\n self.section = nil unless self.has_key?(nil) # section \"nil\" always needed\n\n super()\n save() # writeable?\n end",
"def initialize(db_file = false)\n if (db_file)\n @db_file = db_file\n else\n @db_file = CONFIG['resonance']['db_file']\n end\n self.createIfNotExists\n end",
"def to_import_hash\n {\n :import_from_file => @import_from_file,\n :db_configuration => @db_configuration,\n :db_connection => @db_connection,\n :append_to_table => @append_to_table,\n :force_name => @force_name,\n :suggested_name => @suggested_name,\n :ext => @ext,\n :path => @path,\n :python_bin_path => @python_bin_path,\n :psql_bin_path => @psql_bin_path,\n :entries => @entries,\n :runlog => @runlog,\n :import_type => @import_type\n }\n end",
"def compile_metadata(path = \"PBS/metadata.txt\")\r\n GameData::Metadata::DATA.clear\r\n GameData::MapMetadata::DATA.clear\r\n # Read from PBS file\r\n File.open(path, \"rb\") { |f|\r\n FileLineData.file = path # For error reporting\r\n # Read a whole section's lines at once, then run through this code.\r\n # contents is a hash containing all the XXX=YYY lines in that section, where\r\n # the keys are the XXX and the values are the YYY (as unprocessed strings).\r\n pbEachFileSection(f) { |contents, map_id|\r\n schema = (map_id == 0) ? GameData::Metadata::SCHEMA : GameData::MapMetadata::SCHEMA\r\n # Go through schema hash of compilable data and compile this section\r\n for key in schema.keys\r\n FileLineData.setSection(map_id, key, contents[key]) # For error reporting\r\n # Skip empty properties, or raise an error if a required property is\r\n # empty\r\n if contents[key].nil?\r\n if map_id == 0 && [\"Home\", \"PlayerA\"].include?(key)\r\n raise _INTL(\"The entry {1} is required in {2} section 0.\", key, path)\r\n end\r\n next\r\n end\r\n # Compile value for key\r\n value = pbGetCsvRecord(contents[key], key, schema[key])\r\n value = nil if value.is_a?(Array) && value.length == 0\r\n contents[key] = value\r\n end\r\n if map_id == 0 # Global metadata\r\n # Construct metadata hash\r\n metadata_hash = {\r\n :id => map_id,\r\n :home => contents[\"Home\"],\r\n :wild_battle_BGM => contents[\"WildBattleBGM\"],\r\n :trainer_battle_BGM => contents[\"TrainerBattleBGM\"],\r\n :wild_victory_ME => contents[\"WildVictoryME\"],\r\n :trainer_victory_ME => contents[\"TrainerVictoryME\"],\r\n :wild_capture_ME => contents[\"WildCaptureME\"],\r\n :surf_BGM => contents[\"SurfBGM\"],\r\n :bicycle_BGM => contents[\"BicycleBGM\"],\r\n :player_A => contents[\"PlayerA\"],\r\n :player_B => contents[\"PlayerB\"],\r\n :player_C => contents[\"PlayerC\"],\r\n :player_D => contents[\"PlayerD\"],\r\n :player_E => contents[\"PlayerE\"],\r\n :player_F => contents[\"PlayerF\"],\r\n :player_G => contents[\"PlayerG\"],\r\n :player_H => contents[\"PlayerH\"]\r\n }\r\n # Add metadata's data to records\r\n GameData::Metadata.register(metadata_hash)\r\n else # Map metadata\r\n # Construct metadata hash\r\n metadata_hash = {\r\n :id => map_id,\r\n :outdoor_map => contents[\"Outdoor\"],\r\n :announce_location => contents[\"ShowArea\"],\r\n :can_bicycle => contents[\"Bicycle\"],\r\n :always_bicycle => contents[\"BicycleAlways\"],\r\n :teleport_destination => contents[\"HealingSpot\"],\r\n :weather => contents[\"Weather\"],\r\n :town_map_position => contents[\"MapPosition\"],\r\n :dive_map_id => contents[\"DiveMap\"],\r\n :dark_map => contents[\"DarkMap\"],\r\n :safari_map => contents[\"SafariMap\"],\r\n :snap_edges => contents[\"SnapEdges\"],\r\n :random_dungeon => contents[\"Dungeon\"],\r\n :battle_background => contents[\"BattleBack\"],\r\n :wild_battle_BGM => contents[\"WildBattleBGM\"],\r\n :trainer_battle_BGM => contents[\"TrainerBattleBGM\"],\r\n :wild_victory_ME => contents[\"WildVictoryME\"],\r\n :trainer_victory_ME => contents[\"TrainerVictoryME\"],\r\n :wild_capture_ME => contents[\"WildCaptureME\"],\r\n :town_map_size => contents[\"MapSize\"],\r\n :battle_environment => contents[\"Environment\"]\r\n }\r\n # Add metadata's data to records\r\n GameData::MapMetadata.register(metadata_hash)\r\n end\r\n }\r\n }\r\n # Save all data\r\n GameData::Metadata.save\r\n GameData::MapMetadata.save\r\n Graphics.update\r\n end",
"def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i assume but the check was needed\n if test ?s, db_tmp\n @db = SQLite3::Database.new db_tmp\n else \n puts \"error-> can not open #{db_tmp} for reasing\"\n exit 2\n end\n end",
"def initialize_database(database_path = './secrets.db')\n DataMapper.finalize\n\n database_path = File.expand_path database_path\n\n @dm = DataMapper.setup(:default, \"sqlite:///#{database_path}\")\n\n return if File.exist? database_path\n\n SQLite3::Database.new(database_path)\n DataMapper.auto_migrate!\n end",
"def load(file); end",
"def import_locale_map\n print \"[request_info] importing country-locale map... \"\n\n # read in country locale map file\n CSV.foreach(\n @path\n ) do |row|\n next if row.empty?\n\n # skip the header row\n next if row.first.length > 3\n\n ccode = row[0].strip.downcase.to_sym\n name = row[1].strip\n langs = row[2..-1].reject(&:nil?).map(&:downcase).map(&:strip)\n @cc[ccode] = {\n :name => name,\n :locales => langs\n }\n\n langs.each do |l|\n @ll[l.to_sym] ||= {}\n @ll[l.to_sym][:ccodes] ||= []\n @ll[l.to_sym][:ccodes].push ccode\n end\n end\n\n puts \"Done.\"\n end",
"def initialize(dictionary_file_path, distance_adapter = :gem)\n @tree = Tree.new distance_adapter\n # start = Time.now\n File.open(dictionary_file_path, \"r\") do |f|\n f.readlines.each do |word|\n @tree.add word.delete!(\"\\n\")\n end\n end\n # puts \"Tree created after #{(((Time.now)-start)*1000).to_i}ms.\"\n end",
"def load_dictionary\n @scrubbed_dict = File.readlines(\"dictionary.txt\")\n puts \"Dictionary loaded\"\n end",
"def initialize(file_path, backup, version)\n @file_path = file_path\n @backup = backup\n @database = SQLite3::Database.new(@file_path.to_s, {results_as_hash: true})\n @logger = @backup.logger\n @version = version\n @notes = Hash.new()\n @folders = Hash.new()\n @folder_order = Hash.new()\n @accounts = Hash.new()\n @cloud_kit_participants = Hash.new()\n @retain_order = false\n @html = nil\n puts \"Guessed Notes Version: #{@version}\"\n @range_start = @backup.range_start\n @range_end = @backup.range_end\n @logger.debug(\"Guessed Notes Version: #{@version}\")\n end",
"def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\n end",
"def main\n db = SQLite3::Database.open(\"development.sqlite3\")\n db.execute(\"INSERT INTO COURSES VALUES ('Web Applications', '1212', '4', 'col', 'CSE', '3901'\")\n print db.closed?\n #course_hash = Hash.new(\"course\")\n #course_hash_2 = Hash.new(\"course\")\n #course_hash = {\"title\" => \"Web Applications\", \"term\" => \"1214\", \"maxUnits\" => \"4\", \"campus\" => \"col\", \"subject\" => \"CSE\", \"catalogNumber\" => \"3901\"}\n #course_hash_2 = {\"title\" => \"Computer Networking\", \"term\" => \"1214\", \"maxUnits\" => \"3\", \"campus\" => \"col\", \"subject\" => \"CSE\", \"catalogNumber\" => \"3461\"}\n #add_to_course_db course_hash\n #add_to_course_db course_hash_2\n #puts \"Finished!\"\n end"
] | [
"0.6305885",
"0.6237008",
"0.6169982",
"0.6139616",
"0.60817873",
"0.60049087",
"0.5991264",
"0.5945808",
"0.5920002",
"0.5895195",
"0.5876167",
"0.5869841",
"0.5865554",
"0.5822463",
"0.58046085",
"0.5761357",
"0.5747154",
"0.5736692",
"0.56692624",
"0.564758",
"0.5620761",
"0.5616436",
"0.55853766",
"0.55660486",
"0.5554637",
"0.5548828",
"0.55203426",
"0.5491589",
"0.54848206",
"0.54589474",
"0.5455697",
"0.5447283",
"0.5427618",
"0.5422092",
"0.54208183",
"0.54166996",
"0.54148537",
"0.5402838",
"0.5390656",
"0.53890413",
"0.53837675",
"0.53751856",
"0.5368433",
"0.53645325",
"0.5358014",
"0.53576946",
"0.53555894",
"0.53553957",
"0.53447276",
"0.5342411",
"0.5339792",
"0.5336387",
"0.53260386",
"0.53237426",
"0.5310686",
"0.5309972",
"0.53032106",
"0.52796257",
"0.52635247",
"0.5259545",
"0.5258669",
"0.5257537",
"0.52521163",
"0.52437824",
"0.5233859",
"0.5233293",
"0.5229605",
"0.5228081",
"0.52214795",
"0.52214795",
"0.5206476",
"0.5198045",
"0.5193401",
"0.51887417",
"0.51695484",
"0.5169268",
"0.5160608",
"0.5157625",
"0.51560366",
"0.5152308",
"0.5152198",
"0.5151839",
"0.5151839",
"0.5151839",
"0.5151839",
"0.5145092",
"0.5141938",
"0.5141343",
"0.5141249",
"0.51355845",
"0.51349306",
"0.51305723",
"0.5129189",
"0.5125746",
"0.5125445",
"0.511935",
"0.51116854",
"0.51094645",
"0.5107568",
"0.51049423"
] | 0.66139275 | 0 |
Cause the CSVfile contains phrases we cannot be sure what is the most important word. This method strikes out everything between parenthesis, and if multiple words stay over, simply takes the longes one. | def extract_word( phrase )
w = phrase.gsub(/(\([^(]*\)|\{[^{]*\}|\[[^\[]*\])/, '').strip.downcase
return nil if w.empty? # No empty strings
# Now return the longest word, hoping that it's the most important, too
ary = w.gsub(/[.,\-<>]/, ' ').strip.split do |i| i.strip! end
ary.sort!{ |x,y| y.length <=> x.length }
ary[0] # The longest element is the first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end",
"def wash_row(s)\n i = s.index(')')\n raise \"line in file phrases.ini does not contain )\" if i == nil\n return s.slice(i+1..-1).strip.upcase\n # slice vraci oznaceny substring\n # slice! vraci zbytek stringu\nend",
"def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def top_scoring_words\n @dictionary.each_with_object([]) do |cur_word, words_found|\n return words_found if words_found.length >= WORDS_TO_FIND\n\n words_found << cur_word if letters_present_for cur_word\n end\n end",
"def save_ambigious_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n tag_strings = ['unkjent_ord'] if tag_strings.count == 0\n f.puts w.norm_string + \"\\t\" + tag_strings.sort.join(\"\\t\")\n end\n\n f.puts\n end\n end\n\n nil\n end",
"def save_cleaned_cor_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n if w.ambigious? and w.clean_tag_ambiguity?\n w.remove_clean_tag_ambiguity\n elsif w.ambigious? and w.noun_gender_ambiguity?\n w.remove_noun_gender_ambiguity\n end\n f.puts '\"<' + w.string + '>\"'\n\n w.tags.each do |t|\n f.puts \"\\t\\\"#{t.lemma}\\\" #{t.string} \" + (t.correct ? \"\\t<Correct!>\" : \"\")\n end\n end\n end\n end\n\n nil\n end",
"def preserve_best_sentences(data)\n puts \"For each word with multiple examples below, choose the best selection:\"\n\n total_words = data.count { |d| d[:sentences].size > 1 }\n curr_word = 0\n data.select { |d| d[:sentences].size > 1 }.map! do |d|\n curr_word += 1\n puts \"#{curr_word} of #{total_words}: #{d[:word]} (#{d[:pronounciation]})\"\n d[:sentences].each_with_index do |s, i|\n puts \"#{i + 1}.\\t#{s[0]}\"\n puts \"\\t#{s[1]}\"\n end\n n = get_selection_number(\"Best sentence: \", 1, d[:sentences].size)\n selection = d[:sentences][n - 1]\n d[:sentences] = [ [ selection[0], selection[1] ] ]\n d\n end\n\n puts \"\\nDone.\"\nend",
"def most_com_word(text, min: 3)\n freq = word_freq(text).delete_if { |x, y| x.length} <= min}\nend",
"def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n tokens.each do |token|\n if !complex_token_matches?(token) # token was not transformed earlier\n @to_match << token\n unmatched_db[token] = @processor.original_text\n end\n end\n unmatched_db.close\n end",
"def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end",
"def cleanup_title(line)\n\t#deletes everything but the song title\n\tline.gsub!(/.+>/, '')\n\t#deletes superfluous text\n\tline.gsub!(/(\\(|\\[|\\{|\\\\|\\/|\\_|\\-|\\:|\\\"|\\`|\\+|\\=|\\*|feat\\.).+$/,'')\n\t\t#deletes punctuation\n\t\tline.gsub!(/(\\?|\\¿|\\!|\\¡|\\.|\\;|\\&|\\@|\\%|\\#|\\|)*/,'')\n\t\t#determines if a word uses english characters or not\n\t\tif line =~ /^[\\w\\s']+$/\n\t\t\tline = line.downcase\n\t\t\t#if not english, sets line to nil\n\t\telse\n\t\t\tline = nil\n\t\tend\n\t\treturn line\n\tend",
"def supervising_checker(keywords, tline)\r\n lowestindex = tline.length\r\n counter = 0\r\n keywords.each do |word|\r\n counter += tline.scan(/(?=#{word})/).count\r\n if counter > 2\r\n lowestindex = 1\r\n end\r\n end\r\n return lowestindex\r\nend",
"def remove_all_straits!\n patch_file!(\"map/adjacencies.csv\") do |file|\n # Haida-Tlingit\n file.b.lines.select{|x|\n t = x.split(\";\")[2]\n x =~ /Haida/ or (t != \"sea\" and t != \"lake\")\n }.join\n end\n end",
"def most_significant\n most_sig = []\n # if !description.nil?\n # if tags.any?\n # most_sig = tags.select {|tag| self.description.downcase.include?(tag)}.collect {|tag| tag.singularize }\n # else\n # most_sig = word_frequency.keys.select {|tag| self.description.downcase.include?(tag)}.collect {|tag| tag.singularize }\n # end\n # end\n\n description.to_s.split.each do |word|\n self.word_frequency[word] ||= 0\n self.word_frequency[word] += 1\n end\n\n if most_sig.empty?\n most_sig = self.word_frequency.reject {|k,v| v < 3}.keys\n most_sig.flatten!\n end\n\n if description && tags.any?\n tags.each do |tag|\n if description.include?(tag)\n most_sig << tag.singularize\n end\n end\n end\n \n most_sig.uniq!\n\n self.validate_lang\n\n if SiteClassifier.translate_tags?\n begin\n if self.lang == \"auto\"\n @lang = EasyTranslate.detect(most_sig.first, key: SiteClassifier.configuration.google_translate_api_key)\n end\n EasyTranslate.translate(most_sig, from: self.lang, to: :en, key: SiteClassifier.configuration.google_translate_api_key)\n rescue\n return most_sig\n end\n else\n return most_sig\n end\n end",
"def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend",
"def top_3_words(text)\n text.gsub(\"\\n\", \" \")\n .split(\" \")\n .map(&:downcase)\n .map(&sanitize)\n .reject(&empty)\n .reject(&no_letters)\n .reduce({}, &top_word)\n .sort_by(&word_count)\n .reverse\n .take(3)\n .map(&:first)\nend",
"def trim_post content\n line = ''\n counter = 1\n words = content.split(/ /)\n \n # we break before 272 leaving space for cw and break in case it's needed\n while not words.empty? and not too_long?(line)\n line += \" #{words.shift}\"\n end\n \n return line.strip, words.join(' ')\n end",
"def top_3_words(text)\n count = Hash.new { 0 }\n text.scan(/\\w+'*\\w*/) { |word| count[word.downcase] += 1 }\n count.map{|k,v| [-v,k]}.sort.first(3).map(&:last)\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.each_with_index do |word, index|\n p index\n p word\n p words\n words.delete(word) if negative?(word)\n p words\n end\n\n words.join(' ')\nend",
"def clean_keywords(input)\n keywords = input.split(',').map! { |i| i.chomp.strip.downcase }.compact.uniq.keep_if { |i| i != '' }\n if keywords.empty?\n nil\n else\n keywords.join(', ')\n end\n end",
"def parse\n parse_results = []\n @words.each_index do |i|\n i.upto(@words.size - 1) do |j|\n phrase = Phrase.new(@words[i..j])\n unless phrase_has_definitely_been_checked?(phrase, @existing_article_titles)\n break unless @repository.try_this_phrase_or_longer?(phrase)\n matching_articles = @repository.find_matching_articles(phrase)\n matching_articles.each do |matching_article|\n parse_results << [phrase.to_s, matching_article]\n end\n end\n end\n end\n parse_results = clean_results(parse_results, @existing_article_titles)\n end",
"def record_longer_phrase\n compiled_phrase = compile_phrase\n compiled_phrase_length = compiled_phrase.word_count\n @phrases[compiled_phrase_length] ||= Hash.new(0)\n\n # The first duplicate we find needs to record both occurrances\n # TODO: Clean this up. Absolute mother to read.\n new_occurrances = @phrases[compiled_phrase_length][compiled_phrase] > 0 ? 1 : 2\n @phrases[compiled_phrase_length][compiled_phrase] += new_occurrances\n end",
"def most_common(text, too_short: 3)\n long_enough = each_word_count(text).delete_if{ |word, count| word.length <= too_short }\n\n long_enough.select do |word, count|\n count == long_enough.values.max\n end\nend",
"def mcw(search)\n\t\tif !$bigrams.has_key?(search) # if the search word doesn't exist in the bigram...\n\t\t\tmost_common = nil # we're going to return nil.\n\n\t\telse most_common = $bigrams[search].max_by{|word, number| number}[0] # search for max by # of maxes\n\t\tend\n\n\t\treturn most_common\nend",
"def wp_trim_words(text, num_words = 55, more = nil)\n if more.nil?\n more = '…'\n end\n\n original_text = text\n text = wp_strip_all_tags(text)\n\n if false # no asian...\n else\n words_array = text.split(/[\\n\\r\\t ]+/, num_words + 1)\n sep = ' '\n end\n\n if words_array.length > num_words\n words_array.pop\n text = words_array.join(sep)\n text = text + more\n else\n text = words_array.join(sep)\n end\n\n # Filters the text content after words have been trimmed.\n apply_filters('wp_trim_words', text, num_words, more, original_text)\n end",
"def find_most_similar(term)\n\n match_scores = @words.map { |word|\n\n index = 0\n possibilities = [term.dup]\n\n while index < word.length\n new_possibilities = []\n possibilities.each { |poss|\n\n if word[index] == poss[index]\n new_possibilities.push(poss.dup)\n else\n # '!' stands for inserted character'\n # '?' stands for replaced character'\n char_inserted = poss.dup.insert(index, '!')\n char_replaced = poss.dup\n char_replaced[index] = '?'\n new_possibilities.push(char_inserted)\n new_possibilities.push(char_replaced)\n end\n\n }\n\n possibilities = new_possibilities\n index += 1\n\n end\n\n possibilities.map { |poss|\n\n poss.scan(/\\?/).count + poss.scan(/!/).count\n }.min\n }\n\n return @words[match_scores.index(match_scores.min)]\n\n end",
"def process_phrase_for_word_count\n # remove punctuation\n @phrase.gsub!(/[^0-9a-z ,]/i, '')\n \n # remove list\n @phrase.gsub!(/[,]/, ' ')\n \n # lowercase everything\n @phrase.downcase!\n \n end",
"def corrections\n #For each word to be looked at\n $words.each do |word_array|\n #If the word is misspelled attempt corrections\n possible_matches = Array.new\n if word_array[1] == false\n #Sets word to the actual word, instead of array pair\n word = word_array[0]\n # Get lexicon searching vars\n first_char = word[0]\n len = word.length\n\n ##Find words with similar letters\n #Saves the length of the word for eaiser access\n size = word.length\n #Iterates over words with matching starting letter and length +- 1\n $lexicon[first_char][len].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n # only check shorter words if length is greater than 1\n if len > 1\n $lexicon[first_char][len-1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n end\n\n $lexicon[first_char][len+1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n #Iterate over the possible matches, taking the match with the highest percentage\n #Hash to hold similarity\n similarity = Hash.new(0.0)\n possible_matches.each do |word_to_compare|\n similarity[word_to_compare] = match_percentage word, word_to_compare\n end\n\n best_match = ''\n similarity.each do |match|\n if match[1] > similarity[best_match]\n best_match = match[0]\n end\n end\n $correction[word] = best_match\n end\n end\nend",
"def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend",
"def cleanupStopWords(line)\n\t#removes a, an, and, by, for, from, in, of, on, or, out, the, to, with from line\n\t\tline.gsub!(/\\ba+\\b|\\ban+\\b|\\band+\\b|\\bby+\\b|\\bfor+\\b|\\bfrom+\\b|\\bin+\\b|\\bof+\\b|\\bon+\\b|\\bor+\\b|\\bout+\\b|\\bthe+\\b|\\bto+\\b|\\bwith+\\b/, '')\n\treturn line\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def handle_agent_corporate_punctuation(name_fields)\n name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}\n\n # The value of subfield g must be enclosed in parentheses.\n g_index = name_fields.find_index {|a| a[0] == \"g\"}\n unless !g_index\n name_fields[g_index][1] = \"(#{name_fields[g_index][1]})\"\n end\n\n # The value of subfield n must be enclosed in parentheses.\n n_index = name_fields.find_index {|a| a[0] == \"n\"}\n unless !n_index\n name_fields[n_index][1] = \"(#{name_fields[n_index][1]})\"\n end\n\n #If subfield $e is present, the value of the preceding subfield must end in a comma.\n #If subfield $n is present, the value of the preceding subfield must end in a comma.\n #If subfield $g is present, the value of the preceding subfield must end in a comma.\n ['e', 'n', 'g'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index || s_index == 0\n preceding_index = s_index - 1\n\n # find preceding field and append a comma if there isn't one there already\n unless name_fields[preceding_index][1][-1] == \",\"\n name_fields[preceding_index][1] << \",\"\n end\n end\n end\n\n # Each part of the name (the a and the b’s) ends in a period, until the name itself is complete, unless there's a subfield after it that takes a different mark of punctuation before it, like an e or it's got term subdivisons like $b LYRASIS $y 21th century.\n\n ['a', 'b'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index\n\n # find field and append a period if there isn't one there already\n unless name_fields[s_index][1][-1] == \".\" || name_fields[s_index][1][-1] == \",\"\n name_fields[s_index][1] << \".\"\n end\n end\n end\n\n apply_terminal_punctuation(name_fields)\n\n return name_fields\n end",
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length <=140 || tweet == nil \n tweet\n else word_substituter(tweet)\n end \nend",
"def make_puctuation_ended_line(text, len)\n phrases = text.split(/[\\!\\?\\.\\:\\;\\(\\)\\n]/)\n phrases.shuffle!\n phrases.each do |phrase|\n words = phrase.split(\" \")\n words.reverse!\n line = \"\"\n words.each do |word|\n begin\n line = \"#{word} #{line}\"\n if line.to_phrase.syllables == len\n line.gsub!('\"','')\n return line\n end\n if line.to_phrase.syllables > len\n break\n end\n rescue\n break\n end\n end\n end\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n return tweet\n end\nend",
"def titleize (string)\nstring.capitalize! # capitalize the first word in case it is part of the no words array\n words_no_cap = [\"and\", \"or\", \"the\", \"over\", \"to\", \"the\", \"a\", \"but\"]\n phrase = string.split(\" \").map {|word| \n if words_no_cap.include?(word) \n word\n else\n word.capitalize\n end\n }.join(\" \") # I replaced the \"end\" in \"end.join(\" \") with \"}\" because it wasn't working in Ruby 2.1.1\n phrase # returns the phrase with all the excluded words\nend",
"def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend",
"def sanitised(title)\n title.delete(',') # ignore, commas\n .sub(/[?!']$/, '') # ignore ? and ! and ' at the end of the title!\n .gsub(\"' \", ' ') # ignore ' at the endin' of a word\n .sub('Feat. ', 'Feat ')\n end",
"def process_phrase_line\n file_name = \"./tmp/database_doings/doing_phrases/phrases_sorted.txt\"\n open(file_name) do |f|\n f.each do |line|\n sequence_text = line.to_textual.de_comma \n sequence_creation = line.to_textual.de_comma.de_space\n sequence_complete = line.to_textual.de_comma.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze\n description = \"meanings in nameings\"\n reference = \"code moniker in sequencer app\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n p \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{Time.now}\"\n end\n end\n end",
"def gensecretword \n @wordtable.sample.gsub(/\\s+/, \"\") # revoving all whitespaces as wordfile has phrases as possible secret words\nend",
"def afterthought_most_words\n self.afterthoughts.max_by do |afterthought|\n afterthought.thoughts.length\n end\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end",
"def word_substituter (tweet=\"some thing need to be shorten, like two too\")\n tweet= tweet.strip\n temp_a = tweet.split(\" \")\n words_can_b_sh = dictionary.keys\n #puts words_can_b_sh\n temp = \"\"\n# puts temp_a\n temp_a.each do |word|\n if words_can_b_sh.include?(word.downcase)\n temp << dictionary[word.downcase]\n else\n temp << word\n end\n temp << \" \"\n end\n temp.strip\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n word_substituter(tweet)\n #\"...\"\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def titleize(phrase)\n little_words = ['the','a', 'an', 'and'] # Définition des little_words\n return phrase.split.map.with_index {|word, i| if (little_words.include?(word) && i!=0) then word else word.capitalize end}.join(\" \") # Met en majuscule toutes les première lettres de chaques mots en excluant les little_words qui ont un indice différent de 0\nend",
"def cleanup_title(line)\n\ttitle = line.gsub(/.*>/, '') #strip everything in front of song title\n\ttitle.gsub!(/\\(.*|\\[.*|\\{.*|\\\\.*|\\/.*|\\_.*|\\-.*|\\:.*|\\\".*|\\`.*|\\+.*|\\=.*|\\*.*|feat\\..*/, \"\") #Remove rest of title following given characters\n\ttitle.gsub!(/(\\?|\\¿|\\!|\\¡|\\.|\\;|\\&|\\@|\\%|\\#|\\|)*/, '') #remove special characters\n\ttitle = title.downcase\n\ttitle.gsub!(/\\b(and|an|a|by|for|from|in|of|on|or|out|the|to|with)*\\b/, '') #remove stop words\n\ttitle.gsub!(/\\s\\s+/, ' ') #add whitespace between words\n\treturn title\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend",
"def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend",
"def rhymes\n depth = self.arpabet_transcription.split(' ').size\n results = []\n \n while depth > 1 && results.empty?\n depth -= 1\n pattern = \"*\" + self.arpabet_transcription.split(' ').reverse.take(depth).reverse.join(' ')\n results = Word.find_by_transcription_pattern(pattern)\n end\n \n results\n end",
"def lose_word\n if self.text.split.length > 1\n prev_line = self.text.split\n prev_line.delete_at(rand(prev_line.length))\n self.text = prev_line.join(\" \")\n self.save\n end\n end",
"def selective_tweet_shortener(tweet)\n\tif tweet.size > 140\n\t\tword_substituter(tweet)\n\telse\n\t\ttweet\n\tend\nend",
"def highest_scoring_word(words)\n sorted_words = words.sort_by { |word| word.length }\n\n possibles = sorted_words.group_by { |word| score(word) }.max[1]\n return possibles.find { |w| w.length == 7 } if possibles.any? { |word| word.length == 7}\n possibles.first\n end",
"def process_stopwords(txt = self.search_text)\n #Needs to be set so highlighting will work properly (can't match quotes)\n self.highlight_token_array(txt)\n #Now put humpty dumpty back together without the nasty stopwords, sort the tokens by length\n self.search_token_array(txt).join(\" \")\n end",
"def longest_word(phrase)\n longestWord = \"\"\n longestWordLength = 0\n \n wordArray = phrase.split(\" \")\n wordArray.each do |word|\n if word.length > longestWordLength\n longestWord = word\n longestWordLength = word.length\n end\n end\n return longestWord\nend",
"def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end",
"def remove_duplicates(phrase, important, sentence = true)\n\tres = remove_duplicates_recursivly(sentence, important, sentence.to_s)\n\treturn sentencize(res, sentence)\nend",
"def selective_tweet_shortener(tweet)\n # tweets.each do |tweet|\n new_tweet = \"\"\n if tweet.length > 140\n new_tweet = word_substituter(tweet)\n else\n new_tweet= tweet\n end\n # end\n new_tweet\nend",
"def get_best_translation(eng_word)\n translations = @all_translations[eng_word]\n\n rus_size= @rus_sentence.length - 1\n best= \"\"\n p_best= -1\n rus_index= -1\n translations.each do |translation|\n (0..rus_size).each { |i|\n unless @used_rus[i]\n sentence_word= @rus_sentence[i]\n #puts translation\n p = calc_probability(sentence_word, delete_ending(translation))\n if p > p_best\n p_best = p\n best = translation\n rus_index = i\n end\n end\n }\n end\n\n\n if p_best > MIN_PROBABILITY\n @used_rus[rus_index] = true\n return best\n end\n BAD_TRANSLATION\n end",
"def selective_tweet_shortener(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)\n end\nend",
"def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end",
"def highest_score_from(words)\n contestants = words.map{ |word| [word, score_word(word)] }.to_h\n\n winning_word = {word: \"\", score: 0}\n\n contestants.each do |word, score|\n if score > winning_word[:score]\n winning_word = {word: word, score: score}\n elsif score == winning_word[:score] \n if winning_word[:word].length == 10\n next\n elsif word.length == 10\n winning_word = {word: word, score: score}\n elsif word.length < winning_word[:word].length\n winning_word = {word: word, score: score}\n end\n end \n end\n return winning_word\nend",
"def cleanup_title(single_line)\n\tif single_line =~ /[^>]*$/ #Starts at the end and finds the first > symbol and matches everything before it (the song title), credit goes to Jonah for reminding me that #{$&} exists\n title = \"#{$&}\"\n end\n\t#Thank you Isaac for telling me to use gsub instead of what I did above\n\ttitle.gsub!(/[\\(|\\[|\\{|\\\\|\\/|_|\\-|\\:|\\\"|\\`|\\+|\\{|\\*].*$/,\"\") #Replaces everything after the first instance of ( [ { \\ / _ - : \" ` + = *\n\ttitle.gsub!(/feat\\..*/) #removes everything after feat.\n\ttitle.gsub!(/[\\?|\\¿|\\!|\\¡|\\.|\\;|\\&|\\@|\\%|\\#|\\|]/,\"\") #removes all punctuation\n\tif title =~ /[^\\w\\s']/ #ignores songs that contain non-Eng\n\t\ttitle = nil\n\tend\n\tif title != nil\n\t\ttitle.downcase!\n\t\t#Stop words implementation\n\t\ttitle.gsub!(/is\\s|a\\s|ab\\s|and\\s|by\\s|for\\s|from\\s|in\\s|of\\s|on\\s|or\\s|out\\s|the\\s|to\\s|with\\s/,\"\")\n\t\treturn title\n\tend\nend",
"def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend",
"def delete_least_common\n lc = least_common_word\n self.word_counts.delete(lc) unless lc.nil? || self.word_counts.nil?\n end",
"def catch_phrase\n [\n [\"Фирма1\", \"Суперфирма\", \"Фирма3\", \"ПанСамСклепав\"].rand,\n [\"24 часа\", \"24/7\", \"круглосуточно\", \"3 года на рынке\"].rand,\n [\"доступно\", \"быстро\", \"надежно\"].rand\n ].join(' ')\n end",
"def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend",
"def most_common_word_in_afterthoughts\n arr = self.words_in_afterthoughts\n\n counts= arr.uniq.map { |x| [x, arr.count(x)] }.to_h\n\n most_common = counts.max_by do |word,count|\n count\n end\n\n most_common[0]\n\n end",
"def rhyme?(a,b)\n as = a.gsub /\\W/,\"\"\n bs = b.gsub /\\W/,\"\"\n as.to_phrase.rhymes.flatten.join(\", \").include?(bs.to_phrase.rhymes.flatten.join(\", \")) &&\n (as.length + bs.length < 140)\nend",
"def process_sentance(blob)\n # strip out enclosures\n blob = blob.gsub(/\\\\/,'')\n # test for quotes\n # if quotes, these words are important (flag them)\n test = blob.match(/[\"'](.*)['\"]/)\n if test && test.size > 1\n @words = test[1..test.size].join(\" \")\n #test.each{|word|\n # @words << word\n #}\n #blob = blob.gsub(@words,'')\n blob = blob.gsub(/([\"'])/,'')\n end\n unless @words.nil?\n # break up and add to @local_important\n tmp = @words.split(\" \")\n tmp.each{|word|\n @local_important << word.downcase unless @local_important.include? word\n }\n end\n #puts blob\n the_pieces = blob.split(\" \")\n parse_words(the_pieces)\n \n # try to sort words\n words = grab_important_words\n puts words.inspect\n \n puts \"Derived Tags: #{words.join(' ')}\"\n \n end",
"def mcw(word)\n\t\tmostCommonWord = ''\n\t\tvalue = 0\n\t\t#determines if a word in a hash happens the most\n\t\t#p $bigrams[word]\n\t\t$bigrams[word].each do |x|\n\t\t\tif x[1] > value\n\t\t\t\tmostCommonWord = x[0]\n\t\t\t\tvalue = x[1]\n\n\t\t\t#if two hashes have the same value, then randomly chooses between the two\n\t\t\telsif x[1] == value\n\t\t\t\tchoice = Random.rand(2)\n\t\t\t\tif choice == 1\n\t\t\t\t\tmostCommonWord = x[0]\n\t\t\t\t\tvalue = x[1]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn mostCommonWord\n\tend",
"def mapf_format_by_word(text, line, tw, max_width)\n return line, line, tw, true if text.nil? || text.empty?\n # Extract next word\n if text.sub!(/([ \\t\\r\\f]*)(\\S*)([\\n\\f]?)/, \"\") != nil\n prespace, word, line_end = $1, $2, $3\n ntw = mapf_calc_line_width(word, tw, true)\n pw = contents.text_size(prespace).width\n if (pw + ntw >= max_width)\n # Insert\n if line.empty?\n # If one word takes entire line\n return prespace + word, word + \"\\n\", ntw, true \n else\n return line + prespace + word, line + \"\\n\" + word, tw, true\n end\n else\n line += prespace + word\n tw = pw + ntw\n # If the line is force ended, then end \n return line, line, tw, true if !line_end.empty?\n end\n else\n return line, line, tw, true\n end\n return line, line, tw, false\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend",
"def LongestWord(sen)\n longest = \"\"\n sen.scan(/\\w+/) do |word|\n if word.length > longest.length\n longest = word\n end\n end\n \n return longest\nend",
"def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend",
"def capitalize_most_words\n\t\tself.split.collect{ |w| words_to_skip_capitalization_of.include?(w.downcase) ? w : w.capitalize_first }.join(\" \").capitalize_first\n\tend",
"def word_with_most_repeats(sentence)\nend",
"def get_the_word\n words = File.readlines(\"5desk.txt\")\n words = words.map do |word|\n word.strip\n end\n words = words.select do |word|\n (word.length > 4) && (word.length < 13)\n end\n words.sample.upcase.split(\"\")\n end",
"def is_orig_word_line(line)\n line.match(@orig_word_regex)\n end",
"def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend",
"def mapf_format_by_word(text, line, tw, max_width)\n return line, line, tw, true if text.nil? || text.empty?\n # Extract next word\n if text.sub!(/([ \\t\\r]*)(\\S*)([\\n\\f]?)/, \"\") != nil\n prespace, word, line_end = $1, $2, $3\n ntw = mapf_calc_line_width(word, tw, true)\n pw = contents.text_size(prespace).width\n if (pw + ntw >= max_width)\n # Insert\n if line.empty?\n # If one word takes entire line\n return prespace + word, word + \"\\n\", ntw, true\n else\n return line + prespace + word, line + \"\\n\" + word, tw, true\n end\n else\n line += prespace + word\n tw = pw + ntw\n # If the line is force ended, then end\n return line, line, tw, true if !line_end.strip.empty?\n end\n else\n return line, line, tw, true\n end\n return line, line, tw, false\n end",
"def capitalize_most_words\n self.\n split.\n collect{ |w| words_to_skip_capitalization_of.include?(w.downcase) ? w : w.capitalize_first }.\n join(\" \").\n capitalize_first.\n gsub(/\\-[a-z]/) {|s| s.upcase }.\n gsub(/\\.[a-z]/) {|s| s.upcase }\n end",
"def unambiguous_name\n name = [town.name]\n if can_disambiguate? && town.duplicates.to_i > 0\n name << \"(#{town.county_name})\"\n end\n name.join(' ')\n end",
"def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend",
"def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end",
"def clean_up_word(word)\n\t\tword.strip!\n\t\tword.chomp!(\".\")\n\t\tword.chomp!(\",\")\n\t\tword.chomp!(\"\\\"\")\t\n\t\tword.downcase!\n\tend",
"def get_orig_word(line)\n if m = line.match(@orig_word_regex)\n return m[1]\n end\n\n return nil\n end",
"def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end",
"def clean2\n content = text.split(\"\\n\")\n \n # First, find and mark songs\n in_song = false\n new_content = []\n content.each do |line|\n if line=~/\\*{5}/ .. line=~END_OF_SONG\n new_content << \"SONG:\" unless in_song\n if line =~ END_OF_SONG\n new_content << line\n in_song = false\n else\n new_content << \" #{line}\"\n in_song = true\n end\n else\n if in_song\n new_content << \"END OF SONG\"\n end\n in_song = false\n new_content << line\n end\n end\n \n # Now, fix line endings and merge lines\n old_content = new_content\n new_content = []\n preserve_breaks = false\n last_line = \"\"\n old_content.each do |line|\n new_content << \"\" if preserve_breaks ||\n last_line =~ END_OF_SONG || \n new_content.size == 0 ||\n line =~ /^.[LS]-\\d+(?:\\]|$|.\\s*\\()/ ||\n line =~ /^\\([A-Z]/ ||\n line =~ /^[A-Z][A-Z, \\.-]+:\\s/ ||\n line =~ /^Scene\\s+\\?\\s+-\\s+\\?/ ||\n line =~ START_OF_SONG ||\n line =~ /^#/\n case line\n when START_OF_SONG\n preserve_breaks = true\n when END_OF_SONG\n preserve_breaks = false\n end\n new_content[-1] += ' ' unless new_content[-1] =~ /^$|\\s$/\n new_content[-1] += line\n last_line = line\n end\n \n # Now, insert extra empty lines\n old_content = new_content\n new_content = []\n extra_space = true\n in_cast = false\n in_song = false\n \n old_content.each do |line|\n if line =~ /^#/\n extra_space = false if in_cast\n else\n in_cast = false\n extra_space = true unless in_song\n end\n new_content << \"\" if extra_space && new_content.size > 0\n new_content << line\n case line\n when /^#CAST FOR SCENE/\n in_cast = true\n when START_OF_SONG\n extra_space = false\n in_song = true\n when END_OF_SONG\n extra_space = true\n in_song = false\n end\n end\n \n # Finally, fix songs\n old_content = new_content\n new_content = []\n i = 0\n while i<old_content.size\n line = old_content[i]\n case line\n when START_OF_SONG\n # Find lines with stars in them\n j = i+1\n while j<old_content.size && old_content[j] !~ END_OF_SONG\n j += 1\n end\n # At this point lines i...j are the song; back up and look for the last \"*****\"\n while j>i && old_content[j] !~ /\\*{5}/\n j -= 1\n end\n # Now lines (i+1)...j are the song information block\n song_information = old_content[(i+1)...j].join\n song_name = song_information[/^[\\s\\*]*([^\\*]+)/,1].strip\n tune = song_information[/([^\\*]+)[\\s\\*]*$/,1].strip\n new_content += [\" SONG: #{song_name}\", \" (To the tune of: #{tune})\"]\n i = j+1\n when END_OF_SONG\n i += 1 # Discard end of song markers; we don't need them anymore\n else\n new_content << line\n i += 1\n end\n end\n \n # Save the results\n text = new_content.join(\"\\n\")\n end",
"def longest_string(list_of_words)\n # Your code goes here!\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n \n if list_of_words.length > 1\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n end\n end\n end\n puts list_of_words\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def remove_stop_words(song)\n\ttitle = song\n\ttitle.gsub!(/\\b(a|an|and|by|for|from|in|of|on|out|the|to|with)\\b+/, \"\")\n\treturn title\nend"
] | [
"0.56514716",
"0.5527386",
"0.5458064",
"0.54185283",
"0.5280017",
"0.5211028",
"0.51405776",
"0.5105221",
"0.5092543",
"0.5079871",
"0.5069431",
"0.5043012",
"0.5033231",
"0.5020461",
"0.5016071",
"0.49755785",
"0.49654907",
"0.49645582",
"0.49581897",
"0.49507964",
"0.4931415",
"0.49270886",
"0.49270236",
"0.48979014",
"0.48937714",
"0.4892473",
"0.48896757",
"0.48857364",
"0.48561",
"0.48530328",
"0.4851663",
"0.4851165",
"0.484505",
"0.4844253",
"0.4815993",
"0.48120338",
"0.48098737",
"0.48006898",
"0.47986788",
"0.4794942",
"0.4793212",
"0.47928333",
"0.47890815",
"0.4784944",
"0.478197",
"0.47781983",
"0.4777159",
"0.4775348",
"0.4771723",
"0.4771723",
"0.4771723",
"0.4771723",
"0.47688496",
"0.47644988",
"0.47626528",
"0.47624394",
"0.47602987",
"0.47549063",
"0.47496262",
"0.47495311",
"0.47441593",
"0.4743931",
"0.47413447",
"0.4734411",
"0.4730699",
"0.47269484",
"0.47260475",
"0.47251552",
"0.47233716",
"0.47213143",
"0.47183293",
"0.4717736",
"0.47109255",
"0.4709557",
"0.4708873",
"0.4702196",
"0.46981388",
"0.4696707",
"0.46916786",
"0.46886876",
"0.46876007",
"0.46870995",
"0.46858615",
"0.468508",
"0.4684997",
"0.4684246",
"0.46744117",
"0.4673637",
"0.46658832",
"0.46625933",
"0.46622145",
"0.4660024",
"0.4655482",
"0.46453345",
"0.46427736",
"0.46410745",
"0.46397796",
"0.46387032",
"0.46387032",
"0.4632372"
] | 0.5826419 | 0 |
Opens each database and yields the given block, handing over the data base handle. | def read_db
for file in [$dict_file_a, $dict_file_b] do
if file == $dict_file_a
puts "====================[ A => B ]===================="
else
puts "====================[ B => A ]===================="
end
DBM.open(file, nil, DBM::READER) do |dbm|
yield dbm
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def database(dbname=nil, &block)\n dbname ||= database_name\n if dbname then\n repository dbname, &block\n else\n yield\n end\n end",
"def each(&block)\n @db.each_key{|key|yield key, @db[key]}\n end",
"def open(opts)\n db = Database.new(opts)\n yield db if block_given?\n db\n end",
"def each\n # First yield the results databases.\n yield 'results', @results_database unless @results_database.nil?\n # Then all other databases.\n @databases.each_key do |key|\n db = get_database(key)\n yield key, db unless db.nil?\n end\n end",
"def database\n db = SQLite3::Database.new 'foosey.db'\n\n yield db\nrescue SQLite3::Exception => e\n puts e\n puts e.backtrace\nensure\n db.close if db\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: 'recipes')\n yield(connection)\n ensure\n connection.close\n end\nend",
"def sqlite(dbname)\n db = SQLite3::Database.new dbname + '.sqlite3'\n yield db\n db.close\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname:'news')\n yield(connection)\n ensure\n connection.close\n end\nend",
"def each_value(&block)\n @db.each_key{|key|yield @db[key]}\n end",
"def open\n create_database\n end",
"def db_connection\n begin\n connection = PG.connect(dbname: \"korning\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"movies\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def database(database, &block)\n @databases << Backup::Database.const_get(\n last_constant(database)\n ).new(&block)\n end",
"def each_host(wspace=framework.db.workspace, &block)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.hosts.each do |host|\n block.call(host)\n end\n }\n end",
"def db_connection\n begin connection = PG.connect(dbname: 'validity_take_home')\n yield(connection)\n ensure\n connection.close\n end\nend",
"def db_connection\n begin\n connection = PG.connect(dbname: \"pet_db\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def each\n @pool.with do |conn|\n conn.send_query @sql\n conn.set_single_row_mode\n loop do\n res = conn.get_result\n break unless res\n res.check\n res.stream_each { |row| yield row }\n end\n end\n end",
"def with_db(db_name)\n ensure_db(db_name) do\n old_db_name = @db_name\n @db_name = db_name\n @schema_graph = \"#{db_name}:schema\"\n if block_given?\n yield\n @db_name = old_db_name\n end\n end\n self\n end",
"def each_for_write\n \t \tbegin\n\t \t \thelper = TransHelper.new\n\t \t \thelper.trans([:Layer]) do |tr,db,tables|\n\t \t \t \tself.each do |sel_object|\n\t \t \t \t\tent = helper.get_obj(sel_object.ObjectId, :Read)\n\t \t \t \t\tlayer = helper.get_obj(ent.LayerId)\n\t \t \t \t\tif !layer.IsLocked\n\t \t \t \t\t\tent.UpgradeOpen\n\t \t \t \t \tyield ent \n\t \t \t \t end\t\n\t \t \t \tend\n\t \t \tend\n \t rescue Exception => e\n\t\t puts_ex e\n\t \t end\t\n \t end",
"def doDB\n \t\tbegin\n \t\t# Query the inventory\n \t\tinv = InventoryService.getInv(@@config)\n \t\tyield(inv)\n \t\trescue Exception => ex\n \t\terror = \"Inventory - Error connecting to the Inventory Database - '#{ex}''\"\n \t\traise HTTPStatus::InternalServerError, error\n \t\tend\n \t\tend",
"def begin\n db.transaction do\n yield\n end\n end",
"def databases_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :databases_list, options).each do |page|\n yield page\n end\n else\n get('databases', options)\n end\n end",
"def each_entry\n cmd = [ @fastacmd, '-d', @database, '-D', 'T' ]\n call_command_local(cmd) do |inn, out|\n inn.close_write\n Bio::FlatFile.open(Bio::FastaFormat, out) do |f|\n f.each_entry do |entry|\n yield entry\n end\n end\n end\n self\n end",
"def each_statement(&block)\n if block_given?\n unless @processed || @root.nil?\n # Add prefix definitions from host defaults\n @host_defaults[:uri_mappings].each_pair do |prefix, value|\n prefix(prefix, value)\n end\n\n # parse\n parse_whole_document(@doc, RDF::URI(base_uri))\n\n # Look for Embedded RDF/XML\n unless @root.xpath(\"//rdf:RDF\", \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\").empty?\n extract_script(@root, @doc, \"application/rdf+xml\", **@options.merge(base_uri: base_uri)) do |statement|\n @repository << statement\n end\n end\n\n # Look for Embedded microdata\n unless @root.xpath(\"//@itemscope\").empty?\n begin\n require 'rdf/microdata'\n add_debug(@doc, \"process microdata\")\n @repository << RDF::Microdata::Reader.new(@doc, **options)\n rescue LoadError\n add_debug(@doc, \"microdata detected, not processed\")\n end\n end\n\n # Perform property copying\n copy_properties(@repository) if @options[:reference_folding]\n\n # Perform vocabulary expansion\n expand(@repository) if @options[:vocab_expansion]\n\n @processed = true\n end\n\n # Return statements in the default graph for\n # statements in the associated named or default graph from the\n # processed repository\n @repository.each do |statement|\n case statement.graph_name\n when nil\n yield statement if @options[:rdfagraph].include?(:output)\n when RDF::RDFA.ProcessorGraph\n yield RDF::Statement.new(*statement.to_triple) if @options[:rdfagraph].include?(:processor)\n end\n end\n\n if validate? && log_statistics[:error]\n raise RDF::ReaderError, \"Errors found during processing\"\n end\n end\n enum_for(:each_statement)\n end",
"def execute(sql)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n if block_given?\n db.execute(sql) do |row|\n yield row\n end\n else\n return db.execute(sql)\n end\n ensure\n db.close\n end\n end",
"def each_model(options = {}, &block)\n WingedCouch::Model.subclasses.each do |klass|\n if options[:raise_exceptions] and not klass.database.exist?\n raise %Q{Database for model #{klass.name} doesn't exist, run rake winged_couch:db:create}\n end\n block.call(klass)\n end\n end",
"def add_database(name, host:)\n add_host(host) unless hosts[host]\n if hosts.dig host, :databases, name\n raise \"Database '#{name}' on '#{host}' already configured\"\n end\n db = hosts[host][:databases][name] = db_template\n yield(db) if block_given?\n @saved = false\n end",
"def database(name, database_id = nil, &block)\n @databases << get_class_from_scope(Database, name)\n .new(self, database_id, &block)\n end",
"def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end",
"def open_cursor_with_sql(name, *sql_and_args, &block)\n connection.cursor_eachrow(sql_and_args, name, &block)\n end",
"def each\n store.read do |data|\n data[:columns][column].each do |id, contents| \n yield(Record.new(column, id, contents)) \n end\n end\n end",
"def each(&block) \n reset\n \n while transaction = next_transaction\n yield transaction\n end\n end",
"def each\n return enum_for unless block_given?\n\n if (@database_type != Edition::CITY_REV0 &&\n @database_type != Edition::CITY_REV1)\n throw \"Invalid GeoIP database type, can't iterate thru non-City database\"\n end\n\n @iter_pos = @database_segments[0] + 1\n num = 0\n\n until ((rec = read_city(@iter_pos)).nil?)\n yield rec\n print \"#{num}: #{@iter_pos}\\n\" if((num += 1) % 1000 == 0)\n end\n\n @iter_pos = nil\n return self\n end",
"def seed(&block)\n raise 'Must provide a block' unless block_given?\n\n @@urls.clear\n @@docs.clear\n\n # &block populates the @@urls and @@docs arrays.\n instance_eval(&block)\n\n begin\n @@db.client[:urls].insert_many(@@urls) unless @@urls.empty?\n @@db.client[:documents].insert_many(@@docs) unless @@docs.empty?\n\n @@urls.count + @@docs.count\n rescue StandardError => e\n err_msg = e.respond_to?(:result) ? e.result['writeErrors'] : e.message\n raise \"Write to DB failed - remember that both urls and docs won't \\\naccept duplicate urls. Exception details: #{err_msg}\"\n end\n end",
"def each &block\n db.iterinit\n loop do\n key = db.iternext or break\n val = db[key]\n yield key, val\n end\n end",
"def db_connection\n begin\n connection = PG.connect(Sinatra::Application.db_config)\n # connection = PG.connect(\"users\")\n yield(connection)\n ensure\n connection.close\n end\nend",
"def close\n @database.close if @database\n end",
"def close\n @database.close if @database\n end",
"def db_setup(options = {}, &block)\n # noinspection RubySimplifyBooleanInspection\n Sequel.single_threaded = (options.andand[:single_threaded] == true)\n\n db_connect.tap do |db|\n if options[:use_models]\n Sequel::Model.db = db\n\n if options[:use_prepares]\n Sequel::Model.plugin :prepared_statements\n Sequel::Model.plugin :prepared_statements_associations\n end\n\n require_relative '../models.rb'\n end\n\n if db.respond_to?(:stream_all_queries) && options[:stream_all_queries]\n db.stream_all_queries = options[:stream_all_queries]\n end\n\n block.call(db) if block_given?\n end\n end",
"def open\n @db.open(@db_path)\n\n #Create meta variables if they are absent\n unless @db.m_get(\"n\")\n @db.m_put(\"n\", \"0\") #Total node count\n @db.m_put(\"m\", \"0\") #Total edge count\n @db.m_put(\"node#{Config::DEFAULT_TYPE}\", \n \"0\") #Node count for default type\n @db.m_put(\"edge#{Config::DEFAULT_TYPE}\", \n Marshal.dump({:directed => false, :count => 0})) #Edge count for default type\n end\n\n end",
"def make_blast_databases\n unformatted_fastas.each do |file, sequence_type|\n make_blast_database(file, sequence_type)\n end\n end",
"def dbs_init\n @dbs_hash = Dir[\"#{dbs_store}/*.db\"]\n .map do |dbfile|\n File.open(dbfile){|f| JSON.parse(f.read, symbolize_names: true)}\n end\n .inject({}) do |h, db|\n h.update({\n db[:name].to_sym => LaPack::const_get(db[:clazz]).new(self, db[:params])\n })\n end\n end",
"def each(&block)\n @data.each { |pelem|\n block.call self.factory(@session, pelem)\n }\n end",
"def each\n # Need to close the connection, teh result_set, AND the result_set.getStatement when\n # we're done.\n connection = open_connection!\n\n # We're going to need to ask for item/copy info while in the\n # middle of streaming our results. JDBC is happier and more performant\n # if we use a seperate connection for this.\n extra_connection = open_connection! if include_some_holdings?\n\n # We're going to make our marc records in batches, and only yield\n # them to caller in batches, so we can fetch copy/item info in batches\n # for efficiency.\n batch_size = settings[\"horizon.batch_size\"].to_i\n record_batch = []\n\n exclude_tags = (settings[\"horizon.exclude_tags\"] || \"\").split(\",\")\n\n\n rs = self.fetch_result_set!(connection)\n\n current_bib_id = nil\n record = nil\n record_count = 0\n\n error_handler = org.marc4j.ErrorHandler.new\n\n while(rs.next)\n bib_id = rs.getInt(\"bib#\");\n\n if bib_id != current_bib_id\n record_count += 1\n\n if settings[\"debug_ascii_progress\"] && (record_count % settings[\"solrj_writer.batch_size\"] == 0)\n $stderr.write \",\"\n end\n\n # new record! Put old one on batch queue.\n record_batch << record if record\n\n # prepare and yield batch?\n if (record_count % batch_size == 0)\n enhance_batch!(extra_connection, record_batch)\n record_batch.each do |r|\n # set current_bib_id for error logging\n current_bib_id = r['001'].value\n yield r\n end\n record_batch.clear\n end\n\n # And start new record we've encountered.\n error_handler = org.marc4j.ErrorHandler.new\n current_bib_id = bib_id\n record = MARC::Record.new\n record.append MARC::ControlField.new(\"001\", bib_id.to_s)\n end\n\n tagord = rs.getInt(\"tagord\");\n tag = rs.getString(\"tag\")\n\n # just silently skip it, some weird row in the horizon db, it happens.\n # plus any of our exclude_tags.\n next if tag.nil? || tag == \"\" || exclude_tags.include?(tag)\n\n indicators = rs.getString(\"indicators\")\n\n # a packed byte array could be in various columns, in order of preference...\n # the xref stuff is joined in from the auth table\n # Have to get it as bytes and then convert it to String to avoid JDBC messing\n # up the encoding marc8 grr\n authtext = rs.getBytes(\"xref_longtext\") || rs.getBytes(\"xref_text\")\n text = rs.getBytes(\"longtext\") || rs.getBytes(\"text\")\n\n\n if tag == \"000\"\n # Horizon puts a \\x1E marc field terminator on the end of hte\n # leader in the db too, but that's not really part of it.\n record.leader = String.from_java_bytes(text).chomp(\"\\x1E\")\n\n fix_leader!(record.leader)\n elsif tag != \"001\"\n # we add an 001 ourselves with bib id in another part of code.\n field = build_marc_field!(error_handler, tag, indicators, text, authtext)\n record.append field unless field.nil?\n end\n end\n\n # last one\n record_batch << record if record\n\n # yield last batch\n enhance_batch!(extra_connection, record_batch)\n\n record_batch.each do |r|\n yield r\n end\n record_batch.clear\n\n rescue Exception => e\n logger.fatal \"HorizonReader, unexpected exception at bib id:#{current_bib_id}: #{e}\" \n raise e\n ensure\n logger.info(\"HorizonReader: Closing all JDBC objects...\")\n\n # have to cancel the statement to keep us from waiting on entire\n # result set when exception is raised in the middle of stream.\n statement = rs && rs.getStatement\n if statement\n statement.cancel\n statement.close\n end\n\n rs.close if rs\n\n # shouldn't actually need to close the resultset and statement if we cancel, I think.\n connection.close if connection\n\n extra_connection.close if extra_connection\n\n logger.info(\"HorizonReader: Closed JDBC objects\")\n end",
"def open_db\n if Config.db =~ /^sqlite:\\/{3}(.+)$/\n dir = File.dirname($1)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end\n\n Sequel.datetime_class = Time\n\n @db = Sequel.connect(Config.db, :encoding => 'utf8')\n @db.test_connection\n\n if trait[:sql_log]\n require 'logger'\n @db.logger = Logger.new(trait[:sql_log])\n end\n\n rescue => e\n Ramaze::Log.error(\"Unable to connect to database: #{e}\")\n exit(1)\n end",
"def db name = nil, &block\n repository = name || scopes.size < 1 ? repositories[name ||= :default] : scopes.last\n repository or raise \"Unknown db '#{name}', did you forget to #setup ?\"\n\n if block_given?\n begin\n scopes.push(repository)\n block.call(repository)\n ensure\n scopes.pop\n end\n end\n repository\n end",
"def run_cursor_loop(connection, &block)\n Backfiller.log 'Start cursor loop'\n\n total_count = 0\n cursor = build_cursor(connection)\n\n loop do\n finished, count = cursor.transaction do\n run_fetch_loop(cursor, &block)\n end\n\n total_count += count\n\n Backfiller.log \"Total processed #{total_count}\"\n break if finished\n end\n end",
"def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end",
"def background(&block)\n Thread.new do\n yield\n ActiveRecord::Base.connection.close\n end\n end",
"def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end",
"def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end",
"def execute\n conn = connection\n Benchmark.bm { |x| x.report { yield conn } }\n conn.close\n end",
"def each(&block)\n @queries.each &block\n end",
"def close\n @db.close\n end",
"def database \n # NOTE:: Having an instance variable here, causes problems\n # when having two Sinatra Apps, each with their own db setup.\n # the instance variable retains only the last setup, so the\n # first setup is overwritten.\n @database ||= ::DataMapper.setup(dm_setup_context, dm_database_url)\n end",
"def databases\n get '_all_dbs'\n end",
"def import(&block)\n # Sanity check\n if !@config[:data]\n exit_with_error(\"Importer not configured correctly.\", @config)\n end\n\n bulkSQL = BulkSQLRunner.new(config[:data].size, @config[:sql_buffer_size], @config[:sql_debug])\n @config[:data].each do |rec|\n bulkSQL.add( block.call(rec) )\n end\n end",
"def open_database\n if File.exist? @database_path\n validate_database\n @db = SQLite3::Database.new @database_path\n else\n initialize_database\n end\n end",
"def transaction(start_db_transaction=true)\n yield\n end",
"def all_dbs\n @conn.query({url_path: \"_all_dbs\", method: :get})\n end",
"def run\n create_file_appender\n # The first and ONLY place the results database is created and connected to.\n load_database\n # Create any application specific databases.\n load_application_database\n end",
"def _store_db(db)\n @db = @cfg[:db] = type?(db, Dbx::Index)\n @db.reduce(yield @db) if defined? yield\n # Making run_list\n sites = @cfg[:sites] || []\n @run_list = sites.empty? ? @db.list : (sites & @db.list)\n self\n end",
"def setup\n @dbcount = 1\n @dbids = Array.new\n (0..@dbcount).each do |i|\n @dbids[i] = (0...8).map{('a'..'z').to_a[rand(26)]}.join\n create_or_connect_db(@dbids[i])\n end\n end",
"def close()\n @db.close()\n end",
"def next\n return nil unless next?\n ensure_service!\n options = { token: token, max: @max }\n grpc = @service.list_databases @instance_id, options\n self.class.from_grpc grpc, @service, @max\n end",
"def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end",
"def each\n (0...record_count).each do |i|\n yield get_record(i)\n end\n end",
"def each_dataset(builder, &block)\n block.call(builder.ct.dataset)\n\n @datasets ||= metadata['datasets'].map do |name|\n OsCtl::Lib::Zfs::Dataset.new(\n File.join(builder.ct.dataset.name, name),\n base: builder.ct.dataset.name\n )\n end\n\n @datasets.each(&block)\n end",
"def test(params={}, &block)\n begin\n open(params)\n yield(driver)\n close\n ensure\n abort_if_not_closed\n end\n end",
"def execute(&block)\n TempTableContext.with_context(db) {|context| execute_in_context(context, &block)}\n end",
"def each(&block)\n @raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) }\n\n np = next_page\n while np\n np.current_page.each(&block)\n np = np.next_page\n end\n end",
"def each( & block )\n \n return atomic_cursor.each( & block )\n\n end",
"def each_schema_file(&block)\n Dir[File.expand_path(\"../fixtures/*.yaml\", __FILE__)].each(&block)\n end",
"def define\r\n\t\tdatabase_names.call().collect do |database_name|\r\n\t\t\tnamespace database_name do\r\n\t\t\t\ttasks[:names].collect do |task_name|\r\n\t\t\t\t\tdesc \"#{task_name.to_s.capitalize} the #{database_name} database\"\r\n\t\t\t\t\ttask task_name => tasks[:dependencies] do\r\n\t\t\t\t\t\ttasks[:action].call(task_name, database_name)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tadd_tasks_for(:import, import, database_name)\r\n\t\t\t\tadd_tasks_for(:export, export, database_name)\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\tself\r\n\tend",
"def databases\n unless defined?(@databases)\n # only use mutex on initialization\n MUTEX.synchronize do\n # return if another process initialized while we were waiting\n return @databases if defined?(@databases)\n\n @databases = config[\"databases\"].map { |id, c| [id.to_sym, Database.new(id, c)] }.to_h\n end\n end\n\n @databases\n end",
"def find_each\n return enum_for(:find_each) unless block_given?\n\n client = IronBank.client\n query_string = IronBank::QueryBuilder.zoql(object_name, query_fields)\n query_result = client.query(query_string) # up to 2k records from Zuora\n\n loop do\n query_result[:records].each { |data| yield new(data) }\n break if query_result[:done]\n\n query_result = client.query_more(query_result[:queryLocator])\n end\n end",
"def openDB\n db =Rho::Database.new(Rho::Application.databaseFilePath('local'), \"local\");\n puts \"#{db.to_s}\"\n data = db\n data\n end",
"def remote\n run_in_environment(remote_database) { yield }\n end",
"def each\n @cursor = nil\n session = client.send(:get_session, @options)\n server = cluster.next_primary(nil, session)\n result = send_initial_query(server, session, context: Operation::Context.new(client: client, session: session))\n result = send_fetch_query(server, session) unless inline?\n @cursor = Cursor.new(view, result, server, session: session)\n if block_given?\n @cursor.each do |doc|\n yield doc\n end\n else\n @cursor.to_enum\n end\n end",
"def initialize_db\n init\n (1...15).each do |i|\n puts i\n f = File.read(\"data/#{i}.json\")\n h = JSON.parse(f)\n Organization.transaction do\n h['results'].each do |result|\n org = Organization.find_by_name(result['organization']['name'])\n if org.nil?\n org = create_organization(result['organization'])\n end\n student = create_student(result['student'])\n project = create_project(result)\n org.projects << project\n org.students << student\n student.project = project\n tags = result['organization']['proposal_tags']\n tags.each do |tag|\n t = Tag.create(:name=>tag, :tag_type=>'proposal')\n project.tags << t\n end\n end\n end\n end\nend",
"def iterate_over files\n files.each do |file|\n yield file\n SignalHandler.check { \n @db.close\n Logger.<<(__FILE__,\"WARNING\",\"Signal SIGINT received: stopping decoding files ...\")\n }\n end\n end",
"def with_connection(&block)\n base_model.connection_pool.with_connection(&block)\n end",
"def cursor_eachrow(sql, name='csr', transaction=true, buffer_size=10000)\n count = 0\n begin\n begin_db_transaction if transaction\n open_cursor(sql, name, buffer_size)\n while (row = fetch_cursor(name)) do\n count+= 1\n #puts \"EACH CSR #{row.inspect}\"\n yield row\n end\n close_cursor(name)\n ensure\n commit_db_transaction if transaction\n end\n count\n end",
"def execute\n ret = yield self\n close\n ret\n end",
"def cursor( *args, & block )\n \n cursor_instance = ::Persistence::Cursor.new( self )\n \n if args.count > 0\n cursor_instance.persisted?( *args )\n end\n \n if block_given?\n cursor_instance = cursor_instance.instance_eval( & block )\n cursor_instance.close\n end\n \n return cursor_instance\n \n end",
"def get_db\n # we want to check a couple levels 2011-09-28 \n unless @db\n unless File.exists? @file\n 3.times do |i|\n @file = \"../#{@file}\"\n break if File.exists? @file\n end\n end\n end\n @db ||= DB.new @file\n end",
"def open\n conn = connection.protocol::DbOpen.new(params(name: @name, storage: @storage, user: @user, password: @password)).process(connection)\n @session = conn[:session] || OrientdbBinary::OperationTypes::NEW_SESSION\n\n @clusters = conn[:clusters]\n self\n end",
"def each\n @lock.synchronize do\n @db.clear_marks\n # Start with the object 0 and the indexes of the root objects. Push them\n # onto the work stack.\n stack = [ 0 ] + @root_objects.values\n while !stack.empty?\n # Get an object index from the stack.\n id = stack.pop\n next if @db.is_marked?(id)\n\n unless (obj = object_by_id_internal(id))\n PEROBS.log.fatal \"Database is corrupted. Object with ID #{id} \" +\n \"not found.\"\n end\n # Mark the object so it will never be pushed to the stack again.\n @db.mark(id)\n yield(obj.myself) if block_given?\n # Push the IDs of all unmarked referenced objects onto the stack\n obj._referenced_object_ids.each do |r_id|\n stack << r_id unless @db.is_marked?(r_id)\n end\n end\n end\n end",
"def create_db(db_name)\n\n db = SQLite3::Database.new(db_name + \".db\")\n db.results_as_hash = true\n current_db_name = (db_name + \".db\")\n\n # Create Project Table\n create_project_table = <<-SQL\n CREATE TABLE IF NOT EXISTS projects(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n client VARCHAR(255)\n )\n SQL\n\n # Create Geologists Table\n create_geo_table = <<-SQL\n CREATE TABLE IF NOT EXISTS geologists(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n company VARCHAR(255)\n )\n SQL\n\n # Create Borehole Table\n create_borehole_table = <<-SQL\n CREATE TABLE IF NOT EXISTS boreholes(\n id INTEGER PRIMARY KEY,\n designation VARCHAR(255),\n northing REAL,\n easting REAL,\n elevation REAL,\n project_id INTEGER,\n FOREIGN KEY (project_id) REFERENCES projects(id)\n )\n SQL\n \n # Create Samples Table\n create_sample_table = <<-SQL\n CREATE TABLE IF NOT EXISTS samples(\n id INTEGER PRIMARY KEY,\n bh_id INTEGER, \n logger_id INTEGER,\n depth REAL,\n USCS VARCHAR(63),\n color VARCHAR(127),\n wetness VARCHAR(63),\n percent_gravel INTEGER,\n percent_sand INTEGER,\n percent_fines INTEGER,\n plasticity VARCHAR(63),\n toughness VARCHAR(63),\n other VARCHAR(255),\n FOREIGN KEY (bh_id) REFERENCES boreholes(id),\n FOREIGN KEY (logger_id) REFERENCES geologists(id)\n )\n SQL\n\n db.execute(create_project_table)\n db.execute(create_geo_table)\n db.execute(create_borehole_table)\n db.execute(create_sample_table)\n\n db\nend",
"def openDBRanked()\n\t\t@rankedDB \t\t= SQLite3::Database.new File.expand_path('../../../Data/ranked.db', File.dirname(__FILE__))\n\t\t@rankedTimeDB \t= SQLite3::Database.new File.expand_path('../../../Data/rankedTime.db', File.dirname(__FILE__))\n\tend",
"def each(&block)\n\t plan.query_each(result_set, &block)\n\t self\n\tend",
"def open\n close\n @db = SQLite3::Database.new(@options[:filename])\n self\n end",
"def each(&block)\n @all.each_batch { |batch| batch.each { |s| yield s } }\n end"
] | [
"0.7159878",
"0.70285666",
"0.66747665",
"0.65297025",
"0.6359071",
"0.62822795",
"0.62490904",
"0.62386113",
"0.62386113",
"0.62386113",
"0.62386113",
"0.62386113",
"0.62386113",
"0.62386113",
"0.61385626",
"0.6086385",
"0.6051412",
"0.6014187",
"0.60030675",
"0.5982554",
"0.5956295",
"0.59459937",
"0.5922417",
"0.58740574",
"0.58400345",
"0.5780637",
"0.5757557",
"0.5717682",
"0.5712558",
"0.56640124",
"0.56560844",
"0.5623477",
"0.56162506",
"0.5592882",
"0.5591101",
"0.5573781",
"0.5572751",
"0.5570451",
"0.55657524",
"0.55615175",
"0.5539032",
"0.5510225",
"0.55101824",
"0.550033",
"0.550033",
"0.54976493",
"0.5482189",
"0.54800695",
"0.5467616",
"0.54630363",
"0.54537797",
"0.544746",
"0.5437707",
"0.5436895",
"0.5435218",
"0.5414506",
"0.54004115",
"0.54004115",
"0.5389023",
"0.5384675",
"0.5380039",
"0.5361565",
"0.5358744",
"0.53560543",
"0.53476",
"0.53235763",
"0.5321635",
"0.53213584",
"0.53166384",
"0.5308145",
"0.530792",
"0.53038675",
"0.5302788",
"0.5301706",
"0.52994883",
"0.5299299",
"0.5297587",
"0.5291813",
"0.5289891",
"0.5284094",
"0.52832264",
"0.5282669",
"0.5274512",
"0.5272126",
"0.5261325",
"0.5247387",
"0.52358985",
"0.5233819",
"0.5232633",
"0.52228284",
"0.5214939",
"0.5208858",
"0.5205895",
"0.5203712",
"0.5195678",
"0.51937026",
"0.51923877",
"0.5192187",
"0.5190232",
"0.5186691"
] | 0.59579825 | 20 |
Delegates queries according to query type. | def query( query )
query.downcase!
case query
when /^:r:/ then query_regexp query.gsub(/^:r:/, '')
when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')
else query_simple query
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def query_methods(result_type); 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 process_query(query)\n # Nothing in default\n end",
"def query_class\n Query.get_subclass(params[:type] || 'IssueQuery')\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def set_query_type\n @query_type = QueryType.find(params[: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 query_type\n return @query_type\n end",
"def query_type\n return @query_type\n end",
"def query_type=(value)\n @query_type = value\n end",
"def query_type=(value)\n @query_type = value\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 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 injection_perform\n # Perform the query\n case params[:method]\n when \"order\"\n @all_types_objects = AllTypesObject.order(params[:value])\n when \"where\"\n @all_types_objects = AllTypesObject.where(\"string_col = '#{params[:value]}'\")\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n respond_with(@all_types_objects)\n end",
"def execute_query(query_type, test)\n if @per_test_insert\n query_data = translate_column_names(test['query'])\n else\n query_data = test['query']\n end\n puts ' Querying'\n\n if @verbose\n puts \" - #{query_data}\"\n end\n\n if query_type == 'count_entity'\n result = @client.count_entity(query_data)\n elsif query_type == 'count_event'\n result = @client.count_event(query_data)\n elsif query_type == 'top_values'\n result = @client.top_values(query_data)\n elsif query_type == 'aggregation'\n result = @client.aggregation(query_data)\n elsif query_type == 'result'\n result = @client.result(query_data)\n elsif query_type == 'score'\n result = @client.score(query_data)\n elsif query_type == 'sql'\n result = @client.sql(query_data)\n end\n\n result\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\n super\n end",
"def relation_by_sql_perform\n # Determine the base query\n case params[:method]\n when \"find_by_sql\"\n query = \"SELECT * FROM all_types_objects\"\n when \"count_by_sql\"\n query = \"SELECT COUNT(*) FROM all_types_objects\"\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n case params[:option]\n when 'string'\n # Build the conditions.\n conditions = build_conditions('joined', 'string', params[:conditions]).first\n # And append them to the query\n query += ' WHERE ' + conditions.first if conditions.present?\n when 'array'\n # Build the conditions.\n conditions = build_conditions('joined', 'array', params[:conditions]).first\n # And rebuild the query such that it is an array with a statement and bind values for that statement.\n query = [query + ' WHERE ' + conditions.first.shift, *conditions.first] if conditions.present?\n end\n\n # Perform the query\n @result = AllTypesObject.send(params[:method], query)\n\n respond_with(@result)\n end",
"def queryable_class\n @queryable_class || self.class.queryable_class\n end",
"def query\n end",
"def query(&block)\n @delegate.query(block)\n end",
"def query(query_definition)\n return\n end",
"def query; end",
"def discover\n choria.pql_query(@query, true)\n end",
"def query(index, types, query, options=nil)\n query = {'q' => query} if query.is_a?(String)\n resp = get do |req|\n req.url \"#{index}/#{types}/_search\", query\n req.body = options if options\n end\n resp.body\n end",
"def method_missing(name, *args, &block)\n super unless respond_to_missing?(name)\n _update_query(name, *args, &block)\n end",
"def relation_objects_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods.\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"first\", \"last\", \"take\"\n amount = params[:amount].to_i if params[:amount].present?\n @results = relation.send(params[:method], *amount)\n when \"to_a\", \"all\", \"load\", \"reload\", \"first!\", \"last!\", \"take!\"\n @results = relation.send(params[:method])\n when \"select\"\n @results = relation.send(params[:method]) { true } # Select with a block acts as a finder method. The block simply returns true to not futher limit the results.\n when \"find\"\n case params[:option]\n when \"sub_method\"\n if FIND_SUB_METHODS.include?(params[:sub_method])\n @results = relation.send(params[:method], params[:sub_method].to_sym)\n else\n flash[:alert] = \"Unknown sub method selected\" unless running?\n end\n when \"single_id\"\n @results = relation.send(params[:method], params[:id])\n when \"id_list\"\n @results = relation.send(params[:method], *params[:id])\n when \"id_array\"\n @results = relation.send(params[:method], params[:id])\n end\n when \"find_by\", \"find_by!\"\n conditions = build_conditions('joined', 'list', params[:conditions]).first || [nil]\n @results = relation.send(params[:method], *conditions)\n when \"find_or_initialize_by\", \"find_or_create_by\", \"find_or_create_by!\"\n conditions = build_conditions('joined', 'hash', params[:conditions]).flatten.first || {}\n attributes = params[:attributes].reject { |k,v| v.blank? }\n if attributes.present?\n @results = relation.send(params[:method], conditions) { |object| object.attributes = attributes }\n else\n @results = relation.send(params[:method], conditions)\n end\n when \"dynamic_find_by\", \"dynamic_find_by!\"\n # Check if the attribute name is allowed to prevent errors.\n return redirect_to read_test_relation_objects_form_path(params[:method], params[:option]), :alert => \"Selected attribute is not a valid attribute of AllTypesObject!\" unless AllTypesObject.column_names.include?(params[:attribute])\n method = \"find_by_#{params[:attribute]}\" + (params[:method] == \"dynamic_find_by!\" ? \"!\" : \"\")\n @results = relation.send(method, params[:value])\n when \"find_each\", \"find_in_batches\"\n @results = []\n options = {}\n options[:start] = params[:start].to_i if params[:start].present?\n options[:batch_size] = params[:batch_size].to_i if params[:batch_size].present?\n relation.send(params[:method], options) { |results| @results << results }\n when \"first_or_initialize\", \"first_or_create\", \"first_or_create!\"\n @results = relation.send(params[:method], params[:attributes].presence)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n # Wrap the result(s) in array and flatten (since the template expects an array of results)\n @all_types_objects = (@results.present? ? [@results].flatten : nil)\n\n @includes = (relation.eager_load_values + relation.includes_values + relation.preload_values).uniq\n\n respond_with(@all_types_objects)\n end",
"def set_query_params_type\n @query_params[:type]= @query_params[:type] || \"json\"\n end",
"def query\n @operation = :query\n 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 perform\n # This will allow us to switch backend data structure for\n # searching pretty easily.\n perform_by_mysql\n end",
"def connection_execute_method\n :query\n end",
"def connection_execute_method\n :query\n end",
"def run(query,*args)\n with_query(query,*args) do\n if self.search_method\n run_custom_search\n else\n run_default_search\n end\n end\n end",
"def to_query(_model)\n raise 'subclasses should implement this method.'\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 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 result_type(result_type='mixed')\n @query[:result_type] = result_type\n self\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 search\n searcher = @admin || @user\n query = params[:query]\n if query.blank?\n redirect_to(:action => 'index', :admin_id => @admin.id)\n else\n query.strip!\n\n case params[:type]\n when 'student' then\n @students = Student.students_of_teacher(searcher).search_data(query, filtered_params)\n when 'teacher' then\n @teachers = searcher.children.unblocked.search_data(query, filtered_params)\n else\n @students = Student.students_of_teacher(searcher).search_data(query, filtered_params)\n @teachers = searcher.children.unblocked.search_data(query, filtered_params)\n end\n end\n end",
"def query_type_to_clause_params()\n where_clause = nil\n sql_parameters = []\n qextra = false\n all_query = false\n\n type = self.type\n query = self.query\n if type == 'All'\n all_query = true\n elsif type == 'None'\n where_clause = '1=0'\n elsif type == 'Date'\n where_clause = \"(Begin_Date REGEXP ? OR EndDate REGEXP ?)\"\n sql_parameters << query\n sql_parameters << query\n elsif type == 'after'\n where_clause = \"Begin_Date > ?\"\n sql_parameters << query\n elsif type == 'before'\n where_clause = \"EndDate < ?\"\n sql_parameters << query\n elsif type == 'parameter'\n where_clause = \"`bottle_dbs`.`parameters` LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'params'\n elsif type == 'basin'\n where_clause = \"spatial_groups.`#{query}` = 1\"\n qextra = 'spatial_group'\n elsif type == 'Chief_Scientist'\n where_clause = \"contacts.LastName LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'contacts'\n else\n if @@cruise_columns.include?(type)\n where_clause = \"`cruises`.`#{type}` REGEXP ?\"\n sql_parameters << query\n else\n Rails.logger.debug(\"Search: unrecognized type #{type}\")\n where_clause = nil\n end\n end\n [where_clause, sql_parameters, qextra, all_query]\n end",
"def query(options)\n Direction.define_methods(self, options) do |query, accessor|\n %{\n def #{query}(*args, &block)\n #{accessor}.__send__(:#{query}, *args, &block)\n end\n }\n end\n end",
"def filter(query_type, options = {})\n bool.filter(query_type, options)\n self\n end",
"def results\n send_query\n end",
"def render_json_query(table)\n if request_type_find? && time_query?\n render json: serializer(table).new(model(table).where(generate_date_query_argument(date_parsed)).take)\n elsif request_type_find? && !time_query?\n render json: serializer(table).new(model(table).find_by(valid_params))\n elsif request_type_find_all? && time_query?\n render json: serializer(table).new(model(table).where(generate_date_query_argument(date_parsed)))\n elsif request_type_find_all? && !time_query?\n render json: serializer(table).new(model(table).where(valid_params))\n end\n end",
"def _query(*params)\n fail 'not implemented'\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def query_for_data\n if self.record_klass < ActiveRecord::Base\n self.dataset = self.record_klass.find(:all, self.query)\n \n count_query = self.query.reject do |k, v| \n [:limit, :offset, :order].include?(k.to_sym )\n end\n self.resultcount = self.record_klass.count(:all, count_query)\n \n elsif self.record_klass < ActiveResource::Base\n self.dataset = self.record_klass.find(:all, :params => self.query)\n self.resultcount = self.dataset.delete_at(self.dataset.length - 1).total\n else\n raise \"Unable to query for data. Supported base classes are 'ActiveRecord::Base' and 'ActiveResource::Base' but '#{self.record_klass}' was given\"\n end\n \n self.resultcount = self.resultcount.length if self.resultcount.respond_to?(:length)\n end",
"def options_for(type, query, options={})\n opts = instance_options.merge(filter_hash(options, BASE_OPTIONS))\n opts.merge!(:sources => type.to_s, :query => build_query(query, options))\n \n source_options = filter_hash(options, [:http] + BASE_OPTIONS + QUERY_KEYWORDS)\n opts.merge!(scope_source_options(type, source_options))\n \n http_options = options[:http] || {}\n http_options.merge(:query => opts)\n end",
"def query(index_class, q, index_type = :exact)\n LuceneQuery.query_node_by_class(clause_list, index_class, q, index_type).eval_context\n end",
"def search_document\n query = params[:input]\n type = params[:type]\n case type\n when \"cni\"\n @title = \"Recherche suivant \"+type\n @query = Convocation.where(cni: query).uniq\n when \"immatriculation\"\n @query = Convocation.where(immatriculation: query).uniq\n when \"telephone\"\n @title = \"Recherche suivant \"+type\n @query = Convocation.where(phone: query, status: \"impaye\").order(created_at: :desc).order(cni: :desc)\n #@cni = Convocation \n #redirect_to action: self, id: \"#{type}/#{query}\"\n when \"code\"\n @query = Convocation.where(code: query).uniq\n end\n #render layout: 'administration'\n render layout: 'views/index'\n end",
"def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end",
"def query\n self\n end",
"def query\n self\n end",
"def initial_query; end",
"def compose\n if @queries.length > 1\n compose_multi_query\n else\n compose_single_query\n end\n end",
"def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end",
"def method_missing(name, *params, &block)\n query_proxy_or_target.public_send(name, *params, &block)\n end",
"def query(&blk)\n @adapter.query(collection, self, &blk)\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 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 index\n\n if params[:search] and params[:type]\n @questions = Question.where(\"category LIKE ? and (title LIKE ? or quest LIKE ?)\",\"%#{params[:type]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\")\n elsif params[:type]\n @questions = Question.where(\"category LIKE ?\",\"%#{params[:type]}%\")\n elsif params[:search]\n @questions = Question.where(\"title LIKE ? or quest LIKE ?\",\"%#{params[:search]}%\",\"%#{params[:search]}%\")\n else\n @questions = Question.all\n end\n\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 get_query_type_from_result( json_data )\n retval = nil\n object_class_name = json_data[ \"objectClassName\" ]\n if object_class_name != nil\n case object_class_name\n when \"domain\"\n retval = QueryType::BY_DOMAIN\n when \"ip network\"\n retval = QueryType::BY_IP\n when \"entity\"\n retval = QueryType::BY_ENTITY_HANDLE\n when \"autnum\"\n retval = QueryType::BY_AS_NUMBER\n when \"nameserver\"\n retval = QueryType::BY_NAMESERVER\n end\n end\n if json_data[ \"domainSearchResults\" ]\n retval = QueryType::SRCH_DOMAINS\n elsif json_data[ \"nameserverSearchResults\" ]\n retval = QueryType::SRCH_NS\n elsif json_data[ \"entitySearchResults\" ]\n retval = QueryType::SRCH_ENTITY_BY_NAME\n end\n return retval\n end",
"def remote_query\n raise \"You must override `remote_query' in your class\"\n end",
"def each_query\n 1.upto(nqueries) do |n|\n yield(query(n))\n end\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 search_type\n case type\n when \"opinions\"\n query.only_amendables\n when \"amendments\"\n query.only_visible_emendations_for(@current_user, @component)\n else # Assume 'all'\n query.amendables_and_visible_emendations_for(@current_user, @component)\n end\n end",
"def query_with_modifier(query, strategy, with_timing = false)\n key = query.respond_to?(:key) ? query.key : 'custom'\n\n instrument(\"gql.query.#{key}.#{strategy}\") do\n if strategy.nil?\n if with_timing\n query_standard_with_timing(query)\n else\n query_standard(query)\n end\n elsif Gquery::GQL_MODIFIERS.include?(strategy.strip)\n if with_timing\n with_timing { send(\"query_#{strategy}\", query) }\n else\n send(\"query_#{strategy}\", query)\n end\n end\n end\n end",
"def index_query(query, index_type = :exact, clazz = Neo4j::Node)\n indexer = Indexer.instance_for(clazz)\n indexer.index_query(query, index_type)\n end",
"def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end",
"def viewquery_callback(handle, type, row)\n row_data = Ext::RESPVIEWQUERY.new row\n view = @requests[row_data[:cookie].address]\n\n if row_data[:rc] == :success\n if (row_data[:rflags] & Ext::RESPFLAGS[:resp_f_final]) > 0\n # We can assume this is JSON\n view.received_final(JSON.parse(row_data[:value].read_string(row_data[:nvalue]), DECODE_OPTIONS))\n else\n view.received(row_data)\n end\n else\n error_klass = Error.lookup(row_data[:rc])\n if error_klass == Error::HttpError\n http_resp = row_data[:htresp]\n view.error error_klass.new(body_text(http_resp))\n else\n view.error error_klass.new\n end\n end\n end",
"def query\n @query || params[:q] || params[:tq]\n end",
"def relation_value_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"any?\", \"blank?\", \"empty?\", \"many?\", \"size\", \"explain\", \"inspect\"\n @result = relation.send(params[:method])\n when \"exists?\"\n case params[:option]\n when \"id\"\n @result = relation.send(params[:method], params[:id])\n when \"conditions_array\"\n @result = relation.send(params[:method], build_conditions('joined', 'array', params[:conditions]).flatten)\n when \"conditions_hash\"\n @result = relation.send(params[:method], *build_conditions('joined', 'hash', params[:conditions]).flatten)\n else\n @result = relation.send(params[:method])\n end\n when \"average\", \"count\", \"maximum\", \"minimum\", \"sum\", \"calculate\", \"pluck\", \"ids\"\n # Check if the column_name is allowed (the column_name parameter for the method pluck is considered safe by Rails and thus this parameter should be checked against a whitelist)\n return redirect_to read_test_relation_value_form_path(params[:method], params[:option]), :alert => \"Selected column_name is not a valid attribute of AllTypesObject!\" if params[:column_name].present? && !calculate_column_names(params[:sub_method] || params[:method]).include?(params[:column_name])\n sub_method = [params[:sub_method].to_sym] if params[:method] == \"calculate\" # Only calculate takes a sub_method. For other methods sub method is ignored and not used as an argument.\n column_name = [params[:column_name].presence] unless params[:method] == 'ids'\n options = [{ :distinct => (params[:distinct_calculate] == \"true\") }] if params[:distinct_calculate].present? # Only count and calculate take distinct (and actually only calculate with sub_method=count used distinct)\n @result = relation.send(params[:method], *sub_method, *column_name, *options)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n respond_with(@result)\n end",
"def base_query\n DataServicesApi::QueryGenerator.new\n end",
"def all(query); end",
"def index\n @q = Repuesto.search(params[:q])\n @repuestos = @q.result.order('codigo ASC')\n\n tipo = params[:tipo]\n if tipo == \"Insumo\"\n @repuestos = @repuestos.where(\"familia = 'Insumo'\")\n elsif tipo == \"Lubricante\"\n @repuestos = @repuestos.where(\"familia = 'Lubricante'\")\n elsif tipo == \"Neumatico\"\n @repuestos = @repuestos.where(\"familia = 'Neumáticos'\")\n elsif tipo == \"Pintura\"\n @repuestos = @repuestos.where(\"familia = 'Pintura'\")\n elsif tipo == \"Repuesto\"\n @repuestos = @repuestos.where(\"familia = 'Repuesto'\")\n elsif tipo == \"Seguridad\"\n @repuestos = @repuestos.where(\"familia = 'Seguridad'\")\n elsif tipo == \"Faltantes\"\n @repuestos = @repuestos.where(\"stock < stock_minimo\")\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_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 results\n send_query\n end",
"def query\n\n # Allows us to execute javascript\n respond_to do |format|\n format.html\n format.js\n end\n\n # If a post request is made, store the show name in @query\n if request.post?\n @query = params[:show]\n end\n\n end",
"def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end",
"def query_for_self\n query = Ferret::Search::TermQuery.new(:id, self.id.to_s)\n if self.class.configuration[:single_index]\n bq = Ferret::Search::BooleanQuery.new\n bq.add_query(query, :must)\n bq.add_query(Ferret::Search::TermQuery.new(:class_name, self.class.name), :must)\n return bq\n end\n return query\n end",
"def query_by_trans_type(trans_type)\n @PARAM_HASH[\"trans_type\"] = trans_type\n end",
"def query_type=(query_option)\n @browser.select_list(:id => \"smartSearchSubtype_0\").select(query_option)\n end",
"def respond_to_missing?(name, *)\n query.respond_to?(name, true)\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def query\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n render :json => @filter.run(params)\n }\n end\n end",
"def search_for_type(type)\n q = type\n # search for tweets containing type or #type\n # save them to DB if request is valid (ie not an exception)\n end",
"def query_by_trans_type(trans_type)\r\n @PARAM_HASH[\"trans_type\"] = trans_type\r\n end",
"def query_by_trans_type(trans_type)\r\n @PARAM_HASH[\"trans_type\"] = trans_type\r\n end",
"def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\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 query_search(query, options={})\n run_query query, options\n end",
"def results(query, reverse = false)\n raise NotImplementedError.new\n end",
"def define_resource_query_methods(query, actions)\n if query\n if actions.include?(:show)\n define_singleton_method :find do |id, query_params = {}|\n message = nil\n if query_params.is_a?(query)\n message = query_params\n else\n decorator = ::Protip::Decorator.new(query.new, transformer)\n decorator.assign_attributes query_params\n message = decorator.message\n end\n ::Protip::Resource::SearchMethods.show(self, id, message)\n end\n end\n\n if actions.include?(:index)\n define_singleton_method :all do |query_params = {}|\n message = nil\n if query_params.is_a?(query)\n message = query_params\n else\n decorator = ::Protip::Decorator.new(query.new, transformer)\n decorator.assign_attributes query_params\n message = decorator.message\n end\n ::Protip::Resource::SearchMethods.index(self, message)\n end\n end\n else\n if actions.include?(:show)\n define_singleton_method :find do |id|\n ::Protip::Resource::SearchMethods.show(self, id, nil)\n end\n end\n\n if actions.include?(:index)\n define_singleton_method :all do\n ::Protip::Resource::SearchMethods.index(self, nil)\n end\n end\n end\n end",
"def query(value = nil, &block)\n __define__(:query, value, block)\n end",
"def check_query\n self.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"
] | [
"0.6551042",
"0.6384838",
"0.6276502",
"0.62545526",
"0.6172853",
"0.61648154",
"0.6105809",
"0.60704255",
"0.605146",
"0.605146",
"0.6017838",
"0.6017838",
"0.599544",
"0.599323",
"0.59543794",
"0.5952474",
"0.5886743",
"0.58487505",
"0.58082247",
"0.57764053",
"0.574419",
"0.57379806",
"0.5626703",
"0.56258",
"0.5584934",
"0.5578533",
"0.5574377",
"0.55531967",
"0.55440795",
"0.5536738",
"0.55246246",
"0.54655",
"0.54551715",
"0.54551715",
"0.54497415",
"0.5415512",
"0.5375857",
"0.53699636",
"0.5361267",
"0.53545654",
"0.5326725",
"0.530972",
"0.5300599",
"0.52800065",
"0.5278134",
"0.52659875",
"0.5250634",
"0.52476686",
"0.52456415",
"0.52449745",
"0.5237696",
"0.5234313",
"0.5223427",
"0.51988816",
"0.51988816",
"0.5176777",
"0.5162908",
"0.51552296",
"0.51488554",
"0.51349413",
"0.51307255",
"0.5127849",
"0.5125765",
"0.51083845",
"0.5106169",
"0.51058114",
"0.51055795",
"0.50943816",
"0.5086919",
"0.5080026",
"0.5077354",
"0.5076656",
"0.507248",
"0.5071075",
"0.50703156",
"0.50698644",
"0.5060337",
"0.5059061",
"0.5054996",
"0.5040091",
"0.5038231",
"0.5033772",
"0.50251806",
"0.5023551",
"0.50234675",
"0.5014002",
"0.50070363",
"0.5006548",
"0.49971417",
"0.49951786",
"0.49875078",
"0.49875078",
"0.4969837",
"0.49628198",
"0.49617347",
"0.49586648",
"0.49564505",
"0.49531683",
"0.4946818",
"0.49384463"
] | 0.5101083 | 67 |
Simple hash lookup. Complexity: O(1) | def query_simple( query )
read_db do |dbm|
puts RDictCcEntry.format_str(dbm[query]) if !dbm[query].nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(key); end",
"def hash(*) end",
"def my_hash_finding_method(source, thing_to_find)\n answer = Hash.new\n source.each do |key, value|\n if value == thing_to_find\n answer.store(key, value)\n end\n end\n p answer.keys\nend",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def my_hash_finding_method(source, thing_to_find)\n output_array = []\n i = 0\n source.each_pair { |key,value|\n if value == thing_to_find\n output_array[i] = key\n i += 1\n end\n }\n return output_array\nend",
"def lookup(item)\n fingerprint = fingerprint(item)\n first_index = hash(item)\n second_index = alt_index(first_index, fingerprint)\n\n @buckets[first_index].contains?(fingerprint) || @buckets[second_index].contains?(fingerprint)\n end",
"def hashfind a,k,v\n f = []\n a.each do |e|\n f << e if e[k]==v\n end\n f\nend",
"def geohash(key, member); end",
"def find_by_id(input, value)\n hash = nil\n input.each do |input|\n if input[:id] == value\n hash = input\n end\n end\n hash\nend",
"def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end",
"def get_lh_hash(key)\n res = 0\n key.upcase.bytes do |byte|\n res *= 37\n res += byte.ord\n end\n return res % 0x100000000\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def find hash\n field, value = hash.first\n if index(field).unique\n if id = redis.get(colon(name, field, value))\n new id\n end\n else\n raise \"no unique index on #{field}\"\n end\n end",
"def fnvhash( key, len=key.length )\n state = 0x811C9DC5\n\n len.times{ |i|\n state ^= key[i]\n state *= 0x1000193\n }\n\n return state\nend",
"def search_bin(entry,hash,key)\n while entry\n cur_hash, cur_key, cur_val, nxt = *entry\n\n if cur_hash == hash and key.eql?(cur_key)\n return entry\n end\n\n entry = nxt\n end\n return Undefined\n end",
"def hash\n num = @high << 64\n num |= @low\n num.hash\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def hash_code; end",
"def my_hash_finding_method(source, thing_to_find)\n solution = source.select { |key, value| value == thing_to_find }\n solution.keys\nend",
"def rehash() end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hexists(key, field); end",
"def hexists(key, field); end",
"def lookup(symbol)\n symbol = symbol.to_s\n sym_size = { 32 => 16, 64 => 24 }[@elfclass]\n # Leak GNU_HASH section header.\n nbuckets = @leak.d(hshtab)\n symndx = @leak.d(hshtab + 4)\n maskwords = @leak.d(hshtab + 8)\n\n l_gnu_buckets = hshtab + 16 + (@elfword * maskwords)\n l_gnu_chain_zero = l_gnu_buckets + (4 * nbuckets) - (4 * symndx)\n\n hsh = gnu_hash(symbol)\n bucket = hsh % nbuckets\n\n i = @leak.d(l_gnu_buckets + bucket * 4)\n return nil if i.zero?\n\n hsh2 = 0\n while (hsh2 & 1).zero?\n hsh2 = @leak.d(l_gnu_chain_zero + i * 4)\n if ((hsh ^ hsh2) >> 1).zero?\n sym = symtab + sym_size * i\n st_name = @leak.d(sym)\n name = @leak.n(strtab + st_name, symbol.length + 1)\n if name == (\"#{symbol}\\x00\")\n offset = { 32 => 4, 64 => 8 }[@elfclass]\n st_value = unpack(@leak.n(sym + offset, @elfword))\n return @libbase + st_value\n end\n end\n i += 1\n end\n nil\n end",
"def my_hash_finding_method(source, thing_to_find)\n new_array = []\n source.map do |k, v|\n if v == thing_to_find\n new_array << k\n end\n end\n return new_array\nend",
"def hash_key(name); end",
"def find_fast(u)\n u += 0xe91aaa35\n u ^= u >> 16\n u += (u << 8) & 0xFFFFFFFF\n u &= 0xFFFFFFFF\n u ^= u >> 4\n b = (u >> 8) & 0x1ff\n a = ((u + ((u << 2) & 0xFFFFFFFF)) & 0xFFFFFFFF) >> 19\n a ^ Arrays::HASH_ADJUST[b]\n end",
"def djbhash( key, len=key.length )\n state = 5381\n \n len.times{ |i|\n state = ((state << 5) + state) + key[i]\n }\n return state\nend",
"def my_hash_finding_method(source, thing_to_find)\n final_answer = source.select{|key, value| value == thing_to_find}\n p final_answer.keys\nend",
"def my_hash_finding_method(source, thing_to_find)\n final_answer = source.select{|key, value| value == thing_to_find}\n p final_answer.keys\nend",
"def hash() source.hash ^ target.hash; end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def quadratic_hash_search (string, space_matcher_lambda)\n hash = string.hash % @size\n (0..(@size - 1)).each do |i|\n probe = @table[i]\n if i.odd?\n probe = ((hash + i**2) % @size).abs\n else\n probe = ((hash - i**2) % @size).abs\n end\n if space_matcher_lambda.call(@table[probe])\n return probe\n end\n end\n return nil\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash_two_sum(value,data)\n hash = {}\n hash = add_to_hash(hash,data)\n keys = hash.keys\n data.each do |data_item|\n search_item = value - data_item\n if keys.include?(search_item)\n puts \"found in the hash\"\n break\n end\n end\nend",
"def hashcode(key)\n hashcode_with_internal_hashes(key).first\n end",
"def my_hash_finding_method(source, thing_to_find)\n source.select {|k, v| v == thing_to_find}.keys\nend",
"def lookup_local(md5_hash)\n # TODO: Implement local rainbow table lookup\n end",
"def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end",
"def hash_this(word)\n\t\tdigest = Digest::MD5.hexdigest(word) # get the hex version of the MD5 for the specified string\n\t\tdigest[@offset, @digits].to_i(16) % @max_value # offset it using the initial seed value and get a subset of the md5. then modulo it to get the bit array location\n\tend",
"def hashfunction(key, size)\n #key.hash % size\n key % size\n end",
"def my_hash_finding_method(source, thing_to_find)\n source.select! do|key, value|\n value == thing_to_find\n end\n return source.keys\nend",
"def hashcode_with_internal_hashes(key)\n h, full_hs = phf_with_hashes(key)\n if @g[h] == @r\n return NON_KEY, full_hs # no key\n end\n a, b = h.divmod(RANK_SUPERBLOCKSIZE)\n if a == 0\n result = 0\n else\n result = @rs[a-1]\n end\n b, c = b.divmod(RANK_BLOCKSIZE)\n if b != 0\n result += @rb[a*(RANK_SUPERBLOCKSIZE/RANK_BLOCKSIZE-1)+b-1]\n end\n (h-c).upto(h-1) {|i|\n result += 1 if @g[i] != @r\n }\n return result, full_hs\n end",
"def _hash_val(b_key, &block)\n return ((b_key[block.call(3)] << 24) | \n (b_key[block.call(2)] << 16) | \n (b_key[block.call(1)] << 8) | \n (b_key[block.call(0)])) \n end",
"def using_hash(arr1, arr2)\n sum1 = 0; sum2 = 0\n for i in 0...arr1.length\n sum1 += arr1[i]\n end\n \n for i in 0...arr2.length\n sum2 += arr2[i]\n end \n\n # return if not integer \n return false if (sum1 - sum2) % 2 == 0\n\n diff = (sum1 - sum2).abs / 2\n\n hsh = {}\n \n for i in 0...arr2.length\n hsh[arr2[i]] = true\n end\n\n for i in 0...arr1.length\n if hsh[diff + arr1[i]] == true\n return true\n end \n end \n\n return false\n\nend",
"def hash=(_arg0); end",
"def hash(*args, **_arg1, &block); end",
"def find_single_bay(hash,lookup)\n\n for key,value in hash\n\n if value[:item] == lookup\n return key \n end\n \n end\n #If gone all the way throuh the hash, no item\n #found so return nil\n return nil\nend",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def hash_two_sum?(arr, target)\n hash = {}\n arr.each do |num|\n return true if hash[target - num]\n hash[num] = true\n end\n false\nend",
"def index(key, size)\n MurmurHash3::V32.str_hash(key.to_s, size) % size\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def total_hash_search(hash_to_find=@hash_to_find, stop_on_success=@sos, verbose=true)\n matches={}\n while(true)\n case @hash_type\n when 'MD4'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MD5'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = darkbyte_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.darkbyte.ru', result)\n break if stop_on_success\n end\n\n result = gromweb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.gromweb.com', result)\n break if stop_on_success\n end\n\n result = md5comcn_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.com.cn', result)\n break if stop_on_success\n end\n\n result = md5onlinenet_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.net', result)\n break if stop_on_success\n end\n\n result = md5onlineorg_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.org', result)\n break if stop_on_success\n end\n\n result = myaddr_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.my-addr.com', result)\n break if stop_on_success\n end\n\n result = noisette_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.noisette.ch', result)\n break if stop_on_success\n end\n\n result = netmd5crack_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('netmd5crack.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n when 'LM'\n result = it64_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('rainbowtables.it64.com', result)\n break if stop_on_success\n end\n\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'LM:NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MYSQL'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'SHA1'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n end\n break # tried all sites by now...\n end\n return matches\n end",
"def testHash(a)\n\n\t\tunless @mem_hash.has_key?(a)\n\t\t\t@mem_hash[a] = @next_empty\n\t\t\t@next_empty += 1\n\t\tend\n\t\ttoBin15 @mem_hash[a].to_i\n\n\tend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def find_value hash\n @values_mapping[hash]\n end",
"def index_of(item)\n hash_value = 0\n item.each_byte { |byte| hash_value += byte }\n hash_value % @table.size\n end",
"def two_sum_hash?(arr, target)\n\n hash = Hash.new(0)\n\n arr.each do |el|\n value = target - el\n if hash.has_key?(value)\n return true\n else\n hash[el] = true\n end\n end\n\n false\n\nend",
"def hash_exists?(id)\n @hashes.has_key? id\n end",
"def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end",
"def my_hash_finding_method(hash, number)\n hash.select {|key, value| value == number}.keys\nend",
"def o1\n hasher = {}\n (0...@n).each do |n|\n sym = n.to_s.to_sym\n hasher[sym] = n\n end\n\n print_header('O(1) examples')\n\n hash_count = hasher.count\n do_benchmark(\"O(1) - Hash with #{hash_count} items\") do\n hasher[hash_count.to_s.to_sym]\n end\n\n self\n end",
"def key_for_min_value(hash)\n aa = 1000000000\n i = nil\n hash.each do |key, value|\n if value <= aa\n aa = value\n i = key\n end\n end\n return i\nend",
"def hash_query(search_str, arr, search_key, return_key)\n\tif arr != nil\n\t\tarr.find {|hash| hash[search_key] == search_str}[return_key]\n\tend\nend",
"def find_it(seq)\n # hash = Hash.new\n \n # seq.each do |num|\n # if hash[num].nil?\n # hash[num] = 1\n # else\n # hash[num] += 1\n # end\n # end\n \n hash = Hash.new(0)\n seq.each { |num| hash[num] += 1 }\n \n hash.each { |k, v| return k if v.odd? }\nend",
"def hash\n self.begin.hash ^ self.end.hash\n end",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash256(hex)\n binary = [hex].pack(\"H*\")\n hash1 = Digest::SHA256.digest(binary)\n hash2 = Digest::SHA256.digest(hash1)\n result = hash2.unpack(\"H*\")[0]\n return result\nend",
"def hash_two_sum(array, target)\n numbers = Hash.new(0)\n array.each { |num| numbers[num] = true }\n numbers.each { |k, v| return true if numbers.has_key?(target - k)}\nend",
"def result(hash, key)\n hash[key]\nend",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"def get_hash(str, hash_table)\n value = 1\n str.each_char do |c|\n return 0 unless hash_table.key?(c)\n value *= hash_table[c]\n end\n value\nend",
"def test_Hash_InstanceMethods_index\n\t\th = {'a'=>100, 'b'=>200}\n\t\t# TODO\n\tend",
"def search(value)\n #get hashed value\n hash_value = hash_function(value)\n\n # if value exists return true\n if @@collection[hash_value] == value\n return true\n else\n return false\n end\n end"
] | [
"0.6977181",
"0.6733928",
"0.66706455",
"0.66574436",
"0.66574436",
"0.66574436",
"0.66574436",
"0.66574436",
"0.66574436",
"0.66574436",
"0.65837216",
"0.6547274",
"0.65019864",
"0.6438475",
"0.63978076",
"0.6380903",
"0.63701254",
"0.63479716",
"0.63391304",
"0.63361657",
"0.63263375",
"0.6324434",
"0.6317087",
"0.63153243",
"0.63153243",
"0.6312089",
"0.63036907",
"0.6296623",
"0.62749016",
"0.62601805",
"0.6246661",
"0.6243789",
"0.62418944",
"0.6181602",
"0.6178071",
"0.6178071",
"0.61656904",
"0.6152731",
"0.6141952",
"0.60991263",
"0.60963714",
"0.60881394",
"0.60881394",
"0.60804534",
"0.60680896",
"0.6059152",
"0.6056021",
"0.60393435",
"0.60336715",
"0.6010437",
"0.5997431",
"0.59819144",
"0.5981543",
"0.596831",
"0.5968034",
"0.59651566",
"0.5948392",
"0.593004",
"0.59299004",
"0.5924083",
"0.5905325",
"0.5901026",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5898081",
"0.5871665",
"0.58654666",
"0.5860483",
"0.58600605",
"0.5847146",
"0.5812121",
"0.5800178",
"0.57871264",
"0.5784226",
"0.5781731",
"0.57726586",
"0.5756476",
"0.5755698",
"0.57495356",
"0.574263",
"0.5739638",
"0.5734867",
"0.572636",
"0.57194436",
"0.5712512",
"0.5708752",
"0.57009757",
"0.568115",
"0.5680919",
"0.56741655",
"0.5669422",
"0.566133",
"0.5656895",
"0.56566447"
] | 0.0 | -1 |
Regexp lookup. Complexity: O(n) | def query_regexp( query )
read_db do |dbm|
dbm.each_key do |key|
puts RDictCcEntry.format_str(dbm[key]) if key =~ /#{query}/
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(regexp); end",
"def match(pattern); end",
"def matching_lines(regex); end",
"def regexp; end",
"def regexp; end",
"def regexp_matcher regexp\n lambda do |string, index = 0, counts:|\n found = regexp.match(string, index)\n result_string = found.to_s\n\n if found && found.begin(0) == index && !result_string.empty?\n result_string\n end\n end\n end",
"def pattern2regex(pattern); end",
"def match(p0) end",
"def match(p0) end",
"def extract(pattern); end",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def regexp=(_arg0); end",
"def r regex\n raise 'First use `use`!' if @use.empty?\n \n @use.each_line do |line|\n line.gsub! /\\n$/, ''\n puts '---- ---- ---- ---- ---- ---- ----'\n puts line.inspect\n results = line.match(regex)\n if results.nil?\n puts \"No match\"\n next\n end\n puts \"Match: #{results[0].inspect}\"\n results.captures.each do |capture|\n puts \"Capture #{results.captures.index capture}: #{capture.inspect}\"\n end\n end\n puts '---- ---- ---- ---- ---- ---- ----'\nend",
"def regexps; end",
"def pre_match() end",
"def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end",
"def re; end",
"def scan strOrRegexp\n @in.scan /\\s*/ # Skip whitespace\n @match = @in.scan strOrRegexp\n @last_matched_token = @match if @match # Update last matched only if a token was matched\n end",
"def regexp(r0, which)\n source, stop_index = r0.source, r0.stop_index\n return factor_result(source, stop_index, stop_index+$&.length) \\\n if source.index(@regexps[which],stop_index)==stop_index\n terminal_parse_failure(r0, which)\n end",
"def each_match_range(range, regex); end",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def match(input)\n regexp.match(input)\n end",
"def match(string)\n result = @trie[string]\n return nil unless result\n result.each do |pattern, block|\n match = pattern.match(string)\n block.call(match) if match\n end\n end",
"def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end",
"def match(input); end",
"def fnmatch(matcher); end",
"def scan(pattern); end",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def submatcher; end",
"def submatcher; end",
"def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end",
"def word_pattern(pattern, input)\n \nend",
"def match(regexp)\n return regexp.match(pickle_format)\n end",
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def find(regexp)\n self.body[regexp] ? $1 : nil\n end",
"def match(keyword); end",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def match(text)\n if match = @regexp.match(text)\n @matched_text = match.to_s\n [match.to_s, @name]\n else\n nil\n end\n end",
"def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end",
"def =~(str)\n str = str.to_s if str.is_a?(Symbol)\n # unless str.nil? because it's nil and only nil, not false.\n str = StringValue(str) unless str.nil?\n\n match = match_from(str, 0)\n if match\n Regexp.last_match = match\n return match.begin(0)\n else\n Regexp.last_match = nil\n return nil\n end\n end",
"def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end",
"def methods_matching(re); end",
"def gruber_find(text, schemes = nil)\n schemes = schemes.nil? ? nil : schemes.to_a\n if schemes.nil? then\n scheme_re = $gruber_re_scheme\n else\n scheme_alt = schemes.join('|')\n scheme_re = \"(?:(?:#{scheme_alt}):(?:/{1,3}))\"\n end\n scheme_rec = $gruber_re_front + scheme_re + $gruber_re_back\n gruber_re = Regexp.new(scheme_rec)\n return text.scan(gruber_re).map { |o| o[0] }\nend",
"def multireg(regpexp, str)\n result = []\n while regpexp.match(str)\n result.push regpexp.match(str)\n str = regpexp.match(str).post_match\n end\n result\n end",
"def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end",
"def mreplace regexp, &block\n matches = []\n offset = 0\n while self[offset..-1] =~ regexp\n matches << [offset, $~]\n offset += $~.end($~.size - 1)\n end\n raise 'unmatched' if matches.empty?\n\n matches.reverse.each do |offset, match|\n slice = self[offset...-1]\n send = (1...match.size).map {|i| slice[match.begin(i)...match.end(i)]}\n if send.length == 1\n recv = block.call(send.first)\n self[offset+match.begin(1)...offset+match.end(1)] = recv\n else\n recv = block.call(*send)\n next unless recv\n (1...match.size).map {|i| [match.begin(i), match.end(i), i-1]}.sort.\n reverse.each do |start, fin, i|\n self[offset+start...offset+fin] = recv[i]\n end\n end\n end\n self\n end",
"def safe_match(regex, search_str)\n matchdata = regex.match(search_str)\n return \"\" if matchdata.nil?\n return \"\" if matchdata.size < 2\n return matchdata[1]\n end",
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def match_string_to_regexp(str)\n #str = str.split(/(\\(\\(.*?\\)\\))(?!\\))/).map{ |x|\n # x =~ /\\A\\(\\((.*)\\)\\)\\Z/ ? $1 : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n #str = str.split(/([#$]\\(.*?\\))/).map{ |x|\n # x =~ /\\A[#$]\\((.*)\\)\\Z/ ? ($1.start_with?('#') ? \"(#{$1})\" : $1 ) : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n$stderr.puts \"HERE!!!!!!\"\n\n str = str.split(PATTERN).map{ |x|\n case x\n when /\\A\\(\\((.*)\\)\\)\\Z/\n $1\n when /\\A[#$]\\((.*)\\)\\Z/\n $1.start_with?('#') ? \"(#{$1})\" : $1\n else\n Regexp.escape(x)\n end\n }.join\n\n str = str.gsub(/\\\\\\s+/, '\\s+')\n\n Regexp.new(str, Regexp::IGNORECASE)\n\n #rexps = []\n #str = str.gsub(/\\(\\((.*?)\\)\\)/) do |m|\n # rexps << '(' + $1 + ')'\n # \"\\0\"\n #end\n #str = Regexp.escape(str)\n #rexps.each do |r|\n # str = str.sub(\"\\0\", r)\n #end\n #str = str.gsub(/(\\\\\\ )+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n end",
"def parse(text)\n #10 seconds timeout\n #because those huge regular expressions can take a LONG time if there is no match\n m = nil\n begin\n timeout(10) do\n m = @regexp.match(text)\n end\n rescue => err\n raise \"REGEXP TIMEOUT!\"\n end\n\n if m.nil?\n if @excepts\n raise \"REGEXP from #{@templatefile} IS::::::::::::::::::::::::\\n#{@regexp.source}\" +\n \"COULD NOT MATCH PAGE TEXT:::::::::::::::::::::::::::::\\n#{text}\"\n end\n return nil\n end\n\n vals = []\n # the ... means 1 to val -1 so all of the matches\n (1...m.size).each do |i|\n if @repetitions.key?(i)\n reg = @repetitions[i][0]\n vals<< m[i].scan(reg)\n else\n vals<< m[i]\n end\n end\n return vals\n end",
"def translate_matches\n char_class_re = /(.)-(.)/.freeze\n source.gsub!(char_class_re) { translate_range(*_1.split('-')) }\n nil\n end",
"def on_match_pattern_p(node); end",
"def show_regexp(string, pattern)\n match = pattern.match(string)\n if match\n \"#{match.pre_match}->#{match[0]}<-#{match.post_match}\"\n else\n \"no match\"\n end\nend",
"def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def ORIGnext_match str\n return unless str\n first = nil\n ## content can be string or Chunkline, so we had to write <tt>index</tt> for this.\n ## =~ does not give an error, but it does not work.\n @native_text.each_with_index do |line, ix|\n offset = 0\n # next line just a hack and not correct if only one match in file FIXME\n offset = @curpos + 1 if ix == @current_index\n _col = line.index str, offset\n if _col\n first ||= [ ix, _col ]\n if ix > @current_index || ( ix == @current_index && _col > @curpos)\n return [ix, _col]\n end\n end\n end\n # if first is nil, then none found in current line also, so don't increment offset in current line\n # next time. FIXME TODO\n return first\n end",
"def match(text)\n shift = 0\n result = []\n\n # Try to take previous element from cache, if .test() called before\n if (@__index__ >= 0 && @__text_cache__ == text)\n result.push(Match.createMatch(self, shift))\n shift = @__last_index__\n end\n\n # Cut head if cache was used\n tail = shift ? text.slice(shift..-1) : text\n\n # Scan string until end reached\n while (self.test(tail))\n result.push(Match.createMatch(self, shift))\n\n tail = tail.slice(@__last_index__..-1)\n shift += @__last_index__\n end\n\n if (result.length)\n return result\n end\n\n return nil\n end",
"def show_regexp(a, re) \n if a =~ re \n \"#{$`}<<#{$&}>>#{$'}\" \n else \n \"no match - #{a} - #{re}\" \n end \nend",
"def boyerMooreStringSearch(text,pattern,bad_symbol_shift,good_suffix_shift)\n\treturn nil if pattern.nil? or text.nil?\n text, pattern = text.unpack('U*'), pattern.unpack('U*')\n n=0 \n while (n <= text.length - pattern.length) do \n m = pattern.length - 1 \n while (pattern[m] == text[m+n]) do\n return n if m==0 \n m -= 1; \n end \n # If not found, shift based on our precomputed tables\n n += max(good_suffix_shift[m], m - bad_symbol_shift[text[n+m]]);\n end\n return nil \nend",
"def on_match_pattern(node); end",
"def match_index(lines, regexp)\n index = 0\n lines.each do |line|\n return index if line =~ regexp\n index += 1\n end\n nil\n end",
"def address_part(reg_exp, string = address_parts)\n string.find { |line| reg_exp.match line.downcase }\n end",
"def pattern_matcher *pattern\n lambda do |string, index = 0, counts:|\n original_counts = counts.dup\n\n pattern.inject([]) do |memo, part|\n found = part.call(string, index, counts: counts)\n\n if match? found\n index += found.size\n memo.push(*found)\n else\n counts.replace(original_counts)\n return found\n end\n end\n end\n end",
"def add_regexp(regexp)\n starting_chars = regexp.starting_chars\n if starting_chars.kind_of? Symbol \n scanning_table.default = regexp\n else\n common_chars = starting_chars.select { |c| scanning_table.has_key? c } \n starting_chars = starting_chars - common_chars\n starting_chars.each { |c| scanning_table[c] = regexp }\n colliding_states = common_chars.map { |c| scanning_table[c] }\n colliding_states.uniq!\n colliding_states.zip(common_chars).each { |r,c| scanning_table[c] = RegexpSpecification.mix(regexp,r) }\n end\t\n \n if @built\n build\n end\n \n self\n end",
"def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end",
"def try_regexp( str, re )\n\tif str =~ re\n\t\tputs \" #$PREMATCH\",\n\t\t \" \" + colorize( 'bold', 'green' ) { $MATCH },\n\t\t \" #$POSTMATCH\"\n\telse\n\t\tputs colorize( \"Nope.\", 'red' )\n\tend\nend",
"def match(str=nil)\n return DelayedMatchConstructor.new unless str\n \n return Atoms::Re.new(str)\n end",
"def initialize find, replace\n @regexp = Regexp.new(\"^#{find}$\")\n @replace = replace\n end",
"def next_regex str\n first = nil\n ## content can be string or Chunkline, so we had to write <tt>index</tt> for this.\n ## =~ does not give an error, but it does not work.\n @list.each_with_index do |line, ix|\n col = line =~ /#{str}/\n if col\n first ||= [ ix, col ]\n if ix > @current_index\n return [ix, col]\n end\n end\n end\n return first\n end",
"def regex\n Regexp.new(@str)\n end",
"def regex(pattern)\n Regexp.new pattern.regex\n end",
"def monocle(inputString)\n\toptic = Regexp.new(inputString)\n\treturn optic\nend",
"def maybe_matcher *pattern\n submatcher = pattern_matcher(*pattern)\n\n lambda do |string, index = 0, counts:|\n found = submatcher.call(string, index, counts: counts)\n\n if match? found\n found\n else\n []\n end\n end\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def match_against filename\n @regexp.match(filename)\n end",
"def matching_mapping(key)\n regexp_mappings = (mapping || {}).select { |k, _v| k.class == Regexp }\n (regexp_mappings.detect { |rex, _init| rex.match?(key.to_s) } || []).last\n end",
"def similar_match str\n if !str || str == ''\n return Regexp.new('.*')\n end\n str_array = str.split('')\n reg_str = '(.*?)'\n str_array.each do |x| \n reg_str += \"#{x}(.*?)\"\n end\n\n return reg_str\n end",
"def scan2(regexp)\n captures = Hash.new\n scan(regexp).collect do |match|\n captures.add(:tagcapt, match[0].remove(\"@\"))\n end\n\n return (captures == {}) ? nil : captures\n end",
"def get_regex(pattern, encoding='ASCII', options=0)\n Regexp.new(pattern.encode(encoding),options)\nend",
"def regex(word)\n if word =~ /lab/\n puts word\n else\n puts \"No match\" \n end\nend",
"def scan(regex)\n while @scanner.scan_until(regex)\n match = @scanner.matched\n position = @scanner.charpos - match.length\n yield match, position, match.length\n end\n end",
"def match(input)\n input \n end",
"def extract_regexps(line)\n r = []\n line.scan(/\\s@(rx|dfa) (?:\"((?:\\\\\"|[^\"])+)\"|([^ ]+?))(\\s|$)/) {r << $2}\n r\nend",
"def match(value)\n return _match(@_compiled_pattern, value)\n end",
"def match; end",
"def match; end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def regex(_obj)\n raise NotImplementedError\n end",
"def prepare_for_regexp(output_str)\n split_lines(output_str).map do |str|\n Regexp.new(Regexp.escape(str), Regexp::EXTENDED)\n end\n end",
"def find_exp(input, variable, expression); end",
"def regexp_variables\n return @regexp_variables if @regexp_variables\n @regexp_variables = Array.new\n @base_theme.scan(VARIABLE_MATCHER) { @regexp_variables << $2 }\n @regexp_variables\n end",
"def _find_next regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_next #{@search_found_ix} : #{@current_index}\"\n fend = @list.size-1\n if start != fend\n start += 1 unless start == fend\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.upto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = 0\n if @search_wrap\n start.upto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"def start_re; end",
"def match(regexp)\n self.decoded.match(regexp)\n end",
"def load_file_into_regexes(filename, regex_pos)\n lines = File.open(filename, 'r').readlines\n hash = {}\n lines.each do |line|\n arr = line.split(/,/)\n regex = Regexp.new(arr[regex_pos])\n hash[regex] = 0\n end\n hash\nend",
"def match re\n unless re.inspect[1..2] == \"\\\\A\"\n a = re.inspect\n a[0] = \"/\\\\A\"\n re = eval(a)\n end\n @last_match = remaining.match(re)\n end",
"def next_regex regex\n if regex.is_a? Symbol\n regex = @text_patterns[regex]\n raise \"Pattern specified #{regex} does not exist in text_patterns \" unless regex\n end\n @last_regex = regex\n find_more\n end",
"def _find_prev regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_prev #{@search_found_ix} : #{@current_index}\"\n if start != 0\n start -= 1 unless start == 0\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.downto(0) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = @list.size-1\n if @search_wrap\n start.downto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end"
] | [
"0.73179525",
"0.67580336",
"0.67422414",
"0.6416007",
"0.6416007",
"0.6344963",
"0.6338384",
"0.6328133",
"0.6328133",
"0.6288313",
"0.62152493",
"0.61807865",
"0.61125094",
"0.610289",
"0.6040123",
"0.6001946",
"0.6001755",
"0.5988799",
"0.5987731",
"0.5979083",
"0.5978514",
"0.5978489",
"0.597842",
"0.59631884",
"0.5956591",
"0.5927885",
"0.58856547",
"0.5884049",
"0.58709085",
"0.58709085",
"0.5804026",
"0.57999736",
"0.5775428",
"0.5751688",
"0.5739494",
"0.57360697",
"0.5733859",
"0.57302904",
"0.57278854",
"0.5714822",
"0.57077307",
"0.570758",
"0.5706489",
"0.5692683",
"0.56910294",
"0.5684322",
"0.567972",
"0.56639516",
"0.56639516",
"0.56488186",
"0.5643257",
"0.5641352",
"0.56185865",
"0.5612415",
"0.560232",
"0.55569506",
"0.55569506",
"0.55569506",
"0.55559105",
"0.5551385",
"0.5551045",
"0.5547645",
"0.5531212",
"0.55202067",
"0.5515803",
"0.55153275",
"0.54984",
"0.54940486",
"0.5483039",
"0.54810697",
"0.54789615",
"0.54713464",
"0.5471001",
"0.5464288",
"0.5463834",
"0.5462468",
"0.5458869",
"0.54583395",
"0.54453987",
"0.544229",
"0.5441753",
"0.5435226",
"0.5432106",
"0.5427863",
"0.54190713",
"0.5411911",
"0.5404458",
"0.5403573",
"0.5403573",
"0.53944296",
"0.5390122",
"0.5388621",
"0.53869957",
"0.53818506",
"0.5379828",
"0.537674",
"0.5376275",
"0.5361486",
"0.535585",
"0.5354305",
"0.5343354"
] | 0.0 | -1 |
Fulltext regexp lookup. Complexity: O(n) | def query_fulltext_regexp( query )
read_db do |dbm|
dbm.each_value do |raw_val|
val = RDictCcEntry.format_str(raw_val)
match_line_found = false
val.each_line do |line|
if line =~ /^\s+/
if match_line_found
puts line
else
# Skip lines starting with blanks, because these are already
# translations and they don't belong to the matching line.
next
end
else
match_line_found = false
end
if line.downcase =~ /#{query}/
puts line
match_line_found = true
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(regexp); end",
"def match(keyword); end",
"def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end",
"def word_pattern(pattern, input)\n \nend",
"def matching_lines(regex); end",
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def pre_match() end",
"def regexp; end",
"def regexp; end",
"def match(pattern); end",
"def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend",
"def match_query(query); end",
"def find_reg_ex_matches( reg_ex )\n match_set = Set.new\n @words_set.to_a.each do |word|\n match_set.add word if word.downcase.match(reg_ex)\n end\n match_set\n end",
"def re; end",
"def match(tokens, definitions); end",
"def regexps; end",
"def submatcher; end",
"def submatcher; end",
"def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend",
"def fulltextsearch(query, text, words=2)\n result = \"\"\n if text =~ /.*#{query}.*/i\n text_words = text.scan(/\\w*/)\n indexes = []\n text_words.each_with_index do |word,index|\n if word =~ /.*#{query}.*/i\n i = []\n i << index - words unless words == 0 || index - words < 0\n i << index\n i << index + words unless words == 0 || index + words > text_words.length\n indexes << i\n end\n end\n indexes.each do |i|\n result += \"... \" unless i.length == 1\n i.each {|j| result += \"#{text_words[j]} \"}\n result += \" ...\" unless i.length == 1\n end\n end\n result\n end",
"def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end",
"def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend",
"def match(p0) end",
"def match(p0) end",
"def match(text)\n if match = @regexp.match(text)\n @matched_text = match.to_s\n [match.to_s, @name]\n else\n nil\n end\n end",
"def regex_search\n if use_regex?\n ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formated_value))\n else\n non_regex_search\n end\n end",
"def on_match_pattern(node); end",
"def on_match_pattern_p(node); end",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def regexp=(_arg0); end",
"def search_full(pattern, succptr, getstr)\n _scan(pattern, succptr, getstr)\n end",
"def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end",
"def prepare_search(term, opts = {})\n data_nil?\n r1 = build_regexp(term, opts)\n @search_result = []\n r1\n end",
"def all_matches( re, what )\n matches = []\n m = true\n\n matches << OpenStruct.new({\n :match => \"!fake!\",\n :start => 0,\n :end => 0,\n :fake => true\n })\n\n while m\n if matches.size == 1\n m = what.match(re)\n else\n m = (@@allMatchesSpecialChar + what).match(re)\n end\n\n if m\n pos = what.index(m[0])\n\n if pos > 0\n matches << OpenStruct.new({\n :match => what[0, pos],\n :start => matches.last.end,\n :end => matches.last.end + pos,\n :plain => true\n })\n end\n\n matches << OpenStruct.new({\n :match => m[0],\n :start => matches.last.end,\n :end => matches.last.end + m[0].length\n })\n\n what = what[pos + m[0].length..-1]\n end\n end\n\n if what.length > 0\n matches << OpenStruct.new({\n :match => what,\n :start => matches.last.end,\n :end => matches.last.end + what.length,\n :plain => true\n })\n end\n\n matches\n end",
"def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend",
"def search(word)\r\n \r\n end",
"def regexp_matcher regexp\n lambda do |string, index = 0, counts:|\n found = regexp.match(string, index)\n result_string = found.to_s\n\n if found && found.begin(0) == index && !result_string.empty?\n result_string\n end\n end\n end",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def calculate_match_probability\n # two heuristics: \n # 1 is are their multiple words in term_text? if so, mark as probable\n # if not, does it match the anchor regexp? if so, mark as probable\n # else, mark as improbable\n \n # multiple words?\n anchor_regexp = \"(featuring|plus|the|presents|with|plus|and|\\,|\\&|[()]|\\/|\\:|\\-|^|$)\"\n nix_regexp = \"parking|\\svs\\.?\\s\" \n if artist_name=~/#{nix_regexp}/i\n self.match_probability=\"unlikely\"\n return nil\n end\n text=term_text.strip\n if text[\" \"]\n self.match_probability=\"likely\"\n return \"multpl\"\n end\n if artist_name=~/#{anchor_regexp}\\s*#{text}\\s*#{anchor_regexp}/i\n self.match_probability=\"likely\"\n return \"regexp\"\n end\n# if artist_name=~/#{anchor_regexp}\\s+?#{text}\\s+?#{anchor_regexp}/i\n# match_probability=\"likely\"\n# return \"regexp\"\n# end\n self.match_probability=\"unlikely\"\n return nil\n end",
"def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end",
"def matchanywhere(rgx, text)\n if rgx[0] == '^'\n return matchhere(rgx[1..-1], text)\n elsif matchhere(rgx, text)\n return true\n elsif text.nil? && !rgx.nil?\n return false\n else\n return matchanywhere(rgx, text[1..-1])\n end\nend",
"def match(str=nil)\n return DelayedMatchConstructor.new unless str\n \n return Atoms::Re.new(str)\n end",
"def rematch_for_profile_text_index(pti)\r\n\r\n return # THIS IS NOW DISABLED! handled async\r\n\r\n # return if !pti.profile.active?\r\n # \r\n # query_text = ''\r\n # query_text << prep_text_for_match_query(pti.profile_text) if pti.profile_text\r\n # query_text << ' . '+prep_text_for_match_query(pti.all_answers_text) if pti.answers_text\r\n # mysql_match_term = 'match (qti.question_text) against (?)'\r\n # \r\n # #Profile.transaction do\r\n # \r\n # # for existing question matches, rematch to see if rank changes or if we are excluded\r\n # # this assumes we are matched to a reasonable number of questions\r\n # ps = db_prepare(\"select question_id from question_profile_matches where profile_id=?\")\r\n # ps.execute(pti.profile_id)\r\n # \r\n # while rs = ps.fetch\r\n # match_question_to_profiles(Question.find(rs[0]))\r\n # end\r\n # ps.close\r\n # \r\n # # attempt to find new questions we match on in an optimized fashion using\r\n # # reverse profile->questions matching\r\n # ps = db_prepare(\"select qti.question_id, #{mysql_match_term} as match_rank\"+\r\n # \" from question_text_indices qti\"+\r\n # \" join questions q on q.id=qti.question_id\"+\r\n # \" left join question_profile_matches qpm on qpm.question_id=q.id and qpm.profile_id=?\"+\r\n # \" left join question_profile_exclude_matches qpcm on qpcm.question_id=q.id and qpcm.profile_id=?\"+\r\n # \" left join answers a on a.question_id=q.id and a.profile_id=?\"+\r\n # # ignore questions we're already matched to\r\n # # dont match to those we have marked as ignore\r\n # # or those that we have already answered\r\n # \" where qpm.question_id is null and qpcm.question_id is null and a.question_id is null\"+\r\n # # only match open questions\r\n # \" and q.open_until>current_date()\"+\r\n # \" and q.profile_id!=?\"+\r\n # \" and #{mysql_match_term}\"+\r\n # # only match to questions where we will be in the top [prefetch] list\r\n # \" and exists (select min(qpm.rank) as min_rank, max(qpm.order) as max_order from question_profile_matches qpm where qpm.question_id=q.id having min_rank<match_rank or max_order<?)\")\r\n # \r\n # ps.execute(query_text,pti.profile_id,pti.profile_id,pti.profile_id,pti.profile_id,query_text,@@question_match_max_prefetch)\r\n # while rs = ps.fetch\r\n # match_question_to_profiles(Question.find(rs[0])) #!O we could do a reorder or insert\r\n # end\r\n # ps.close\r\n # #end\r\n end",
"def match(string)\n result = @trie[string]\n return nil unless result\n result.each do |pattern, block|\n match = pattern.match(string)\n block.call(match) if match\n end\n end",
"def start_re; end",
"def fnmatch(matcher); end",
"def each_match_range(range, regex); end",
"def methods_matching(re); end",
"def scan strOrRegexp\n @in.scan /\\s*/ # Skip whitespace\n @match = @in.scan strOrRegexp\n @last_matched_token = @match if @match # Update last matched only if a token was matched\n end",
"def match(input); end",
"def alpha_search(str)\r\n\r\nend",
"def search(term)\n # pattern = Regexp.new(pattern, case_insensitive=true)\n # pattern = Regexp.new(pattern, Regexp::EXTENDED | Regexp::IGNORECASE)\n # pattern = Regexp.new(pattern)\n pattern = Regexp.new(term)\n select do |tweet|\n tweet.full_text =~ pattern\n end\n end",
"def pattern2regex(pattern); end",
"def parse(text)\n #10 seconds timeout\n #because those huge regular expressions can take a LONG time if there is no match\n m = nil\n begin\n timeout(10) do\n m = @regexp.match(text)\n end\n rescue => err\n raise \"REGEXP TIMEOUT!\"\n end\n\n if m.nil?\n if @excepts\n raise \"REGEXP from #{@templatefile} IS::::::::::::::::::::::::\\n#{@regexp.source}\" +\n \"COULD NOT MATCH PAGE TEXT:::::::::::::::::::::::::::::\\n#{text}\"\n end\n return nil\n end\n\n vals = []\n # the ... means 1 to val -1 so all of the matches\n (1...m.size).each do |i|\n if @repetitions.key?(i)\n reg = @repetitions[i][0]\n vals<< m[i].scan(reg)\n else\n vals<< m[i]\n end\n end\n return vals\n end",
"def search_full(pattern, advance_pointer, return_string)\n do_scan pattern, advance_pointer, return_string, false\n end",
"def match(text, fix_encode = true)\n return [] if text.nil? or text.empty?\n\n text = text.encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '') if fix_encode\n res = @tagger.getEntities(text)\n types = res[1]\n strings = res[0]\n\n docid = Misc.digest(text)\n global_offset = 0\n strings.zip(types).collect do |mention, type| \n mention = mention.to_s; \n offset = text.index(mention)\n if offset.nil?\n NamedEntity.setup(mention, :docid => docid, :entity_type => type)\n else\n NamedEntity.setup(mention, :offset => offset + global_offset, :docid => docid, :entity_type => type.to_s)\n text = text[offset + mention.length..-1]\n global_offset += offset + mention.length\n end\n\n mention\n end\n end",
"def search(str)\n return [] if str.to_s.empty?\n \n words = str.downcase.split(' ')\n pattern = Regexp.new(words.join('|'))\n matches = []\n\n pages.each do |page|\n if page.title.downcase =~ pattern\n matches << [page, []]\n \n elsif page.body.downcase =~ pattern\n matches << [page, highlight(page.html, words)]\n end\n end\n\n matches\n end",
"def for_term(query_term)\n SubstringRules.for(query_term)\n end",
"def fuzzy_match( query )\n return self.keywords.fuzzy_match(query)\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def match(input)\n regexp.match(input)\n end",
"def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, start_at))\r\n matches.push(m)\r\n start_at = m.end(0)\r\n end\r\n return matches\r\n end",
"def textField(textField, completions:somecompletions, forPartialWordRange:partialWordRange, indexOfSelectedItem:theIndexOfSelectedItem)\n matches = Entry.where(:title).contains(textField.stringValue,NSCaseInsensitivePredicateOption).map(&:title).uniq\n matches\n end",
"def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend",
"def fscan!(str, fuzziness=2)\n str.gsub!(/\\n/, \" \")\n words = str.extend(TRE).ascan regex, TRE.fuzziness(fuzziness)\n words.uniq\n end",
"def scan(pattern); end",
"def find_words(lines, words, sec, point_map)\n found = {}\n max = @letters.length\n lines.each_with_index do |s, i|\n start = 0\n while start < 15\n pattern = ''\n match_regex = ''\n j = start\n while j <= 14 do\n break if s[j] == '!'\n #puts \"** #{i},#{j}\"\n match_regex << (s[j] == '?' ? \"(#{sec[i][j].keys.join('|')})\" : (s[j] == '*' ? '.' : s[j]))\n pattern << s[j]\n break if pattern.count(\".?\") >= max\n j += 1\n end\n if j && j < 14 && s[j] != '!' && words[i][j+1]\n pattern += words[i][j+1]\n match_regex += words[i][j+1]\n end\n\n\n #puts \"regex: #{match_regex}\"\n found.merge!(match(pattern, start, i, words[i], sec[i], point_map[i], match_regex)) unless pattern == ''\n\n if '.?!*'.include?(s[start])\n start += 1\n else\n start += words[i][start].length + 1\n end\n\n end\n end\n #puts \"found: #{found.inspect}\"\n found\n end",
"def match(text)\n shift = 0\n result = []\n\n # Try to take previous element from cache, if .test() called before\n if (@__index__ >= 0 && @__text_cache__ == text)\n result.push(Match.createMatch(self, shift))\n shift = @__last_index__\n end\n\n # Cut head if cache was used\n tail = shift ? text.slice(shift..-1) : text\n\n # Scan string until end reached\n while (self.test(tail))\n result.push(Match.createMatch(self, shift))\n\n tail = tail.slice(@__last_index__..-1)\n shift += @__last_index__\n end\n\n if (result.length)\n return result\n end\n\n return nil\n end",
"def annotate_based_on_exact_string_matching(text)\n # Generate queries from an input text\n build_opts = { min_tokens: @options[\"min_tokens\"],\n max_tokens: @options[\"max_tokens\"] }\n norm_opts = @pgr.get_string_normalization_options\n queries = @qbuilder.build_queries(text, build_opts, norm_opts)\n\n # Retrieve the entries from PostgreSQL DB\n results = @pgr.retrieve( @qbuilder.change_format(queries) )\n\n # Apply post-processing methods\n if @options[\"top_n\"] > 0\n results = @pproc.get_top_n(results, @options[\"top_n\"])\n end\n results = @pproc.keep_last_one_for_crossing_boundaries(results)\n\n format_results(results)\n end",
"def query(needle)\n rx = Regexp.new(needle, Regexp::IGNORECASE) # escaping?\n found = @index.find_all do |term, project|\n rx.match(term)\n end\n results = found.map do |term, project|\n # Yast::Logger#log -> Yast/Logger:log\n path = term.gsub(/::/, \"/\").sub(\"#\", \":\")\n # Term:empty? -> Term%3Aempty%3F\n path = Rack::Utils.escape_path(path)\n Result.new(term, \"http://www.rubydoc.info/#{project}/master/#{path}\")\n end\n results.sort_by(&:text)\n end",
"def has_match_for_all(text, regexp)\n text.to_a.all?{ |line| line =~ regexp }\n end",
"def forward_regex regex\n if regex.is_a? Symbol\n regex = @text_patterns[regex]\n raise \"Pattern specified #{regex} does not exist in text_patterns \" unless regex\n end\n $multiplier = 1 if !$multiplier || $multiplier == 0\n line = @current_index\n _arr = _getarray\n buff = _arr[line].to_s\n return unless buff\n pos = @curpos || 0 # list does not have curpos\n $multiplier.times {\n found = buff.index(regex, pos)\n if !found\n # if not found, we've lost a counter\n if line+1 < _arr.length\n line += 1\n else\n return\n end\n pos = 0\n else\n pos = found + 1\n end\n $log.debug \" forward_word: pos #{pos} line #{line} buff: #{buff}\"\n }\n $multiplier = 0\n @current_index = line\n @curpos = pos\n ensure_visible\n @repaint_required = true\n end",
"def search_expansions(str, pos= 0, len= -1, limit= 0)\n end",
"def case_insensitive_match; end",
"def start_word_pattern; end",
"def define_word_EDICT(word)\n @edict = 'edict2utf8'\n @word_matches = File.readlines(@edict).grep(/#{word}/)\n\n @best_match = []\n \n @word_matches.each do |x|\n @match = x.split(/[ ()\\[\\];]/)\n \n if @match[0] == word || @match[1] == word || @match[2] == word || @match[3] == word\n @best_match << x\n end\n end\n \n return @best_match\n end",
"def query_regexp( query )\n read_db do |dbm|\n dbm.each_key do |key|\n puts RDictCcEntry.format_str(dbm[key]) if key =~ /#{query}/\n end\n end\n end",
"def gruber_find(text, schemes = nil)\n schemes = schemes.nil? ? nil : schemes.to_a\n if schemes.nil? then\n scheme_re = $gruber_re_scheme\n else\n scheme_alt = schemes.join('|')\n scheme_re = \"(?:(?:#{scheme_alt}):(?:/{1,3}))\"\n end\n scheme_rec = $gruber_re_front + scheme_re + $gruber_re_back\n gruber_re = Regexp.new(scheme_rec)\n return text.scan(gruber_re).map { |o| o[0] }\nend",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end",
"def suggest(query_term)\n @qt = query_term\n @candidates = Candidates.new\n srs = for_term(@qt)\n\n srs.each do |seg|\n @lex.search(seg).each do |result|\n found(result)\n end\n end\n\n # Run substring rules\n # Check confidence\n # Run ngrams\n # Return most confident candidate set\n return @candidates\n end",
"def search(word)\n \n end",
"def boyerMooreStringSearch(text,pattern,bad_symbol_shift,good_suffix_shift)\n\treturn nil if pattern.nil? or text.nil?\n text, pattern = text.unpack('U*'), pattern.unpack('U*')\n n=0 \n while (n <= text.length - pattern.length) do \n m = pattern.length - 1 \n while (pattern[m] == text[m+n]) do\n return n if m==0 \n m -= 1; \n end \n # If not found, shift based on our precomputed tables\n n += max(good_suffix_shift[m], m - bad_symbol_shift[text[n+m]]);\n end\n return nil \nend",
"def regexp(r0, which)\n source, stop_index = r0.source, r0.stop_index\n return factor_result(source, stop_index, stop_index+$&.length) \\\n if source.index(@regexps[which],stop_index)==stop_index\n terminal_parse_failure(r0, which)\n end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def initialize find, replace\n @regexp = Regexp.new(\"^#{find}$\")\n @replace = replace\n end",
"def matching_bigrams(word1)\n list = @index[word1]\n list.map{ |word2| @table[[word1,word2]] }\n end",
"def start_re=(_); end",
"def find(t)\n text = t\n text.downcase! unless @case_sensitive\n text.gsub!(/\\s+/,' ') # Get rid of multiple spaces.\n @state = 0\n index = 0\n text.each_char do |char|\n # Incrementing now so that I can announce index - @length.\n index += 1\n @state = step(@state,char)\n if @state == @length # Yay, we've got ourselves a match!\n puts \"Match found for #{@word[1,@length]} at #{index - @length}\"\n @state = 0\n end\n end\n end",
"def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def search(word)\n last = word.each_char.inject(@root) do |curr, char|\n curr.is_a?(TrieNode) ? curr[char] : nil\n end \n last && last[:_] || false \n end",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def extract(pattern); end",
"def scan(search_exp, used_as_search_exp_occurence = nil)\n if used_as_search_exp_occurence then\n encode(@str).\n gsub(Regexp.new(used_as_search_exp_occurence.encoded_regexp_str)) do |o|\n \"S#{o.hex_encode}S\"\n end.\n scan(Regexp.new(search_exp.encoded_regexp_str)).\n map do |part|\n part.gsub!(/S\\h+S/) { |m| m[1...-1].hex_decode }\n Text.new(decode(part))\n end\n else\n encode(@str).\n scan(Regexp.new(\"(#{search_exp.encoded_regexp_str})\")).map(&:first).\n map { |part| Text.new(decode(part)) }\n end\n end",
"def match_against filename\n @regexp.match(filename)\n end",
"def test_string_matcher\n ngram_builder = SimString::NGramBuilder.new(3)\n db = SimString::Database.new(ngram_builder)\n\n db.add(\"Barack Hussein Obama II\")\n db.add(\"James Gordon Brown\")\n\n matcher = SimString::StringMatcher.new(db, SimString::CosineMeasure.new)\n\n assert_equal([], matcher.search(\"Barack Obama\", 0.6))\n assert_equal([\"James Gordon Brown\"], matcher.search(\"Gordon Brown\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 1, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Barack Hussein Obama I\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Barack Hussein Obama II\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Obama\", 0.42, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Obama\", 0.43, SimString::OverlapMeasure.new))\n end"
] | [
"0.68299747",
"0.6342473",
"0.62648624",
"0.61767787",
"0.617327",
"0.61730075",
"0.61099666",
"0.60797215",
"0.6057485",
"0.6057485",
"0.60552454",
"0.60254884",
"0.600918",
"0.5985297",
"0.5951371",
"0.59369147",
"0.59265125",
"0.59112245",
"0.59112245",
"0.58205426",
"0.57938796",
"0.57896733",
"0.57679397",
"0.5747721",
"0.5747721",
"0.5746925",
"0.5738865",
"0.5727701",
"0.57168674",
"0.57045126",
"0.570015",
"0.56555986",
"0.56489295",
"0.5643437",
"0.5639532",
"0.56200886",
"0.5614095",
"0.5600636",
"0.56000257",
"0.5586348",
"0.55754435",
"0.5555873",
"0.55526364",
"0.55444616",
"0.55438584",
"0.5543572",
"0.55155987",
"0.5510676",
"0.55078614",
"0.5505277",
"0.5489988",
"0.5476837",
"0.5464588",
"0.54621863",
"0.5458353",
"0.5448516",
"0.54336846",
"0.54317766",
"0.54301286",
"0.5427094",
"0.5422842",
"0.5421568",
"0.54172915",
"0.54114527",
"0.5405885",
"0.54022545",
"0.53962564",
"0.53917557",
"0.5391056",
"0.53906375",
"0.5388089",
"0.5384939",
"0.5384522",
"0.5383963",
"0.5380653",
"0.5377225",
"0.5373299",
"0.53732747",
"0.5356358",
"0.5351253",
"0.53501487",
"0.53498614",
"0.53482974",
"0.53478605",
"0.5339899",
"0.5331985",
"0.5331985",
"0.5331985",
"0.5320778",
"0.5312878",
"0.5312856",
"0.5306714",
"0.5299508",
"0.5285134",
"0.52739584",
"0.5267202",
"0.5266462",
"0.52568793",
"0.52515405",
"0.52510923"
] | 0.68641853 | 0 |
Public: Add new rawdata to parser data String the request headers data Returns nothing | def <<(data)
@parser << data
@buffer << data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(data)\n\t\t\t\tif @finished # Header finished, can only be some more body\n\t\t\t\t\t@body << data\n\t\t\t\telse # Parse more header using the super parser\n\t\t\t\t\t@data << data\n\t\t\t\t\tif data =~ /\\r?\\n\\r?\\n/\n\t\t\t\t\t\theaders, @body = @data.split(/\\r?\\n\\r?\\n/,2)\n\t\t\t\t\t\theaders = headers.split(/\\r?\\n/)\n\t\t\t\t\t\trequest = headers.shift\n\t\t\t\t\t\theaders.each do |h|\n\t\t\t\t\t\t\tk,v=h.split(/:\\s*/,2);\n\t\t\t\t\t\t\tk = k.upcase.gsub(/\\-/,'_')\n\t\t\t\t\t\t\t@headers[k] = v\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@headers['CONTENT_LENGTH'] = (@headers['CONTENT_LENGTH']) ? @headers['CONTENT_LENGTH'].to_i : 0\n\t\t\t\t\t\t@verb, @fullpath, @httpver = request.split(/ /)\n @uri = URI.parse(@fullpath)\n if @uri.query\n @query_hash = Hash[*@uri.query.split(/&/).map {|x| x.split(/=/,2)}.flatten]\n end\n\t\t\t\t\t\t@finished = true\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif finished? # Check if header and body are complete\n\t\t\t\t\t@data = nil\n\t\t\t\t\ttrue # Request is fully parsed\n\t\t\t\telse\n\t\t\t\t\tfalse # Not finished, need more data\n\t\t\t\tend\n\t\t\tend",
"def parse(rawdata)\n end",
"def parse!\n if /^(?<key>.*?):(?<value>.*)/m =~ @raw\n @key = key.strip\n @value = value.strip\n else\n raise \"Unable to parse Header: #{@raw}\"\n end\n end",
"def header_to_hash data\n header = {}\n data = data.split(@opts[:delimiter])\n self.req[\"Verb\"], self.req[\"Url\"], self.req[\"Version\"] = data.shift.split(\" \", 3)\n data.each do |line|\n k,v = line.split(\":\", 2)\n if !@opts[:header_bl] || !(HEADER_BLACKLIST.include? k)\n header[k] = v.lstrip\n end\n end\n header\n end",
"def initialize(header_data, content_data = '')\n @content_data = StringIO.new content_data.to_s\n @header_data = header_data\n end",
"def send_raw_data request, response, data, mime, status_code = 200, headers = {}\n\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\tresponse.status = status_code if response.status == 200 # avoid resetting a manually set status \n\t\t\t\tresponse['content-type'.freeze] = mime\n\t\t\t\tresponse['cache-control'.freeze] ||= 'public, max-age=86400'.freeze\t\t\t\t\n\t\t\t\tresponse.body = data\n\t\t\t\t# response['content-length'] = data.bytesize #this one is automated by the server and should be avoided to support Range requests.\n\t\t\t\ttrue\n\t\t\tend",
"def raw_headers; end",
"def initialize_data\n @data = parse_body || {}\n end",
"def parse_header_contents; end",
"def parse_header\n header.each do |field, value|\n self.instance_variable_set(\"@#{field}\", value) if HEADER_FIELDS.include? field\n end\n end",
"def cgi_parse_header(line); end",
"def parseHeaders(request) \n headers = {};\n\n # Loop through headers\n request.lines[1..-1].each do |line|\n # If we are moving to the next line, return what we currently have\n return headers if line == \"\\r\\n\"\n\n # Structure data\n header, value = line.split\n header = header.gsub(\":\", \"\").downcase.to_sym\n headers[header] = value\n end\nend",
"def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end",
"def initialize(string)\n if self.class.has_headers?(string)\n # if there is a separator between header content and body content\n if string =~ HEADERS_SEPARATOR_PATTERN\n @string = $'\n header_content = $`\n super(@string)\n\n @headers = Redhead::HeaderSet.parse(header_content)\n else\n @string = \"\"\n super(@string)\n\n # we're dealing with only headers, so pass in the entire original string.\n # this lets us deal with inputs like new(\"foo: bar\")\n @headers = Redhead::HeaderSet.parse(string)\n end\n else\n @string = string\n super(@string)\n @headers = Redhead::HeaderSet.new([])\n end\n end",
"def _push data\n\t\t\tresponse << data.to_s\n\t\tend",
"def initialize(raw_data)\n @raw_data = raw_data\n end",
"def parse_response_data\n log :debug, \"cas_server response.body:\\r\\n#{@raw_data}\"\n formatted_data = format_data\n formatted_data = formatted_data.nil? ? @raw_data : formatted_data\n log :debug, \"Formatted response.body: #{formatted_data}\"\n\n formatted_data\n end",
"def header_data\n\t\treturn self.normalized_headers.to_s\n\tend",
"def headers=(hash); end",
"def headers=(hash); end",
"def fill_header(response); end",
"def initialize(data)\n @header = Hash.new\n\n # Parse request\n line = data.gets.split\n @protocol = line[2]\n @method = line[0]\n @query_string = line[1].match(/\\?(.*?)$/)\n unless @query_string.nil?\n @query_string = @query_string[1]\n end\n @path = line[1].gsub(/\\?(.*?)$/, '')\n\n # Parse header\n while (line = data.gets) != \"\\r\\n\"\n line = line.split\n @header[line[0][0..-2]] = line[1..-1].join(' ')\n end\n\n # Deal with WebSocket\n if @header['Upgrade'] == 'websocket' && @header['Connection'] == 'Upgrade'\n @method = 'WEBSOCKET'\n end\n\n # Deal with EventSource\n if @header['Accept'] == 'text/event-stream'\n @method = 'EVENTSOURCE'\n end\n\n # Parse body\n @body = data.read\n end",
"def finish_data\n @data.chop!\n name = nil\n \n disp = @headers[\"content-disposition\"]\n raise \"No 'content-disposition' was given.\" if !disp\n \n \n #Figure out value-name in post-hash.\n match_name = disp.match(/name=\\\"(.+?)\\\"/)\n raise \"Could not match name.\" if !match_name\n name = match_name[1]\n \n \n #Fix count with name if given as increamental [].\n if match = name.match(/^(.+)\\[\\]$/)\n if [email protected]?(match[1])\n @counts[match[1]] = 0\n else\n @counts[match[1]] += 1\n end\n \n name = \"#{match[1]}[#{@counts[match[1]]}]\"\n end\n \n \n #Figure out actual filename.\n match_fname = disp.match(/filename=\\\"(.+?)\\\"/)\n \n if match_fname\n obj = Knjappserver::Httpsession::Post_multipart::File_upload.new(\n \"fname\" => match_fname[1],\n \"headers\" => @headers,\n \"data\" => @data\n )\n @return[name] = obj\n @data = nil\n @headers = {}\n @mode = nil\n else\n @return[name] = @data\n @data = nil\n @headers = {}\n @mode = nil\n end\n end",
"def parse_headers raw_headers\n\t\theaders = Hash.new\n\n\t\t# Store values as hash, but don't include duplicate values\n\t\tremove_fws(raw_headers).map do |line|\n\t\t\tkey, value = line.split(\": \", 2)\n\t\t\theaders[key] ||= []\n\t\t\theaders[key] << value unless headers[key].include? value\n\t\tend\n\n\t\t# Pop value from array if there's only one value\n\t\theaders.each{ |key, value| headers[key] = value.pop if value.length == 1 }\n\tend",
"def receive_data(data)\n data = UTF8Cleaner.clean(data)\n begin\n Skates.logger.debug {\n \"RECEIVED : #{data}\"\n }\n @parser.push(data) \n rescue\n Skates.logger.error {\n \"#{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end",
"def parse_message\n header_part, body_part = raw_source.lstrip.split(HEADER_SEPARATOR, 2)\n self.header = header_part\n self.body = body_part\n end",
"def parse_headers(raw_headers)\n # raw headers from net_http have an array for each result. Flatten them out.\n raw_headers.inject({}) do |remainder, (k, v)|\n remainder[k] = [v].flatten.first\n remainder\n end\n end",
"def parsed_request\n request.body.rewind\n\n data = URI.unescape(request.body.read.to_s.split('signed_request=')[1])\nend",
"def parse(data)\n @data = data\n end",
"def add_headers(current_string)\n return current_string if @headers.nil?\n string_headers = @headers.map { |k, v| \" -H '#{k}:#{v}' \" }.join(\"\")\n current_string + string_headers\n end",
"def encode_header(s); s; end",
"def parse_header(raw)\n header = {}\n field = nil\n\n raw.each_line do |line|\n case line\n when /^([A-Za-z0-9!\\#$%&'*+\\-.^_`|~]+):\\s*(.*?)\\s*\\z/om\n field, value = $1, $2\n header[field] = value\n when /^\\s+(.*?)\\s*\\z/om\n value = $1\n fail \"bad header '#{line}'.\" unless field\n\n header[field][-1] << ' ' << value\n else\n fail \"bad header '#{line}'.\"\n end\n end\n\n header.each do |key, value|\n value.strip!\n value.gsub!(/\\s+/, ' ')\n end\n\n header\n end",
"def parse_header(string)\n {\n # identificação do registro header (conteúdo 0)\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # código da empresa no bradesco\n :codigo_empresa => string[26..45].strip,\n # razão social da empresa\n :razao_social => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => convert_date(string[94..99]),\n # brancos\n #:brancos1 => string[100..107],\n # número aviso bancário\n :numero_aviso_bancario => string[108..112],\n # brancos\n #:brancos2 => string[113..378],\n # data de crédito dos lançamentos\n :data_credito => convert_date(string[379..384]),\n # brancos\n #:brancos3 => string[385..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end",
"def body\n @raw.split(header)[1]\n end",
"def receive_data(data)\n # p \"|<-- #{data}\"\n @parser << data\n end",
"def parse_body( data )\n return [ data.delete(\"\\0\") ]\n end",
"def initialize(data, opts)\n @opts = opts\n header, body = data.split(@opts[:delimiter]*2, 2)\n self.req = {}\n self.header = header_to_hash(header)\n self.body = body_to_hash(body)\n end",
"def append_data(data)\n data = Encoding::ASCII_8BIT == data.encoding ? data : data.htb\n chunks << Tapyrus::Script.pack_pushdata(data)\n self\n end",
"def form_data= data\n @headers['Content-Type'] = \"application/x-www-form-urlencoded\"\n @body = self.class.build_query data\n end",
"def receive_data(data)\n @last_data_received_at = Time.now\n @parser << data\n end",
"def test_data_headers(string)\n\n\t\theaders = test_data_response(string).headers\n\n\tend",
"def initialize(data)\n super\n pre_parse!\n end",
"def parse(data); end",
"def parse(content_disposition, header = T.unsafe(nil)); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def add_raw_content(data)\n @content = data\n if File.extname(self.href) =~ /x?html$/\n @content.force_encoding('utf-8')\n end\n guess_content_property\n self\n end",
"def actual_header\n data.lines.first.chomp\n end",
"def parse_setext_header; end",
"def parse_headers(raw_headers)\n headers = {}\n raw_headers.each do |h|\n if h =~ /^# *([a-zA-Z_]+) *:(.*)/\n h_key = $1.downcase.intern\n h_value = $2.split(\",\").collect { |v| v.strip }\n if h_value.length > 0 # ignore empty headers\n headers[h_key] = h_value.length > 1 ? h_value : h_value[0]\n end\n end\n end\n \n return headers\n end",
"def parse(data)\n new_data = {}\n\n unless data =~ /\\n/\n log \"Received response as a single-line String. Discarding.\"\n log \"Bad response looked like:\\n#{data}\"\n return new_data\n end\n\n data.each_line do |line|\n line =~ /(\\S*):(.*)/\n\n unless $1.nil?\n key = $1\n value = $2\n key = key.gsub('-', '_').downcase.to_sym\n new_data[key] = value.strip\n end\n end\n\n new_data\n end",
"def build_raw_data(data)\r\n data.kind_of?(String) ? data : data.inspect\r\n end",
"def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n arr.inject({}) do |hash, hdr|\n key, val = hdr.split(/:\\s+/, 2)\n hash[key.downcase] = val\n hash\n end\n end\n end",
"def append_headers(*headers)\n new_headers = headers.join(\"\\r\\n\")\n new_headers = \"#{new_headers}\\r\\n#{self.raw_headers}\"\n @raw_headers = new_headers\n @raw_validation = nil\n @headers = nil\n end",
"def data=(data)\n @raw_data = data\n end",
"def receive_data(data)\n begin\n @parser << data\n return if restarting\n if @parser.upgrade?\n if [email protected][UPGRADE_DATA]\n @current.env[UPGRADE_DATA] = @parser.upgrade_data\n @current.process\n else\n @current.parse(data)\n end\n end\n\n rescue HTTP::Parser::Error => e\n terminate_request(false)\n end\n end",
"def add_headers; end",
"def parse_header(string)\n {\n # identificação do registro header\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # agência mantenedora da conta\n :agencia => string[26..29],\n # complemento de registro\n :zeros => string[30..31],\n # número da conta corrente da empresa\n :conta => string[32..36],\n # dígito de auto-conferência ag/conta empresa\n :dac => string[37..37],\n # complemento do registro\n #:brancos1 => string[38..45],\n # nome por extenso da \"empresa mãe\"\n :nome_empresa => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => string[94..99],\n # unidade de densidade\n :densidade => string[100..104],\n # densidade de gravação do arquivo\n :unidade_densidade => string[105..107],\n # número sequencial do arquivo retorno\n :numero_sequencial_arquivo_retorno => string[108..112],\n # data de crédito dos lançamentos\n :data_credito => string[113..118],\n # complemento do registro\n #:brancos2 => string[119..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end",
"def parse_header( data )\n k,v = data.split(\"\\0\", 2)\n return [k, v.delete(\"\\0\")]\n end",
"def get_headers\nheader_values = {}\n i = 1\n # while !params[:header][:type_.to_s + \"#{i}\"].nil?\n while !params[:header_values_.to_s + \"#{i}\"].nil?\n\t value = params[:header_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n \theader_values[params[:header][:type_.to_s + \"#{i}\"]] = value\n i += 1\n end\n header_values\nend",
"def rebuild\n @data = ''\n each_symbols do |s|\n @data += s.header.to_binary_s\n end\n\n header.sh_info = symbols.index { |s| s.st_bind == Symbol::Bind.GLOBAL } || num_symbols\n\n super\n end",
"def receive_data(data)\n Babylon.logger.debug(\"RECEIVED : #{data}\")\n @parser.push(data)\n end",
"def raw_post\r\nunless @env.include? 'RAW_POST_DATA'\r\nraw_post_body = body\r\n@env['RAW_POST_DATA'] = raw_post_body.read(@env['CONTENT_LENGTH'].to_i)\r\nraw_post_body.rewind if raw_post_body.respond_to?(:rewind)\r\nend\r\n@env['RAW_POST_DATA']\r\nend",
"def parse(text)\n text.split(\"\\n\").each do |line|\n if line =~ /^.*\\:.*$/\n s = line.split(\":\")\n \n key = s[0].strip\n value = s[1].strip\n \n @headers[key] = value\n else\n s = line.split\n \n @http_version = s[0]\n @status = s[1].to_i\n @response_text = s[2]\n end\n end\n end",
"def header=(new_header)\n @header = new_header\n # prepare defaults\n @header[\"description\"] ||= \"\"\n # handle tags\n @dependencies = parse_tag_list(Array(@header[\"requires\"]))\n @provides = parse_tag_list(Array(@header[\"provides\"]))\n\n @extends = case @header[\"extends\"]\n when Array then Tag.new(@header[\"extends\"][0])\n when String then Tag.new(@header[\"extends\"])\n else nil\n end\n\n @replaces = case @header[\"replaces\"]\n when Array then Tag.new(@header[\"replaces\"][0])\n when String then Tag.new(@header[\"replaces\"])\n else nil\n end\n end",
"def initialize data\n self.data = data\n parse_data\n end",
"def request_data; end",
"def parse_body(buf)\n if self[:total_body_length] < 1\n buf, rest = \"\", buf\n else\n buf, rest = buf[0..(self[:total_body_length] - 1)], buf[self[:total_body_length]..-1]\n end\n\n if self[:extras_length] > 0\n self[:extras] = parse_extras(buf[0..(self[:extras_length]-1)])\n else\n self[:extras] = parse_extras(\"\")\n end\n if self[:key_length] > 0\n self[:key] = buf[self[:extras_length]..(self[:extras_length]+self[:key_length]-1)]\n else\n self[:key] = \"\"\n end\n self[:value] = buf[(self[:extras_length]+self[:key_length])..-1]\n\n rest\n end",
"def processed_headers; end",
"def parse_headers\n headers = {}\n @request.lines[1..-1].each do |line|\n # puts line.inspect\n # puts line.split.inspect\n return headers if line == \"\\r\\n\" # Because HTTP header's last line will be /r/n we return bc we're done\n header, value = line.split\n header = normalize(header)\n headers[header] = value\n end\n \n return headers\n end",
"def headers(headers); end",
"def header\n @raw.split(\"--\" + boundary)[0]\n end",
"def header(str)\n # {{{\n if @output_started\n raise \"HTTP-Headers are already send. You can't change them after output has started!\"\n end\n unless @output_allowed\n raise \"You just can set headers inside of a Rweb::out-block\"\n end\n if str.is_a?Array\n str.each do | value |\n self.header(value)\n end\n\n elsif str.split(/\\n/).length > 1\n str.split(/\\n/).each do | value |\n self.header(value)\n end\n\n elsif str.is_a? String\n str.gsub!(/\\r/, \"\")\n\n if (str =~ /^HTTP\\/1\\.[01] [0-9]{3} ?.*$/) == 0\n pattern = /^HTTP\\/1.[01] ([0-9]{3}) ?(.*)$/\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n elsif (str =~ /^status: [0-9]{3} ?.*$/i) == 0\n pattern = /^status: ([0-9]{3}) ?(.*)$/i\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n else\n a = str.split(/: ?/, 2)\n\n @header[a[0].downcase] = a[1]\n end\n end\n # }}}\n end",
"def << hdata\n hdata.each{ |name,value| @querystring << \"#{name}=#{value}\" }\n end",
"def register\n grab_header.invert\n end",
"def process\n # Fix body\n unless @data[:request][:body]._blank?\n # Make sure 'content-type' is set if we have a body\n @data[:request][:headers].set_if_blank('content-type', 'application/x-amz-json-1.1' )\n # Fix body if it is a Hash instance\n if @data[:request][:body].is_a?(Hash)\n @data[:request][:body] = Utils::contentify_body(@data[:request][:body], @data[:request][:headers]['content-type'])\n end\n # Calculate 'content-md5' when possible (some API calls wanna have it set)\n if @data[:request][:body].is_a?(String)\n @data[:request][:headers]['content-md5'] = Base64::encode64(Digest::MD5::digest(@data[:request][:body])).strip\n end\n end\n # Set date\n @data[:request][:headers].set_if_blank('x-amz-date', Time::now.utc.httpdate)\n # Set path\n @data[:request][:path] = Utils::join_urn(@data[:connection][:uri].path, @data[:request][:relative_path], @data[:request][:params])\n # Sign a request\n Utils::AWS::sign_v4_signature(\n @data[:credentials][:aws_access_key_id],\n @data[:credentials][:aws_secret_access_key],\n @data[:connection][:uri].host,\n @data[:request]\n )\n end",
"def append_headers(*headers)\n new_headers = headers.join(\"\\r\\n\")\n new_headers = \"#{new_headers}\\r\\n#{self.raw_headers}\"\n @database.update(self.raw_table, {:data => new_headers}, :where => {:id => self.raw_headers_id})\n @raw_headers = new_headers\n @raw_message = nil\n @headers = nil\n end",
"def store_header #:nodoc:\n record = 0x0014 # Record identifier\n # length # Bytes to follow\n\n str = @header # header string\n cch = str.length # Length of header string\n encoding = @header_encoding # Character encoding\n\n\n # Character length is num of chars not num of bytes\n cch /= 2 if encoding != 0\n\n # Change the UTF-16 name from BE to LE\n str = str.unpack('v*').pack('n*') if encoding != 0\n\n length = 3 + str.length\n\n header = [record, length].pack('vv')\n data = [cch, encoding].pack('vC')\n\n prepend(header, data, str)\n end",
"def parse_header(line)\n if (match = line.match(/^(.+?):\\s*(.+)#{@nl}$/))\n key = match[1].downcase\n set_header_special_values(key, match[2])\n parse_normal_header(line, key, match[1], match[2])\n elsif (match = line.match(/^HTTP\\/([\\d\\.]+)\\s+(\\d+)\\s+(.+)$/))\n @response.code = match[2]\n @response.http_version = match[1]\n @http2.on_content_call(@args, line)\n else\n raise \"Could not understand header string: '#{line}'.\"\n end\n end",
"def add(data)\n @parser << data\n end",
"def prepare_data(data)\n data.gsub(/Do some fancy data manipulation here/, '')\n end",
"def str_headers(env, status, headers, res_info, lines, requests, client); end",
"def modify_raw(data, decrypted)\n data.sub(/\\+OK \\S+(\\s+\\S+)?/, decrypted)\n end",
"def initialize_http_header(initheader)\n super\n set_headers_for_body\n end",
"def data=(raw_data)\n new_data = Dis::Model::Data.new(self, raw_data)\n attribute_will_change!(\"data\") unless new_data == dis_data\n @dis_data = new_data\n dis_set :content_hash, if raw_data.nil?\n nil\n else\n Storage.file_digest(new_data.read)\n end\n dis_set :content_length, dis_data.content_length\n end",
"def headers; return {}; end",
"def headers; return {}; end",
"def receive_data(data)\n self.data_received_from_upstream << data\n @parser << data unless is_ssl\n self.client.send_data(data)\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def update(raw_data)\n if @policy_type == :buffer\n if @buffer.size != @buffer_size\n @buffer << raw_data\n end\n elsif @policy_type == :data\n @buffer = [raw_data]\n else\n raise \"port policy #{@policy_type} is not supported by #{self.class}\"\n end\n end",
"def prepend_header(name, value)\n end",
"def patched_encoded\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.to_s\n buffer\n end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end"
] | [
"0.6606611",
"0.63224226",
"0.6096258",
"0.58922434",
"0.5847437",
"0.5771832",
"0.57594454",
"0.5759046",
"0.5736888",
"0.5650954",
"0.56470305",
"0.5614342",
"0.56004924",
"0.5599062",
"0.5591024",
"0.5565687",
"0.55576813",
"0.55539644",
"0.5548405",
"0.5548405",
"0.5548148",
"0.5532515",
"0.550884",
"0.55068356",
"0.5498232",
"0.54934806",
"0.54877216",
"0.5483165",
"0.5479063",
"0.5474795",
"0.5467509",
"0.5458406",
"0.5438448",
"0.54052836",
"0.5397375",
"0.53829944",
"0.53799945",
"0.5374691",
"0.53568095",
"0.5355954",
"0.53347594",
"0.53347135",
"0.5332101",
"0.531904",
"0.53140813",
"0.53140813",
"0.53140813",
"0.53140813",
"0.5303223",
"0.5293506",
"0.5290128",
"0.52861845",
"0.5274486",
"0.5267622",
"0.5263177",
"0.5250583",
"0.5246039",
"0.5244438",
"0.5244035",
"0.52423596",
"0.5227086",
"0.52253336",
"0.5224662",
"0.522315",
"0.5219017",
"0.5218305",
"0.5215507",
"0.5214173",
"0.5205183",
"0.52040464",
"0.5198541",
"0.51973253",
"0.5196812",
"0.519547",
"0.5188468",
"0.5171127",
"0.5169465",
"0.5160423",
"0.51587504",
"0.51571673",
"0.5155126",
"0.5146078",
"0.5145319",
"0.51439404",
"0.5140378",
"0.5130414",
"0.51304007",
"0.51070714",
"0.51070714",
"0.5100541",
"0.50944734",
"0.5086699",
"0.5075125",
"0.5065571",
"0.5063425",
"0.5063425",
"0.5063425",
"0.5063425",
"0.5063425",
"0.5063425",
"0.5063425"
] | 0.0 | -1 |
Public: Setup callback on headers parsing complete block Block the block of code Examples headers = HttpProxy::HeadersParser.new headers.process do |parsing_result| p parsing_result["UserAgent"] end Returns nothing | def process(&block)
@parser.on_headers_complete = block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser_init\n @http = Http::Parser.new\n @http.on_headers_complete = proc do\n p @http.headers\n end\n @http.on_body = proc do |chunk|\n # One chunk of the body\n p chunk\n end\n\n @http.on_message_complete = proc do |env|\n # Headers and body is all parsed\n puts \"Done!\"\n end\n\n\n end",
"def parse(headers, &block)\n @headers = headers\n parse_headers!(block)\n end",
"def parse_headers!(block)\n headers.each { |header| block.call(header.key, parse_value(header.value)) }\n end",
"def processed_headers; end",
"def parse_header_contents; end",
"def handle_headers_complete(headers)\n @code = @parser.status_code.to_i\n if @code != 200\n receive_error(\"invalid status code: #{@code}.\")\n end\n self.headers = headers\n @state = :stream\n end",
"def cgi_parse_header(line); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def on_headers_complete(headers)\n @headers = headers\n end",
"def fill_header(response); end",
"def headers(headers); end",
"def on_header_init()\n end",
"def read_headers!; end",
"def parseHeaders(request) \n headers = {};\n\n # Loop through headers\n request.lines[1..-1].each do |line|\n # If we are moving to the next line, return what we currently have\n return headers if line == \"\\r\\n\"\n\n # Structure data\n header, value = line.split\n header = header.gsub(\":\", \"\").downcase.to_sym\n headers[header] = value\n end\nend",
"def on_headers(headers)\n log.info { \">> headers (#{headers.size})\" }\n headers.each {|h| @node.queue.push([:block, h])}\n end",
"def header_write_callback\n @header_write_callback ||= proc {|stream, size, num, object|\n @response_headers << stream.read_string(size * num)\n size * num\n }\n end",
"def parse_headers\n headers = {}\n @request.lines[1..-1].each do |line|\n # puts line.inspect\n # puts line.split.inspect\n return headers if line == \"\\r\\n\" # Because HTTP header's last line will be /r/n we return bc we're done\n header, value = line.split\n header = normalize(header)\n headers[header] = value\n end\n \n return headers\n end",
"def install_header_callback( request, wrapped_response )\n original_callback = request.on_header\n request._ty_original_on_header = original_callback\n request._ty_header_str = ''\n request.on_header do |header_data|\n wrapped_response.append_header_data( header_data )\n\n if original_callback\n original_callback.call( header_data )\n else\n header_data.length\n end\n end\n end",
"def request_headers=(_arg0); end",
"def parse_headers(raw_headers)\n # raw headers from net_http have an array for each result. Flatten them out.\n raw_headers.inject({}) do |remainder, (k, v)|\n remainder[k] = [v].flatten.first\n remainder\n end\n end",
"def read_headers!\n until @parser.headers?\n result = read_more(BUFFER_SIZE)\n raise ConnectionError, \"couldn't read response headers\" if result == :eof\n end\n\n set_keep_alive\n end",
"def make_headers(user_headers); end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def on_complete(env)\n if respond_to? :parse\n env[:body] = parse(env[:body]) unless [204,304].index env[:status]\n end\n end",
"def parse_header\n header.each do |field, value|\n self.instance_variable_set(\"@#{field}\", value) if HEADER_FIELDS.include? field\n end\n end",
"def parse(data)\n\t\t\t\tif @finished # Header finished, can only be some more body\n\t\t\t\t\t@body << data\n\t\t\t\telse # Parse more header using the super parser\n\t\t\t\t\t@data << data\n\t\t\t\t\tif data =~ /\\r?\\n\\r?\\n/\n\t\t\t\t\t\theaders, @body = @data.split(/\\r?\\n\\r?\\n/,2)\n\t\t\t\t\t\theaders = headers.split(/\\r?\\n/)\n\t\t\t\t\t\trequest = headers.shift\n\t\t\t\t\t\theaders.each do |h|\n\t\t\t\t\t\t\tk,v=h.split(/:\\s*/,2);\n\t\t\t\t\t\t\tk = k.upcase.gsub(/\\-/,'_')\n\t\t\t\t\t\t\t@headers[k] = v\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@headers['CONTENT_LENGTH'] = (@headers['CONTENT_LENGTH']) ? @headers['CONTENT_LENGTH'].to_i : 0\n\t\t\t\t\t\t@verb, @fullpath, @httpver = request.split(/ /)\n @uri = URI.parse(@fullpath)\n if @uri.query\n @query_hash = Hash[*@uri.query.split(/&/).map {|x| x.split(/=/,2)}.flatten]\n end\n\t\t\t\t\t\t@finished = true\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif finished? # Check if header and body are complete\n\t\t\t\t\t@data = nil\n\t\t\t\t\ttrue # Request is fully parsed\n\t\t\t\telse\n\t\t\t\t\tfalse # Not finished, need more data\n\t\t\t\tend\n\t\t\tend",
"def process_url_params(url, headers); end",
"def each_request_target_with_headers(&block)\n\t\ttarget_requests('AND requests.headers IS NOT NULL').each do |req|\n\t\t\tblock.call(req)\n\t\tend\n\tend",
"def headers=(hash); end",
"def headers=(hash); end",
"def request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end",
"def parse_header(line)\n if (match = line.match(/^(.+?):\\s*(.+)#{@nl}$/))\n key = match[1].downcase\n set_header_special_values(key, match[2])\n parse_normal_header(line, key, match[1], match[2])\n elsif (match = line.match(/^HTTP\\/([\\d\\.]+)\\s+(\\d+)\\s+(.+)$/))\n @response.code = match[2]\n @response.http_version = match[1]\n @http2.on_content_call(@args, line)\n else\n raise \"Could not understand header string: '#{line}'.\"\n end\n end",
"def each_request_target_with_headers(&block)\n\t\ttarget_requests('AND wmap_requests.headers IS NOT NULL').each do |req|\n\t\t\tblock.call(req)\n\t\tend\n\tend",
"def fill_header response\n @response = Mechanize::Headers.new\n\n response.each { |k,v|\n @response[k] = v\n } if response\n\n @response\n end",
"def parse_setext_header; end",
"def parser\n\t\t# read mail header from the file\n\t\tfile= File.open(\"header.txt\",\"r\")\n header=\"\"\n\t\tfile.each_line { |line|\n header= get_header_content(line).to_s\n check_google_apps(line)\n line=line.downcase\n\t\t\t#parser received value from mail header\n\t\t\tparser_received(line)\n parser_email(line)\n check_google_apps(line)\n\t\t}\n lower_case_header=header.downcase;\n check_microsoft_exchange(lower_case_header)\n check_lotus_notes(lower_case_header)\n check_novell_grouwpise(lower_case_header)\n check_other_apps(lower_case_header)\n check_software_conflicts()\n check_software_version_conflicts()\n get_security_software(lower_case_header)\n\tend",
"def _initialize_headers\n {}\n end",
"def header_content\n yield if block_given?\n end",
"def parse_headers(raw_headers)\n headers = {}\n raw_headers.each do |h|\n if h =~ /^# *([a-zA-Z_]+) *:(.*)/\n h_key = $1.downcase.intern\n h_value = $2.split(\",\").collect { |v| v.strip }\n if h_value.length > 0 # ignore empty headers\n headers[h_key] = h_value.length > 1 ? h_value : h_value[0]\n end\n end\n end\n \n return headers\n end",
"def method_missing(m, *args, &block)\n\t\t\treturn super unless header.respond_to?(m)\n\t\t\theader.send(m, *args, &block)\n\t\tend",
"def headers; return {}; end",
"def headers; return {}; end",
"def parse(uri, response, body); end",
"def parse_response!; end",
"def processed_header\n lineno = 0\n @processed_header ||= header.lines.map { |line|\n lineno += 1\n\n # Replace directive line with a clean break\n # Replace `#target` line with collect target application name\n\n unless directives.assoc(lineno).nil?\n \"\\n\"\n else\n \n line.scan(/^(\\#target) (\\S+.*?)$/) do |m1,m2|\n _app_name = m2.split(/[\\-|\\s]/).map{|x| x.gsub(/['|\"|;]/,\"\").downcase}\n _reg_name = Jsx::CS::REG_NAME[_app_name[0]]\n raise Jsx::Platform::UndeterminedApplicationError if _reg_name.nil?\n _vers = Jsx::CS::VERSIONS[_app_name[0]].invert\n _app_ver = (_app_name.size==1)? _vers[Jsx::CS::DEFAULTS[_app_name[0]]] : _app_name[1]\n line = line.gsub(m2,\"#{_reg_name}-#{_app_ver}\")\n end\n \n line\n end\n }.join.chomp\n end",
"def parse_header(line, opts = {})\n host = opts[:host]\n if host\n line = line.gsub(/^(Host:\\s+).*$/, \"\\\\1#{host}\")\n line = line.gsub(/^(Referer:\\s+https?:\\/\\/)[^\\/]*(.*)$/, \"\\\\1#{host}\\\\2\")\n end\n @headers << line\n line = line.downcase\n if line.start_with? 'content-length: '\n @content_length = line.gsub(/^\\S+\\s+(\\d+)\\s*$/, '\\1').to_i\n elsif line.start_with? 'transfer-encoding: '\n encodings = line.gsub(/^\\S+\\s+(.*)$/, '\\1')\n @transfer_encodings = encodings.split(/\\s*,\\s*/).map {|e| e.strip.to_sym}\n end\n end",
"def parse!\n if /^(?<key>.*?):(?<value>.*)/m =~ @raw\n @key = key.strip\n @value = value.strip\n else\n raise \"Unable to parse Header: #{@raw}\"\n end\n end",
"def analyze_headers\n# @chron_list = nil\n chrons = []\n extractor.headers.each_with_index do |v, colnum|\n pv = ParsedValue.new(v)\n if !pv.chron.empty? then\n chrons << pv.chron.first\n if colnum < @ncolumns\n# puts \"Setting the column role to #{pv.chron.first}\"\n @columns[colnum].role = pv.chron.first\n end\n end\n end\n # p chrons\n# @chron_list = chrons unless chrons.empty?\n end",
"def raw_headers; end",
"def run_user_block(response, body, &block)\n header = extract_header_data(response)\n case block.arity\n when 1 then yield(header)\n when 2 then yield(header, body)\n else\n raise AdsCommon::Errors::ApiException,\n \"Wrong number of block parameters: %d\" % block.arity\n end\n return nil\n end",
"def resolve_headers(view_context); end",
"def headers\n end",
"def with_headers(tmp_headers)\n current_headers = @headers\n set_headers(tmp_headers)\n yield\n ensure\n set_headers(current_headers)\n end",
"def parse_with_block(&block)\n\n # if there is a valid column_mapping, then we need to change the mapped_header\n mapped_header = @headers\n if (@column_mapping.mapping)\n mapped_header = Array.new\n @column_mapping.mapping.each_with_index do |map, index|\n mapped_header[map] = @headers[index] if (map.is_a? Numeric)\n end\n end\n\n while (!((chunk = read_chunk).nil?))\n if (mapped_header.size == 0)\n block.call(@reader.getLineNumber(), @reader.getRowNumber(), format(chunk))\n else\n block.call(@reader.getLineNumber(), @reader.getRowNumber(), format(chunk),\n mapped_header)\n end\n end\n \n end",
"def handle_head(env)\n status, headers, body = *yield\n headers['Content-Length'] = body.sum(&:bytesize).to_s\n [status, headers, env['REQUEST_METHOD'].casecmp('head').zero? ? [] : body]\n end",
"def headers\n\t\t\thdr = @curb.header_str\n\t\t\tself.class.recode(log?, @curb.content_type, hdr) ?\n\t\t\t\tself.class.parse_headers(hdr) :\n\t\t\t\tself.class.parse_headers(@curb.header_str) # recode failed\n\t\tend",
"def headers\n if !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headers, []).call(),::Vertx::MultiMap)\n end\n raise ArgumentError, \"Invalid arguments when calling headers()\"\n end",
"def method_missing method, *args, &block\n header.send method, *args, &block\n end",
"def method_missing method, *args, &block\n header.send method, *args, &block\n end",
"def parse_atx_header; end",
"def parse_response_headers\n return {} if response_headers.empty?\n\n lines = response_headers.split(\"\\n\")\n\n lines = lines[1..(lines.size - 1)] # Remove Status-Line and trailing whitespace.\n\n # Find only well-behaved HTTP headers.\n lines.map do |line|\n header = line.split(':', 2)\n header.size != 2 ? nil : header\n end.compact.to_h\n end",
"def initialize_http_header(initheader)\n super\n set_headers_for_body\n end",
"def state_request_headers\n while line = @in.get_line\n # Check header size\n if line.size > MAX_HEADER_SIZE\n raise BadRequestError, \"Invalid header size\"\n # If the line empty then we move to the next state\n elsif line.empty?\n expecting_body = @request.content_length.to_i > 0\n set_state(expecting_body ? :state_request_body : :state_response)\n else\n @request.parse_header(line)\n end\n end\n # rescue PrematureBoundaryError\n # @in.insert(0, line)\n # expecting_body = @request.content_length.to_i > 0\n # set_state(expecting_body ? :state_request_body : :state_response)\n end",
"def proxy_response_headers; end",
"def init_response\n headers = SSE_HEADER.merge @headers\n @parser.headers stringify_headers(headers)\n rescue ::HTTP2::Error::StreamClosed\n @stream.log :warn, \"stream closed early by client\"\n end",
"def add_headers; end",
"def header(str)\n # {{{\n if @output_started\n raise \"HTTP-Headers are already send. You can't change them after output has started!\"\n end\n unless @output_allowed\n raise \"You just can set headers inside of a Rweb::out-block\"\n end\n if str.is_a?Array\n str.each do | value |\n self.header(value)\n end\n\n elsif str.split(/\\n/).length > 1\n str.split(/\\n/).each do | value |\n self.header(value)\n end\n\n elsif str.is_a? String\n str.gsub!(/\\r/, \"\")\n\n if (str =~ /^HTTP\\/1\\.[01] [0-9]{3} ?.*$/) == 0\n pattern = /^HTTP\\/1.[01] ([0-9]{3}) ?(.*)$/\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n elsif (str =~ /^status: [0-9]{3} ?.*$/i) == 0\n pattern = /^status: ([0-9]{3}) ?(.*)$/i\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n else\n a = str.split(/: ?/, 2)\n\n @header[a[0].downcase] = a[1]\n end\n end\n # }}}\n end",
"def each_response_header(sock)\n key = value = nil\n\n while true\n # read until a newline\n line = sock.readuntil(\"\\n\", true).rstrip\n\n # empty line means we're done with headers\n break if line.empty?\n\n first = line[0]\n line.strip!\n\n # initial whitespace means it's part of the last header\n if first == ?\\s || first == ?\\t && value\n value << ' ' unless value.empty?\n value << line\n else\n yield key, value if key\n key, value = line.split(/\\s*:\\s*/, 2)\n raise HTTPBadResponse, 'wrong header line format' if value.nil?\n end\n end\n\n yield key, value if key\n end",
"def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end",
"def parse_header(line)\n case line\n when /^#%checkm/\n match = /^#%checkm_(\\d+)\\.(\\d+)/.match line\n @version = \"#{match[1]}.#{match[2]}\" if match\n when /^#%eof/\n @eof = true\n when /^#%fields/\n list = line.split('|')\n list.shift\n @fields = list.map { |v| v.strip.downcase }\n when /^#%prefix/, /^#%profile/\n # do nothing\n end\n end",
"def with_headers(tmp_headers)\n current_headers = @headers\n add_headers(tmp_headers)\n yield\n ensure\n add_headers(current_headers)\n end",
"def with_headers(tmp_headers)\n current_headers = @headers\n add_headers(tmp_headers)\n yield\n ensure\n add_headers(current_headers)\n end",
"def process_headers\n { \"Content-Type\" => content_type }.tap do |result|\n headers.each do |header|\n result[header.name] = header.value\n end\n end\n end",
"def each(&block)\n file_handle.each do |line|\n yield headers.zip(line.chomp!.split(col_sep, -1)).to_h\n end\n end",
"def response_parser; end",
"def net_http_init(net_http_response)\n\n @original = net_http_response\n @status = net_http_response.code.to_i\n @body = net_http_response.body\n @headers = {}\n net_http_response.each { |k, v|\n @headers[k.split('-').collect { |s| s.capitalize }.join('-')] = v\n }\n end",
"def headers\n @headers ||= HeaderHash.new(@http_response.to_hash)\n end",
"def vary_headers=(_arg0); end",
"def parse(text)\n text.split(\"\\n\").each do |line|\n if line =~ /^.*\\:.*$/\n s = line.split(\":\")\n \n key = s[0].strip\n value = s[1].strip\n \n @headers[key] = value\n else\n s = line.split\n \n @http_version = s[0]\n @status = s[1].to_i\n @response_text = s[2]\n end\n end\n end",
"def response_headers! http_status_code = 200, http_with_version = 'HTTP 1.1', header_hash\n errors = header_hash.each_with_object [] do |(key, val), errors|\n key = key.to_s; val = val.to_s\n rv = Wrapper.msc_add_n_response_header txn_ptr, (strptr key), key.bytesize, (strptr val), val.bytesize\n rv == 1 or errors << \"msc_add_n_response_header failed adding #{[key,val].inspect}\"\n end\n\n raise Error, errors if errors.any?\n\n rv = Wrapper.msc_process_response_headers txn_ptr, (Integer http_status_code), (strptr http_with_version)\n rv == 1 or raise \"msc_process_response_headers failed\"\n\n intervention!\n end",
"def call_block_for_request(request, parsed_response)\n if parsed_response[\"body\"].nil?\n request.on_complete_block.call(parsed_response) if request.on_complete_block\n else\n case request.token.gsub(/:.*/, \"\")\n when \"subscribe\"\n request.on_datastream_block.call(parsed_response) if request.on_datastream_block\n when \"get\"\n request.on_get_block.call(parsed_response) if request.on_get_block\n end\n end\n end",
"def headers(value = nil, &block)\n __define__(:headers, value, block)\n end",
"def parse\n # if body.chomp!\n if body.include?(\"\\n\")\n parse_multi_line\n else\n parse_line(response_keys, body)\n end\n end",
"def perform\n add_request_if_new do |request|\n request.header_set(*arguments)\n end\n end",
"def parse_for_header\n expect(:KW_FOR)\n expect(:L_PARANTH)\n header = parse_for_condition\n expect(:R_PARANTH)\n\n header\n end",
"def proxy_connect_headers; end",
"def run\n\n response = http_fetch(@entity.name)\n\n # Shortcut\n if response\n response.each_header do |name,value|\n create_entity(Entities::WebApplicationHeader, {\n :name => \"#{name}: #{value}\", \n :content => \"#{name}: #{value}\" })\n end\n end\n\nend",
"def parse\n reset!\n\n unless text.nil?\n text.each_line do |line|\n items = parse_line(line)\n unless items.empty?\n if headers?\n set_headers(items)\n else\n items_to_hash(items) do |item_hash|\n @result << item_hash\n end\n end\n end\n end\n end\n\n @result\n end"
] | [
"0.7018227",
"0.69397557",
"0.692272",
"0.66465926",
"0.65960246",
"0.6448536",
"0.61827725",
"0.61497754",
"0.61497754",
"0.61497754",
"0.61497754",
"0.60907024",
"0.59932834",
"0.596692",
"0.59114987",
"0.5881159",
"0.58745456",
"0.58024544",
"0.5777607",
"0.5706517",
"0.56920505",
"0.5690344",
"0.5689659",
"0.566579",
"0.56650954",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.5608585",
"0.55620575",
"0.55211616",
"0.55191016",
"0.5512759",
"0.5495044",
"0.5483495",
"0.5483495",
"0.5468535",
"0.5468186",
"0.5447931",
"0.5418396",
"0.5412176",
"0.5409051",
"0.5408635",
"0.5407427",
"0.540408",
"0.53937817",
"0.53743947",
"0.53743947",
"0.53740925",
"0.53726757",
"0.5349522",
"0.5343996",
"0.53363264",
"0.5333057",
"0.53264266",
"0.5318111",
"0.53166515",
"0.5311931",
"0.5296875",
"0.52963257",
"0.52951765",
"0.52712727",
"0.5265277",
"0.52546346",
"0.52546346",
"0.5254281",
"0.5243982",
"0.5243846",
"0.52395093",
"0.52194566",
"0.52103317",
"0.52096677",
"0.5201196",
"0.51988053",
"0.51869655",
"0.517383",
"0.5173633",
"0.5173633",
"0.51728386",
"0.5166287",
"0.51656544",
"0.51573896",
"0.51481324",
"0.5139509",
"0.5137697",
"0.51339847",
"0.51339597",
"0.51330197",
"0.5111915",
"0.51092464",
"0.5099577",
"0.5093069",
"0.509222",
"0.50853705"
] | 0.83165455 | 0 |
Change the number of columns in the main window. | def spawn_panes(num)
main.number_of_panes = num
@current_row = @current_page = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns; IO.console.winsize[1] rescue 80; end",
"def columns=(n)\n @columns = n\n end",
"def columns=(integer); end",
"def ListView_SetColumnWidth(hwnd, iCol, cx)\n send_listview_message(hwnd, :SETCOLUMNWIDTH, wparam: iCol, lparam: MAKELPARAM(cx, 0))\n end",
"def switch_windows\n tv = @form.by_name[\"tv\"]\n list = @form.by_name[\"mylist\"]\n if tv.col > 0\n tv.col = 0\n tmp = tv.width\n list.col = tmp + 1\n else\n list.col = 0\n tv.col = list.width + 1\n end\nend",
"def addcol num\n return if @col.nil? || @col == -1\n @col += num\n @window.wmove @row, @col\n ## 2010-01-30 23:45 exchange calling parent with calling this forms setrow\n # since in tabbedpane with table i am not gietting this forms offset. \n setrowcol nil, col\n end",
"def width\n cols\n end",
"def _window_size\n unless @window_size\n rows = `tput lines`\n cols = `tput cols`\n @window_size = [cols.chomp.to_i, rows.chomp.to_i]\n end\n @window_size\n end",
"def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscols > 6\n @pagesize = @grows * @gviscols\nend",
"def _print_more_columns_marker tf\n tf = false\n if @pmincol + @display_w < @pad_w\n tf = true\n end\n marker = tf ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n h = @display_h; w = @display_w\n r = @orig_top\n c = @orig_left\n @target_window.mvwaddch r+h, c+w-2, marker\n #\n # show if columns to left or not\n marker = @pmincol > 0 ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n @target_window.mvwaddch r+h, c+1, marker\n end",
"def demoExplorerSmallIcons(t)\n demoExplorerList(t)\n t.configure(:orient=>:horizontal, :xscrollincrement=>0)\n t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false)\nend",
"def columns\n gtk_instance.columns\n end",
"def setwsviewport(*)\n super\n end",
"def lnbsetColumnsPos _args\n \"lnbsetColumnsPos _args;\" \n end",
"def columns\n IO.console.winsize.last\n end",
"def width\n @columns * @block_size\n end",
"def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n \n # Remove all parent widgets from grid.\n child = nil\n while(child = @grid.take_at(0)) \n widget = child.widget\n widget.set_parent(nil)\n widget = nil\n child = nil\n end\n \n # Generate container widgets with label if not yet existent\n counter = 0\n for row in 0..row_count-1 do\n for col in 0..col_count-1 do\n container = nil\n if not @container_hash[counter]\n widget_pos = (row * col_count) + col\n container = ContainerWidget.new(widget_pos)\n @container_hash[counter] = container\n else\n container = @container_hash[counter]\n end\n \n # Add parent widget to grid\n @grid.add_widget(container, row, col) # TODO does this make @grid the parent of the widget?\n container.show\n counter = counter + 1\n end\n end\n \n # Delete useless container widgets if any\n @container_hash.delete_if {|pos, conatiner| pos >= counter}\n \n end",
"def column_count\n @stkw_config[:max_col]\n end",
"def console_col_size\n IO.console.winsize[1]\n end",
"def intefy!\n @num_cols = @num_cols.to_i\n @col_width = @col_width.to_i\n @gutter = @gutter.to_i\n end",
"def width(new_width, options = {})\n fill_window(false, options)\n width_str = \"width: #{new_width};\"\n\n add_style(width_str, options[:screen])\n end",
"def window_width; QuestData::LIST_WINDOW_WIDTH; end",
"def window_width; QuestData::LIST_WINDOW_WIDTH; end",
"def update_local_window_size(size); end",
"def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end",
"def column_width=(value)\n @column_width = value\n end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n @tabs.render\n end",
"def insert_columns(add_count)\n add_count.times do\n new_column = self.columns.create(:jivepage => jivepage)\n new_column.create_box!(\"textblock\", 1, \n :content => \"Click here to change text.\") if new_column.first?\n end\n end",
"def ListView_GetColumnWidth(hwnd, iCol) send_listview_message(hwnd, :GETCOLUMNWIDTH, wparam: iCol) end",
"def columns\n layout_text.blank? ? 12 : layout[0].size\n end",
"def cols\n @size\n end",
"def set_cell_count\n cell_count = self.all_cells_array.size\n Rails.logger.info \"Setting cell count in #{self.name} to #{cell_count}\"\n self.update(cell_count: cell_count)\n Rails.logger.info \"Cell count set for #{self.name}\"\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def widthcell\n 10\n end",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def draw_table_five_columns(table_info, width_columns = [100, 100, 100, 70, 130])\n table (table_info) do\n columns(0..4).border_width = 1\n columns(0..4).size = 9\n self.column_widths = width_columns\n end\n end",
"def defaults # :nodoc:\n self.columns.length.times { |idx|\n }\n end",
"def setwidth(width)\n @width = width\n end",
"def column_width(n=0)\n sg = 0\n if n.zero?\n n = g_total_cols\n sg = g_side_gutter_width\n end\n (n*g_col_width) + ((n - 1)*g_gutter_width).ceil + (sg*2)\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def window_width\n return COMMAND_WINDOW_WIDTH\n end",
"def update_height\n @height = max_column.size if max_column.size > @height\n end",
"def ncols\n @colnames.length\n end",
"def window_width\n return CONTROL_WINDOW_WIDTH \n end",
"def window_width\n @width_overwrite || default_width\n end",
"def ui_max_x\n\t\t\t\tCurses.cols\n\t\t\tend",
"def draw_table_six_columns(table_info, width_columns = [100, 100, 100, 90, 90, 40])\n table (table_info) do\n columns(0..5).border_width = 1\n columns(0..5).size = 7\n self.column_widths = width_columns\n end\n end",
"def resize(width)\n @cli_opts[:geometry] = \"#{width}x\"\n self\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def tabsize=(value)\n\t\t\teditor.tabsize= value\n\t\tend",
"def col_max; (contents_width / (MA_IconItemList::RECT_WIDTH + spacing)); end",
"def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end",
"def window_width\n end",
"def window_line_size\n lines - 2\n end",
"def win_width\n Curses.cols - win_padding\n end",
"def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n super(@win)\n @title_prefix = title_prefix\n set_max_contents_len(cols)\n end",
"def draw_table_four_columns(table_info, width_columns = [130, 130, 130, 130])\n table (table_info) do\n columns(0..3).border_width = 1\n columns(0..3).size = 8\n self.column_widths = width_columns\n end\n end",
"def column_space(); @column_space; end",
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def column_size; end",
"def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end",
"def columns\n @columns || 150\n end",
"def width=(w)\n @view__.width = w\n end",
"def columnCount(parent)\n return 1\n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def screen_settings\n # TODO these need to become part of our new full_indexer class, not hang about separately.\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n # this depends now on textpad size not screen size TODO FIXME\n $grows = $glines - 1\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\n end",
"def build_table (number)\n @main_table.each{|child| @main_table.remove(child)}\n if number<=3\n @main_table.n_columns = number\n @main_table.n_rows = 1\n i = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n text.editable = false\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n @main_table.attach(scrolled,i,i+1,0,1)\n @main_table.show_all\n i+=1\n end\n else\n @main_table.n_rows = 2\n @main_table.n_columns = (number+1)/2\n i = 0\n fil = col = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n #Fils the first row. The fil variable acts like a controller. When it changes, the row has changed.\n if (col < @main_table.n_columns && fil == 0)\n @main_table.attach(scrolled,col,col+1,0,1)\n col+=1\n if col==@main_table.n_columns #All the columns have been filled. We change rows\n fil = 1; col = 0 #Restart the columns index\n end\n else #Second row statrs here\n @main_table.attach(scrolled,col,col+1,1,2)\n col+=1\n end\n @main_table.show_all\n i+=1\n end\n end\n end",
"def cols(value)\n @page_cols_num = value.to_i\n end",
"def screen_size=(new_screen_size)\n\t try_set_screen\n Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size])\n\t \n\t load_rows(@index) #readjust screen rows\n new_screen_size\n end",
"def colnum; @options.fetch(:colnum, 0); end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def set_cols(visible, list)\n @rows = 1 if visible\n @cols = (depends_on & list).find_all { |u| u.visible }.inject(0) { |s, v| s + (v.cols || 0) }\n @cols = 1 if @cols == 0 and visible\n end",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def size\n\t\t@rows * @columns\n\tend",
"def width(val); @width = val; self; end",
"def increment_size\n\t\tincremented_size = row_count + 1\n\n\t\t@rows = Array.new(incremented_size){Array.new(incremented_size, 0)}\t# adding a row and a column to the current Matrix\n\t\t@row_count = incremented_size\t# incrementing the counter of rows\n\t\t@column_count = incremented_size\t# incrementing the counter of columns\n\tend",
"def width=(new_width)\n resize_width(new_width)\n end",
"def set_iline( string = \"\" )\n return if @testing\n Curses::curs_set 0\n @win_interaction.setpos( 0, 0 )\n @win_interaction.addstr( \"%-#{Curses::cols}s\" % string )\n @win_interaction.refresh\n Curses::curs_set 1\n string.length\n end",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def num_cols\n col_labels.length\n end",
"def resize new_width, new_height\n win.resize new_width, new_height\n end",
"def infer_console_width\n interactive? ? interaction_highline.output_cols-3 : 80\n end",
"def setOptions(iDisplayedList)\n @DisplayedList = iDisplayedList\n set_item_count(@DisplayedList.size)\n # Refresh everything\n refresh_items(0, item_count)\n # Rearrange columns widths\n set_column_width(0, 20)\n set_column_width(1, Wx::LIST_AUTOSIZE)\n set_column_width(2, Wx::LIST_AUTOSIZE)\n # Compute minimal size\n self.min_size = [ [ column_width(0) + column_width(1) + column_width(2) + 8, 200 ].min, 0 ]\n # Resize\n lOldSize = self.parent.size\n self.parent.fit\n self.parent.size = lOldSize\n end",
"def width= w\n\t\t\t@width = w\n\t\t\t@column_width = nil\n\t\t\t@margin_width = nil\n\t\tend",
"def size\n rows * columns\n end",
"def columns=(columns)\n resize_field @rows, columns\n end",
"def set_form_col col1=0 #:nodoc:\n @cols_panned ||= 0 \n # editable listboxes will involve changing cursor and the form issue\n ## added win_col on 2010-01-04 23:28 for embedded forms BUFFERED TRYING OUT\n #[email protected]\n win_col = 0 \n col2 = win_col + @col + @col_offset + col1 + @cols_panned + @left_margin\n $log.debug \" set_form_col in rlistbox #{@col}+ left_margin #{@left_margin} ( #{col2} ) \"\n setrowcol nil, col2 \n end",
"def test_line_width\n w = Window_Selectable_Implemented.new(480,0,160,128,$data_items.compact, 24, true, 24)\n @windows.push(w)\n end",
"def local_window_size; end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end"
] | [
"0.64864033",
"0.63125116",
"0.6250382",
"0.60696",
"0.6048492",
"0.60479534",
"0.59623027",
"0.5933511",
"0.59149873",
"0.57982916",
"0.579712",
"0.57804483",
"0.57195246",
"0.56635034",
"0.56495506",
"0.563061",
"0.56280065",
"0.56041455",
"0.55989176",
"0.55983967",
"0.55823433",
"0.55724",
"0.55724",
"0.5531095",
"0.5524802",
"0.5522785",
"0.5503665",
"0.5502652",
"0.5487941",
"0.5479685",
"0.5477611",
"0.54613465",
"0.5460347",
"0.54521114",
"0.5437435",
"0.5437351",
"0.5436351",
"0.54304665",
"0.5419435",
"0.5417465",
"0.5413998",
"0.5401452",
"0.53949636",
"0.5370697",
"0.5362021",
"0.5362016",
"0.53613484",
"0.53607416",
"0.53598297",
"0.533376",
"0.5331722",
"0.5319878",
"0.53057873",
"0.53055555",
"0.5278439",
"0.52717704",
"0.5271754",
"0.5270595",
"0.52663577",
"0.5262847",
"0.5262833",
"0.5262664",
"0.52626",
"0.5261909",
"0.5261171",
"0.52572113",
"0.52552426",
"0.5254426",
"0.52522904",
"0.52332646",
"0.52291274",
"0.5211985",
"0.52084017",
"0.51991516",
"0.51978695",
"0.5187653",
"0.5182167",
"0.5182167",
"0.51791906",
"0.5178569",
"0.51737344",
"0.5167009",
"0.516699",
"0.5162556",
"0.5158519",
"0.51561654",
"0.51518995",
"0.51501405",
"0.514924",
"0.5148937",
"0.51474345",
"0.5142666",
"0.51389086",
"0.513701",
"0.5133732",
"0.5129554",
"0.5129554",
"0.5129554",
"0.5129554",
"0.5129554"
] | 0.51670164 | 81 |
Number of times to repeat the next command. | def times
(@times || 1).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cycle_count\n put('o^')\n get.strip.to_i\n end",
"def count number\r\n number.times do\r\n number += 1\r\n end\r\nend",
"def increment_tries\n @tries += 1\n end",
"def times num\n @count = num\n self\n end",
"def repeat_yourself(word, count)\n count.times {puts word}\n end",
"def count\n @count ||= 0\n @count += 1\n end",
"def repeat(string, number_of_times)\n number_of_times.times do\n puts string\n end\nend",
"def incr_count\n @count ||= 0\n @count += 1\n end",
"def count\n @count ||= begin\n ARGV.each { |a| task a.to_sym do ; end }\n Integer(ARGV[1]) rescue 0 >0 ? ARGV[1].to_i : 10\n end\n @count\n end",
"def how_many_times(n)\r\n case n\r\n when 1 then 'once'\r\n when 2 then 'twice'\r\n else \"#{n} times\"\r\n end\r\n end",
"def count\n run.count\n end",
"def num_repeats(string)\nend",
"def repeat(str, n)\n n.times do\n puts str\n end\nend",
"def repeat(message, times)\n\tcounter = 1\n\twhile counter <= times\n\t\tputs message\n\t\tcounter += 1\n\tend\nend",
"def n_times\n yield\n yield\nend",
"def count!\n if not self.count.nil? then self.count += 1; else self.count = 1; end\n end",
"def pTimes2(statement,num)\n num.times do\n puts statement\n end\nend",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def try_again(count)\n what_to_do(count)\nend",
"def turn_count()\n count = 0\n index = 0\n loop do\n if position_taken?(index)\n count += 1\n end\n index += 1\n if index > 9 \n break\n end\n end\n return count\n end",
"def repeat(string, num)\n num.times do\n puts string\n end\nend",
"def count_sheep\n\t5.times do |sheep|\n\t\tputs sheep\n\tend\nend",
"def loop_message_n_times(message, number)\n number.times {puts message}\nend",
"def repeat(string, number)\r\n number.times do\r\n puts string\r\n end\r\nend",
"def repeat_yourself(string,number)\n number.times { puts string }\nend",
"def repeating_position\n @repeat || @digits.size\n end",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend",
"def cycles\n @cycles ||= 5\n end",
"def increment_guess_count(count)\n\treturn count += 1\nend",
"def times(*args)\n\t\t\t\t\trepeat *args\n\t\t\t\tend",
"def repeat(str, n)\n\tn.times {|n| puts str}\nend",
"def repeat(str, nb_times)\r\n if nb_times < 0\r\n puts 'You must provide a positive number!'\r\n return\r\n end\r\n\r\n nb_times.times { puts str }\r\nend",
"def repeat(string, number)\n number.times do\n p string\n end\nend",
"def repeat(string, num)\n num.times {puts string}\nend",
"def loop_message_n_times(message, number)\n count = 0\n while count < number do\n puts message\n count += 1\n end\nend",
"def how_many_steps?\n steps=0\n loop do\n steps += 1\n puts \"Add another step\"\n break\nend\nend",
"def do_times(count, &block)\n while count > 0\n block.call\n count -= 1\n end\nend",
"def count\n @mutex.synchronize { @count }\n end",
"def repeater(n = 1)\n\tn.times { yield }\nend",
"def repeat(string, number)\n number.times {puts string}\nend",
"def repeat(string, number)\n number.times {puts string}\nend",
"def repeat(str, num)\n puts num.times {puts str}\nend",
"def repeat(string, num)\n num.times { puts string }\nend",
"def repeat(string, num)\n num.times { puts string }\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend",
"def repeat(string, int)\r\n int.times {puts string}\r\nend",
"def repeat_again(string, i)\n i.times {puts string}\nend",
"def repeat(string, int)\n int.times{puts string}\nend",
"def to count\n take count + 1\n end",
"def repeat(input_str, pos_num)\n pos_num.times {puts input_str}\nend",
"def count_sheep\n 5.times do |sheep| \n puts sheep\n end\nend",
"def repeat(string, integer)\n integer.times do \n puts string\n end\nend",
"def repeat(word, num)\n num.times { |_| puts word }\nend",
"def repeater(n, str)\n i = 0\n while i < n\n puts str\n i += 1\n end\nend",
"def test_try_a_word_increments_num_tries\n\t\trandom_number = rand(10)\n\t\trandom_number.times {@pass_cracker.try_a_word!}\n\t\tnum_tries = @pass_cracker.num_tries\n\n\t\tassert num_tries == random_number\n\tend",
"def repeat(string, int)\n int.times do\n p string\n end\nend",
"def repeat(string, number)\n number.times { puts string }\nend",
"def repeat(string, number)\n number.times { puts string }\nend",
"def add_to_count\n @count += 1\n end",
"def repeat(str, num)\n num.times do | i |\n puts str\n end\nend",
"def repeat(str, int)\n int.times do\n puts str\n end\nend",
"def update_loop_count\r\n @loop_count += 1\r\n if @loop_count > 100\r\n log_debug(\"Event #{@event_id} executed 100 commands without giving the control back\")\r\n Graphics.update\r\n @loop_count = 0\r\n end\r\n end",
"def p_times(statement, num)\n (num).times do\n puts statement\n end\nend",
"def repeater(n=1, &block)\n n.times &block\nend",
"def repeat(word, number)\n number.times { puts word}\nend",
"def repeat(string, times)\n times.times do\n print string\n end\nend",
"def repeat(string, int)\n int.times { puts string }\nend",
"def repeater(count=1)\n count.times {|ii| yield }\nend",
"def increment_iteration\n @iteration += 1\n end",
"def repeat(str, num)\n num.times { puts str }\nend",
"def repeat(str, num)\n num.times { puts str }\nend",
"def repeat(str, num)\n num.times { puts str }\nend",
"def increment_count(current_count)\n current_count.to_i + 1\n end",
"def number_counting_seq(n)\r\n\r\nend",
"def repeat(string, number)\n number.times{ puts string }\nend",
"def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end",
"def n\n @reps.size\n end",
"def count\r\n\t\tputs \"There are \" + @yield.to_s + \" oranges.\"\r\n\tend",
"def number\n before.count + 1\n end",
"def repeat_ho(num)\n num.times { puts 'hi' }\n end",
"def repeat(word, number)\n number.times { puts word }\nend",
"def count\n each.count\n end",
"def counting\n puts \"hard to do right\"\n end"
] | [
"0.67411965",
"0.67273045",
"0.668447",
"0.66117305",
"0.6541622",
"0.64984715",
"0.6408484",
"0.6353681",
"0.6341251",
"0.632535",
"0.6278638",
"0.62735426",
"0.6249874",
"0.6230514",
"0.62286985",
"0.6225942",
"0.6222806",
"0.62163365",
"0.62163365",
"0.62163365",
"0.62153417",
"0.6168352",
"0.61566997",
"0.61544967",
"0.6149384",
"0.6124999",
"0.61247987",
"0.6118043",
"0.6110754",
"0.6110754",
"0.6110754",
"0.6110754",
"0.6110754",
"0.6110754",
"0.6110754",
"0.6098287",
"0.6083157",
"0.6080549",
"0.6075945",
"0.6068919",
"0.60563815",
"0.60472655",
"0.6046639",
"0.6046547",
"0.6042003",
"0.6034101",
"0.6018479",
"0.6010063",
"0.60097635",
"0.60097635",
"0.60074943",
"0.59989226",
"0.59989226",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.59915966",
"0.5984543",
"0.59833777",
"0.59741086",
"0.5972657",
"0.5970667",
"0.59643435",
"0.59590477",
"0.59561753",
"0.5950914",
"0.59500456",
"0.5946843",
"0.59413534",
"0.59413534",
"0.5936714",
"0.59355974",
"0.5932215",
"0.5929549",
"0.592545",
"0.5921045",
"0.5918016",
"0.59149826",
"0.591096",
"0.59099454",
"0.59091324",
"0.5906896",
"0.5906896",
"0.5906896",
"0.5904882",
"0.59041226",
"0.5897927",
"0.58976907",
"0.5894546",
"0.58901983",
"0.58857846",
"0.5883987",
"0.5882885",
"0.5880685",
"0.58716214"
] | 0.6427643 | 6 |
The file or directory on which the cursor is on. | def current_item
items[current_row]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_file\n @view[@cursor]\nend",
"def current_file_path\n current_file.to_path\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def current_dir; end",
"def current_file\n @path || @parent.current_file rescue nil\n end",
"def current_path\n file.try(:path)\n end",
"def file_path\n dir\n end",
"def current_folder\n tree.terminal\n end",
"def parent\n Wayfinder.for(@file_set).parent\n end",
"def dir\n @working_directory\n end",
"def file_or_folder_name\n return @file_or_folder_name\n end",
"def current\n\t\t\t\t\treturn Pathname.new(\".\")\n\t\t\t\tend",
"def linked_path\n File.readlink current_directory\n end",
"def current_path\n current_folder.path\n end",
"def pos_directory\n pos_fil_trailer\n end",
"def working_directory\n @link.WorkingDirectory\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def path\n @reader.path\n end",
"def file\n @pathname.to_s\n end",
"def source_file\n @source_location[0]\n end",
"def path\n @file.path\n end",
"def dir\n self\n end",
"def path\n return self.saved? ? @realfile.path : nil\n end",
"def work\n '/' + File.dirname(file)\n end",
"def path\n @file.path\n end",
"def path\n @file\n end",
"def filename\n __advance!\n @_st_fileName\n end",
"def directory\n self.path.directory\n end",
"def file_dir # :nodoc:\n nil\n end",
"def file_dir\n 'files'\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def current_file_path\n clurl = AssetSettings[:local_assets][@file_id].last\n clurl.sub(/\\A#{AssetSettings[:local_assets].assets_url_prefix}/,\n '') if clurl\n end",
"def current_working_directory; @rye_current_working_directory; end",
"def path\n @file\n end",
"def filename\n\t\treturn self.fullpath.split('/').last\n\tend",
"def file_history_current\n file_history = $file_history.to_h\n file_history.each_pair do |index, file_name|\n return file_name unless file_name == \"\"\n end\n end",
"def access_file_name\n end",
"def directory\n File.dirname @path\n end",
"def file_path\n end",
"def x\n wd.location[0]\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def filename()\n #This is a stub, used for indexing\n end",
"def file_dir\n @parent_generator.file_dir\n end",
"def file_path; end",
"def file\n backtrace.first.split(\":\")[0]\n end",
"def access_file_name\n return @access_file_name\n end",
"def path\n self.file.to_s\n end",
"def file\n @file ||= File.basename(link)\n end",
"def file\n files.first\n end",
"def file\n files.first\n end",
"def dir\n @directory\n end",
"def file_path(was=false)\n if was\n self.site.directory_path.join(name_was)\n else\n self.site.directory_path.join(name)\n end\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def file_name\n \"/\" + current_file.path.split('/').pop\n end",
"def path\n file.url\n end",
"def dir\n File.dirname(self.path)\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def filename\n @scanner.filename\n end",
"def cur_pos\n @cursor.pos\n end",
"def working_directory\n @options[:working_directory]\n end",
"def directory\r\n \[email protected]\r\n end",
"def line\n\t\treturn @file_data[@current_line]\n\tend",
"def root_fs\n\t\t\t\tfind_root[2].to_s\n\t\t\tend",
"def inspect\n File.basename @__path\n end",
"def realpath\n @site.tags[@tag].sort_by do |v|\n v.data[\"date\"]\n end.first.relative_path\n end",
"def root_file_path; end",
"def path\n @filename\n end",
"def directory\n return @directory\n end",
"def cursorTarget \n \"cursorTarget\" \n end",
"def containing_directory\n path.dirname\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def cursor\n @data['cursor']\n end",
"def cursor\n @data['cursor']\n end",
"def curVimDir()\r\n\t# is pwd(), if 'cpoptions' contains 'd'\r\n\t#if (VIM::evaluate('&cpoptions').include?(?d))\r\n\t\tcurDir = Dir.pwd\r\n\t#else\r\n\t\t#curDir = VIM::evaluate(\"expand('%:p:h')\")\r\n\t#end\r\n\treturn curDir\r\nend",
"def path\n `window.location.pathname`\n end",
"def file_dir\n nil\n end",
"def root\n '../' * file.count('/')\n end",
"def pathname\n end",
"def path\n @directory.path\n end",
"def space\n if @filename.include?('/.polarion/tracker/')\n\t return 'tracker'\n\telse\n\t File.dirname(@filename).split(/\\//)[4]\n\tend\n end",
"def pwd\n Dir.pwd\n end",
"def path\r\n @pathname.to_s\r\n end",
"def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end",
"def file\n @file ||= find_file\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def pos\n file.pos\n end",
"def face\n return @face.dir\n end",
"def root\n Dir.pwd\n end",
"def path\n if @file\n @file.name\n elsif @path\n @path.to_s\n elsif @stream.is_a?(File)\n @stream.path\n end\n end",
"def file_name\n @file_name ||= File.basename tree\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def parent_directory\n File.dirname(@full_path).split('/').last\n end",
"def active_path\n if script = script_object()\n if path = script.path\n return path.dup\n end\n end\n\n # If for some reason that didn't work, return the compile time filename.\n method.file.to_s\n end",
"def dir\n calc_dir(@basename)\n end",
"def last_resurrect\n File.readlink(the_symlink)\n end",
"def line\n @files.first ? @files.first[1] : nil\n end",
"def line\n @files.first ? @files.first[1] : nil\n end"
] | [
"0.7390515",
"0.68972135",
"0.6853903",
"0.6800115",
"0.6719103",
"0.66615504",
"0.6481221",
"0.64487165",
"0.63464165",
"0.6289791",
"0.6285747",
"0.62845814",
"0.62453586",
"0.62375176",
"0.61845165",
"0.61819404",
"0.6158958",
"0.6149144",
"0.6148188",
"0.6145312",
"0.60992",
"0.60866225",
"0.60833216",
"0.6082911",
"0.60768646",
"0.6059695",
"0.6049814",
"0.6048434",
"0.60480475",
"0.6047374",
"0.60382235",
"0.60382235",
"0.603805",
"0.60354954",
"0.60270315",
"0.60258496",
"0.60213286",
"0.6007156",
"0.5983144",
"0.5976074",
"0.5955841",
"0.59470546",
"0.5942669",
"0.59387994",
"0.5933077",
"0.59072036",
"0.59059227",
"0.5897785",
"0.58866227",
"0.5877921",
"0.58773446",
"0.58773446",
"0.58748895",
"0.58623594",
"0.5861475",
"0.5860772",
"0.5859389",
"0.58522326",
"0.58518225",
"0.58518225",
"0.58518225",
"0.5845256",
"0.5838928",
"0.58330655",
"0.58308184",
"0.5828455",
"0.582362",
"0.58178186",
"0.5811446",
"0.580858",
"0.5803172",
"0.58020484",
"0.57878745",
"0.5775034",
"0.57734704",
"0.57734525",
"0.57734525",
"0.5772703",
"0.5770097",
"0.576677",
"0.57584006",
"0.57560456",
"0.5755786",
"0.57497406",
"0.5749018",
"0.5744977",
"0.57431126",
"0.5737691",
"0.57366127",
"0.57286966",
"0.57283235",
"0.57213473",
"0.57171196",
"0.57162595",
"0.5713934",
"0.5713934",
"0.57132745",
"0.5712659",
"0.56994575",
"0.5698862",
"0.5698862"
] | 0.0 | -1 |
marked files and directories. | def marked_items
items.select(&:marked?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marks_dir\n dir \"/tmp/marks\"\n end",
"def modified_files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def test_marked\n end",
"def mark; end",
"def markerDir _args\n \"markerDir _args;\" \n end",
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def track_files(glob); end",
"def tracked_files; end",
"def removed_unmarked_paths\n #remove dirs\n dirs_enum = @dirs.each_value\n loop do\n dir_stat = dirs_enum.next rescue break\n if dir_stat.marked\n dir_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n #recursive call\n dir_stat.removed_unmarked_paths\n else\n # directory is not marked. Remove it, since it does not exist.\n write_to_log(\"NON_EXISTING dir: \" + dir_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_directory(dir_stat.path, Params['local_server_name'])\n }\n rm_dir(dir_stat)\n end\n end\n\n #remove files\n files_enum = @files.each_value\n loop do\n file_stat = files_enum.next rescue break\n if file_stat.marked\n file_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n else\n # file not marked meaning it is no longer exist. Remove.\n write_to_log(\"NON_EXISTING file: \" + file_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_instance(Params['local_server_name'], file_stat.path)\n }\n # remove from tree\n @files.delete(file_stat.path)\n end\n end\n end",
"def watchable_files; end",
"def grouped(files); end",
"def all_files; end",
"def all_files; end",
"def mark\n classes = Set.new\n marked_objects = 0\n @progressmeter.start(\"Marking linked objects\", @db.item_counter) do\n each do |obj|\n classes.add(obj.class)\n @progressmeter.update(marked_objects += 1)\n end\n end\n @class_map.keep(classes.map { |c| c.to_s })\n\n # The root_objects object is included in the count, but we only want to\n # count user objects here.\n PEROBS.log.debug \"#{marked_objects - 1} of #{@db.item_counter} \" +\n \"objects marked\"\n @stats.marked_objects = marked_objects - 1\n end",
"def directories; end",
"def directories; end",
"def analyse_modified_files\n modified_files = Config.feature_branch_collection.where(SourceControlSystem::Git.modified_files)\n analysed_modules = AnalysedModulesCollection.new(modified_files.map(&:path), modified_files)\n Config.root = Config.compare_root_directory\n report(analysed_modules)\n end",
"def existing_files; end",
"def filter_directories(modified_files); end",
"def files() = files_path.glob('**/*')",
"def keep_files; end",
"def setMarkerDir _obj, _args\n \"_obj setMarkerDir _args;\" \n end",
"def fi_scan\n FileObj.all.each do |fo|\n fd = File.open(fo.abs_path)\n if dirty?(fo, fd)\n\t\t\t\twarn\n\t\t\t\tnotify_admin fo if CONFIG['notify_admin']\n\t\t\telse\n\t\t\t\tclean\n\t\t\tend\n puts fo.abs_path\n end\n end",
"def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend",
"def formatted_file_list(title, source_files); end",
"def mark \n @paths.unshift Proc.new {self.fail!}\n end",
"def check_for_fixes(files, marker=nil)\n marker ||= EDIT_MARKER\n list = []\n files.each do |file|\n next if File.directory?(file)\n File.open(file) do |f|\n f.grep(marker){ |l| list << file }\n end\n end\n list.uniq\n end",
"def reset_marks(path, lines_added=[], lines_changed=[])\n [ [:added, lines_added],\n [:changed, lines_changed],\n ].each do |k, lines|\n mark = \"#{ENV[\"TM_BUNDLE_SUPPORT\"]}/#{k}.pdf\"\n mate = ENV[\"TM_MATE\"]\n cmd = mate ? [mate] : %w[ echo mate ] # if invoked from outside textmate (without TM_MATE set) just print what it would run, instead\n cmd << \"--clear-mark=#{mark}\"\n cmd.concat [\"--set-mark=#{mark}\", *lines.map{|n| \"--line=#{n}\" }] unless lines.empty?\n cmd << path\n system *cmd\n end\nend",
"def get_important_files dir\n # checks various lists like visited_files and bookmarks\n # to see if files from this dir or below are in it.\n # More to be used in a dir with few files.\n list = []\n l = dir.size + 1\n\n # 2019-03-23 - i think we are getting the basename of the file\n # if it is present in the given directory XXX\n @visited_files.each do |e|\n list << e[l..-1] if e.index(dir) == 0\n end\n list = get_recent(list)\n\n # bookmarks if it starts with this directory then add it\n # FIXME it puts same directory cetus into the list with full path\n # We need to remove the base until this dir. get relative part\n list1 = @bookmarks.values.select do |e|\n e.index(dir) == 0 && e != dir\n end\n\n list.concat list1\n list\nend",
"def scan(dir)\n puts \"Scanning '#{dir}' for asdoc files...\"\n\n found = []\n\n Search.find_all(@asdoc,dir,@excludes) do |path|\n found << {:path => path, :package => ProjectTools.package(path)}\n end\n\n found.each { |file| log(\"Adding #{file[:path]}\") }\n\n found\n end",
"def output_status files\n # new files (ansi green)\n if files[:added].length > 0\n print \"\\033[32m\"\n puts \"\\nNew Files\"\n puts \"=========\\n\\n\"\n\n files[:added].each do |file|\n puts \"* #{file}\"\n end\n puts \"\"\n end\n\n # modified files (ansi yellow)\n if files[:modified].length > 0\n print \"\\033[33m\"\n puts \"\\nModified Files\"\n puts \"==============\\n\\n\"\n\n files[:modified].each do |file|\n puts \"* #{file}\"\n end\n end\n\n # deleted files (ansi red)\n if files[:deleted].length > 0\n print \"\\033[31m\"\n puts \"\\nDeleted Files\"\n puts \"=============\\n\\n\"\n\n files[:deleted].each do |file|\n puts \"* #{file}\"\n end\n\n puts \"\"\n end\n\n # nothing changed\n if files[:added].length == 0 && files[:modified].length == 0 && files[:deleted].length == 0\n print \"Nothing has changed since your last save!\"\n end\n\n # ansi reset\n print \"\\033[0m\\n\"\n end",
"def file_list\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def filenames; end",
"def markToDelete\n #N Without this we won't remember that this file is to be deleted\n @toBeDeleted = true\n end",
"def scan_files\n raise \"scan_files must be redefined in children classes\"\n end",
"def tag_manifested_files\n tagmanifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n path\n end\n }\n (acc + files).uniq\n end\n end",
"def document_entries\n entries.select{ |f| File.file?(File.join(path,f)) }\n end",
"def enum_scanned_files(files)\n Enumerator.new do |yielder|\n todos = []\n parser = Grammars::RubyCommentsParser.new\n \n files.each do |file|\n content = File.read(file)\n parser.parse(content).comments.each{|comment| \n yielder << new_todo(\n comment.merge('file' => relative_path(file),\n 'created_at' => File.ctime(file),\n 'updated_at' => File.ctime(file)\n ))\n }\n end\n end\n end",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end",
"def select_bookmarks\n # added changes in both select_current and select_hint\n # However, the age mark that is show is still for the earlier shown forum based on outdated full_data\n # So we need to show age mark based on file datw which means a change in display program !!! At least\n # clear the array full_data\n $mode = \"forum\"\n $title = \"Bookmarks\"\n $files = $bookmarks.values\n\nend",
"def tree\n # Caution: use only for small projects, don't use in root.\n @title = 'Full Tree'\n # @files = `zsh -c 'print -rl -- **/*(#{@sorto}#{@hidden}M)'`.split(\"\\n\")\n @files = Dir['**/*']\n message \"#{@files.size} files.\"\nend",
"def find_files(base_dir, flags); end",
"def saved_dir_taggers\n unless profile.exist?\n puts \"\\e[031m Not Any Directory Tagged\"\n exit\n end\n if dir_taggers.empty?\n profile.each_line do |l|\n tags, dir = tags_and_dir(l)\n dir_taggers.take_in DirTagger.new(tags.pop, dir.first), tags\n end\n end\n dir_taggers\n end",
"def obsolete_files; end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.tex')))\n end",
"def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end",
"def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end",
"def watchable_dirs; end",
"def progress_mark; end",
"def modified_files(options); end",
"def modified_files(options); end",
"def file_watcher; end",
"def file_watcher; end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def visit\n @mark = true\n end",
"def walk(path); end",
"def finished(inspected_files); end",
"def show_asset_files\n display_collection_of_folders_docs_tasks\n end",
"def altered_files; (modified + added + removed).sort; end",
"def select_all\n dir = Dir.pwd\n # check this out with visited_files TODO FIXME\n @selected_files = @view.map { |file| File.join(dir, file) }\n message \"#{@selected_files.count} files selected.\"\nend",
"def dirs; end",
"def dirs; end",
"def target_files\n @target_files ||= git.modified_files + git.added_files\n end",
"def check_files(files)\r\n files_before = @file_info.keys\r\n used_files = {} \r\n files.each do |file|\r\n begin\r\n if @file_info[file]\r\n if @file_info[file].timestamp != File.mtime(file)\r\n @file_info[file].timestamp = File.mtime(file)\r\n digest = calc_digest(file)\r\n if @file_info[file].digest != digest\r\n @file_info[file].digest = digest \r\n @file_changed && @file_changed.call(file)\r\n end\r\n end\r\n else\r\n @file_info[file] = FileInfo.new\r\n @file_info[file].timestamp = File.mtime(file)\r\n @file_info[file].digest = calc_digest(file)\r\n @file_added && @file_added.call(file)\r\n end\r\n used_files[file] = true\r\n # protect against missing files\r\n rescue Errno::ENOENT\r\n # used_files is not set and @file_info will be removed below\r\n # notification hook hasn't been called yet since it comes after file accesses\r\n end\r\n end\r\n files_before.each do |file|\r\n if !used_files[file]\r\n @file_info.delete(file)\r\n @file_removed && @file_removed.call(file)\r\n end\r\n end\r\n end",
"def dir; end",
"def dir; end",
"def dir; end",
"def each_file(markup)\n @files.each do |dest,file|\n if (formatted_like?(dest,markup) || !formatted?(dest))\n yield dest, file\n end\n end\n end",
"def changed_files\n @files.each do |file, stat|\n if new_stat = safe_stat(file)\n if new_stat.mtime > stat.mtime\n @files[file] = new_stat\n yield(file)\n end\n end\n end\n end",
"def edl_mark \n send_cmd(\"edl_mark\")\n end",
"def annotate_one_file(file_name, info_block, position, options = T.unsafe(nil)); end",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"def replaced_files; end",
"def start(_files); end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || [email protected](/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && [email protected]('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && [email protected]('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def read_code_files_from_path(path)\n Dir.foreach path do |it|\n path_and_name = \"#{path}/#{it}\"\n if FileTest.directory?(path_and_name) && it != '.' && it != '..'\n read_code_files_from_path path_and_name unless BLACK_LIST_DIRECTORIES.include? path_and_name\n elsif FileTest.file?(path_and_name) && !BLACK_LIST_FILES.include?(it)\n puts \"Processing => #{path_and_name}\"\n file = File.open(path_and_name, 'r')\n file_content = ''\n line_number = 1\n file.each_line do |line|\n file_content << line.gsub(/</, '<').gsub(/^/, \"<color rgb='AAAAAA'>#{line_number}</color> \"); line_number += 1\n end\n file.close\n @code_files << [path_and_name, file_content]\n end\n end\nend",
"def dir(*) end",
"def show_changed_files(status)\n status.each_line do |line|\n if line =~ /^#\\t/ # only print out the changed files (I think)\n if line =~ /new file:|modified:|deleted:/\n puts \" #{line}\" \n else\n puts \" #{line.chop}\\t\\t(may need to be 'git add'ed)\" \n end\n end\n end\nend",
"def markNode name\n\t\tgetNode(name).marked = true\n\tend",
"def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end",
"def scan_now\n #Check for add/modify\n scan_dir(@directory)\n \n # Check for removed files\n if @on_remove.respond_to?( :call )\n @known_file_stats.each_pair{ |path,stats|\n next if File.file?( path )\n stats[:path] = path\n @on_remove.call( stats )\n @known_file_stats.delete(path)\n }\n end\n \n @scanned_once = true\n end",
"def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end",
"def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end",
"def page_files\n @page_files ||= (Dir.glob (Pathname.pwd.join(\"pages\", \"*.md\"))).sort\n end",
"def on_file_changed(content, out, path)\n SpacewalkHtmlClean.generate_diff(content, out, path)\n end",
"def for(file_or_dir); end",
"def marked_entries(*types, &block)\n if types.nil? || types.empty?\n marked_entry('**', &block)\n else\n types.each { |type| marked_entry(type, &block) }\n end\n end"
] | [
"0.5902551",
"0.5838147",
"0.5793395",
"0.5793395",
"0.5793395",
"0.5793395",
"0.5793395",
"0.5793395",
"0.57748294",
"0.5764185",
"0.57475203",
"0.57220906",
"0.5694817",
"0.56722283",
"0.5594392",
"0.5544779",
"0.5463387",
"0.5430009",
"0.5430009",
"0.54261637",
"0.53945386",
"0.53945386",
"0.5355836",
"0.53441924",
"0.5340104",
"0.53070754",
"0.5297054",
"0.5293916",
"0.52903336",
"0.5288174",
"0.52690864",
"0.526898",
"0.52542716",
"0.52541924",
"0.5243084",
"0.52227485",
"0.5219896",
"0.5203169",
"0.5188348",
"0.51861477",
"0.51849246",
"0.5183343",
"0.5179266",
"0.51571864",
"0.5153235",
"0.513394",
"0.5132923",
"0.51252955",
"0.51234484",
"0.5104368",
"0.51037014",
"0.50964594",
"0.5083065",
"0.5079784",
"0.50750214",
"0.5073781",
"0.50664943",
"0.50664943",
"0.5043562",
"0.5043562",
"0.504264",
"0.50403374",
"0.50389296",
"0.5037774",
"0.50358903",
"0.5034338",
"0.5030682",
"0.50261533",
"0.50261533",
"0.5023695",
"0.502178",
"0.50164115",
"0.50164115",
"0.50164115",
"0.5015696",
"0.50147545",
"0.5010781",
"0.5010621",
"0.50085914",
"0.50085914",
"0.5006984",
"0.50006735",
"0.49936348",
"0.49936348",
"0.49936348",
"0.49936348",
"0.49936348",
"0.499357",
"0.49933243",
"0.49889183",
"0.4988257",
"0.49863297",
"0.49801826",
"0.49793428",
"0.49778613",
"0.49777567",
"0.49776357",
"0.4976564",
"0.49734843",
"0.49721158"
] | 0.5386966 | 22 |
Marked files and directories or Array(the current file or directory). . and .. will not be included. | def selected_items
((m = marked_items).any? ? m : Array(current_item)).reject {|i| %w(. ..).include? i.name}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind.flat_map do |asset|\r\n\t\t\t\tasset.properties.select{ |name,prop| prop.type=='Texture' }.flat_map do |name,prop|\r\n\t\t\t\t\tasset[name].values.compact.uniq.map{ |path| absolute_path(path) }\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind(_type:'Text').flat_map do |asset|\r\n\t\t\t\tasset['font'].values.compact.map{ |font| absolute_path(font) }\r\n\t\t\tend +\r\n\t\t\[email protected]('/UIP/Project/Classes/*/@sourcepath').map{ |att| absolute_path att.value }\r\n\t\t).uniq\r\n\tend",
"def files() = files_path.glob('**/*')",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def included_files; end",
"def all_files; end",
"def all_files; end",
"def files_inspected(ext, delimiter = ',', remove = @config.working_dir)\n @path.is_a?(Array) ? @path.split(delimiter) : file_list(@path, ext, remove)\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files\n @files = Dir[File.join(root(:site), '**', '*')].inject([]) do |a, match|\n # Make sure its the canonical name\n path = File.expand_path(match)\n file = path.gsub /^#{Regexp.escape root(:site)}\\/?/, ''\n ext = File.extname(file)[1..-1]\n \n if ignored_files.include?(path) or File.directory?(match)\n # pass\n elsif not get_renderer(ext).nil? # Has a renderer associated\n fname = file.chomp(\".#{ext}\")\n fname += get_renderer(ext).default_ext unless File.basename(fname).include?('.')\n a << fname\n else\n a << file\n end\n a\n end\n end",
"def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end",
"def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end",
"def exploreFiles( target, results = Array[] )\n # First, check if the target is a directory\n if isDirectory( target )\n # Okay, target is a directory, get all the entries inside the\n # directory and iterate over them\n Dir.entries( target ).each do |path|\n fullPath = \"#{target}/#{path}\"\n # We are now iterating over each of the directory entries. Ignore\n # paths that do NOT end with .ti, they are not Titanium class files\n # and we do not want to create documentation for them.\n\n # However, if a path is a directory, iterate over that too\n if path != \".\" and path != \"..\"\n if isDirectory fullPath\n results = exploreFiles( fullPath, results )\n elsif File.extname( path ) == \".ti\"\n # Alright! The path is marked as a Titanium class file via the .ti ext.\n # Lets begin parsing for functions and comments.\n results.push fullPath\n end\n end\n end\n\n return results\n else\n raise \"Failed to generate documentation. Cannot explore #{target}, is a file\"\n end\nend",
"def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend",
"def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end",
"def get_important_files dir\n # checks various lists like visited_files and bookmarks\n # to see if files from this dir or below are in it.\n # More to be used in a dir with few files.\n list = []\n l = dir.size + 1\n\n # 2019-03-23 - i think we are getting the basename of the file\n # if it is present in the given directory XXX\n @visited_files.each do |e|\n list << e[l..-1] if e.index(dir) == 0\n end\n list = get_recent(list)\n\n # bookmarks if it starts with this directory then add it\n # FIXME it puts same directory cetus into the list with full path\n # We need to remove the base until this dir. get relative part\n list1 = @bookmarks.values.select do |e|\n e.index(dir) == 0 && e != dir\n end\n\n list.concat list1\n list\nend",
"def files\n return [] unless meta?\n filename = meta['path'] + '/' + meta['filename']\n [\n Inch::Utils::CodeLocation.new('', filename, meta['lineno'])\n ]\n end",
"def files(*args)\r\n LocalDirectory.current.files(*args)\r\n end",
"def find_kotlin_files(dir_selected, files = nil, excluded_paths = [], included_paths = [])\n # Needs to be escaped before comparsion with escaped file paths\n dir_selected = Shellwords.escape(dir_selected)\n\n # Assign files to lint\n files = if files.nil?\n (git.modified_files - git.deleted_files) + git.added_files\n else\n Dir.glob(files)\n end\n # Filter files to lint\n files.\n # Ensure only Kotlin files are selected\n select { |file| file.end_with?(\".kt\") }.\n # Make sure we don't fail when paths have spaces\n map { |file| Shellwords.escape(File.expand_path(file)) }.\n # Remove dups\n uniq.\n # Ensure only files in the selected directory\n select { |file| file.start_with?(dir_selected) }.\n # Reject files excluded on configuration\n reject { |file| file_exists?(excluded_paths, file) }.\n # Accept files included on configuration\n select do |file|\n next true if included_paths.empty?\n\n file_exists?(included_paths, file)\n end\n end",
"def blacklisted_dir_entries\n %w[. ..]\n end",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || [email protected](/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && [email protected]('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && [email protected]('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def glob; end",
"def include_hidden!\n @flags |= File::FNM_DOTMATCH\n end",
"def for(file_or_dir); end",
"def related_files\n []\n end",
"def applicable_files; end",
"def files\n Native `#{@el}.files`\n end",
"def files\n Native `#{@el}.files`\n end",
"def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend",
"def files()\n children.select { |c| c.file? }\n end",
"def source_files; end",
"def filenames; end",
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def excluded_files() = []",
"def in_files\n return [] if @comments.empty?\n\n case @comments\n when Array then\n @comments.map do |comment|\n comment.file\n end\n when RDoc::Markup::Document then\n @comment.parts.map do |document|\n document.file\n end\n else\n raise RDoc::Error, \"BUG: unknown comment class #{@comments.class}\"\n end\n end",
"def code_files_in(some_dir, extensions)\n raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname\n\n full_dir = path + some_dir\n return [] unless full_dir.exist? && full_dir.directory?\n\n files = full_dir.children.reject(&:directory?)\n cpp = files.select { |path| extensions.include?(path.extname.downcase) }\n not_hidden = cpp.reject { |path| path.basename.to_s.start_with?(\".\") }\n not_hidden.sort_by(&:to_s)\n end",
"def sources\n files(!p?)\n end",
"def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end",
"def add_to_selection file\n ff = file\n case file\n when String\n ff = [file]\n end\n @current_dir ||= Dir.pwd\n ff.each do |f|\n # this is wrong if the file is a dir listing or visited files listing.\n # full = File.join(@current_dir, f)\n full = expand_path(f)\n @selected_files.push(full) unless @selected_files.include?(full)\n end\nend",
"def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end",
"def ignored_files=(_arg0); end",
"def select_all\n dir = Dir.pwd\n # check this out with visited_files TODO FIXME\n @selected_files = @view.map { |file| File.join(dir, file) }\n message \"#{@selected_files.count} files selected.\"\nend",
"def selected_files\n a = Array.new\n selected_iters do |iter|\n a.push(@current_dir+iter[LS_Name])\n end\n return a\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def files\n file_sets.map{|fs| fs.files }.flatten\n end",
"def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end",
"def parse_files(files, opts = {})\n opts = { :extension => nil, :directory => nil }.merge opts\n files = [files] unless files.is_a?(Array)\n search_text = files.join(\" \")\n parsed_files = []\n while !files.empty?\n file = files.shift\n unless opts[:directory].nil?\n file = opts[:directory] + \"/\" + file\n end\n unless opts[:extension].nil?\n file = file.sub(/\\.[^\\\\\\/]*$/, \"\") + \".\" + opts[:extension].to_s.tr(\".\", \"\")\n end\n parsed_files += Dir.glob(File.expand_path(file))\n end\n puts I18n.t(:no_match) % search_text if parsed_files.empty?\n parsed_files.uniq\n end",
"def directories; end",
"def directories; end",
"def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end",
"def document_files\n allowed_formats = \n if not parsers.empty?\n parsers.collect do |filetype, parser| \n \".\" + parser.file_extension_name\n end.join(\"|\")\n elsif not parser.nil?\n \".\" + parser.file_extension_name\n end\n\n allowed_formats = Regexp.new(allowed_formats)\n \n \tFileUtils.collect_files_from(docs_path).select do |document_filename|\n \t document_filename =~ allowed_formats\n end\n end",
"def files\n\t\t# if the directory doesn't exist, we bail out with a nil\n\t\treturn nil unless File.directory? dir\n\t\t\n\t\tf = Dir.entries(dir)\n\t\tf.delete(\".\")\n\t\tf.delete(\"..\")\n\n\t\treturn f\n\tend",
"def selected_files\n Dir[\"#{ARGV.first}*.log\"] \nend",
"def breadcrumb_files\n Dir[*Gretel.breadcrumb_paths]\n end",
"def filtered(files); end",
"def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end",
"def files()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |f|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + f )\n\t\t\t\t\tnext unless ( f[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << file( f )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"def files\n filenames || []\n end",
"def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end",
"def target_files_in_dir(base_dir = T.unsafe(nil)); end",
"def page_files\n @page_files ||= (Dir.glob (Pathname.pwd.join(\"pages\", \"*.md\"))).sort\n end",
"def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end",
"def working_files\n files.map {|f| working_file f}\n end",
"def glob\n \"**/*\"\n end",
"def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def array_decide\n @parameter['a'] ? Dir.glob('*', File::FNM_DOTMATCH) : Dir.glob('*')\nend",
"def files\n @files ||= preferred_sources([@path])\n end",
"def dir; end",
"def dir; end",
"def dir; end",
"def track_files(glob); end",
"def ignore_includes\n ret = []\n ret << \"_includes/jekyll/**/*\"\n ret << [\"_includes/styleguide\", \"_includes/styleguide/**/*\"]\n ret << \"_includes/*.html\"\n ret << [\"_includes/atoms/figure\", \"_includes/atoms/figure/*\"]\n ret << [\"_includes/atoms/sanitize.html\", \"_includes/atoms/imagetitle.html\", \"_includes/atoms/classname.html\"]\n ret\n end",
"def project_code_arrays\n [:controller_files, :model_files, :view_files, :lib_files]\n end",
"def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end",
"def files(dir = nil)\n return Fileset.from_glob(dir) unless dir.nil?\n input_files\n end",
"def extension_whitelist\n %w(doc docx rtf pdf xls xlsx csv zip)\n end",
"def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end",
"def files\n cli_arguments.each_with_index do |filename, index|\n if Dir.exist?(filename)\n cli_arguments[index] = Dir[\"#{filename}/**/*.md\"]\n end\n end\n cli_arguments.flatten!\n cli_arguments\n end",
"def files_in(dir)\n Dir.chdir(dir) do\n Dir.glob('**/*').select { |f| File.file?(f) }\n end\nend",
"def expandable_default_files; end",
"def files=(_arg0); end",
"def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def find_files(path)\r\n Dir.entries(path).reject {|f| f =~ /^\\./} || Array.new\r\nend",
"def formatted_file_list(title, source_files); end",
"def helper_files\n source_dir = File.join(Dir.pwd, \"lib/drydock/jobs\", helper_source_dir)\n if Dir.exists?(source_dir)\n Dir[source_dir + \"/*\"]\n else\n []\n end\n end",
"def file_list\n end",
"def current_dir; end"
] | [
"0.5985589",
"0.5861694",
"0.58194774",
"0.57821",
"0.57643884",
"0.5762127",
"0.57152206",
"0.57152206",
"0.5693926",
"0.56917053",
"0.56917053",
"0.56917053",
"0.56917053",
"0.56917053",
"0.56917053",
"0.5686094",
"0.5632464",
"0.561607",
"0.55936986",
"0.55614895",
"0.5511078",
"0.54993975",
"0.5491461",
"0.5481474",
"0.5458174",
"0.54506373",
"0.5448745",
"0.5438355",
"0.5427278",
"0.5406582",
"0.5405381",
"0.5404569",
"0.5385817",
"0.5385817",
"0.53638893",
"0.53604406",
"0.5356759",
"0.53554827",
"0.53534454",
"0.53455067",
"0.534124",
"0.5340737",
"0.53373116",
"0.53354543",
"0.53334886",
"0.5330885",
"0.5326669",
"0.53179365",
"0.5316385",
"0.53056186",
"0.52963775",
"0.52963775",
"0.52960485",
"0.529023",
"0.52796924",
"0.5277547",
"0.5277547",
"0.52775323",
"0.52774966",
"0.52669924",
"0.5262003",
"0.52549076",
"0.525196",
"0.5249233",
"0.5243163",
"0.5242857",
"0.5240878",
"0.5230264",
"0.52246726",
"0.5222642",
"0.5218444",
"0.52180105",
"0.5213489",
"0.52126443",
"0.52126443",
"0.52126443",
"0.52126443",
"0.52126443",
"0.5209046",
"0.5207501",
"0.52042854",
"0.52042854",
"0.52042854",
"0.5198524",
"0.5193943",
"0.51910067",
"0.5183764",
"0.517672",
"0.5172636",
"0.51689583",
"0.5162642",
"0.5159551",
"0.515788",
"0.51557004",
"0.5155439",
"0.5154018",
"0.5152631",
"0.5148591",
"0.51464844",
"0.51318556",
"0.51303846"
] | 0.0 | -1 |
Move the cursor to specified row. The main window and the headers will be updated reflecting the displayed files and directories. The row number can be out of range of the current page. | def move_cursor(row = nil)
if row
if (prev_item = items[current_row])
main.draw_item prev_item
end
page = row / max_items
switch_page page if page != current_page
main.activate_pane row / maxy
@current_row = row
else
@current_row = 0
end
item = items[current_row]
main.draw_item item, current: true
main.display current_page
header_l.draw_current_file_info item
@current_row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto_row(row)\n \n set RGhost::Cursor.goto_row(row) \n end",
"def jump_rows(row)\n @rows+=row\n set RGhost::Cursor.jump_rows(row)\n end",
"def select_row(row_number = 0)\n set_cursor(Gtk::TreePath.new(row_number), nil, false)\n end",
"def update_head_vertical_location(row)\n locate_head[0] = row\n end",
"def next_row\n @rows+=1\n set RGhost::Cursor.next_row\n end",
"def move_to position\n orig = @cursor\n place_cursor(CLEAR) if @highlight_row_flag\n @cursor = position\n @cursor = [@cursor, @view.size - 1].min\n @cursor = [@cursor, 0].max\n\n # try to stop it from landing on separator\n if current_file == SEPARATOR\n @cursor += 1 if @cursor_movement == :down\n @cursor -= 1 if @cursor_movement == :up\n # 2019-06-01 - remove return in case scrolling happens here\n # return\n end\n\n # 2019-03-18 - adding sta\n # @sta = position - only when page flips and file not visible\n # FIXME not correct, it must stop at end or correctly cycle\n # sta goes to 0 but cursor remains at 70\n # viewport.size may be wrong here, maybe should be pagesize only\n oldsta = @sta\n if @cursor - @sta >= @pagesize\n @sta += @pagesize\n # elsif @sta - @cursor >= @vps\n end\n if @sta > @cursor\n @sta -= @pagesize\n # @sta = @cursor\n end\n\n @cursor_movement = nil if oldsta != @sta # we need to redraw\n\n # -------- return here --- only visual mode continues ---------------------#\n return unless @visual_mode\n\n star = [orig, @cursor].min\n fin = [orig, @cursor].max\n @cursor_movement = nil # visual mode needs to redraw page\n\n # PWD has to be there in selction\n # FIXME with visited_files\n if selected? File.join(@current_dir, current_file)\n # this depends on the direction\n # @selected_files = @selected_files - @view[star..fin]\n remove_from_selection @view[star..fin]\n ## current row remains in selection always.\n add_to_selection current_file\n else\n # @selected_files.concat @view[star..fin]\n add_to_selection @view[star..fin]\n end\n message \"#{@selected_files.count} files selected. \"\nend",
"def move_to(row = nil, column = nil)\n return CSI + 'H' if row.nil? && column.nil?\n CSI + \"#{column + 1};#{row + 1}H\"\n end",
"def set_cursor_position(row, col)\n\t\tinvalid_rows = [@cursor_row, row]\n\t\t@cursor_row, @cursor_col = row, col\n\t\tif @cursor_row < first_line_in_view\n\t\t\tset_contents_pos(0, line_num_to_coord(@cursor_row))\n\t\t\temit_changed(nil)\n\t\telsif @cursor_row > last_line_in_view\n\t\t\tset_contents_pos(0, line_num_to_coord(@cursor_row - num_lines_in_view))\n\t\t\temit_changed(nil)\n\t\tend\n\tend",
"def goto_next_selection\n return if selected_rows().length == 0 \n row = selected_rows().sort.find { |i| i > @obj.current_index }\n row ||= @obj.current_index\n #@obj.current_index = row\n @obj.goto_line row\n end",
"def customize_row_index(row_index)\n row_index += 1\n end",
"def go_to_next_row()\n turn_left()\n move()\n turn_left()\n end",
"def next_row\n @current_row += 1\n end",
"def current_row\n @row_offset\n end",
"def update_head_horizontal_location(column)\n locate_head[1] = column\n end",
"def row_seek(n)\n @result.row_seek(n)\n end",
"def move_to(row, col)\n @row, @col = wrap(row, col)\n end",
"def row_seek(n)\n ret = @index\n @index = n\n ret\n end",
"def cursor_to( row, col, do_display = DONT_DISPLAY, stopped_typing = STOPPED_TYPING, adjust_row = ADJUST_ROW )\n old_last_row = @last_row\n old_last_col = @last_col\n\n row = row.fit( 0, @lines.length - 1 )\n\n if col < 0\n if adjust_row\n if row > 0\n row = row - 1\n col = @lines[ row ].length\n else\n col = 0\n end\n else\n col = 0\n end\n elsif col > @lines[ row ].length\n if adjust_row\n if row < @lines.length - 1\n row = row + 1\n col = 0\n else\n col = @lines[ row ].length\n end\n else\n col = @lines[ row ].length\n end\n end\n\n if adjust_row\n @desired_column = col\n else\n goto_col = [ @desired_column, @lines[ row ].length ].min\n if col < goto_col\n col = goto_col\n end\n end\n\n new_col = tab_expanded_column( col, row )\n view_changed = show_character( row, new_col )\n @last_screen_y = row - @top_line\n @last_screen_x = new_col - @left_column\n\n @typing = false if stopped_typing\n @last_row = row\n @last_col = col\n @last_screen_col = new_col\n changed = ( @last_row != old_last_row or @last_col != old_last_col )\n if changed\n record_mark_start_and_end\n\n removed = false\n if not @changing_selection and selecting?\n remove_selection( DONT_DISPLAY )\n removed = true\n end\n if removed or ( do_display and ( selecting? or view_changed ) )\n display\n else\n @diakonos.display_mutex.synchronize do\n @win_main.setpos( @last_screen_y, @last_screen_x )\n end\n end\n @diakonos.update_status_line\n @diakonos.update_context_line\n\n @diakonos.remember_buffer self\n end\n\n changed\n end",
"def move row, col\n @row = row\n @col = col\n end",
"def goto_prev_selection\n return if selected_rows().length == 0 \n row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index }\n row ||= @obj.current_index\n #@obj.current_index = row\n @obj.goto_line row\n end",
"def ensure_visible row = @current_index\n unless is_visible? row\n @prow = row\n end\n end",
"def ensure_visible row = @current_index\n unless is_visible? row\n @prow = @current_index\n end\n end",
"def current_row\n @current_row ||= 1\n end",
"def row=(row)\n @row = Utility.clamp(row, 0, GRID_ROWS - 1)\n end",
"def scroll_forward\n #@oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def select_next!\n pane.next_row!\n end",
"def row_position=(position)\n @row_position = position \n end",
"def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end",
"def show_focus_on_row row0, _prow, tf=true\n # color = tf ? $reversecolor : $datacolor\n # if cursor on row, reverse else normal\n attr = tf ? Ncurses::A_REVERSE : Ncurses::A_NORMAL\n color = @color_pair\n r = row0+1 \n #check if row is selected or not\n row_att = @list_attribs[_prow] unless @list_attribs.nil?\n if !row_att.nil?\n status = row_att.fetch(:status, \" \")\n attr1 = row_att[:bgcolor] \n color = attr1 unless attr1.nil?\n end\n @datawidth ||= @width-2\n return if r > get_content().length\n @form.window.mvchgat(y=r+@row, x=1+@col, max=@datawidth, attr, color, nil)\n end",
"def scroll_forward\n @oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def set_form_row\n r,c = rowcol\n @rows_panned ||= 0\n \n #[email protected]\n win_row=@win_top # 2010-02-11 15:12 RFED16\n win_row = 0 # 2010-02-07 21:44 now ext offset added by widget\n #win_row = 0 # new approach, we have it \n #[email protected]\n # added 1 ?? in copywin too 2010-02-11 18:51 RFED16 this results in extra in normal situations.\n row = win_row + r + (@current_index-@toprow) + @rows_panned \n $log.debug \" #{@name} LIST set_form_row #{row} = ci #{@current_index} + r #{r} + winrow: #{win_row} - tr:#{@toprow} #{@toprow} + rowsp #{@rows_panned} \"\n $log.debug \" - LIST set_form_row row_offset: #{@row_offset} + r #{r} + ci - topr + rowsp: #{@rows_panned}. c= #{c} \"\n\n ## 2009-12-28 23:05 TRYING OUT but i really can't do this everywhere. BUFFERED\n ## this needs to percolate up a heirarchy.\n ## 2010-01-05 21:09 changed c to nil, since c is not cursor col pos but where printing starts, i think\n #@form.setrowcol row, nil\n #setformrowcol row, nil\n setrowcol row, nil\n show_caret_func\n end",
"def right_click_table_row(table, row_index)\n append_to_script \"right_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end",
"def set_cursor(position)\r\n print locate((@disks*2+2)*@column+4, @disks+4-position)\r\n end",
"def setpos r=@row, c=@col\n #$log.debug \"setpos : (#{self.name}) #{r} #{c} XXX\"\n ## adding just in case things are going out of bounds of a parent and no cursor to be shown\n return if r.nil? or c.nil? # added 2009-12-29 23:28 BUFFERED\n return if r<0 or c<0 # added 2010-01-02 18:49 stack too deep coming if goes above screen\n @window.wmove r,c\n end",
"def cursor_home\n @curpos = 0\n @pcol = 0\n set_col_offset 0\n end",
"def rowAt(row)\n self.tiles[row.to_i * N_COLS, N_COLS]\n end",
"def cursor_up(wrap = false)\n if row == 0\n process_up\n else\n super\n end\n end",
"def lnbSetCurSelRow _args\n \"lnbSetCurSelRow _args;\" \n end",
"def track_row_print row, tabs=3\n @filehandle << track_row_string( row, tabs )\n end",
"def next_row\n raise(\"no more rows available\") unless next?\n self.last_row = self.rows[self.current_row_index]\n self.current_row_index += 1\n\n if self.current_row_index == self.rows.size\n self.rows = nil\n end\n\n self.last_row\n end",
"def row_tell\n @index\n end",
"def goto_last_position\n return unless @oldrow\n @current_index = @oldrow\n bounds_check\n end",
"def goto_line pos\n pages = ((pos * 1.00) / @pagesize).ceil\n pages -= 1\n @sta = pages * @pagesize + 1\n @cursor = pos\nend",
"def goto_line pos\n pos = pos.to_i\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n $sta = pages * $pagesize + 1\n $cursor = pos\nend",
"def move_by(row_delta, col_delta)\n @row, @col = wrap(@row + row_delta, @col + col_delta)\n end",
"def step\n @seed.text = @row.cells\n \n @canvas.append do\n image width, CELL_HEIGHT do\n @row.draw(self)\n end\n end\n @canvas.scroll_top = @canvas.scroll_max\n \n @row = @row.next\n end",
"def line_number\n $curwin.cursor.first\n end",
"def row(row, by)\n by.times { @display[row].unshift @display[row].pop }\n self\n end",
"def record_move(row, col, value)\n tile = @rows[row-1][col-1]\n tile.value = value\n tile\n end",
"def colrow=(val) @records.set(GRT_COLROW, val); end",
"def cursor_up(wrap)\n if @index >= 10\n @index -= 10\n elsif wrap\n @index += 80\n end\n end",
"def cursor_forward\n $multiplier = 1 if $multiplier == 0\n if @curpos < @cols\n @curpos += $multiplier\n if @curpos > @cols\n @curpos = @cols\n end\n @repaint_required = true\n end\n $multiplier = 0\n end",
"def place_cursor color=CURSOR_COLOR\n # empty directory\n if @vps == 0\n tput_cup 0, 0\n return\n end\n\n c = @cursor - @sta\n\n # NOTE: cursor can be higher that viewport !!!\n # we need to move it to next page TODO 2019-05-21 -\n if c > @vps\n c = 0\n end\n\n wid = get_width @vps, @grows\n if c < @grows\n rows = c\n cols = 0\n else\n rows = c % @grows\n cols = (c / @grows) * wid\n end\n\n tput_cup rows, cols\n return unless @highlight_row_flag\n\n color = nil if color == CLEAR # let it determine its own color\n f = get_formatted_filename(c, wid)\n\n f = color + f + CLEAR if color\n\n # f = color + f if color # NOTE: this was causing 2 issues: color bleed onto\n # status line and top line. And the highcolor of some rows would not go away.\n # If REVERSE_OFF is used, then REVERSE_OFF must also be used\n #\n print f\n tput_cup rows, cols # put it back at start\nend",
"def clicked(row, col)\n return unless row == 2\n level, file, = @elements[col - 1]\n title = @headers[col - 1]\n GuiQt.show_file(self, title, file) unless level == :NEVER\n end",
"def cursor_pageup\n @mode = (@mode + TABLE.size - 1) % TABLE.size\n refresh\n end",
"def cursor_home\n @curpos = 0\n @pcol = 0\n set_form_col 0\n end",
"def switch_page(page)\n main.display (@current_page = page)\n @displayed_items = items[current_page * max_items, max_items]\n header_l.draw_path_and_page_number path: current_dir.path, current: current_page + 1, total: total_pages\n end",
"def current_row\n @list[@current_index]\n end",
"def select_next_completion\n completer.current_row += 1\n completer.popup.current_index =\n completer.popup.current_index.sibling(completer.current_row, 0)\n end",
"def cur_row=(cur_row)\n raise('overrides detected; must use cur_raw_row= instead') if compute_cur_row(cur_row) != cur_row\n\n @cur_raw_row = cur_row\n @cur_row = cur_row\n end",
"def move(line, column = T.unsafe(nil)); end",
"def move(line, column = T.unsafe(nil)); end",
"def row_at(row_idx)\n @grid[row_idx]\n end",
"def double_click_table_row(table, row_index)\n append_to_script \"double_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end",
"def move_to_start\n @cursor = 0\n end",
"def move_to_start\n @cursor = 0\n end",
"def config_row(row, options = {})\n TkGrid.rowconfigure content, row, options\n end",
"def goto_end\n @oldindex = @current_index\n $multiplier ||= 0\n if $multiplier > 0\n goto_line $multiplier\n return\n end\n @current_index = @content_rows-1\n @prow = @current_index - @scrollatrows\n $multiplier = 0\n end",
"def move_row(pos)\n from = pos[:from].to_i\n dest = pos[:dest].to_i\n moving = nil\n\n # Moving down\n if dest > from\n rws = rows.where(position: from..dest)\n rws.each do |row|\n if row.position == from\n moving = row\n moving.position = -1\n else\n row.position -= 1\n end\n end\n moving.position = dest\n\n # Moving up\n else\n rws = rows.where(position: dest..from)\n rws.each do |row|\n if row.position == from\n moving = row\n moving.position = -1\n else\n row.position += 1\n end\n end\n moving.position = dest\n end\n\n saved = rws.map(&:save)\n saved.all?\n end",
"def cur_pos=(idx)\n @cursor_moved=true\n @cursor.pos=idx\n end",
"def move(line, column=0)\n \"\\e[#{line.to_i};#{column.to_i}H\"\n end",
"def row(index)\n end",
"def slide_card_row_cards\n i = 0\n card_row.each do |card|\n if card\n card.position = i\n card.save\n i += 1\n end\n end\n end",
"def pick_row(index)\n raise ArgumentError, 'Argument (: index) is out of range' unless index < @rows\n @grid[index]\n end",
"def delete_row(row)\n puts \"---------------------------\"\n puts \"| Delete Row |\"\n puts \"---------------------------\"\n @file.delete('row')\n puts @file\n puts \"\\n\"\n end",
"def jumpToCell(row, col)\n new_row = row\n new_col = col\n\n # Only create the row scale if needed.\n if (row == -1) || (row > @rows)\n # Create the row scale widget.\n scale = CDK::SCALE.new(@screen, CDK::CENTER, CDK::CENTER,\n '<C>Jump to which row.', '</5/B>Row: ', Ncurses::A_NORMAL,\n 5, 1, 1, @rows, 1, 1, true, false)\n\n # Activate the scale and get the row.\n new_row = scale.activate([])\n scale.destroy\n end\n\n # Only create the column scale if needed.\n if (col == -1) || (col > @cols)\n # Create the column scale widget.\n scale = CDK::SCALE.new(@screen, CDK::CENTER, CDK::CENTER,\n '<C>Jump to which column', '</5/B>Col: ', Ncurses::A_NORMAL,\n 5, 1, 1, @cols, 1, 1, true, false)\n\n # Activate the scale and get the column.\n new_col = scale.activate([])\n scale.destroy\n end\n\n # Hyper-warp....\n if new_row != @row || @new_col != @col\n return self.moveToCell(new_row, new_col)\n else\n return 1\n end\n end",
"def insert_row(row, [email protected])\n @rows.insert(index, row)\n end",
"def index_of_position(row, col = 0)\n\t\tline_index(row) + col + 1\n\tend",
"def cursor_pagedown\n @mode = (@mode + 1) % TABLE.size\n refresh\n end",
"def table_click_index(name,x,y,top = 2)\n first_row = top # header bar + top of table\n first_row += 2 if self.special_elements[:table][:header]\n\n if y >= top && y < self.height - 1\n y - first_row\n else\n nil\n end\n end",
"def row index\n rows[index / 9]\n end",
"def top_row=(row)\n if row < 0\n row = 0\n end\n if row > row_max - 1\n row = row_max - 1\n end\n self.oy = row * 116 #116\n end",
"def cursor_at(row, col)\n \"\\e[#{row};#{col}H\"\nend",
"def lnbCurSelRow _args\n \"lnbCurSelRow _args;\" \n end",
"def update_table_row(name, slide_index, shape_index, row_index, dto, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = update_table_row_with_http_info(name, slide_index, shape_index, row_index, dto, password, folder, storage)\n data\n end",
"def get_row(csv_file, row)\n csv_data = CSV.read(csv_file)\n path = File.dirname(csv_file)\n\n csv_data[row-1]\n end",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def gnuplot_row(col, row, value)\n col += 1; row += 1\n \"#{col} #{row - 0.5} #{value}\\n#{col} #{row + 0.5} #{value}\\n\"\n end",
"def next_row\n observation_matrix.observation_matrix_rows.where('position > ?', position).order(:position).first\n end",
"def move!(row, column, icon)\n @row, @column, @icon = row, column, icon\n\n make_move!\n end",
"def row_to_px row_number\n\n # Row 0 starts 5 units below the top of the grid.\n # Each row afterward is 20 units lower.\n grid.top.shift_down(5).shift_down(20 * row_number)\n end",
"def addcol num\n return if @col.nil? || @col == -1\n @col += num\n @window.wmove @row, @col\n ## 2010-01-30 23:45 exchange calling parent with calling this forms setrow\n # since in tabbedpane with table i am not gietting this forms offset. \n setrowcol nil, col\n end",
"def step_cursor()\r\n unless @@busy_cursors \r\n self.class.send(:get_cursors)\r\n end\r\n \r\n @cursor_index = (@cursor_index + 1) % 8\r\n UI.set_cursor(@@busy_cursors[@cursor_index]) if @mouse_in_viewport\r\n end",
"def endRow; @row + @height - 1; end",
"def paginate_row_offset_assign(per_page = 8)\n @row_offset = params[:page] ? 1 + (params[:page].to_i - 1) * per_page : 1\n end",
"def row(position)\n position[0]\n end",
"def addrowcol row,col\n return if @col.nil? or @col == -1 # contradicts comment on top\n return if @row.nil? or @row == -1\n @col += col\n @row += row\n @window.wmove @row, @col\n \n end",
"def fire_row_changed ix\n return if ix >= @list.length\n clear_row @pad, ix\n # allow documents to reparse that line\n fire_handler :ROW_CHANGED, ix\n _arr = _getarray\n render @pad, ix, _arr[ix]\n\n end"
] | [
"0.72010726",
"0.68817645",
"0.6806795",
"0.64135754",
"0.64131194",
"0.6307145",
"0.6255472",
"0.6245421",
"0.62252295",
"0.61407685",
"0.60533386",
"0.6020533",
"0.59794873",
"0.5968704",
"0.5912319",
"0.5890729",
"0.5836306",
"0.583052",
"0.5828907",
"0.58208406",
"0.58069265",
"0.58032185",
"0.57952654",
"0.5723768",
"0.5699866",
"0.56943804",
"0.56731546",
"0.5649522",
"0.5644759",
"0.5612328",
"0.56102026",
"0.55907416",
"0.5587414",
"0.55731636",
"0.5542478",
"0.5532512",
"0.55178016",
"0.55170226",
"0.55064267",
"0.5484729",
"0.5475613",
"0.5467031",
"0.5463241",
"0.54433995",
"0.5437336",
"0.5432644",
"0.5392288",
"0.5384804",
"0.5368379",
"0.5353739",
"0.53521675",
"0.5342081",
"0.53369665",
"0.5328171",
"0.5300575",
"0.5297146",
"0.52906674",
"0.5280643",
"0.5276178",
"0.52743167",
"0.5271952",
"0.5271952",
"0.52659106",
"0.52402014",
"0.52301604",
"0.52301604",
"0.5216682",
"0.5182472",
"0.517473",
"0.5170708",
"0.5163448",
"0.5162387",
"0.5157628",
"0.5156918",
"0.5153725",
"0.5148575",
"0.5146313",
"0.51460195",
"0.5140158",
"0.51332825",
"0.5132293",
"0.51305425",
"0.51287377",
"0.51203877",
"0.5107411",
"0.50991225",
"0.5094817",
"0.5094817",
"0.5094817",
"0.50947493",
"0.5094735",
"0.5086498",
"0.5077479",
"0.50712943",
"0.5068118",
"0.50678796",
"0.50608826",
"0.5058798",
"0.505627",
"0.5055337"
] | 0.84249705 | 0 |
Change the current directory. | def cd(dir = '~', pushd: true)
dir = load_item path: expand_path(dir) unless dir.is_a? Item
unless dir.zip?
Dir.chdir dir
@current_zip = nil
else
@current_zip = dir
end
@dir_history << current_dir if current_dir && pushd
@current_dir, @current_page, @current_row = dir, 0, nil
main.activate_pane 0
ls
@current_dir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chdir; end",
"def change_dir f\n unless File.directory? f\n perror \"#{f} is not a directory, or does not exist.\"\n return\n end\n\n # before leaving a dir we save it in the list, as well as the cursor\n # position, so we can restore that position when we return\n @visited_dirs.insert(0, Dir.pwd)\n save_dir_pos\n\n f = expand_path(f)\n Dir.chdir f\n @current_dir = Dir.pwd # 2019-04-24 - earlier was in post_cd but too late\n read_directory\n post_cd\n\n redraw_required\nend",
"def cd(target = ENV['HOME'])\n Dir.chdir(target.strip)\n \"Directory changed to #{Dir.pwd}\"\n end",
"def chdir(path)\n ensure_relative_path! :chdir, path\n @path += path\n end",
"def chdir(dir=nil)\n @chdir = dir.to_s if dir\n @chdir\n end",
"def set_dir(new_dir)\n # checking for / at the end of the env variable\n new_dir = '' unless new_dir\n new_dir += '/' unless new_dir[-1, 1] == '/'\n @dir = new_dir\n end",
"def chdir=(dir)\n @chdir = dir.to_s\n end",
"def chdir(dir)\n previous_dir = File.expand_path(\".\")\n\n Dir.chdir(dir)\n begin\n @p4.cwd = File.expand_path(\".\")\n rescue\n Dir.chdir(previous_dir)\n raise\n end\n\n if block_given?\n begin\n yield dir\n ensure\n Dir.chdir(previous_dir)\n @p4.cwd = previous_dir\n end\n end\n end",
"def change_dir(iDir)\n lOldDir = Dir.getwd\n Dir.chdir(iDir)\n begin\n yield\n rescue Exception\n Dir.chdir(lOldDir)\n raise\n end\n Dir.chdir(lOldDir)\n end",
"def cd(dir = nil)\n d = dir\n case d\n when File, Dir\n d = d.path if File.directory?(d.path)\n end\n $env.chdir(d)\nend",
"def chdir(&block)\n Dir.chdir(self, &block)\n end",
"def chdir(&block)\n Dir.chdir(top_level, &block)\n end",
"def cd(dir = nil)\n dir ||= homedir\n dir = expand_path(dir)\n @cwd = dir\n end",
"def cd(path)\n Dir.chdir(path)\n \"cd #{path}\"\n end",
"def set_current_path; end",
"def change_dir(dir)\n begin\n return true if Dir.chdir(dir)\n rescue Exception => error\n Loggers::Main.log.warn error.message\n exit 5\n end\n end",
"def chdir(dir)\n puts Dir.pwd\n\n Dir.chdir(dir) do\n puts Dir.pwd\n end\nend",
"def excel_change_directory(new_wd)\n new_wd = File.expand_path(new_wd)\n raise ExcelError.new(\"Cannot change working directory - '#{new_wd}' does not exist\") unless File.exist?(new_wd)\n\n begin\n orig_wd_w = Converter.to_windows_path(Dir.pwd)\n new_wd_w = Converter.to_windows_path(new_wd)\n # In some machines, ChDir will not change the directory immediately.\n # So to make sure, first change the drive and then change the directory if the directory is absolute.\n excel_call('ChangeWorkingDrive', new_wd_w[0..1]) if new_wd_w[1] == ?:\n excel_call('ChangeWorkingDirectory', new_wd_w)\n current_dir = excel_call('ShowWorkingDirectory')\n @logger.trace('Changed Excel.exe working directory: ' + current_dir)\n # Execute the provided block.\n yield\n ensure\n # All done, reset working directory.\n excel_call('ChangeWorkingDrive', orig_wd_w[0..1]) if orig_wd_w[1] == ?:\n excel_call('ChangeWorkingDirectory', orig_wd_w)\n current_dir = excel_call('ShowWorkingDirectory')\n @logger.trace('Reset Excel.exe working directory: ' + current_dir)\n end\n end",
"def chdir(&block)\n Dir.chdir(ROOT.join(name), &block)\n end",
"def changePath(path, &block)\n currPath = Dir.pwd\n begin\n Dir.chdir(path)\n result = block.call\n Dir.chdir(currPath)\n result\n rescue\n Dir.chdir(currPath)\n raise $!\n end\nend",
"def cd( path = File.expand_path('~') )\n new_last_path = FileUtils.pwd\n if path == '-'\n if @last_path\n path = @last_path\n else\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n cd path\n @last_path = new_last_path\n ls\n end",
"def chdir(&block)\n ::Dir.chdir(path, &block)\n end",
"def current_dir; end",
"def set_current_path(path)\n @current_path = path\nend",
"def chdir(path)\n ensure_relative_path! :chdir, path\n @ftp.chdir path\n end",
"def chdir(&block)\n warn \"Path::Name#chdir is obsoleted. Use Dir.chdir.\"\n Dir.chdir(path, &block)\n end",
"def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend",
"def restore_dir\n cd @dir\n end",
"def push_dir(dir = nil)\n @directory_stack.push(Dir.pwd)\n self.chdir(dir)\n end",
"def chdir(dir, &block)\n Dir.chdir(File.expand_path(dir), &block)\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def cd( path = '~' )\n new_last_path = FileUtils.pwd\n if path == '-'\n unless path = Irbtools.instance_variable_get(:@last_cd_path)\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n super(File.expand_path(path))\n Irbtools.instance_variable_set(:@last_cd_path, new_last_path)\n ls\n end",
"def change_dir f, pos=nil\nend",
"def within_dir dir, &blk\n cur_dir = Dir.getwd\n Dir.chdir(dir)\n yield\n Dir.chdir(cur_dir)\n end",
"def in_path(path, &blk)\n old = Dir.pwd\n Dir.chdir path\n say_status :cd, path\n yield\n Dir.chdir old\n end",
"def change_directory_for_start\n \"cd tomcat\"\n end",
"def write_curdir\n f = File.expand_path('~/.fff_d')\n s = Dir.pwd\n File.open(f, 'w') do |f2|\n f2.puts s\n end\n # puts \"Written #{s} to #{f}\"\nend",
"def work_dir=(path)\n path << '/' unless path.end_with?('/')\n @work_dir = path\n end",
"def chdir # :yields: the Git::Path\n Dir.chdir(dir.path) do\n yield dir.path\n end\n end",
"def working_directory=(directory)\n @link.WorkingDirectory = directory.tr('/', \"\\\\\")\n end",
"def [](fpath=nil)\n if fpath.nil? || fpath.index('/') == 0\n @rye_current_working_directory = fpath\n else\n # Append to non-absolute paths\n if @rye_current_working_directory\n newpath = File.join(@rye_current_working_directory, fpath)\n @rye_current_working_directory = newpath\n else\n @rye_current_working_directory = fpath\n end\n end\n debug \"CWD: #{@rye_current_working_directory}\"\n self\n end",
"def working_directory(v)\n @options[:working_directory] = v\n end",
"def current path=nil\n current = `pwd`.strip + \"/\"\n if path\n current + path \n else\n current\n end\nend",
"def set_git_path basedir\n @git_path = basedir\n end",
"def store_dir\n @dir = Dir.pwd\n end",
"def sync_dir(dir=Dir.getwd)\n @r.cmd \"setwd('#{dir}')\"\n end",
"def chroot\n Dir.chdir '/'\n File.umask 0000\n end",
"def working_dir(&block)\n return Dir.chdir(@working_dir, &block) if block_given?\n @working_dir\n end",
"def cd(path,&block)\n if block\n cwd = Dir.pwd\n\n Dir.chdir(path)\n block.call()\n Dir.chdir(cwd)\n else\n Dir.chdir(path)\n end\n end",
"def current_working_directory; @rye_current_working_directory; end",
"def set_workdir(filename)\n @workdir = File.dirname(filename)\n end",
"def in_directory(working_dir)\n old_dir = Dir.pwd\n begin\n Dir.chdir working_dir\n yield\n ensure\n Dir.chdir old_dir\n end\n end",
"def chdir(dest, &block)\n if block\n Dir.chdir(dest, &block)\n else\n if !defined? @original_dir\n @original_dir = Dir.pwd\n @cleaners << -> { Dir.chdir(@original_dir); @original_dir=nil }\n end\n Dir.chdir(dest)\n end\n end",
"def symlink_current_dir\n @shell.symlink self.checkout_path, self.current_path\n end",
"def chdir_to_repo(repo_name)\n repo_path = \"#{settings['build_dir']}/#{repo_name}\"\n assert_path_exists(repo_path, \"This is the expected path to the repo: #{repo_name}\")\n stdout.verbose(\"Changing to dir: #{repo_path}\")\n FileUtils.chdir(repo_path)\n @repo_context = repo_name\n @submodule_context = ''\n end",
"def cwd\n return cd(\"\").to_s\n end",
"def cd(path = nil)\n Cd.cd(path)\n end",
"def path=(path=\"\")\n path = Dir.pwd if not path or path.empty?\n @path = File.expand_path(path)\n end",
"def chroot\n warn \"Path::Name#chroot is obsoleted. Use Dir.chroot.\"\n Dir.chroot(path)\n end",
"def setDir _obj, _args\n \"_obj setDir _args;\" \n end",
"def set_directory(path)\n if File.exists? path and File.directory? path\n @directory = path.reverse.index(\"/\") == 0 ? path.chop : path\n else\n raise Error, \"Invalid path name\"\n end \n end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def setPath(path)\n @currentPath = path.clone\n @root = @currentPath.getRoot unless path.empty?\n end",
"def inside_cookbook(&block)\n cookbook_path = File.join(Strainer.sandbox_path.to_s, @cookbook.cookbook_name)\n Strainer.ui.debug \"Changing working directory to '#{cookbook_path}'\"\n original_pwd = ENV['PWD']\n\n ENV['PWD'] = cookbook_path\n success = Dir.chdir(cookbook_path, &block)\n ENV['PWD'] = original_pwd\n\n Strainer.ui.debug \"Restoring working directory to '#{original_pwd}'\"\n success\n end",
"def exec_in_git_dir(&block)\n Dir.chdir(top_level, &block)\n end",
"def working_dir(*path)\n if _working_dir.nil?\n @_working_dir = ENV['PROJECT_WORKING_DIR']\n if _working_dir != nil\n @_working_dir = Pathname.new(expand_variables _working_dir)\n Dir.chdir _working_dir.to_s\n\n elsif run_mode == :daemon\n @_working_dir = state_dir\n Dir.chdir _working_dir.to_s\n\n else\n @_working_dir = Pathname.getwd\n end\n\n raise \"working_dir not a directory: #{_working_dir.safe_s}\" unless _working_dir.directory?\n end\n [_working_dir, *path].reduce(:+)\n end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block) unless options[:noop]\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def directory(from, to = nil)\n @directories[from.chomp('/')] = to\n end",
"def current_path\n File.expand_path(File.join(__FILE__,\"../\"))\nend",
"def restart_dir; end",
"def cwd\n File.expand_path(@options[:cwd] || \".\")\n end",
"def cwd\n @target.is_a?(String) && File.directory?(@target) ? @target : \"./\"\n end",
"def cwd\n Dir.getwd\n end",
"def path=(path = nil)\n path = Dir.pwd if not path or path.strip.empty?\n @path = File.expand_path(path)\n end",
"def setOutdir(dir)\r\n @context.outdir = dir\r\n end",
"def chroot(new_root_dir)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:chroot]}=#{new_root_dir}\"\n self\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def indir(dir)\n olddir = Dir.pwd\n Dir.chdir(dir)\n yield\n ensure\n Dir.chdir(olddir)\n end",
"def indir(dir)\n olddir = Dir.pwd\n Dir.chdir(dir)\n yield\n ensure\n Dir.chdir(olddir)\n end",
"def cwd\n @cwd ||= begin\n exec! 'pwd'\n rescue => e\n raise e\n '/'\n end\n end",
"def cd(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Changing working directory to: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.cd(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end",
"def working_dir\n ENV['PWD'] || Dir.pwd\n end",
"def exec_in_git_dir(&block)\n curr = Dir.getwd\n result = nil\n begin\n Dir.chdir top_level\n result = yield\n rescue\n raise\n ensure\n Dir.chdir curr\n end\n result\n end",
"def setup\n switch_dir\n end",
"def cd(path,&block)\n @history << ['cd', path]\n\n if block\n block.call() if block\n\n @history << ['cd', '-']\n end\n end",
"def do_into_dir(dir, t)\n Dir.chdir dir do\n t.call\n end\nend",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def cd(path)\n @history << ['cd', path]\n\n if block_given?\n yield\n @history << ['cd', '-']\n end\n end",
"def destination\n File.join(cwd, 'Applications')\nend",
"def current_directory\n @current_directory ||=\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n tempdir = Dir.mktmpdir(\"rails-templates\")\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/nimbl3/rails-templates.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n tempdir\n else\n File.expand_path(File.dirname(__FILE__))\n end\nend",
"def set_path\n self.path = File.join(self.store_dir, self.filename)\n end",
"def update_working_dir(index, dir, name, format)\n unless @repo.bare\n path =\n if dir == ''\n page_file_name(name, format)\n else\n ::File.join(dir, page_file_name(name, format))\n end\n\n Dir.chdir(::File.join(@repo.path, '..')) do\n if file_path_scheduled_for_deletion?(index.tree, path)\n @repo.git.rm({'f' => true}, '--', path)\n else\n @repo.git.checkout({}, 'HEAD', '--', path)\n end\n end\n end\n end",
"def change_dir(dir)\n @face_dir = dir\n @sprite.change_dir(dir)\n end",
"def current_directory\n @current_directory ||=\n if __FILE__ =~ %r{\\Ahttps?://}\n tempdir = Dir.mktmpdir(\"rails-templates\")\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/nimbl3/rails-templates.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n tempdir\n else\n File.expand_path(File.dirname(__FILE__))\n end\nend",
"def current_directory\n @current_directory ||=\n if __FILE__ =~ %r{\\Ahttps?://}\n tempdir = Dir.mktmpdir(\"rails-templates\")\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/nimbl3/rails-templates.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n tempdir\n else\n File.expand_path(File.dirname(__FILE__))\n end\nend",
"def jump_to(path, &block)\n Dir.chdir(test_content_dirs(path), &block)\nend",
"def cd(arg)\n config_options = configuration_with_overrides(options)\n config_options.run_initializers! context: :static\n\n directive = arg.split(\"/\")\n unless directive[1]\n Bridgetown.logger.warn(\"Oops!\", \"Your command needs to be in the <origin/dir> format\")\n return\n end\n\n manifest = config_options.source_manifests.find do |source_manifest|\n source_manifest.origin.to_s == directive[0]\n end\n\n if manifest.respond_to?(directive[1].downcase)\n dir = manifest.send(directive[1].downcase)\n Bridgetown.logger.info(\"Opening the #{dir.green} folder for\" \\\n \" #{manifest.origin.to_s.cyan}…\")\n Bridgetown.logger.info(\"Type #{\"exit\".yellow} when you're done to\" \\\n \" return to your site root.\")\n puts\n\n # rubocop: disable Style/RedundantCondition\n Dir.chdir dir do\n ENV[\"BRIDGETOWN_SITE\"] = config_options.root_dir\n if ENV[\"SHELL\"]\n system(ENV[\"SHELL\"])\n else\n system(\"/bin/sh\")\n end\n end\n # rubocop: enable Style/RedundantCondition\n\n puts\n Bridgetown.logger.info(\"Done!\", \"You're back in #{Dir.pwd.green}\")\n else\n Bridgetown.logger.warn(\"Oops!\", \"I wasn't able to find the\" \\\n \" #{directive[1]} folder for #{directive[0]}\")\n end\n end",
"def loadDir(dirname)\n\t\told = Dir.getwd()\n\t\tDir.chdir(dirname)\n\t\tret = self._loadDir(dirname)\n\t\tDir.chdir(old)\n\t\treturn ret\n\tend",
"def goto_dir\n begin\n path = get_line \"Enter path: \"\n return if path.nil? || path == \"\"\n rescue Exception => ex\n perror \"Cancelled cd, press a key\"\n return\n end\n f = File.expand_path(path)\n unless File.directory? f\n ## check for env variable\n tmp = ENV[path]\n if tmp.nil? || !File.directory?( tmp )\n ## check for dir in home \n tmp = File.expand_path(\"~/#{path}\")\n if File.directory? tmp\n f = tmp\n end\n else\n f = tmp\n end\n end\n\n open_file f\nend"
] | [
"0.7232564",
"0.70640314",
"0.70472205",
"0.70143205",
"0.697366",
"0.6961057",
"0.68245286",
"0.681888",
"0.6814806",
"0.6777482",
"0.6768993",
"0.6763502",
"0.66206026",
"0.65494037",
"0.6513547",
"0.6508767",
"0.6496187",
"0.6493231",
"0.6448512",
"0.6431163",
"0.63857627",
"0.6363673",
"0.63400424",
"0.63264453",
"0.6293969",
"0.6276941",
"0.62486833",
"0.62437636",
"0.6234372",
"0.6218605",
"0.6209953",
"0.6188896",
"0.61580473",
"0.6146769",
"0.61417687",
"0.61398345",
"0.6131896",
"0.610023",
"0.6064173",
"0.6018731",
"0.60168296",
"0.6010845",
"0.6008304",
"0.5975999",
"0.5967212",
"0.5933214",
"0.5904473",
"0.5882525",
"0.58631724",
"0.58547336",
"0.5845413",
"0.5826988",
"0.58039474",
"0.5801612",
"0.57647216",
"0.5734321",
"0.5730746",
"0.5728222",
"0.5700684",
"0.5646642",
"0.56211805",
"0.56186813",
"0.56186813",
"0.5614331",
"0.5592262",
"0.55886424",
"0.5565897",
"0.55648345",
"0.5562162",
"0.5546341",
"0.5538936",
"0.553813",
"0.55291104",
"0.5528894",
"0.5527852",
"0.55238545",
"0.5515922",
"0.5470079",
"0.5453968",
"0.5453968",
"0.54367703",
"0.54358244",
"0.5430442",
"0.54256123",
"0.5409366",
"0.54020345",
"0.5385727",
"0.5368513",
"0.53572863",
"0.5353019",
"0.53529835",
"0.5337671",
"0.5331005",
"0.53245807",
"0.53219515",
"0.53219515",
"0.5313449",
"0.52964073",
"0.52923405",
"0.5292279"
] | 0.56651044 | 59 |
cd to the previous directory. | def popd
cd @dir_history.pop, pushd: false if @dir_history.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cd( path = File.expand_path('~') )\n new_last_path = FileUtils.pwd\n if path == '-'\n if @last_path\n path = @last_path\n else\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n cd path\n @last_path = new_last_path\n ls\n end",
"def cd( path = '~' )\n new_last_path = FileUtils.pwd\n if path == '-'\n unless path = Irbtools.instance_variable_get(:@last_cd_path)\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n super(File.expand_path(path))\n Irbtools.instance_variable_set(:@last_cd_path, new_last_path)\n ls\n end",
"def restore_dir\n cd @dir\n end",
"def go_back\r\n command 'goBack'\r\n end",
"def go_back\r\n command 'goBack'\r\n end",
"def cd(path)\n Dir.chdir(path)\n \"cd #{path}\"\n end",
"def chdir; end",
"def move_prev\n self.step -= 1\n 'prev'\n end",
"def teardown\n Dir.chdir @previous_wd # restore the working directory to what it was previously\n end",
"def move_to(n)\n cd(n)\n end",
"def cd(target = ENV['HOME'])\n Dir.chdir(target.strip)\n \"Directory changed to #{Dir.pwd}\"\n end",
"def prev\n goto(@current_page - 1)\n end",
"def test_when_going_backwards\n controller = new_controller\n trail controller, ['/path1', '/path2', '/path3']\n go_back controller, '/path2'\n\n assert_equal '/path1', controller.previous_path\n assert_equal 1, controller.session['previous_paths'].length\n end",
"def goto_dir\n return\nend",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n @visited_dirs.push Dir.pwd unless @visited_dirs.index(Dir.pwd)\n ## XXX make sure thre is something to pop\n d = @visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n @visited_dirs.push d\n Dir.chdir d\n @current_dir = Dir.pwd # 2019-04-24 - earlier was in post_cd but too late\n post_cd\n rescan_required\nend",
"def cd(path = nil)\n Cd.cd(path)\n end",
"def goto_parent_dir\n\n # if in search mode, LEFT should open current dir like escape\n # Not nice to put this in here !!!\n if @mode == \"SEARCH\"\n escape\n return\n end\n\n # When changing to parent, we need to keep cursor on\n # parent dir, not first\n curr = File.basename(Dir.pwd)\n\n return if curr == '/'\n\n change_dir '..'\n\n return if curr == Dir.pwd\n\n # get index of child dir in this dir, and set cursor to it.\n index = @files.index(curr + '/')\n pause \"WARNING: Could not find #{curr} in this directory.\" unless index\n @cursor = index if index\nend",
"def cd(path,&block)\n @history << ['cd', path]\n\n if block\n block.call() if block\n\n @history << ['cd', '-']\n end\n end",
"def goto_dir\n # print \"\\e[?25h\"\n # print_last_line 'Enter path: '\n begin\n # path = gets.chomp\n path = readline 'Enter path to go to: '\n if path.nil? || path == ''\n clear_last_line\n return\n end\n # rescue => ex\n rescue StandardError => ex\n # Nope, already caught interrupt and sent back nil\n perror 'Cancelled cd, press a key'\n return\n ensure\n # print \"\\e[?25l\"\n end\n f = expand_path(path)\n unless File.directory? f\n ## check for env variable\n tmp = ENV[path]\n if tmp.nil? || !File.directory?(tmp)\n ## check for dir in home\n tmp = File.expand_path(\"~/#{path}\")\n f = tmp if File.directory? tmp\n else\n f = tmp\n end\n end\n\n open_file f\nend",
"def cd(dir = nil)\n d = dir\n case d\n when File, Dir\n d = d.path if File.directory?(d.path)\n end\n $env.chdir(d)\nend",
"def cd(*cmdargs)\n if @rootnode.nil?\n puts 'How the F is the rootnode nil? That should NOT happen'\n end\n\n if cmdargs.length > 0\n dirnum = cmdargs.shift\n if /^\\d+$/ =~ dirnum\n #puts \"Tgtdir was an integer: #{dirnum}\"\n pwd_hash = get_pwd_hash(true)\n #puts \"Full PwdHash is #{pwd_hash}\"\n tgtdir = pwd_hash[dirnum.to_i]\n if tgtdir.nil?\n puts \"Index out of range. Expected < #{pwd_hash.length}, but got #{dirnum.to_i}\"\n return nil\n end\n puts \"Changed tgtdir to the real-name: #{tgtdir}\"\n else\n tgtdir = dirnum\n end\n\n if @pwdnode[\"path\"].nil?\n puts 'The current directory has no path! Ah!'\n end\n\n chdir = nil\n if tgtdir == '..'\n #puts \"CDing .. #{@pwdnode['path'].nil?}\"\n if not @pwdnode[\"path\"].nil?\n # We need the pwdnode's path not to be null, since we're going to use it to determine the previous directory\n pathSplit = @pwdnode[\"path\"].split('/')\n if pathSplit[0].empty?\n pathSplit.shift\n end\n # Skip the root-node's name\n pathSplit.shift\n #puts \"Path split for .. was #{pathSplit}\"\n if pathSplit.length >= 1\n chdir = node_recurse @rootnode, (pathSplit.first pathSplit.length-1)\n #puts \"Chdir is now #{chdir}\"\n else\n # If the pathSplit without the root-name has no length, then we're trying to do /.. (cd .. from root)\n # Do nothing.\n end\n end\n else\n filelist = @pwdnode[\"file\"]\n if not filelist.nil?\n filelist.each do |f|\n if f[\"name\"] == tgtdir\n #puts \"CDing to #{tgtdir}\"\n if f[\"path\"].nil?\n # If the desired directory doesn't yet have a path, define it as the previous directory's path + the next directory's name\n f[\"path\"] = @pwdnode[\"path\"] + '/' + f[\"name\"]\n end\n chdir = f\n #@pwdnode = f\n #return @pwdnode\n end\n end\n end\n end\n\n if chdir.nil?\n puts \"Invalid directory: #{tgtdir}\"\n return nil\n else\n @pwdnode = chdir\n return @pwdnode\n end\n end\n\n end",
"def back\n history_navigate(delta: -1)\n end",
"def back\n fetch(\"window.history.go(-1)\")\n\n end",
"def switch_to_previous_window\n @window_id -= 1\n if @window_id < 0\n # wrap back to the last\n @window_id = @browser.windows.count - 1\n end\n\n @browser.windows[@window_id].use\n end",
"def back\n @driver.navigate.back\n @after_hooks.run\n end",
"def previous\n connection.write(\"prev\")\n end",
"def prev_page\n go_to_page(@current_page-1)\n end",
"def previous_step\n self.step_flow.previous_step if can_decrement_step\n end",
"def cd(dir = '~', pushd: true)\n dir = load_item path: expand_path(dir) unless dir.is_a? Item\n unless dir.zip?\n Dir.chdir dir\n @current_zip = nil\n else\n @current_zip = dir\n end\n @dir_history << current_dir if current_dir && pushd\n @current_dir, @current_page, @current_row = dir, 0, nil\n main.activate_pane 0\n ls\n @current_dir\n end",
"def previous_page!\n previous_page.tap { |page| update_self(page) }\n end",
"def go_back\n @browser.back\n end",
"def previous_page\n @current_page = @agent.page.links.find { |l| l.text == \"← Previous\" }.click\n rescue\n nil\n end",
"def cd(path)\n @history << ['cd', path]\n\n if block_given?\n yield\n @history << ['cd', '-']\n end\n end",
"def cd(dir = nil)\n dir ||= homedir\n dir = expand_path(dir)\n @cwd = dir\n end",
"def chdir(path)\n ensure_relative_path! :chdir, path\n @path += path\n end",
"def previous\n end",
"def previous\n end",
"def goto_dir\n begin\n path = get_line \"Enter path: \"\n return if path.nil? || path == \"\"\n rescue Exception => ex\n perror \"Cancelled cd, press a key\"\n return\n end\n f = File.expand_path(path)\n unless File.directory? f\n ## check for env variable\n tmp = ENV[path]\n if tmp.nil? || !File.directory?( tmp )\n ## check for dir in home \n tmp = File.expand_path(\"~/#{path}\")\n if File.directory? tmp\n f = tmp\n end\n else\n f = tmp\n end\n end\n\n open_file f\nend",
"def back(number = 1)\n `History.go(-number)`\n end",
"def forward\n history_navigate(delta: 1)\n end",
"def previous_version!(steps_back = 0)\n prev_version = previous_version(steps_back)\n\n prev_version.save if prev_version.present?\n end",
"def previous_path\n return h.controller.previous_group_path if h.controller.previous_wizard_path == active_group_path\n\n h.controller.previous_wizard_path\n end",
"def goto_dir\n print \"Enter path: \"\n begin\n path = gets.chomp\n #rescue => ex\n rescue Exception => ex\n perror \"Cancelled cd, press a key\"\n return\n end\n f = File.expand_path(path)\n unless File.directory? f\n ## check for env variable\n tmp = ENV[path]\n if tmp.nil? || !File.directory?( tmp )\n ## check for dir in home \n tmp = File.expand_path(\"~/#{path}\")\n if File.directory? tmp\n f = tmp\n end\n else\n f = tmp\n end\n end\n\n open_file f\n end",
"def revert_dir_pos\n @sta = 0\n @cursor = 0\n a = @dir_position[Dir.pwd]\n if a\n @sta = a.first\n @cursor = a[1]\n raise \"sta is nil for #{Dir.pwd} : #{@dir_position[Dir.pwd]}\" unless @sta\n raise 'cursor is nil' unless @cursor\n end\nend",
"def change_dir f\n unless File.directory? f\n perror \"#{f} is not a directory, or does not exist.\"\n return\n end\n\n # before leaving a dir we save it in the list, as well as the cursor\n # position, so we can restore that position when we return\n @visited_dirs.insert(0, Dir.pwd)\n save_dir_pos\n\n f = expand_path(f)\n Dir.chdir f\n @current_dir = Dir.pwd # 2019-04-24 - earlier was in post_cd but too late\n read_directory\n post_cd\n\n redraw_required\nend",
"def prev\n connection.write(\"prev\")\n end",
"def chdir(dir)\n previous_dir = File.expand_path(\".\")\n\n Dir.chdir(dir)\n begin\n @p4.cwd = File.expand_path(\".\")\n rescue\n Dir.chdir(previous_dir)\n raise\n end\n\n if block_given?\n begin\n yield dir\n ensure\n Dir.chdir(previous_dir)\n @p4.cwd = previous_dir\n end\n end\n end",
"def switch_to_previous_window\n $driver.switch_to.window $previous_window\nend",
"def prev_project # :nologin: :norobots:\n redirect_to_next_object(:prev, Project, params[:id].to_s)\n end",
"def undo()\r\n Dir.delete(@DirectoryPath)\r\n end",
"def prev_day(days = 1)\n advance(days: -days)\n end",
"def test_when_going_forward\n controller = new_controller\n trail controller, ['/path1', '/path2']\n\n assert_equal '/path1', controller.previous_path\n assert_equal 1, controller.session['previous_paths'].length\n end",
"def back(steps)\n move(-steps)\n end",
"def push_dir(dir = nil)\n @directory_stack.push(Dir.pwd)\n self.chdir(dir)\n end",
"def previous\t \n @music.off\n @song.kill\n @count -= 2\n end",
"def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end",
"def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end",
"def go_forward\n @browser.forward\n end",
"def undo()\r\n #need to manipulate strings by taking file name off of OldFilePath and adding it onto NewFilePath\r\n oldname = @OldFilePath.basename\r\n @NewFilePath = \"#{@NewFilePath}/#{oldname}\"\r\n origfolder = @OldFilePath.dirname\r\n @OldFilePath = origfolder\r\n\r\n FileUtils.mv(@NewFilePath, @OldFilePath)\r\n end",
"def back\n driver.navigate.back\n end",
"def back\n driver.navigate.back\n end",
"def symlink_current_dir\n @shell.symlink self.checkout_path, self.current_path\n end",
"def go_back\n begin\n @driver.back\n\n rescue Exception => e\n @@logger.an_event.error \"browser go back : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_GO_BACK, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser go back\"\n\n ensure\n\n end\n end",
"def rewind_disk(time_going_back)\n if (@dvd_time_move - time_going_back) > 0\n @dvd_time_move = @dvd_time_move - time_going_back\n else\n @dvd_time_move = 0\n end\n end",
"def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end",
"def redirect_back\n send_to = session[:return_to]\n session[:return_to] = nil\n redirect_to(send_to || root_path)\n end",
"def goto_previous_page(browser_handle)\n browser_handle.back\nend",
"def undo()\r\n oldname = @FilePath.basename\r\n @CopiedFilePath = \"#{@CopiedFilePath}/#{oldname}\"\r\n origfolder = @FilePath.dirname\r\n @FilePath = origfolder\r\n FileUtils.mv(@CopiedFilePath, @FilePath)\r\n end",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n display_dir\n\n return\n # old stuff with zsh\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def restart_dir; end",
"def pop_dir\n return # 2014-07-25 - 22:43 \n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def undo\n\t\tif Dir.exist?(\"#{parent_directory}/#{newname}\")\n\t\t\tif Dir.exist?(filePath)\n\t\t\t\tputs \"-'#{name_of_subject}' already exists in this directory\"\n\t\t\telse\n\t\t\t\tFile.rename(\"#{parent_directory}/#{newname}\", filePath)\n\t\t\t\tputs \"-'#{newname}' was renamed '#{name_of_subject}' \\n\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"-'#{newname}' does not exist in this directory \\n\"\n\t\tend\n\tend",
"def back\n navigate.back\n end",
"def back\n navigate.back\n end",
"def back\n navigate.back\n end",
"def previous_url\n session[:forwarding_url] || root_path\n end",
"def previous_step\n (history.keys.last.to_i - 1).to_s\n end",
"def previous\n @pointer -= 1\n end",
"def forward\n driver.navigate.forward\n end",
"def forward\n driver.navigate.forward\n end",
"def chdir(dir=nil)\n @chdir = dir.to_s if dir\n @chdir\n end",
"def cd(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Changing working directory to: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.cd(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end",
"def back\r\n @browser.navigate.back\r\n end",
"def prev_user # :norobots:\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end",
"def undo(project_name)\n\n\t\tcurrent_branch = @@setting_manager.get_branch(project_name)\n\t\tnew_branch_name = branch_generator(project_name)\n\n\t\tif project_name.nil?\n\t\t\tputs \"Missing project name!\"\n\t\telse\n\t\t\texec(\"\n\t\t\tcd #{@@default_directory}#{project_name.to_s} &&\n\t\t\tgit checkout master &&\n\t\t\tgit branch -D #{current_branch} &&\n\t\t\tgit checkout -b #{new_branch_name}\n\t\t\t\")\n\t\tend\n\tend",
"def previous_page_path; end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def prev_user\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end",
"def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block) unless options[:noop]\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end",
"def previous\n at(position - 1)\n end",
"def on_prev_in_folder_clicked\n @wall.run(:prev_in_folder, @settings.current_file) do |pic|\n inform_pic_change pic\n end\n end",
"def store_previous\n end",
"def set_previous\n @activity_sequence = ActivitySequence.find(params[:id])\n @activity_sequence.set_previous\n redirect_to myp_path(@activity_sequence.current_activity)\n end",
"def return_to_previous_page\n\n if params[:from_view]\n\n redirect_to(\n :controller => \"workitem\", :action => \"view\", :id => params[:id])\n\n else\n\n redirect_to :controller => \"stores\"\n end\n end",
"def chdir(&block)\n Dir.chdir(top_level, &block)\n end",
"def showprevious\n if @session.pointer > 0\n @session.previous\n @session.previous\n display @session.current_screen\n @session.next\n else\n puts \"There is no previous screen.\"\n end\nend",
"def revert!\n @shell.call \"rm -rf #{self.checkout_path}\"\n\n last_deploy = previous_deploy_name(true)\n\n if last_deploy && !last_deploy.empty?\n @shell.symlink \"#{self.deploys_path}/#{last_deploy}\", self.current_path\n\n Sunshine.logger.info @shell.host, \"Reverted to #{last_deploy}\"\n\n else\n @crontab.delete!\n\n Sunshine.logger.info @shell.host, \"No previous deploy to revert to.\"\n end\n end",
"def redirect_back_to\n if !session[:return_to].blank?\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end",
"def goto_end_of_history\r\n end"
] | [
"0.77334416",
"0.7546548",
"0.68178266",
"0.62805855",
"0.62805855",
"0.61458087",
"0.6110539",
"0.6103584",
"0.6085886",
"0.60841215",
"0.6080295",
"0.602286",
"0.5983547",
"0.5953504",
"0.58955216",
"0.5882706",
"0.58667815",
"0.5858816",
"0.58165073",
"0.58141476",
"0.579471",
"0.5777622",
"0.5768574",
"0.5756145",
"0.57413214",
"0.57363075",
"0.57340604",
"0.56766",
"0.56639445",
"0.5638398",
"0.5623397",
"0.5623047",
"0.5613928",
"0.561253",
"0.55983675",
"0.55892795",
"0.55892795",
"0.55748916",
"0.55703634",
"0.5561188",
"0.55540824",
"0.5552117",
"0.5539826",
"0.5529826",
"0.55270994",
"0.55197614",
"0.5510387",
"0.55047363",
"0.54920906",
"0.5491845",
"0.5491121",
"0.548061",
"0.5476563",
"0.5459393",
"0.54512334",
"0.5443988",
"0.54296774",
"0.54140383",
"0.5409466",
"0.54003847",
"0.54003847",
"0.5392747",
"0.53598195",
"0.53558254",
"0.5337637",
"0.5337263",
"0.5335907",
"0.53230727",
"0.5313811",
"0.53078157",
"0.5290795",
"0.52903736",
"0.5290208",
"0.5290208",
"0.5290208",
"0.5282548",
"0.52779776",
"0.5274494",
"0.52705044",
"0.52705044",
"0.52650243",
"0.52467126",
"0.5246594",
"0.5243065",
"0.52388656",
"0.5238031",
"0.523348",
"0.523348",
"0.5230197",
"0.5221743",
"0.5212092",
"0.5192027",
"0.5176858",
"0.517272",
"0.5169408",
"0.51554877",
"0.5154776",
"0.51532596",
"0.5149055",
"0.5140705"
] | 0.6052459 | 11 |
Fetch files from current directory. Then update each windows reflecting the newest information. | def ls
fetch_items_from_filesystem_or_zip
sort_items_according_to_current_direction
@current_page ||= 0
draw_items
move_cursor (current_row ? [current_row, items.size - 1].min : nil)
draw_marked_items
draw_total_items
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh\n list.clear\n\n Ginatra.load_config[\"git_dirs\"].map do |git_dir|\n if Dir.exist?(git_dir.chop)\n dirs = Dir.glob(git_dir).sort\n else\n dir = File.expand_path(\"../../../#{git_dir}\", __FILE__)\n dirs = Dir.glob(dir).sort\n end\n\n dirs = dirs.select {|f| File.directory? f }\n dirs.each {|d| add(d) }\n end\n\n list\n end",
"def get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__,\"INFO\",\"Found #{@files[folder].size} files for #{@current_source.base_dir}/#{folder} at #{@current_source.host.address}\")\n SignalHandler.check\n end\n end\n end",
"def all\n updates = fetch_updates\n updates.map { |update| WindowsUpdate.new(update) }\n end",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def fetch!\n\n open(fetch_txt_file) do |io|\n \n io.readlines.each do |line|\n \n (url, length, path) = line.chomp.split(/\\s+/, 3)\n \n add_file(path) do |io|\n io.write open(url)\n end\n \n end\n \n end\n\n # rename the old fetch.txt\n Dir[\"#{fetch_txt_file}.?*\"].sort.reverse.each do |f|\n \n if f =~ /fetch.txt.(\\d+)$/\n new_f = File.join File.dirname(f), \"fetch.txt.#{$1.to_i + 1}\"\n FileUtils::mv f, new_f\n end\n \n end\n\n # move the current fetch_txt\n FileUtils::mv fetch_txt_file, \"#{fetch_txt_file}.0\"\n end",
"def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end",
"def update_recent(file_name)\n # Read in the list of recently opened files\n recent_files = []\n File.open(RECENT_LOC, 'r') do |recent|\n recent_files = recent.read.split(\"\\n\")\n end\n\n # If file is already in recent_files, move it to the beginning\n # Otherwise, just add it to the beginning\n abs_path = File.expand_path(file_name)\n recent_files.delete(abs_path) if recent_files.include?(abs_path)\n recent_files.prepend(abs_path)\n\n # Write updated list of recent files back into file\n File.open(RECENT_LOC, 'w') do |recent|\n recent.puts recent_files.join(\"\\n\")\n end\n\n puts recent_files\nend",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\[email protected] self, @wrapped_object, @window, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def poll_changed_dirs\n until @stop\n sleep(@latency)\n report_changes\n end\n end",
"def poll_changed_directories\n until stopped\n sleep(latency)\n report_changes\n end\n end",
"def refresh\n\t\t\[email protected]\n\t\t\[email protected] { |w| w.refresh if w.visible? }\n\t\tend",
"def update\n return if @thread != nil\n\n @thread = Thread.new {\n while true do\n refreshed = get_current_images\n @cache = refreshed # atomic assign\n sleep (60 * 60 * 24)\n end\n }\n end",
"def recents\n files = session[:user].x_files.all(:last_update.gte => (DateTime.now - 20.days), folder: false, limit: 20)\n files_list = []\n files.each do |file|\n files_list.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files_list, success: true }\n end",
"def c_refresh\n $filterstr ||= \"M\"\n #$files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n $patt=nil\n $title = nil\n display_dir\nend",
"def update_remote\n last_commit = @connection.last_commit(self.id)\n files = Repository.diff(last_commit)\n \n if files.length > 0\n puts \"#{files.length} changes since last delivery\"\n pbar = ProgressBar.new(\"Uploading\", files.length)\n files.each do |file|\n @connection.send(Gift::Connection.file_method(file.last.action), file.last)\n pbar.inc\n end\n pbar.finish\n \n last_commit = Gift::Repository.last_commit_hash unless last_commit && last_commit != \"\"\n self.save_state(last_commit)\n else\n puts \"Everything up to date!\"\n end\n \n @connection.close\n end",
"def update_list(url, directory)\n puts \"Pulling \" + url\n package_list = HTTP.get url\n # Saves the file to list.json\n if File.open(directory + 'list.json', 'w') { |file| file.write(package_list) }\n puts \"Downloaded lits.json to \".green + directory.green\n end\nend",
"def update(_show_output)\n @check_existing_files_for_update = true\n begin\n preheat_existing_files\n ensure\n @check_existing_files_for_update = false\n end\n []\n end",
"def reload\n Dir.glob('**/*').each { |file| reload_file(file) }\n end",
"def files\n self.raise\n click_on_perc(@id, 5.7, 2.5)\n # Return the new window\n return Files.new\n end",
"def main_files\n retrieve_files_in_main_dir\n end",
"def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end",
"def fetch_watched_repos\n toggle! :fetching_repos\n\n sidekiq_logger.info { \"[#{username}] Fetching watched repos...\" }\n\n github_watched.each do |wr|\n attrs = wr.slice(:name, :language, :description, :fork, :private, :size,\n :forks, :open_issues, :pushed_at, :created_at, :updated_at)\n\n if repo = Repo.find_by_id(wr.id)\n repo.attributes = attrs.merge({:watchers_count => wr.watchers})\n else\n repo = Repo.new(attrs.merge({:watchers_count => wr.watchers}))\n repo.id = wr.id\n end\n\n repo.owner = User.find_or_create_by_username(wr.owner.login)\n repo.save\n\n unless watchings.exists?(repo.id)\n watchings << repo\n sidekiq_logger.info { \"[#{username}] now watching #{wr.name}\" }\n end\n end\n\n sidekiq_logger.info { \"[#{username}] Completed fetching watched repos\" }\n\n prune_unwatched_repos\n\n toggle! :fetching_repos\n end",
"def window_update(saves)\n @data = []\n if saves != nil\n for save in saves\n if save != nil\n @data.push(save)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucSavesList.clear()\n for i in 0..@item_max-1\n @ucSavesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def window_update(saves)\n @data = []\n if saves != nil\n for save in saves\n if save != nil\n @data.push(save)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucSavesList.clear()\n for i in 0..@item_max-1\n @ucSavesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end",
"def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend",
"def recent_files\n # print -rl -- **/*(Dom[1,10])\n @title = 'Recent files'\n # zsh D DOT_GLOB, show dot files\n # zsh om order on modification time\n @files = `zsh -c 'print -rl -- **/*(Dom[1,15])'`.split(\"\\n\").reject { |f| f[0] == '.' }\nend",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def refresh\n _get_file_contents(connfile.to_s)\n self\n end",
"def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end",
"def refresh_statistics_in_files(entity_types, count = 10)\n resources = get_best_ranked_resources(entity_types, count)\n\n resources = keep_loaded(resources)\n\n resources.each { |resource_uri, resource_info|\n puts \"_____ #{resource_uri} _____\" if @console_output\n\n update_nif_file_properties(resource_uri, resource_info[:type]) { |link|\n get_predicates_by_link(resource_uri, link, resource_info[:type])\n }\n }\n\n end",
"def refresh\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end",
"def do_update! results\r\n\trequire 'sunflower'\r\n\ts = Sunflower.new.login\r\n\t\r\n\tbasepage = \"Wikiprojekt:Nauki medyczne/Ilustrowanie/Histologia\"\r\n\ts.summary = 'automatyczny update listy'\r\n\t\r\n\tfiles = bysize results\r\n\t\r\n\tfiles.each do |fn|\r\n\t\ttitlebit = fn.sub(/\\.txt\\Z/, '')\r\n\t\r\n\t\ttext = File.read fn\r\n\t\tp = Page.new \"#{basepage}/#{titlebit}\"\r\n\t\t\r\n\t\tif !p.pageid # page doesn't exist yet\r\n\t\t\tp.text = \"Zobacz: [[#{basepage}]].\" + \"\\n\\n\" + text\r\n\t\t\tp.save\r\n\t\t\r\n\t\t\tputs \"#{titlebit} - saved.\"\r\n\t\telse\r\n\t\t\tputs \"#{titlebit} - already there.\"\r\n\t\tend\r\n\tend\r\n\t\r\n\tp = Page.new \"#{basepage}/ignored\"\r\n\tp.text = File.read \"ignored.txt\"\r\n\tp.save\r\n\t\r\n\tputs 'ignored'\r\nend",
"def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end",
"def get_changed_file_list\n command = \"git log -m -1 --name-only --pretty='format:' $(git rev-parse origin/master)\"\n file_paths = []\n features = {}\n features.compare_by_identity\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n files = stdout.read.gsub! \"\\n\", \",\"\n file_paths = files.split(\",\")\n puts \"Found files:\\n#{file_paths}\"\n end\n\n puts \"Count files in push: #{file_paths.count}\"\n\n file_paths.each do |file_path|\n if file_path.include?(\".feature\")\n puts \"Added: #{file_path}\"\n folder = get_name_folder_from_path file_path\n features.store(folder, file_path)\n end\n end\n\n puts \"\\n\"\n puts \"Count feature files: #{features.count}\"\n features.sort\nend",
"def refresh\n clone_appium = \"git clone #{clone} #{path}\"\n sh clone_appium unless File.exists? path\n\n sh 'git reset --hard'\n sh 'git fetch --tags'\n\n update_branches\n\n branches.each do |branch|\n sh \"git checkout #{branch}\"\n sh \"git pull --rebase origin #{branch}\"\n end\n\n update_tags\n end",
"def thread_invalidate_all_dirlines\n # Find the DirLine\n (@main_widget.get_dest_dirlines + @main_widget.get_src_dirlines).each do |dirline_widget|\n Gtk::idle_add do\n update_dirline(dirline_widget)\n next false\n end\n end\n end",
"def show\n @file_update_from_file_package = []\n @file_to_update_file_package = FileToUpdateFilePackage.where(file_package_id: @file_package.id)\n @file_to_update_file_package.each do |file_update_file_package|\n @file_update_from_file_package << file_update_file_package.file_to_update.name\n end\n end",
"def local_ls(*args)\n begin\n @model_local.clear\n path = args[0] || @parent_local\n path = dirname(path)\n @local_path.set_text(path)\n\n Dir.entries(path).each do |file|\n if FileTest.directory?(path + File::SEPARATOR + file)\n is_dir = true\n else\n is_dir = false\n end\n iter = @model_local.append\n iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(file)\n iter[COL_PATH] = path\n iter[COL_IS_DIR] = is_dir\n iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf\n iter[COL_TYPE] = \"local\"\n end\n @parent_local = path\n\n # If not possible return a *warning***\n rescue ::Exception => e\n MsfDialog::Warning.new(self, \"Local Browser\", e.to_s)\n local_ls\n end\n end",
"def window_update(modes)\n @data = []\n if modes != nil\n for mode in modes\n if mode != nil\n @data.push(mode)\n end\n end\n @item_max = @data.size\n create_contents()\n @modesList.clear()\n for i in 0..@item_max-1\n @modesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def each_newer()\n new = []\n @files.each { |f|\n src = @srcDir+'/'+f\n dst = @dstDir+'/'+f\n yield src, dst if newer?(src, dst)\n }\n end",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def refresh!\n updated_contents = File.read(@path)\n updated_yml = YAML.load(updated_contents)\n\n updated_items = fetch_items(updated_yml)\n original_items = items.flatten\n\n updated_items.flatten.each do |updated_item|\n original_item = original_items.find do |oi|\n oi.full_src == updated_item.full_src\n end\n\n # If this is a new item, we're good\n next if !original_item\n\n # Otherwise, we'll need to see if this file changed\n if !original_item.identical?(updated_item)\n original_item.delete!\n end\n end\n\n @items = updated_items\n\n prepare!\n end",
"def refresh_vcs_status(evt = nil)\n \n if not (@selWs.nil?)\n\n mst, mods_dirs, mods_files = @selWs.modified_files\n cst, cflt_dirs, cflt_files = @selWs.conflicted_files\n nst, news_dirs, news_files = @selWs.new_files\n dst, dels_dirs, dels_files = @selWs.deleted_files\n\n data = []\n mods_dirs.each do |f|\n data << ModifiedFile.new(f,:dir)\n end\n mods_files.each do |f|\n data << ModifiedFile.new(f,:file)\n end\n\n cflt_dirs.each do |f|\n data << ConflictedFile.new(f,:dir)\n end\n cflt_files.each do |f|\n data << ConflictedFile.new(f,:file)\n end\n\n news_dirs.each do |f|\n data << NewFile.new(f,:dir)\n end\n news_files.each do |f|\n data << NewFile.new(f,:file)\n end\n dels_dirs.each do |f|\n data << DeletedFile.new(f,:dir)\n end\n dels_files.each do |f|\n data << DeletedFile.new(f,:file)\n end\n\n bst, currBranch = @selWs.current_branch\n if bst\n @lblCurrBranch.text = currBranch\n else\n @lblCurrBranch.text = \"<Exception while reading branch [#{currBranch}]>\"\n end\n\n\n @tblChanges.items.clear\n @tblChanges.items.add_all(data)\n end\n\n end",
"def listen_for_changes\n @semaphore.synchronize do\n @files_alive = []\n\n paths = initialize_paths(@paths, @dirs)\n directories = handle_paths(paths)\n if @opts[:recurse]\n update_changed_files(directories)\n end\n\n deleted_files = @file_cache.keys - @files_alive.uniq\n deleted_files.each do |filename|\n @file_cache.delete(filename)\n push_changes(filename, :removed)\n end\n end\n end",
"def directory\n @recently_added_tools = Tool.ordered_by(\"recently_added\").limit(5)\n end",
"def retrieve_files\r\n if RUBY_PLATFORM =~ /win32|win64/i then\r\n $help_file = File.read('C:\\files\\BJHelp.txt')\r\n $welcome_file = File.read('C:\\files\\BJWelcome.txt')\r\n $credits_file = File.read('C:\\files\\BJCredits.txt')\r\n else\r\n $help_file = File.read('files/BJHelp.txt')\r\n $welcome_file = File.read('files/BJWelcome.txt')\r\n $credits_file = File.read('files/BJCredits.txt')\r\n end\r\n end",
"def sync\n local_directories.each do |local_directory|\n if settings[:dry_run]\n log.info(sync_command(local_directory))\n else\n IO.popen(sync_command(local_directory)).each { |line| handle_output(line) }\n end\n end\n end",
"def update_files(&block)\n \n get_template_entries.each do |entry|\n \n next if entry.directory?\n \n entry.get_input_stream do |is|\n \n data = is.sysread\n \n if CONTENT_FILES.include?(entry.name)\n process_entry(data, &block)\n end\n \n @output_stream.put_next_entry(entry.name)\n @output_stream.write data\n \n end\n end\n end",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\[email protected]_text(CP::Vec2.new(352,100), \"ERROR: See terminal for details. Step back to start time traveling.\")\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\[email protected] @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def list_file_changed\n content = \"Files changed since last deploy:\\n\"\n IO.popen('find * -newer _last_deploy.txt -type f') do |io| \n while (line = io.gets) do\n filename = line.chomp\n if user_visible(filename) then\n content << \"* \\\"#{filename}\\\":{{site.url}}/#{file_change_ext(filename, \".html\")}\\n\"\n end\n end\n end \n content\nend",
"def refresh\n load if changed?\n end",
"def fetch_links\n if @options[:timeout]\n stat = File.stat(@options[:filename]) rescue nil\n return update if !stat || stat.mtime < Time.now - @options[:timeout] || stat.size == 0 || @force_update_db\n end\n\n parse_links(File.read(@options[:filename]))\n end",
"def update!\n @repo_dir.mkdir unless @repo_dir.directory?\n repo = Git::Repo.new(@repo_dir, @repo_url)\n\n if repo.exists?\n repo.checkout\n @initial = repo.head\n repo.add_origin\n else\n repo.init\n end\n\n repo.pull\n @current = repo.head\n\n if @initial && @initial != @current\n # hash with status characters for keys:\n # Added (A), Deleted (D), Modified (M)\n @changes_map = Hash.new { |h, k| h[k] = [] }\n\n changes = repo.changes(@initial, @current)\n\n while status = changes.shift\n file = changes.shift\n @changes_map[status] << file\n end\n\n if @changes_map.any?\n @changes = { 'New' => changed_items('A', @filter),\n 'Updated' => changed_items('M', @filter),\n 'Deleted' => changed_items('D', @filter) }\n return true\n end\n end\n\n # assume nothing was updated\n return false\n end",
"def reload!\n @boxes.clear\n\n Dir.open(@directory) do |dir|\n dir.each do |d|\n next if d == \".\" || d == \"..\" || [email protected](d).directory?\n @boxes << Box.new(d, @directory.join(d), @action_runner)\n end\n end\n end",
"def monitor\n was_changed = false\n new_state = nil\n self_stat = File.lstat(@path) rescue nil\n if self_stat == nil\n new_state = FileStatEnum::NON_EXISTING\n @files = nil\n @dirs = nil\n @cycles = 0\n elsif @files == nil\n new_state = FileStatEnum::NEW\n @files = Hash.new\n @dirs = Hash.new\n @cycles = 0\n update_dir\n elsif update_dir\n new_state = FileStatEnum::CHANGED\n @cycles = 0\n else\n new_state = FileStatEnum::UNCHANGED\n @cycles += 1\n if @cycles >= @stable_state\n new_state = FileStatEnum::STABLE\n end\n end\n\n # The assignment\n self.state= new_state\n end",
"def sync_many_files(files, user, api)\n files.group_by(&:project).each do |project, project_files|\n project_files.each_slice(FILES_CHUNK_SIZE) do |files_chunk|\n results = find_files_on_platform(files_chunk.map(&:dxid), project, api)\n\n files_chunk.each do |file|\n res = results.find { |r| r[:id] == file.dxid }\n # means that file doesn't exist on the platform anymore\n remove_local_file(file, user) unless res\n sync_file_state(res, file, user)\n end\n end\n end\n end",
"def refresh\n @all_window.each.with_index do |window, i|\n window.opacity = (i == @index ? 255 : 128)\n end\n current_window = @all_window[@index]\n return unless current_window\n last_y = current_window.y + current_window.height + 2\n if last_y > @viewport.rect.height\n oy = @viewport.rect.height - last_y - 48\n if WINDOW_VIEWPORT_INCOMPATIBILITY\n @all_window.move(0, oy)\n else\n @viewport.oy = -oy\n @background_sprite.oy = oy\n end\n elsif WINDOW_VIEWPORT_INCOMPATIBILITY && (last_y = current_window.y - 2) < 0\n @all_window.move(0, -last_y)\n elsif !WINDOW_VIEWPORT_INCOMPATIBILITY\n @background_sprite.oy = @viewport.oy = 0\n end\n end",
"def retrieve_files\r\n\r\n #Determine which platform the game is running on\r\n if RUBY_PLATFORM =~ /win32|win64|\\.NET|windows|cygwin|mingw32/ then\r\n #Retrieve files and assign to global variable\r\n $help_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJHelp.txt')\r\n $welcome_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJWelcome.txt')\r\n $credits_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJCredits.txt')\r\n else\r\n $help_file = File.read('/Ruby22/Ruby_Apps/myApp/BJHelp.txt')\r\n $welcome_file = File.read('/Ruby22/Ruby_Apps/myApp/BJWelcome.txt')\r\n $credits_file = File.read('/Ruby22/Ruby_Apps/myApp/BJCredits.txt')\r\n end\r\n\r\n end",
"def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end",
"def update(files)\n reset_variables\n\n files.each do |filename|\n @files_processed[filename] = false\n @errors = false\n if File.file?(filename)\n begin\n temp_file = Tempfile.new('closed_courseware')\n @@current_filename = filename\n\n File.open(filename, 'r+') do |file|\n file.each_line do |line|\n begin\n line = https_it(line)\n\n temp_file.puts line\n rescue\n @errors = true\n end\n end\n end\n\n FileUtils.mv(temp_file.path, filename)\n temp_file.close\n temp_file.unlink\n\n if !@errors\n @files_processed[filename] = true\n end\n ensure\n temp_file.close\n temp_file.unlink\n end\n end\n end\n end",
"def get_updated_files(days)\n FileAsset.\n select(\"CONCAT( servers.httpurl, '/', files.filename ) AS 'link', files.filelang AS 'flang', files.filetype AS 'ftype', files.filesize AS 'fsize', files.updated AS 'updated', lessonfiles.lessonid AS 'lessonid'\").\n where(:'files.updated' => days.days.ago.to_s(:db)..0.days.ago.to_s(:db)).\n joins(:server, :lessons).\n order(:lessonid, :ftype).\n all.group_by { |x| x['lessonid'] }\n end",
"def window_update(items)\n @data = []\n if items != nil\n for item in items\n if item != nil\n @data.push(item)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucVictoryItemsList.clear()\n for i in 0..@item_max-1\n @ucVictoryItemsList.push(create_item(i))\n end\n end\n\n refresh()\n end",
"def current_data\n start_ssh do |ssh|\n return ssh.scp.download!(full_filename)\n end\n end",
"def watch( *glob )\n yield unless block_given?\n files = []\n loop do\n new_files = Dir[*glob].map {|file| File.mtime(file) }\n yield if new_files != files\n files = new_files\n sleep 0.5\n end\nend",
"def list\n BakFile.where('saved = ?', true).each do |file|\n Log.instance.info(\"#{file.fid},#{file.dkey},#{file.length},#{file.classname}\")\n break if SignalHandler.instance.should_quit\n end\n end",
"def latest_file(glob)\n require 'find'\n return FileList[glob].map{|path| [path, File.mtime(path)]}.sort_by(&:last).map(&:first).last\n end",
"def pull_and_checkout\n Dir.new('.').each do |directory|\n next unless /[a-z]{2,3}\\d{4}/.match(directory)\n puts \"Pulling repo for #{directory.cyan}\"\n g = Git.open(directory)\n g.pull\n date = CONFIG['extended']['dce'].include?(directory) ? CONFIG['extended']['due_date'] : CONFIG['due_date']\n commit = g.log.until(date).first\n unless commit.nil?\n puts \"Reseting to commit #{commit.sha.cyan}\"\n g.reset_hard(commit)\n end\n end\n end",
"def window_update(views)\n @data = []\n if views != nil\n for view in views\n if view != nil\n @data.push(view)\n end\n end\n @item_max = @data.size\n create_contents()\n @viewsList.clear()\n for i in 0..@item_max-1\n @viewsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def window_update(views)\n @data = []\n if views != nil\n for view in views\n if view != nil\n @data.push(view)\n end\n end\n @item_max = @data.size\n create_contents()\n @viewsList.clear()\n for i in 0..@item_max-1\n @viewsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def snapshot_filesystem\n mtimes = {}\n\n files = @files.map { |file| Dir[file] }.flatten.uniq\n\n files.each do |file|\n if File.exists? file\n mtimes[file] = File.stat(file).mtime\n end\n end\n\n mtimes\n end",
"def main()\n res = @s.execute_get(@s.url_for(\"var/search/needsprocessing.json\"))\n unless res.code == '200'\n raise \"Failed to retrieve list to process [#{res.code}]\"\n end\n\n process_results = JSON.parse(res.body)['results']\n log \"processing #{process_results.size} entries\"\n unless process_results.size > 0\n return\n end\n\n # Create some temporary directories.\n Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR\n Dir.mkdir PREV_DIR unless File.directory? PREV_DIR\n Dir.mkdir PDFS_DIR unless File.directory? PDFS_DIR\n\n # Create a temporary file in the DOCS_DIR for all the pending files and outputs all the filenames in the terminal.\n Dir.chdir DOCS_DIR\n queued_files = process_results.collect do |result|\n FileUtils.touch result['_path']\n end\n\n log \" \"\n log \"Starts a new batch of queued files: #{queued_files.join(', ')}\"\n\n Dir['*'].each do |id|\n FileUtils.rm_f id\n log \"processing #{id}\"\n\n begin\n meta_file = @s.execute_get @s.url_for(\"p/#{id}.json\")\n unless meta_file.code == '200'\n raise \"Failed to process: #{id}\"\n end\n\n meta = JSON.parse meta_file.body\n mime_type = meta['_mimeType']\n given_extension = meta[\"sakai:fileextension\"]\n extension = determine_file_extension_with_mime_type(mime_type, given_extension)\n filename = id + extension\n log \"with filename: #{filename}\"\n\n if ignore_processing?(mime_type) || extension.eql?('')\n if extension.eql?('')\n log \"ignoring processing of #{filename}, no preview can be generated for files without a known mime type\"\n log \"The file's original extension was #{given_extension}, and it's mime type is #{mime_type}\"\n else\n log \"ignoring processing of #{filename}, no preview can be generated for #{mime_type} files\"\n end\n else\n # Making a local copy of the file.\n content_file = @s.execute_get @s.url_for(\"p/#{id}\")\n unless ['200', '204'].include? content_file.code\n raise \"Failed to process file: #{id}, status: #{content_file.code}\"\n end\n File.open(filename, 'wb') { |f| f.write content_file.body }\n\n if process_as_image? extension\n extension = output_extension extension\n page_count = 1\n filename_thumb = 'thumb' + extension\n\n content = resize_and_write_file filename, filename_thumb, 900\n post_file_to_server id, content, :normal, page_count, extension\n\n content = resize_and_write_file filename, filename_thumb, 180, 225\n post_file_to_server id, content, :small, page_count, extension\n\n FileUtils.rm_f DOCS_DIR + \"/#{filename_thumb}\"\n else\n begin\n # Check if user wants autotagging\n user_id = meta[\"sakai:pool-content-created-for\"]\n user_file = @s.execute_get @s.url_for(\"/system/me?uid=#{user_id}\")\n unless user_file.code == '200'\n raise \"Failed to get user: #{uid}\"\n end\n user = JSON.parse(user_file.body)\n if user[\"user\"][\"properties\"][\"isAutoTagging\"] != \"false\"\n # Get text from the document\n Docsplit.extract_text filename, :ocr => false\n text_content = IO.read(id + \".txt\")\n terms = extract_terms(text_content)\n tags = \"\"\n terms.each_with_index do |t, i|\n tags += \"- #{t}\\n\"\n terms[i] = \"/tags/#{t}\"\n end\n # Generate tags for document\n @s.execute_post @s.url_for(\"p/#{id}\"), {':operation' => 'tag', 'key' => terms}\n log \"Generate tags for #{id}, #{terms}\"\n admin_id = \"admin\"\n origin_file_name = meta[\"sakai:pooled-content-file-name\"]\n if not terms.nil? and terms.length > 0 and user[\"user\"][\"properties\"][\"sendTagMsg\"] and user[\"user\"][\"properties\"][\"sendTagMsg\"] != \"false\"\n msg_body = \"We have automatically added the following tags for #{origin_file_name}:\\n\\n #{tags}\\n\\nThese tags were created to aid in the discoverability of your content.\\n\\nRegards, \\nThe Sakai Team\"\n @s.execute_post(@s.url_for(\"~#{admin_id}/message.create.html\"), {\n \"sakai:type\" => \"internal\",\n \"sakai:sendstate\" => \"pending\",\n \"sakai:messagebox\" => \"outbox\",\n \"sakai:to\" => \"internal:#{user_id}\",\n \"sakai:from\" => \"#{admin_id}\",\n \"sakai:subject\" => \"We've added some tags to #{origin_file_name}\",\n \"sakai:body\" => msg_body,\n \"_charset_\" => \"utf-8\",\n \"sakai:category\" => \"message\"\n })\n log \"sending message from #{admin_id} user to #{user_id}\"\n end\n end\n rescue Exception => msg\n log \"failed to generate document tags: #{msg}\", :warn\n end\n\n # Generating image previews of the document.\n if only_first_page? extension\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg, :pages => 1\n else\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg\n end\n\n # Skip documents with a page count of 0, just to be sure.\n next if Dir[id + '_*'].size == 0\n\n Dir.mkdir PREV_DIR + \"/#{id}\" unless File.directory? PREV_DIR + \"/#{id}\"\n\n # Moving these previews to another directory: \"PREVS_DIR/filename/index.jpg\".\n Dir[id + '_*'].each_with_index do |preview, index|\n FileUtils.mv \"#{id}_#{index + 1}.jpg\", \"#{PREV_DIR}/#{id}/#{index}.jpg\"\n end\n\n Dir.chdir PREV_DIR + \"/#{id}\"\n page_count = Dir[\"*\"].size\n\n # Upload each preview and create+upload a thumbnail.\n for index in (0..page_count - 1)\n filename_p = \"#{index}.jpg\"\n # Upload the generated preview of this page.\n nbytes, content = File.size(filename_p), nil\n File.open(filename_p, \"rb\") { |f| content = f.read nbytes }\n post_file_to_server id, content, :large, index + 1\n\n # Generate 2 thumbnails and upload them to the server.\n filename_thumb = File.basename(filename_p, '.*') + '.normal.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 700\n post_file_to_server id, content, :normal, index + 1\n\n filename_thumb = File.basename(filename_p, '.*') + '.small.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 180, 225\n post_file_to_server id, content, :small, index + 1\n end\n\n FileUtils.remove_dir PREV_DIR + \"/#{id}\"\n end\n # Pass on the page_count\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:pagecount\" => page_count, \"sakai:hasPreview\" => \"true\"}\n\n # Change to the documents directory otherwise we won't find the next file.\n Dir.chdir DOCS_DIR\n end\n\n #SAKAI TO PDF\n # We check if mimetype is sakaidoc\n if(mime_type == \"x-sakai/document\")\n if (File.exist?(\"../wkhtmltopdf\"))\n # Go to PDF Dir\n Dir.chdir PDFS_DIR\n\n #delay in secs\n $delay = \"20\"\n\n #filename with extension\n filename_p = id + \".pdf\"\n\n # We parse the structure data to var structure (we do not need the rest)\n structure = JSON.parse meta['structure0']\n\n # Create var and add beginning of code line to run\n line = \"../wkhtmltopdf \"\n\n # Go through structure and add the pagelink for each page id\n structure.each do |page|\n link = \"content#l=\" + page[0] + \"&p=\" + id\n link = @s.url_for(link)\n link = \"'\" + link + \"' \"\n line += link\n end\n\n # Fetch cookie value to get access to all content\n # USERNAME PASSWORD SERVER\n $username = \"admin\"\n auth = \"../auth.sh \" + $username + \" \" + $pw + \" \" + $preview_referer\n cookietoken = `#{auth}`\n\n # Append end of line containing arguments for print css, delay and authentication\n line += filename_p + \" --print-media-type --redirect-delay \" + $delay + \"000 --cookie 'sakai-trusted-authn' \" + cookietoken\n\n # Run the command line (run wkhtmltopdf)\n `#{line}`\n\n # We read the content from the pdf in the PDF directory\n content = open(filename_p, 'rb') { |f| f.read }\n\n # We post it to server through this function\n post_pdf_to_server id, content\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"false\"}\n #Change dir\n Dir.chdir DOCS_DIR\n else\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n log \"PDF Converter (wkhtmltopdf) not present in directory\"\n log \"Cannot convert Sakai document to PDF\"\n log \"Continuing without conversion\"\n end\n end\n rescue Exception => msg\n # Output a timestamp + the error message whenever an exception is raised\n # and flag this file as failed for processing.\n log \"error generating preview/thumbnail (ID: #{id}): #{msg.inspect}\\n#{msg.backtrace.join(\"\\n\")}\", :warn\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n ensure\n # No matter what we flag the file as processed and delete the temp copied file.\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:needsprocessing\" => \"false\"}\n FileUtils.rm_f DOCS_DIR + \"/#{filename}\"\n end\n end\n\n FileUtils.remove_dir PDFS_DIR\n FileUtils.remove_dir PREV_DIR\n FileUtils.remove_dir DOCS_DIR\nend",
"def loop_for_incoming(config_file)\n\n STDERR.puts \"INFO: reading configuration file #{config_file}\"\n watched_directories = watch_configured_directories(config_file)\n watched_directories.each { |wd| wd.enqueue_incoming_packages }\n\n initial_mtime = File.stat(config_file).mtime\n while true\n sleep WatchConstants::DIRECTORY_SCAN_PAUSE\n current_mtime = File.stat(config_file).mtime\n if current_mtime > initial_mtime\n initial_mtime = current_mtime\n STDERR.puts \"INFO: configuration file #{config_file} was updated, re-reading\"\n watched_directories = watch_configured_directories(config_file)\n end\n watched_directories.each { |wd| wd.enqueue_incoming_packages }\n end\nend",
"def process_vmware_patch_info(patch_list,download,patchdir)\n patch_list.each do |patch_no, patch_url|\n puts \"Update: \"+patch_no\n puts \"Download: \"+patch_url\n local_file = patch_url.split(/\\?/)[0]\n local_file = File.basename(local_file)\n local_file = patchdir+\"/\"+local_file\n missing = \"n\"\n if File.exist?(local_file)\n puts \"Present: \"+local_file\n missing = \"n\"\n else\n puts \"Missing: \"+local_file\n missing = \"y\"\n end\n if download == \"y\" and missing == \"y\"\n %x[wget \"#{patch_url}\" -O \"#{local_file}\"]\n end\n end\n return\nend",
"def changed_files\n @files.each do |file, stat|\n if new_stat = safe_stat(file)\n if new_stat.mtime > stat.mtime\n @files[file] = new_stat\n yield(file)\n end\n end\n end\n end",
"def window_update(items, dataview=nil)\n @data = []\n if dataview != nil\n items = apply_dataview(dataview, items)\n end\n \n if items != nil\n for item in items\n if item != nil && include?(item)\n @data.push(item)\n if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id\n self.index = @data.size - 1\n end\n end\n end\n @item_max = @data.size\n create_contents()\n @ucItemsList.clear()\n for i in 0..@item_max-1\n @ucItemsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || [email protected](/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && [email protected]('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && [email protected]('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def window_update(items)\n @data = []\n for i in @data.size .. 4-1\n @data.push(nil)\n end\n \n if items != nil\n index = 0\n for item in items\n @data[index] = item\n index += 1\n end\n end\n \n @item_max = @data.size\n create_contents()\n @cLabelsList.clear()\n for i in 0..@item_max-1\n @cLabelsList.push(create_item(i))\n end\n refresh()\n end",
"def enhance_file_list\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n # zsh gives errors which stick on stdscr and don't get off!\n # Rather than using N I'll try to convert to ruby, but then we lose\n # similarity to cetus and its tough to redo all the sorting stuff.\n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n #f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_file_list d\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]MN)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]MN)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]MN)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]MN)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]MN)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def run\n @files.each do |file|\n generate_tracklist(file)\n end\n end",
"def get_img_all\n while not @end_state\n puts \"Currently downloading: #{@current_title}\"\n get_img\n next_page\n @global_count += 1\n if not @ch_limit.nil? and @global_count == @ch_limit\n @end_state = true\n end\n end\n puts \"Finished downloading!\"\n end",
"def work!\n loop do\n if inside_operating_window?\n fetch\n check_for_history_request\n else\n pause\n end\n log_activity\n end\n end",
"def do_update\n git = ::Git.open(@repo_dir)\n do_fetch(git)\n git.reset_hard\n do_checkout_revision(git)\n do_update_tag(git)\n end",
"def process_threads\n @thread_images.each do |key, value|\n if value[:dirty]\n value[:images].each do |image|\n if !value[:dir] || value[:dir].length == 0\n # Skip if save directory not set\n next\n end\n \n file_path = value[:dir] + '/' + File.basename(image)\n if @in_progress[image] || File.exists?(file_path)\n # Skip if already downloading/downloaded\n next\n end\n \n value[:dirty] = false\n \n work_data = {\n image_url: image,\n image_path: value[:dir]\n }\n \n # Add to queue\n @download_queue.push(work_data)\n end\n end\n \n status_updated\n end\n end",
"def watch_files(files)\n @files.concat files\n self\n end",
"def update\n app_dir = app_dir\n # there's probably a git gem we could use here\n system \"cd #{app_dir} && git pull\" unless app_dir.nil?\n system \"cd #{File.dirname(__FILE__)} && git pull\"\nend",
"def update\n # check that we've got a clean working directory. Git can't pull\n # updates with a dirty working directory.\n unless `git status --porcelain`.empty?\n puts \"Can't proceed: the working directory is dirty. Please stash, \"\n puts \"commit, or reset any changes listed in `git status`.\"\n\n exit 1\n end\n\n puts \"Pulling latest changes from GitHub...\"\n `git pull > /dev/null`\n\n puts \"Synchronizing git submodule URLs...\"\n `git submodule sync > /dev/null`\n\n puts \"Fetching any newly added git submodules...\"\n `git submodule update --init > /dev/null`\n end",
"def poll_changed_directories\n until stopped\n next if paused\n\n start = Time.now.to_f\n callback.call(directories.dup, :recursive => true)\n turnstile.signal\n nap_time = latency - (Time.now.to_f - start)\n sleep(nap_time) if nap_time > 0\n end\n rescue Interrupt\n end",
"def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end",
"def get_files_by_mtime dir='*'\n gfb dir, :mtime\nend",
"def sync\n each_difference(local_resources, true) { |name, diffs| sync_difference(name, diffs) }\n end",
"def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end",
"def reload_metadata()\n api_result = @session.execute!(\n :api_method => @session.drive.files.get,\n :parameters => { \"fileId\" => self.id })\n @api_file = api_result.data\n if @acl\n @acl = Acl.new(@session, self)\n end\n end",
"def fetch_items_from_filesystem_or_zip\n unless in_zip?\n @items = Dir.foreach(current_dir).map {|fn|\n load_item dir: current_dir, name: fn\n }.to_a.partition {|i| %w(. ..).include? i.name}.flatten\n else\n @items = [load_item(dir: current_dir, name: '.', stat: File.stat(current_dir)),\n load_item(dir: current_dir, name: '..', stat: File.stat(File.dirname(current_dir)))]\n zf = Zip::File.new current_dir\n zf.each {|entry|\n next if entry.name_is_directory?\n stat = zf.file.stat entry.name\n @items << load_item(dir: current_dir, name: entry.name, stat: stat)\n }\n end\n end",
"def getfiles path\n\nDir.foreach(path) do |f|\nname=File.basename f\npathn= @to_path + name\n\t\nfilepath =path +\"/\"+ f\n\nputs filepath\n if File.directory? filepath and name != '..' and name != '.' and name != 'new' \n\n Dir.chdir filepath\nstr = Dir.pwd\ngetfiles str\n\nDir.chdir('..')\nelsif File.file? f and name != 'app.rb' \n\tf1 = File.open(f, \"r:binary\")\nf2 = File.open(pathn, \"a:binary\")\n while (b = f1.getc)!= nil do\n \tf2.putc b\nend\n \nf2.close\n\n\nend\n\nend\nend",
"def fetch\n dst = Pathname.pwd+File.basename(@url.to_s)\n blah \"Fetching patch...\"\n begin\n curl @url.to_s, '-o', dst\n rescue => ex\n raise \"Patch #{File.basename(@url.to_s)} could not be fetched.\"\n debug ex.message\n end\n @cached_location = dst\n debug \"Patch downloaded into #{@cached_location}\"\n end",
"def cnewer path\n time = File.stat(path).ctime\n @files = @files.select { |file| File.stat(file).ctime > time}\n self\n end",
"def on_next_in_folder_clicked\n @wall.run(:next_in_folder, @settings.current_file) do |pic|\n inform_pic_change pic\n end\n end",
"def get_files\n self.locales.each do |l|\n self.files[l] = Dir.glob(\"#{self.locale_dir}/*#{l}.#{self.source_format}\")\n\n next if l == self.default_locale\n\n self.files[self.default_locale].each do |original_file|\n locale_file = original_file.gsub(\"#{self.default_locale}.#{self.source_format}\", \"#{l}.#{self.source_format}\")\n\n next if self.files[l].include?(locale_file)\n\n create_locale_file(locale_file, original_file)\n\n self.files[l] << locale_file\n end\n end\n end",
"def all_files= ( value )\n Dir.chdir(value)\n @all_files = Dir.glob(\"*\");\n end"
] | [
"0.5996507",
"0.59421897",
"0.5928477",
"0.58682674",
"0.58014375",
"0.57655156",
"0.5755845",
"0.5695688",
"0.5673214",
"0.5561599",
"0.55521715",
"0.54958373",
"0.5395383",
"0.53856426",
"0.53328204",
"0.5331938",
"0.53183925",
"0.5289763",
"0.52758867",
"0.52729386",
"0.52680707",
"0.526345",
"0.52624434",
"0.52624434",
"0.5259987",
"0.5257126",
"0.52561104",
"0.5248767",
"0.5236594",
"0.5233405",
"0.5231126",
"0.5220446",
"0.52133125",
"0.520724",
"0.52057487",
"0.5198918",
"0.51951325",
"0.51850784",
"0.5181393",
"0.5175293",
"0.5174448",
"0.51704365",
"0.5165517",
"0.5160336",
"0.51542956",
"0.51522505",
"0.5122772",
"0.51149184",
"0.5112929",
"0.5108608",
"0.5089251",
"0.50548166",
"0.5054111",
"0.5047476",
"0.5038947",
"0.502808",
"0.5023319",
"0.5019294",
"0.5011082",
"0.5008005",
"0.49914008",
"0.49865213",
"0.49834853",
"0.49742696",
"0.49690044",
"0.49533227",
"0.4950849",
"0.493884",
"0.49385494",
"0.4922317",
"0.4922317",
"0.49184424",
"0.49178475",
"0.49166697",
"0.49160334",
"0.49029586",
"0.48999172",
"0.48874316",
"0.48806548",
"0.4879774",
"0.4869399",
"0.4868949",
"0.48657435",
"0.48620257",
"0.48580027",
"0.48498476",
"0.48491776",
"0.48462558",
"0.48431996",
"0.48423034",
"0.48418728",
"0.48415542",
"0.4841269",
"0.48337546",
"0.48303035",
"0.48252934",
"0.48169035",
"0.48165637",
"0.48162997",
"0.48147193",
"0.48061433"
] | 0.0 | -1 |
Sort the whole files and directories in the current directory, then refresh the screen. ==== Parameters +direction+ Sort order in a String. nil : order by name r : reverse order by name s, S : order by file size sr, Sr: reverse order by file size t : order by mtime tr : reverse order by mtime c : order by ctime cr : reverse order by ctime u : order by atime ur : reverse order by atime e : order by extname er : reverse order by extname | def sort(direction = nil)
@direction, @current_page = direction, 0
sort_items_according_to_current_direction
switch_page 0
move_cursor 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_items_according_to_current_direction\n case @direction\n when nil\n @items = items.shift(2) + items.partition(&:directory?).flat_map(&:sort)\n when 'r'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort.reverse}\n when 'S', 's'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by {|i| -i.size}}\n when 'Sr', 'sr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:size)}\n when 't'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.mtime <=> x.mtime}}\n when 'tr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:mtime)}\n when 'c'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.ctime <=> x.ctime}}\n when 'cr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:ctime)}\n when 'u'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.atime <=> x.atime}}\n when 'ur'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:atime)}\n when 'e'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.extname <=> x.extname}}\n when 'er'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:extname)}\n end\n items.each.with_index {|item, index| item.index = index}\n end",
"def sort_files!; end",
"def order\n \"#{sort} #{dir}\"\n end",
"def swap_sort_direction(direction = @paginable_params[:sort_direction])\n direction_upcased = upcasing_sort_direction(direction)\n return 'DESC' if direction_upcased == 'ASC'\n return 'ASC' if direction_upcased == 'DESC'\n end",
"def sort_direction\n params[:dir] == \"asc\" ? \"asc\" : \"desc\"\n end",
"def sort_direction(direction)\n %w[asc desc].include?(direction) ? direction : 'asc'\n end",
"def sort!\n #N Without this, the immediate sub-directories won't get sorted\n dirs.sort_by! {|dir| dir.name}\n #N Without this, files contained immediately in this directory won't get sorted\n files.sort_by! {|file| file.name}\n #N Without this, files and directories contained within sub-directories of this directory won't get sorted\n for dir in dirs\n #N Without this, this sub-directory won't have its contents sorted\n dir.sort!\n end\n end",
"def sort_direction\n %w[asc, desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def list_files dir='*', sorto=@sorto, hidden=@hidden, _filter=@filterstr\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # decide sort method based on second character\n # first char is o or O (reverse)\n # second char is macLn etc (as in zsh glob)\n so = sorto ? sorto[1] : nil\n func = case so\n when 'm'\n :mtime\n when 'a'\n :atime\n when 'c'\n :ctime\n when 'L'\n :size\n when 'n'\n :path\n when 'x'\n :extname\n end\n\n # sort by time and then reverse so latest first.\n sorted_files = if hidden == 'D'\n Dir.glob(dir, File::FNM_DOTMATCH) - %w[. ..]\n else\n Dir.glob(dir)\n end\n\n # WARN: crashes on a deadlink since no mtime\n if func\n sorted_files = sorted_files.sort_by do |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n end\n end\n\n sorted_files.sort! { |w1, w2| w1.casecmp(w2) } if func == :path && @ignore_case\n\n # zsh gives mtime sort with latest first, ruby gives latest last\n sorted_files.reverse! if sorto && sorto[0] == 'O'\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n # return sorted_files\n @files = sorted_files\n calculate_bookmarks_for_dir # we don't want to override those set by others\nend",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'\n end",
"def files_search_results(search_result, direction)\n files, files_in_folders = search_result.compact.partition { |v| v[:file_path] == \"/\" }\n\n folders_result = files_map(files_in_folders)\n sorted_folders = []\n folders_result.\n group_by { |k| [k[:path]] }.\n sort_by { |k, _| k[0].downcase }.\n each { |_, v| sorted_folders << v }\n sorted_folders.flatten!\n\n files_result = files_map(files)\n sorted_files = files_result.sort_by { |k| k[:title].downcase }\n\n if direction == \"desc\"\n sorted_folders = sorted_folders.reverse\n sorted_files = sorted_files.reverse\n end\n sorted_folders + sorted_files\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def sort_direction\n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"desc\"\n end",
"def c_refresh\n $filterstr ||= \"M\"\n #$files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n $patt=nil\n $title = nil\n display_dir\nend",
"def upcasing_sort_direction(direction = @paginable_params[:sort_direction])\n directions = ['asc', 'desc', 'ASC', 'DESC']\n return directions.include?(direction) ? direction.upcase : 'ASC'\n end",
"def order_menu\n # zsh o = order, O = reverse order\n # ruby mtime/atime/ctime come reversed so we have to change o to O\n lo = nil\n h = { m: :modified, a: :accessed, M: :oldest,\n s: :largest, S: :smallest, n: :name, N: :rev_name,\n # d: :dirs,\n c: :inode,\n x: :extension,\n z: :clear }\n _, menu_text = menu 'Sort Menu', h\n case menu_text\n when :modified\n lo = 'Om'\n when :accessed\n lo = 'Oa'\n when :inode\n lo = 'Oc'\n when :oldest\n lo = 'om'\n when :largest\n lo = 'OL'\n when :smallest\n lo = 'oL'\n when :name\n lo = 'on'\n when :extension\n lo = 'ox'\n when :rev_name\n lo = 'On'\n when :dirs\n lo = '/'\n when :clear\n lo = ''\n else\n return\n end\n ## This needs to persist and be a part of all listings, put in change_dir.\n @sorto = lo\n message \"Sorted on #{menu_text}\"\n rescan_required\nend",
"def sort\n if self.checkDestination\n\n if @interactive\n answer = readUserInput(\"Process '#{@filename}' ([y]/n): \")\n answer = answer.empty? ? 'y' : answer\n self.log('info', \"User Answer for file '#{@filename}': #{answer}\")\n if !answer.match(/y/) \n self.log('info',\"Skipping file '#{@filename}' due to user answer: '#{answer}'.\")\n return\n else\n self.log('info',\"Processing file '#{@filename}' due to user answer: '#{answer}'.\")\n end\n end\n\n if not author = get_author() or author.empty?\n self.log('error', \"File '#{@filename}' has not value for author set. Cannot sort file. Abort.\")\n exit 1\n end\n targetdir = @destination.chomp + '/' + author\n targetfile = targetdir + '/' + Pathname.new(@filename).basename.to_s\n\n # Create the target directory, if it does not exist yet.\n if !File.exists? targetdir\n\n # Check for similiar directory names which might indicate a typo in the\n # current directory name.\n if @typo and foundDir = self.findSimilarTargetdir(targetdir)\n\n self.log('info', \"Similar target found ('\" + foundDir + \"'). Request user input.\")\n puts 'Similar target directory detected:'\n puts 'Found : ' + foundDir\n puts 'Target: ' + targetdir\n while answer = readUserInput('Abort? ([y]/n): ')\n if answer.match(/(y|yes|j|ja|^$)/i)\n self.log('info','User chose to abort sorting.')\n puts 'Abort.'\n exit 0\n elsif answer.match(/(n|no)/i)\n self.log('info', 'User chose to continue sorting.')\n break\n end\n end\n end\n\n if @dryrun\n self.log('info', \"Dryrun: Created Directory '#{targetdir}'.\")\n else\n self.log('info', \"Created directory '#{targetdir}'.\")\n puts 'Created: ' + targetdir\n FileUtils.mkdir_p(targetdir)\n end\n end\n\n # Check if the file already exists\n # This does nothing so far\n if File.exists?(targetfile) and @overwrite\n self.log('info', \"File '#{@filename}' already exists. Overwrite active: replacing file.\")\n elsif File.exists?(targetfile) and !@overwrite\n self.log('info', \"File '#{@filename}' already exists, overwrite disabled: not replacing file.\")\n return true\n end\n\n if @copy\n\n if @dryrun\n self.log('info', \"Dryrun: Copy file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Copy file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.cp(@filename, targetdir)\n end\n\n else\n\n if @dryrun\n self.log('info', \"Dryrun: Move file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Move file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.mv(@filename, targetdir)\n end\n\n end\n\n end\n end",
"def sorting_info(s_item, s_direction)\n\n file_link_dir = mtime_link_dir = sortby_link_dir = \"ascending\"\n s_item_display = s_direction_display = \"\"\n \n case s_item\n when \"file\"\n s_item_display = \"alphabetically\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"\"\n file_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"reversed\"\n file_link_dir = \"ascending\"\n end\n when \"mtime\"\n s_item_display = \"by modification date\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"oldest to newest\"\n mtime_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"newest to oldest\"\n mtime_link_dir = \"ascending\"\n end\n when \"size\"\n s_item_display = \"by size\"\n case s_direction\n when \"ascending\"\n s_direction_display = \"smallest to largest\"\n sortby_link_dir = \"descending\"\n when \"descending\"\n s_direction_display = \"largest to smallest\"\n sortby_link_dir = \"ascending\"\n end\n end\n \n return \"?sortby=file&direction=#{file_link_dir}\",\n \"?sortby=mtime&direction=#{mtime_link_dir}\",\n \"?sortby=size&direction=#{sortby_link_dir}\",\n s_item_display,\n s_direction_display\n \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def sort_direction_class options = {}\n options = options.with_indifferent_access\n attribute = (order.attributes.presence || params[:sort].presence || []).find {|x| x[:field]== options[:field].to_s} || {}\n direction = options[:direction].presence || attribute[:direction]\n return \"\" if direction.blank?\n return \"fa fa-sort-up\" if [:asc, :up].include?(direction.to_s.downcase.to_sym)\n return \"fa fa-sort-down\" if [:desc, :down].include?(direction.to_s.downcase.to_sym)\n end",
"def sort_direction default_direction = \"asc\"\n %w[asc desc].include?(params[:direction]) ? params[:direction] : default_direction\n end",
"def sort_direction default_direction = \"asc\"\n %w[asc desc].include?(params[:direction]) ? params[:direction] : default_direction\n end",
"def sort_direction default_direction = \"asc\"\n %w[asc desc].include?(params[:direction]) ? params[:direction] : default_direction\n end",
"def sort_direction\n params[:direction] || \"asc\"\n end",
"def sort_dir\n params[:sort_dir] == 'desc' ? 'desc' : 'asc'\n end",
"def sort_direction\n params[\"order\"][\"0\"][\"dir\"] == \"desc\" ? \"desc\" : \"asc\"\n end",
"def sort!(reverse=false)\n @files = files.sort {|f1, f2| file_date(f1) <=> file_date(f2) }\n @files = files.reverse if reverse\n self\n end",
"def sort_by(tree, col, direction)\n tree.children(nil).map!{|row| [tree.get(row, col), row.id]} .\n sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) .\n each_with_index{|info, idx| tree.move(info[1], nil, idx)}\n\n tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)})\nend",
"def sort(field, direction = 'desc')\n @sorting = { field => direction }\n self\n end",
"def sort_content(ascending = true)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Sorting Webform Results\")\n wait.until { @browser.find_element(:xpath => @webformmgr.sort_asc) }.click\n elem = wait.until { @browser.find_element(:xpath => \"//a[contains(@title, 'sort by Submitted')]/img\") }\n current_sorting = elem.attribute(\"title\")\n if (current_sorting == 'sort descending' and ascending)\n @browser.find_element(:xpath => @webformmgr.sort_asc).click\n elsif (current_sorting == 'sort descending' and !ascending)\n Log.logger.info(\"Already sorted by Descending\")\n elsif (current_sorting == 'sort ascending' and ascending)\n Log.logger.info(\"Already sorted by Ascending\")\n else\n @browser.find_element(:xpath => @webformmgr.sort_asc).click\n end\n end",
"def gfb dir, func\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # sort by time and then reverse so latest first.\n sorted_files = Dir[dir].sort_by { |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n }.reverse\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n return sorted_files\nend",
"def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end",
"def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end",
"def sort_by(column)\n column = column.to_s\n\n direction = next_dir(column)\n column = direction && column\n\n { 'sort' => column, 'dir' => direction }\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sort_by(field_name, dir = 'desc')\n @query_hash[SORT_BY][field_name] = { field_name => dir }\n self\n end",
"def sort_files!\n site.generated_pages.sort_by!(&:name)\n site.static_files.sort_by!(&:relative_path)\n end",
"def refresh\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def order_by_statement(direction:)\n direction = direction.to_s.upcase\n raise \"Ording direction should be 'asc' or 'desc'\" unless %w[ASC DESC].include?(direction)\n return \"#{degenerate_fragment} #{direction}\" if type == Dimension::TYPES[:degenerate]\n \"#{label_fragment} #{direction}\"\n end",
"def direction_for_solr\n DIRECTIONS[@direction] || \n raise(\n ArgumentError,\n \"Unknown sort direction #{@direction}. Acceptable input is: #{DIRECTIONS.keys.map { |input| input.inspect } * ', '}\"\n )\n end",
"def sort_dir_list(dir_list, path)\n order_by ||= session[:order_by]\n order_by ||= 'filename'\n order_desc = session[:order_desc]\n \n if dir_list.first[order_by.to_sym].class == Fixnum\n dir_list.sort! { |a,b| a[order_by.to_sym] <=> b[order_by.to_sym] }\n else\n dir_list.sort! { |a,b| a[order_by.to_sym].to_s.downcase <=> b[order_by.to_sym].to_s.downcase }\n end\n\n dir_list.reverse! if order_desc\n \n # move folders to top\n new_list = []\n new_dir_list = []\n dir_list.each do |element|\n new_list << element if File.directory?(path + '/' + element[:original_name])\n new_dir_list << element if File.file?(path + '/' + element[:original_name])\n end\n new_list.sort! { |a,b| a[:filename].to_s.downcase <=> b[:filename].to_s.downcase }\n new_list.concat new_dir_list\n end",
"def sort_direction=(sort_direction)\n validator = EnumAttributeValidator.new('String', [\"ASC\", \"DESC\"])\n unless validator.valid?(sort_direction)\n fail ArgumentError, \"invalid value for \\\"sort_direction\\\", must be one of #{validator.allowable_values}.\"\n end\n @sort_direction = sort_direction\n end",
"def main\n filelist = split_ts_export_main\n sort_lines_main(filelist)\n #reverse_lines_main\nend",
"def sort_link(*args)\n\t\toptions = {\n\t\t\t:image => true\n\t\t}.merge(args.extract_options!)\n\t\tcolumn = args[0]\n\t\ttext = args[1]\n\t\t#\tmake local copy so mods to muck up real params which\n\t\t#\tmay still be references elsewhere.\n\t\tlocal_params = params.dup\n\n#\n#\tMay want to NOT flip dir for other columns. Only the current order.\n#\tWill wait until someone else makes the suggestion.\n#\n\t\torder = column.to_s.downcase.gsub(/\\s+/,'_')\n\t\tdir = ( local_params[:dir] && local_params[:dir] == 'asc' ) ? 'desc' : 'asc'\n\n\t\tlocal_params[:page] = nil\n\t\tlink_text = text||column\n\t\tclasses = ['sortable',order]\n\t\tarrow = ''\n\t\tif local_params[:order] && local_params[:order] == order\n\t\t\tclasses.push('sorted')\n\t\t\tarrow = if dir == 'desc'\n\t\t\t\tif File.exists?( sort_down_image ) && options[:image]\n\t\t\t\t\timage_tag( File.basename(sort_down_image), :class => 'down arrow')\n\t\t\t\telse\n\t\t\t\t\t\"<span class='down arrow'>↓</span>\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif File.exists?( sort_up_image ) && options[:image]\n\t\t\t\t\timage_tag( File.basename(sort_up_image), :class => 'up arrow')\n\t\t\t\telse\n\t\t\t\t\t\"<span class='up arrow'>↑</span>\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ts = \"<div class='#{classes.join(' ')}'>\"\n\t\ts << link_to(link_text,local_params.merge(:order => order,:dir => dir))\n\t\ts << arrow unless arrow.blank?\n\t\ts << \"</div>\"\n\t\ts.html_safe\n#\tNOTE test this as I suspect that it needs an \"html_safe\" added\n\tend",
"def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='asc'\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='desc'\n Technologist.all.order(\"technologists.name DESC\")\n elsif value && direction=='asc'\n Technologist.full_text_search(value).reorder(\"technologists.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Technologist.full_text_search(value).reorder(\"technologists.name DESC\").with_pg_search_rank\n else\n Technologist.full_text_search(value).with_pg_search_rank\n end\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def get_files(sort_style = SortStyle::Size)\n\t\tif sort_style.eql?(SortStyle::Name)\n\t\t\treturn @files.sort\n\telse\n\t\t\treturn @files.sort {|a,b| a[1]<=>b[1]}\n\t\tend\n\tend",
"def sort_files!\n site.collections.each_value { |c| c.docs.sort! }\n site.pages.sort_by!(&:name)\n site.static_files.sort_by!(&:relative_path)\n end",
"def sort(field, _direction)\n @params.raw_parameter(:\"f.#{@facet_name}.facet.sort\", field)\n self\n end",
"def sortFilesFromDirs array, dir #array is elements in current directory: dir\n\n #temp arrays to hold files vs dirs\n dirs = Array.new\n files = Array.new\n\n array.each do |elem|\n\n #path to current entity interested in\n currentPath = dir + \"/\" + elem\n #puts \"currentPath: \" + currentPath\n\n #is dir or no?\n if Dir.exist? currentPath\n dirs << elem\n else\n files << elem\n end\n\n end\n\n #puts \"dirs: \" + dirs.to_s\n #puts \"files: \" + files.to_s\n \n #return concatenated array\n return dirs + files\n\n end",
"def polish_result_browse!(revert_result,option = {})\n return if revert_result[\"files\"].nil?\n list_result = revert_result[\"files\"]\n list_result.sort! do |a,b|\n folder_a = a[\"_file_type\"] == \"folder\"\n folder_b = b[\"_file_type\"] == \"folder\"\n if folder_a && folder_b\n b[\"_file_name\"] >= a[\"_file_name\"] ? -1 : 1\n elsif folder_a && !folder_b\n -1\n elsif !folder_a && folder_b\n 1\n else\n b[\"_file_name\"] >= a[\"_file_name\"] ? -1 : 1\n end\n end\n notify \"Sorting Result\"\n list_result.each do |f|\n notify %Q{#{f[\"_file_name\"]}:#{f[\"_file_type\"]}}\n end\n end",
"def order_for(directions)\n directions.map { |direction| dispatch(direction) }.join(SEPARATOR)\n end",
"def apply_search_direction( ds, options )\n\t\tds.reverse! if options[:direction] && options[:direction] == 'desc'\n\t\treturn ds\n\tend",
"def ordered_topologically\n FolderSort.new(self)\n end",
"def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end",
"def get_list_order(sort, dir)\n\t\t\tif sort\n\t\t\t\tcolumn_order_mapping = get_sext_constant('SEXT_COLUMN_ORDER_MAPPING')\n\n\t\t\t\t# Lookup and use the designated ordering if defined in the model.\n\t\t \t\tif column_order_mapping && column_order_mapping.has_key?(sort.to_sym)\n\t\t \t\t\tsort = column_order_mapping[sort.to_sym]\n\n\t\t \t\t# Use the passed in value if it looks complete with table name.\n \t\t\t\telsif !sort.include?('.')\n\t\t\t\t\tsort = [self.table_name, sort].join('.')\n\t\t \t\tend\n\n\t\t\t\tdir ||= \"ASC\"\n\t\t \t\torder = sort + \" \" + dir\n\t\t \telse\n\t\t \t\torder = get_sext_constant('SEXT_DEFAULT_SORT')\n\t\t \tend\n\t\t \t\n\t\t\treturn order\t\n\t\tend",
"def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='asc'\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='desc'\n Servicer.all.order(\"servicers.name DESC\")\n elsif value && direction=='asc'\n Servicer.full_text_search(value).reorder(\"servicers.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Servicer.full_text_search(value).reorder(\"servicers.name DESC\").with_pg_search_rank\n else\n Servicer.full_text_search(value).with_pg_search_rank\n end\n end",
"def flip(dir, boxes)\n dir == 'R' ? boxes.sort : boxes.sort.reverse\nend",
"def sort(sort = nil)\n set_option(:sort, sort)\n end",
"def fallback_sort_order(direction)\n \"#{resource_handler.model.table_name}.id #{direction}\"\n end",
"def timestamp_sort_order(direction = \"asc\")\n [arel_table[PaperTrail.event_field].send(direction.downcase), arel_table[PaperTrail.timestamp_field].send(direction.downcase)].tap do |array|\n array << arel_table[primary_key].send(direction.downcase) if primary_key_is_int?\n end\n end",
"def order_string\n \"#{params[:sort]} #{params[:direction]}\"\n end",
"def check_kaminari_sort(klass, column = nil, dir = nil)\n if (column.nil? && dir.nil?)\n return klass::DEFAULT_ORDER\n end\n begin\n unless klass::SORTABLE_COLUMNS.include? column\n raise ArgumentError, \"Column (#{column.to_s}) is not sortable for model #{klass.to_s}. See #{klass.to_s}::SORTABLE_COLUMNS\"\n end\n rescue ArgumentError => e\n puts e.message\n return klass::DEFAULT_ORDER\n end\n safe_col = column\n safe_dir = (dir == 'asc') ? 'asc' : 'desc'\n return '%s %s' % [safe_col, safe_dir] # sql order by clause\n end",
"def sort!\n sort_if_needed\n self\n end",
"def sort_entries; end",
"def sort_order # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n col = sort_column\n # do a case-insensitive sort if we are sort on last name\n col = \"lower(#{col})\" if col.include?('last_name')\n return Arel.sql(\"#{col} #{sort_direction}\") unless col.include?('enumerations')\n\n klass, method = col.split('.')\n values = klass.singularize.capitalize.constantize.send(method.intern)\n .order(Arel.sql(\"value #{sort_direction} \")).pluck('value')\n order_query = values.each_with_index.inject(+'CASE ') do |memo, (val, i)| # rubocop:disable Style/EachWithObject\n memo << \"WHEN( enumerations.value = '#{val}') THEN #{i} \"\n memo\n end\n Arel.sql(\"#{order_query} ELSE #{values.length} END\")\n end",
"def sort_order(order)\n \"#{(params[:order] || order.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:direction] == 'up' ? 'ASC' : 'DESC'}\"\n end",
"def sort_images(directory)\n log_file(\"[START] sorting images...\")\n\n Dir.glob(directory + \"**/*.{DNG,JPG,JPEG,CR2,RW2}\", File::FNM_CASEFOLD).each do |image|\n parent_folder = File.basename(File.dirname(image))\n\n unless IGNORE_FOLDERS.include?(parent_folder) then\n puts `exiftool \"-filemodifydate<DateTimeOriginal\" \"-filecreatedate<DateTimeOriginal\" \"#{image}\" -v5 -q 2>> #{ERROR_FILE} 1>> #{LOG_FILE}`\n puts `exiftool \"-directory<FilecreateDate\" \"-directory<createdate\" \"-directory<DateTimeOriginal\" -d #{SORTED_FOLDER}%Y/%Y-%m-%d \"#{image}\" -v1 -q 2>> #{ERROR_FILE} 1>> #{LOG_FILE}`\n end\n end\n log_file(\"[COMPLETE] ...sorting images done.\")\nend",
"def sort\n order = params[:image]\n Image.order(order)\n render :text => order.inspect\n end",
"def set_listing_sort_order(search_object, default_val)\n if params[:sort]\n sort_order = params[:sort].downcase\n case sort_order\n when \"manu\"\n search_object.sort_order = SortOrder::SORT_BY_MANU_ASC\n when \"manud\"\n search_object.sort_order = SortOrder::SORT_BY_MANU_DESC\n when \"size\"\n search_object.sort_order = SortOrder::SORT_BY_SIZE_ASC\n when \"sized\"\n search_object.sort_order = SortOrder::SORT_BY_SIZE_DESC\n when \"upd\"\n search_object.sort_order = SortOrder::SORT_BY_UPDATED_ASC\n when \"updd\"\n search_object.sort_order = SortOrder::SORT_BY_UPDATED_DESC\n when \"qty\"\n search_object.sort_order = SortOrder::SORT_BY_QTY_ASC\n when \"type\"\n search_object.sort_order = SortOrder::SORT_BY_TYPE_ASC\n when \"treadd\"\n search_object.sort_order = SortOrder::SORT_BY_TREADLIFE_DESC\n when \"distance\"\n search_object.sort_order = SortOrder::SORT_BY_DISTANCE_ASC\n when \"cost\"\n search_object.sort_order = SortOrder::SORT_BY_COST_PER_TIRE_ASC\n when \"costd\"\n search_object.sort_order = SortOrder::SORT_BY_COST_PER_TIRE_DESC\n when \"name\"\n search_object.sort_order = SortOrder::SORT_BY_MODEL_NAME_ASC\n when \"named\"\n search_object.sort_order = SortOrder::SORT_BY_MODEL_NAME_DESC\n when \"store\"\n search_object.sort_order = SortOrder::SORT_BY_STORE_NAME_ASC\n when \"stored\"\n search_object.sort_order = SortOrder::SORT_BY_STORE_NAME_DESC\n else\n search_object.sort_order = default_val\n end\n else\n search_object.sort_order = default_val\n end\n end",
"def index\n\n \tparams[:dir] == \"asc\" ? dir = \"ASC\" : dir = \"DESC\"\n\n case params[:sort]\n when 'name'\n @users = User.includes(:member).order(\"members.last_name #{dir}\").all\n when 'cx'\n @users = User.order(\"sign_in_count #{dir}\").all\n else\n @users = User.order(\"last_sign_in_at #{dir}\").all\n end\n end",
"def sort_direction(default=nil)\n direction = (params[:sort_direction] || @_sort_direction || default || :asc).to_sym\n [:asc, :desc].include?(direction) ? direction : :asc\n end",
"def sort\n\t\t#User.order(sort_column + \" \" + sort_direction).page(params[:page])\n\t\tUser.paginate(\t:page => params[:page], per_page: 10, \n\t\t\t\t\t \torder: (sort_column + \" \" + sort_direction))\n\tend"
] | [
"0.6753547",
"0.62339425",
"0.6180216",
"0.605791",
"0.5885136",
"0.57776505",
"0.5731589",
"0.57272637",
"0.5712036",
"0.5698475",
"0.5698475",
"0.5698475",
"0.5698475",
"0.5698475",
"0.56878465",
"0.56710196",
"0.56634325",
"0.56546617",
"0.56546617",
"0.5644094",
"0.5644094",
"0.5644094",
"0.5644094",
"0.5644094",
"0.5644094",
"0.5644094",
"0.5643172",
"0.5604612",
"0.5604612",
"0.5604612",
"0.559795",
"0.559795",
"0.559795",
"0.5559283",
"0.55549043",
"0.55494446",
"0.5534373",
"0.5521747",
"0.55166066",
"0.55119365",
"0.55119365",
"0.55119365",
"0.55119365",
"0.55119365",
"0.55119365",
"0.5494874",
"0.5472233",
"0.54706264",
"0.54706264",
"0.54706264",
"0.54698324",
"0.546373",
"0.5418921",
"0.5411691",
"0.54097134",
"0.5300003",
"0.52907485",
"0.52856755",
"0.5269756",
"0.5269756",
"0.524769",
"0.5235882",
"0.52211285",
"0.5207207",
"0.5202706",
"0.5193028",
"0.51854694",
"0.5185204",
"0.51666033",
"0.5137292",
"0.51364905",
"0.5096157",
"0.50554425",
"0.50461143",
"0.5030632",
"0.5022939",
"0.500233",
"0.49964768",
"0.49777675",
"0.49721727",
"0.4929826",
"0.49246803",
"0.49233603",
"0.49222043",
"0.4919738",
"0.49190548",
"0.4918529",
"0.49095687",
"0.49058977",
"0.4905743",
"0.49012324",
"0.48889592",
"0.48834455",
"0.48597682",
"0.48549137",
"0.48541802",
"0.48486465",
"0.48422197",
"0.4806317",
"0.47967428"
] | 0.7013775 | 0 |
Change the file permission of the selected files and directories. ==== Parameters +mode+ Unix chmod string (e.g. +w, gr, 755, 0644) | def chmod(mode = nil)
return unless mode
begin
Integer mode
mode = Integer mode.size == 3 ? "0#{mode}" : mode
rescue ArgumentError
end
FileUtils.chmod mode, selected_items.map(&:path)
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chmod(mode) File.chmod(mode, path) end",
"def chmod(mode, options={})\n #list = list.to_a\n fileutils.chmod(mode, list, options)\n end",
"def chmod(file, mode)\n if File.stat(file).mode != mode\n FileUtils.chmod(mode, file, :verbose => verbose?) \n end\n end",
"def chmod(mode, path)\n exec! \"chmod #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end",
"def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end",
"def chmod(path, mode, *args, **opts)\n TTY::File.chmod(path, mode, *args, **opts)\n end",
"def chmod(mode, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose\n return if noop\n list.each do |path|\n Entry_.new(path).chmod(fu_mode(mode, path))\n end\n end",
"def chmod(path, mode = 0700)\n if session.platform == 'windows'\n raise \"`chmod' method does not support Windows systems\"\n end\n\n if session.type == 'meterpreter' && session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHMOD)\n session.fs.file.chmod(path, mode)\n else\n cmd_exec(\"chmod #{mode.to_s(8)} '#{path}'\")\n end\n end",
"def chmod(mode, list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]\r\n return if options[:noop]\r\n File.chmod mode, *list\r\n end",
"def chmod( mode ) File.chmod( mode, expand_tilde ) end",
"def chmod ctx, path, mode\n\n end",
"def set_mode\n chmod = command? 'chmod'\n find = command? 'find'\n\n return unless chmod && find\n\n {fmode: 'f', dmode: 'd'}.each do |k, v|\n next if send(k).nil?\n cmd = [find, destination_path, '-type', v, '-exec']\n cmd.concat [chmod, send(k).to_s(8), '{}', '+']\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end\n end",
"def change_mode!\n chmod_params = [Integer(\"0\" + self.target_mode), self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chmod'))\n File.lchmod *chmod_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chmod'))\n FileUtils.chmod_R *chmod_params\n else\n File.chmod *chmod_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchmod is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change mode for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def chmod(path, mode, config = {})\n return unless behavior == :invoke\n path = File.expand_path(path, destination_root)\n say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true)\n FileUtils.chmod_R(mode, path) unless options[:pretend]\n end",
"def chmod(mode, args, options)\n FileUtils.chmod_R(mode, args, **options)\n end",
"def chmod_r(mode)\n util.chmod_r(mode, path)\n end",
"def chmod_r(mode, options={})\n #list = list.to_a\n fileutils.chmod_r(mode, list, options)\n end",
"def action_chmod\n if @omode == nil\n Chef::Log::fatal \"target mode need to be provided to perform chmod\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chmod #{ @new_resource }\") do\n @client.chmod(@path, @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def mode=(value)\n File.chmod(Integer(\"0\" + value), @resource[:name])\n end",
"def chmod_r(mode, path)\n exec! \"chmod -R #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end",
"def chmod(path, mode, options = {})\n paths = glob(path, options).reject{|f| f.include?(\".git\")} # We can probably generalize this later\n changed = false\n\n paths.each do |f|\n old_mode = File.stat(f).mode & 07777\n unless old_mode == mode\n puts \"Changing mode of #{f} from #{old_mode.to_s(8)} to #{mode.to_s(8)}\"\n FileUtils.chmod(mode, f)\n changed = true\n end\n end\n\n @changed ||= changed\n changed\n end",
"def mode=(value)\n File.chmod(Integer(\"0#{value}\"), @resource[:name])\n end",
"def chmod(path, mode = nil, &block)\n add Config::Patterns::Chmod do |p|\n p.path = path\n p.mode = mode if mode\n yield p if block_given?\n end\n end",
"def chmod(file)\n mode = options[:mode]\n return unless mode\n\n FileUtils.chmod(mode, file)\n end",
"def set_modes(dir)\n Dir.glob(\"#{dir}/**/*\", File::FNM_DOTMATCH).each do |path|\n next if File.basename(path) == '.'\n\n if File.directory? path\n File.chmod(0755, path)\n else\n File.chmod(0644, path)\n end\n end\nend",
"def chmod(mode, target)\n eval(CHMOD, binding, __FILE__, CHMOD_LINE)\n nil\nend",
"def set_access_mode(mode = :r)\n modes = [:r, :w, :rw, :x]\n raise ArgumentError, \"Mode must be one of #{modes}\" unless modes.include? mode\n case mode\n when :r\n self.access_mode = 0\n when :w\n self.access_mode = 1\n when :rw\n self.access_mode = 2\n when :x\n self.access_mode = 3\n end\n end",
"def chmod(acl)\n if(acl == 777)\n mode = \"777\"\n end\n end",
"def chmod mod, path\n add \"chmod #{mod} #{path}\", check_perms(mod, path)\n end",
"def set_perms_on_remote(host, path, mode, opts = {})\n opts[:owner] ||= on(host, puppet('config print user')).stdout.rstrip\n opts[:group] ||= on(host, puppet('config print group')).stdout.rstrip\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{opts[:owner]}:#{opts[:group]} #{path}\")\n end",
"def chmod(permissions = nil)\r\n permissions ||= self.class.upload_options[:chmod]\r\n File.chmod(permissions, full_path) if file_exists?\r\n end",
"def files filename,attrib={}\n\t\tif has_attrib? filename \n\t\t\teval(send('form_files',filename))\n\t\telse\n\t\t\toptions = map('files',check_pattern(attrib,filename))\n\t\t\t(owner,group,mode) = pop_options(options,:owner,:group,:mode)\n\t\t\tbegin\n\t\t\t\t\t# p [filename,owner,group,mode,options]\n if options[:shell]\n\t\t\t\t \tCfruby::FileOps.shell_chown_mod filename,owner,group,mode,options\n else\n\t\t\t\t\t Cfruby::FileOps.chown_mod filename,owner,group,mode,options\n end\n options[:shell] = nil\n\t\t\trescue Cfruby::FileFind::FileExistError\n\t\t\t\tCfruby.controller.inform('verbose', \"Can not chmod on non-existing file #{filename}\")\n\t\t\tend\n\t\tend\n\tend",
"def touch(path, mode = 0o755)\n FileUtils.touch path\n FileUtils.chmod mode, path\n end",
"def set_mode\n FileUtils.chmod options[:mode], options[:file] if options[:mode] && File.exist?(options[:file])\n\n return true if !backup_file\n FileUtils.chmod options[:mode], backup_file if File.exist? backup_file\n return true\n end",
"def set_mode(mode)\n send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '')\n end",
"def set_perms_files(dir_path, perm = 644)\n try_sudo \"find #{dir_path} -type f -exec chmod #{perm} {} \\\\;\"\nend",
"def set_mode\n # Why are we trying to set_mode when we don't even have a file?\n return false if !@file\n File.chmod @mode, @file if File.exist? @file\n\n # the backup file may not exist for whatever reason, lets not shit if it doesn't.\n return true if !backup_file\n File.chmod @mode, backup_file if File.exist? backup_file\n true\n end",
"def set_mode(mode)\n @mode = mode\n\n if mode == 'w'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_WRITE) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/value\", \"w\")\n elsif mode =='r'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_READ) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{pin_num}/value\", \"r\")\n end\n end",
"def set_perms_on_remote(host, path, mode, owner=nil, group=nil)\n if (owner.nil?)\n owner = on(host, puppet('config', 'print', 'user')).stdout.rstrip\n end\n\n if (group.nil?)\n group = on(host, puppet('config', 'print', 'group')).stdout.rstrip\n end\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{owner}:#{group} #{path}\")\nend",
"def chmod(p0) end",
"def FileModesOwnership\n\tarquivo = File.new(\"arquivo_novo.txt\", \"w\")\n\tarquivo.chmod(0755)\n\tarquivo.close()\nend",
"def mode=(newmode)\n case newmode\n when :auto\n update('--auto', @resource.value(:name))\n when :manual\n # No change in value, but sets it to manual\n update('--set', name, path)\n end\n end",
"def set_mode(m)\n @mode = m\n end",
"def update_permissions_on_storage\n if @options[:perms]\n response = system(\"chmod -R o+w #{File.join(@path, 'storage')}\")\n if response\n say_success \"Updated permissions on storage/ directory.\"\n else\n say_failed \"Could not update permissions on storage/ directory.\"\n end\n end\n end",
"def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end",
"def mode=(mode)\n super(0120000 | (mode & 07777))\n end",
"def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end",
"def filemode(file)\n File.stat(file).mode & 007777\n end",
"def mode=(mode)\n super(0100000 | (mode & 07777))\n end",
"def adjust(path, permissions)\n\n # chowns all run user files to the sftp user\n with_tempfile do |tf|\n sudo(run_user_uid,group_gid) do\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}\")\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}\")\n end\n on_filelist(File.read(tf),run_user_uid) do |p|\n FileUtils.chown( options['sftp_user'], options['group'], p)\n end\n end\n # chmod runs as sftp user, which should own all the relevant files now\n sudo(sftp_user_uid,group_gid) do\n cmd(\"chmod -R #{permissions} #{shellescape(path)}\")\n end\n log \"Adjusted #{path} with #{permissions} and #{options['sftp_user']}:#{options['group']}\"\nrescue => e\n log \"Error while adjusting path #{path}: #{e.message}\"\nend",
"def mode=(mode)\n super(040000 | (mode & 07777))\n end",
"def chmod(path=nil,perms=nil)\n if path.class == String && perms.class == String && block_given?\n @j_del.java_method(:chmod, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,perms,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling chmod(path,perms)\"\n end",
"def switch_mode mode = \"unknown\"\n begin\n settings = YAML::load_file @settings_file\n @settings[:mode] = mode\n save_settings @settings\n shell.say \"Switched mode to: #{mode}.\"\n shell.say\n print_account\n rescue\n shell.say \"ERROR: Invalid #{@settings_file} settings file.\"\n end\n end",
"def set_mode(new)\n @mode = new\n end",
"def adjust_permissions\n # adjust base directory permission\n subsection 'Adjust file and directory permissions', color: :green, prefix: @output_prefix unless @silent\n FileUtils.chown @owner, @group, \"#{ @destination_directory }/#{ @artifact }\"\n FileUtils.chmod \"u+w,g+ws\", \"#{ @destination_directory }/#{ @artifact }\"\n\n # adjust release directory permission\n FileUtils.chown_R @owner, @group, @release_directory\n end",
"def mode=(a_mode)\n @@mode = a_mode.to_sym\n end",
"def mode=(new_mode)\n LOGGER.mode = new_mode\n end",
"def mode=(new_mode)\n LOGGER.mode = new_mode\n end",
"def fix_perms(dir)\n File.chmod(0600, File.expand_path('conf/config.rb', dir))\n end",
"def edit(mode=@mode)\n\told_mode = @mode unless @mode == mode\n\t\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend",
"def mode\n \"%o\" % (File.stat(@resource[:name]).mode & 007777)\n end",
"def set_mode(mode)\n puts \"Setting mode to #{mode}\" if $verbose\n m='MD'+mode.to_s+';'\n puts m if $verbose\n ret=send_cmd(m,'MD;',m,0.1,0.5,3)\n if(ret)\n return(ret.gsub(/^MD/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def copy_perms(src, dst)\n stat = File.stat(src)\n File.chmod(stat.mode, dst)\n end",
"def change_mode!( new_mode )\n unless new_mode.nil? or actor.modes.has_key?(new_mode)\n raise \"Unsupported mode #{new_mode} for actor #{actor}\"\n end\n\n if actor.mode and actor.has_behavior?(actor.mode)\n actor.remove_behavior(actor.mode)\n end\n\n if new_mode\n mode_opts = actor.modes[new_mode]\n add_behavior(new_mode, mode_opts)\n end\n actor.mode = new_mode\n end",
"def open(path, mode)\n path = expand_path(path)\n if File.directory?(path)\n\tDir.open(path)\n else\n\teffect_umask do\n\t File.open(path, mode)\n\tend\n end\n end",
"def set_lacp_mode(name, mode)\n return false unless %w(on passive active).include?(mode)\n grpid = /(\\d+)/.match(name)[0]\n\n remove_commands = []\n add_commands = []\n\n parse_members(name)[:members].each do |member|\n remove_commands << \"interface #{member}\"\n remove_commands << \"no channel-group #{grpid}\"\n add_commands << \"interface #{member}\"\n add_commands << \"channel-group #{grpid} mode #{mode}\"\n end\n configure remove_commands + add_commands\n end",
"def chown(owner, group) File.chown(owner, group, path) end",
"def change_mode(*packages, mode: :manual,**opts)\n\t\t\t\tunless packages.empty? or @packager.nil?\n\t\t\t\t\tcase mode\n\t\t\t\t\twhen :manual,:explicit\n\t\t\t\t\t\tmode=:manual\n\t\t\t\t\twhen :auto,:automatic,:dependency,:dep\n\t\t\t\t\t\tmode=:automatic\n\t\t\t\t\telse\n\t\t\t\t\t\twarn 'Unknown mode, fallback to automatic'\n\t\t\t\t\t\tmode=:automatic\n\t\t\t\t\tend\n\t\t\t\t\tpackages_str=packages.uniq.shelljoin\n\t\t\t\t\to=common_options(**opts)\n\t\t\t\t\teval_shell(yield(packages_str, mode, o),**opts) if block_given?\n\t\t\t\tend\n\t\t\tend",
"def mode=(mode)\n request.mode = mode\n end",
"def change_mode(mode)\n\n @mode = mode\n\n # Create new effect and volume modifier\n case mode\n when 'normal', ''\n @effect = @fx_nil\n\n when 'cave'\n @effect = @fx_cave\n \n end\n\n #@sfx.each{ |s| s = nil }\n #@sfx = []\n #GC.start\n\n @sfx.each{ |e| e.feed(@effect,0) }\n \n end",
"def remove_read_permission(path)\n mode=path.stat.mode\n path.chmod(mode ^ 0444) # Remove read permissions.\n begin assert_nothing_raised{yield}\n ensure path.chmod mode end\n end",
"def file_mode\n super | 0o111\n end",
"def set_perms_dirs(dir_path, perm = 755)\n try_sudo \"find #{dir_path} -type d -exec chmod #{perm} {} \\\\;\"\nend",
"def output_mode(stat)\n output = ((stat['type'] == 'DIRECTORY') ? 'd' : '-')\n mode = stat['permission'].oct # convert to octal number\n output << (((mode & 0400) == 0) ? '-' : 'r')\n output << (((mode & 0200) == 0) ? '-' : 'w')\n output << (((mode & 0100) == 0) ? '-' : 'x')\n output << (((mode & 0040) == 0) ? '-' : 'r')\n output << (((mode & 0020) == 0) ? '-' : 'w')\n output << (((mode & 0010) == 0) ? '-' : 'x')\n output << (((mode & 0004) == 0) ? '-' : 'r')\n output << (((mode & 0002) == 0) ? '-' : 'w')\n output << (((mode & 0001) == 0) ? '-' : 'x')\n output\n end",
"def mode\n if File.exists?(@resource[:name])\n \"%o\" % (File.stat(@resource[:name]).mode & 007777)\n else\n :absent\n end\n end",
"def chmod_remote!(username, pass)\n com = \"chmod 644 #{CONFIG[:server_path] + @filename}\"\n ssh_command(com, username, pass)\n\tend",
"def set_file_priv()\n FileUtils.chmod 0644, @setting_file_path\n FileUtils.chmod 0644, @root_cert_kc_path\n end",
"def mode(io) \n readable, writable = try_handle(io, \"mode\")\n\n case\n when readable && writable then \"r+\"\n when readable then \"r\"\n when writable then \"w\"\n else\n # occurs for r+ mode, for some reason\n \"r+\"\n end\n end",
"def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end",
"def mode=(mode)\n Nitro.mode = mode.to_sym\n end",
"def set_permissions_to(perm_level)\r\n unless self.relationshiptype_id == perm_level\r\n if self.new?\r\n self.relationshiptype_id = perm_level\r\n self.save! #for validation on create to happen\r\n else\r\n update_attribute(:relationshiptype_id, perm_level)\r\n end\r\n end\r\n \r\n if self.is_a?(Album)\r\n self.album_contents.each {|item| item.set_permissions_to(perm_level) }\r\n end\r\n end",
"def mode=(val)\n if val.blank? or val.kind_of? Fixnum then\n write_attribute(:mode, val)\n else\n write_attribute(:mode, Mode[val])\n end\n end",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end",
"def set_mode pin, mode\n reg = pin / 10\n shift = (pin % 10) * 3\n new_value = (get_int_at(reg) & ~(7 << shift)) | (mode << shift)\n set_int_at(reg, new_value)\n end",
"def file_mode\n File.instance_methods.include?(:test_write) ? \"r\" : \"w\"\n end",
"def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end",
"def file_mode\n File.instance_methods.include?(:test_write) ? 'r' : 'w'\n end",
"def user_writable?(mode)\n mode & 00200 == 00200\n end",
"def test_stat_modifications\n @client.write(@file, '')\n\n [0745, 0600, 0443].each do |mode|\n @client.chmod(@file, mode)\n assert_equal mode, @client.stat(@file, refresh: true).mode\n end\n end",
"def setuid?(mode)\n mode & 04000 == 04000\n end",
"def file_perms(path)\n perms = sprintf(\"%o\", File.stat(path).mode)\n perms.reverse[0..2].reverse\n end",
"def modify_with(dataset, mode)\n raise(ArgumentError, 'Provided mode is not supported') unless support?(mode)\n raise(ArgumentError, 'No such modifier found') unless @modes[mode][:modifier]\n\n @modes[mode][:modifier].call(dataset)\n end",
"def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end",
"def mode= new_mode\n @gapi.update! mode: verify_mode(new_mode)\n end",
"def chmod_linux_file(host, user, pass, path, file_name)\n Net::SSH.start(host, user, :password => pass) do |ssh|\n ssh.exec!(\"cd #{path}; chmod 777 #{file_name}\")\n end\n end",
"def unix_perms=(_arg0); end",
"def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end",
"def edit(mode=@mode) # not sure if you can use an instance variable like this\n\told_mode = @mode\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend"
] | [
"0.7961633",
"0.79208547",
"0.79111606",
"0.7789717",
"0.7640511",
"0.76338196",
"0.7572123",
"0.75515854",
"0.7550537",
"0.7530089",
"0.751246",
"0.7440374",
"0.7425923",
"0.7330557",
"0.72711575",
"0.724482",
"0.7224371",
"0.72054064",
"0.72024363",
"0.7167651",
"0.7126878",
"0.7115463",
"0.6974075",
"0.6969252",
"0.69196725",
"0.69186026",
"0.6897974",
"0.6880145",
"0.66826284",
"0.6607638",
"0.6590026",
"0.6552731",
"0.65361875",
"0.63701653",
"0.6360134",
"0.62919354",
"0.6262568",
"0.6246651",
"0.62040854",
"0.611774",
"0.60470253",
"0.60455036",
"0.59853184",
"0.5966201",
"0.5934208",
"0.59294355",
"0.5797063",
"0.57930636",
"0.57908344",
"0.57828605",
"0.5768106",
"0.5731182",
"0.57172084",
"0.56240916",
"0.5621682",
"0.56051916",
"0.5586166",
"0.5586166",
"0.5571596",
"0.5564655",
"0.55620515",
"0.5537798",
"0.5481873",
"0.54760844",
"0.5442036",
"0.5438183",
"0.5415387",
"0.54050237",
"0.5402502",
"0.53925675",
"0.53765327",
"0.537475",
"0.5356838",
"0.53527236",
"0.5349052",
"0.53353554",
"0.5332868",
"0.5329606",
"0.5325057",
"0.5315963",
"0.53106946",
"0.5302223",
"0.52928907",
"0.52928907",
"0.528807",
"0.52819633",
"0.5279186",
"0.5277562",
"0.52758986",
"0.5250807",
"0.5248053",
"0.52480394",
"0.5214687",
"0.52046615",
"0.5179706",
"0.51747745",
"0.51539344",
"0.515086",
"0.51504916",
"0.5149191"
] | 0.7932743 | 1 |
Change the file owner of the selected files and directories. ==== Parameters +user_and_group+ user name and group name separated by : (e.g. alice, nobody:nobody, :admin) | def chown(user_and_group)
return unless user_and_group
user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}
FileUtils.chown user, group, selected_items.map(&:path)
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_owner(username, group, path)\n %x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})\n\n $?.success?\n end",
"def set_owner\n user = @conf['user'] || Process.uid\n group = @conf['group'] || Process.gid\n\n begin\n FileUtils.chown_R(user, group, @location)\n rescue StandardError => err\n Pemlogger.logit(err, :fatal)\n raise(err)\n end\n end",
"def set_owner\n return unless owner || group\n chown = command? 'chown'\n\n return unless chown\n\n cmd = [chown, '-R', \"#{owner}:#{group}\", destination_path]\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end",
"def chown( owner, group ) File.chown( owner, group, expand_tilde ) end",
"def chown(owner, group) File.chown(owner, group, path) end",
"def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end",
"def change_user!\n tgt_uid = self.target_user.is_a?(Fixnum) ? self.target_user : Etc.getpwnam(self.target_user).uid\n chown_params = [tgt_uid, nil, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change user for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def chown(file, user)\n user = user.to_s\n # who is the current owner?\n @uids ||= {}\n @uids[user] ||= Etc.getpwnam(user).uid\n uid = @uids[user]\n if File.stat(file).uid != uid\n run \"chown #{user}:#{user} '#{file}'\" \n end\n end",
"def chown(path, owner, options = {})\n paths = glob(path, options)\n owner = Etc.getpwnam(owner)\n changed = false\n\n paths.each do |f|\n stat = File.stat(f)\n unless stat.uid == owner.uid && stat.gid == owner.gid\n old_owner = \"#{Etc.getpwuid(stat.uid).name}:#{Etc.getgrgid(stat.gid).name}\"\n puts \"Changing owner of #{f} from #{old_owner} to #{owner.name}:#{owner.name}\"\n File.chown(owner.uid, owner.gid, f)\n changed = true\n end\n end\n\n @changed ||= changed\n changed\n end",
"def chown(owner, group, *files)\n token = FFI::MemoryPointer.new(:ulong)\n\n begin\n bool = OpenProcessToken(\n GetCurrentProcess(),\n TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,\n token\n )\n\n raise SystemCallError.new(\"OpenProcessToken\", FFI.errno) unless bool\n\n token_handle = token.read_ulong\n\n privs = [\n SE_SECURITY_NAME,\n SE_TAKE_OWNERSHIP_NAME,\n SE_BACKUP_NAME,\n SE_RESTORE_NAME,\n SE_CHANGE_NOTIFY_NAME\n ]\n\n privs.each{ |name|\n luid = LUID.new\n\n unless LookupPrivilegeValueA(nil, name, luid)\n raise SystemCallError.new(\"LookupPrivilegeValue\", FFI.errno)\n end\n\n tp = TOKEN_PRIVILEGES.new\n tp[:PrivilegeCount] = 1\n tp[:Privileges][0][:Luid] = luid\n tp[:Privileges][0][:Attributes] = SE_PRIVILEGE_ENABLED\n\n unless AdjustTokenPrivileges(token_handle, 0, tp, 0, nil, nil)\n raise SystemCallError.new(\"AdjustTokenPrivileges\", FFI.errno)\n end\n }\n\n sid = FFI::MemoryPointer.new(:uchar)\n sid_size = FFI::MemoryPointer.new(:ulong)\n dom = FFI::MemoryPointer.new(:uchar)\n dom_size = FFI::MemoryPointer.new(:ulong)\n use = FFI::MemoryPointer.new(:ulong)\n\n wowner = owner.wincode\n\n # First run, get needed sizes\n LookupAccountNameW(nil, wowner, sid, sid_size, dom, dom_size, use)\n\n sid = FFI::MemoryPointer.new(:uchar, sid_size.read_ulong * 2)\n dom = FFI::MemoryPointer.new(:uchar, dom_size.read_ulong * 2)\n\n # Second run with required sizes\n unless LookupAccountNameW(nil, wowner, sid, sid_size, dom, dom_size, use)\n raise SystemCallError.new(\"LookupAccountName\", FFI.errno)\n end\n\n files.each{ |file|\n wfile = string_check(file).wincode\n\n size = FFI::MemoryPointer.new(:ulong)\n sec = FFI::MemoryPointer.new(:ulong)\n\n # First pass, get the size needed\n GetFileSecurityW(wfile, OWNER_SECURITY_INFORMATION, sec, sec.size, size)\n\n security = FFI::MemoryPointer.new(size.read_ulong)\n\n # Second pass, this time with the appropriately sized security pointer\n bool = GetFileSecurityW(\n wfile,\n OWNER_SECURITY_INFORMATION,\n security,\n security.size,\n size\n )\n\n raise SystemCallError.new(\"GetFileSecurity\", FFI.errno) unless bool\n\n unless InitializeSecurityDescriptor(security, SECURITY_DESCRIPTOR_REVISION)\n raise SystemCallError.new(\"InitializeSecurityDescriptor\", FFI.errno)\n end\n\n unless SetSecurityDescriptorOwner(security, sid, 0)\n raise SystemCallError.new(\"SetSecurityDescriptorOwner\", FFI.errno)\n end\n\n unless SetFileSecurityW(wfile, OWNER_SECURITY_INFORMATION, security)\n raise SystemCallError.new(\"SetFileSecurity\", FFI.errno)\n end\n }\n ensure\n CloseHandle(token.read_ulong)\n end\n\n files.size\n end",
"def chown(user, group, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown %s %s',\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |path|\n Entry_.new(path).chown uid, gid\n end\n end",
"def action_chown\n if @tuser == nil\n Chef::Log::fatal \"target user need to be provided to perform chown\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Directory #{ @path } doesn't exist; chown action not taken\")\n else\n if @tgroup == nil\n @tgroup = @meta_data[\"group\"]\n end\n converge_by(\"chown #{ @new_resource }\") do\n @client.chown(@path, 'owner' => @tuser, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def owner=(new_owner)\n if @owner != new_owner\n @dacl.reassign!(@owner, new_owner)\n @owner = new_owner\n end\n end",
"def chown_r(user, group, options={})\n #list = list.to_a\n fileutils.chown_r(user, group, list, options)\n end",
"def chown(path, owner = nil, group = nil, &block)\n add Config::Patterns::Chown do |p|\n p.path = path\n p.owner = owner if owner\n p.group = group if group\n yield p if block_given?\n end\n end",
"def chown(file)\n user = options[:user]\n group = options[:group]\n return unless user || group\n\n FileUtils.chown(user, group, file)\n end",
"def chown(path, owner); raise NotImplementedError; end",
"def chown user, path, options = {}\n recursive = '-R ' if options[:recursive]\n add \"chown #{recursive}#{user}:#{user} #{path}\", check_owner(user, path)\n end",
"def chown_run_user( *args )\n flags, paths = args.partition { |a| a =~ /^-/ }\n sudo( [ 'chown', flags,\n [ run_user, run_group || run_user ].join(':'),\n paths ].flatten.compact.join( ' ' ) )\n end",
"def owner=(owner)\n debug \"#{self.artifactid}: Changing owner to '#{self.artifactOwner}'.\"\n begin\n File.chown(Etc.getpwnam(self.owner).uid,nil,self.artifact)\n rescue => detail\n raise Puppet::Error, \"Failed to set owner to '#{self.owner}': #{detail}\"\n end\n end",
"def user= user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n @fileInTable.user = user\n @fileInTable.path = user.name + '/'\n @fileInTable.path += @group + '/' + @path\n @user = user.name\n @path = @user + '/' + @group + '/' + @path\n save\n end",
"def setUserFileAccess(adminSettingPerms, userName, filePath, grantAccess)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath.concat \".access\"\n access = Hash.new {}\n if !File.exist?(fAccess)\n if grantAccess\n access[\"users\"] = \";#{userName};\"\n else\n access[\"users\"] = \"\"\n end\n access[\"groups\"] = \"\"\n if(adminSettingPerms == \"root\")\n access[\"adminUsers\"] = \";root(rwp);\"\n else\n access[\"adminUsers\"] = \";root(rwp);\"+adminSettingPerms+\"(rw);\"\n end\n access[\"adminGroups\"] = \"\"\n else\n access = YAML.load_file(fAccess)\n users = access[\"users\"]\n if users.index(userName) == nil && grantAccess\n users.concat( userName+\";\")\n elsif users.index(userName) != nil && !grantAccess\n\n beginning = users[0..users.index(userName)]\n gend = users[users.index(\";\", users.index(userName)+userName.size)]\n users = beginning.concat gend\n end\n access[\"users\"] = users\n end\n File.write(fAccess, access.to_yaml)\n\n end",
"def chown_files(tmpdir)\n notifying_block do\n Dir[\"#{tmpdir}/**/*\"].each do |path|\n declare_resource(::File.directory?(path) ? :directory : :file, path) do\n owner new_resource.user if new_resource.user\n group new_resource.group if new_resource.group\n end\n end\n end\n end",
"def change_group!\n tgt_gid = self.target_group.is_a?(Fixnum) ? self.target_group : Etc.getgrnam(self.target_group).gid\n chown_params = [nil, tgt_gid, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change group for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end",
"def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end",
"def owner=(newuser) #:nodoc:\n saved? ? raise(NotImplementedError, \"Cannot change a document's owner once the document has been saved\") : super\n end",
"def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end",
"def owner=(user)\n de = document_editor_owner\n if de\n return user if de == user\n de.set_owner(false)\n end\n\n de = document_editors.find_by(user_id: user.id)\n if de.nil?\n self.editors << user\n de = document_editors.find_by(user_id: user.id)\n end\n de.set_owner(true)\n end",
"def set_publication_owner(name, owner)\n typed_exec(\"ALTER PUBLICATION #{connection.quote_ident(name)} OWNER TO #{connection.quote_ident(owner)}\")\n end",
"def set_user_file\n @user_file = @folder.files.find(params[:id])\n end",
"def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def fix_ownership\n return if Process.uid != 0\n begin\n uid = Etc.getpwnam(\"bixby\").uid\n gid = Etc.getgrnam(\"bixby\").gid\n # user/group exists, chown\n File.chown(uid, gid, Bixby.path(\"var\"), Bixby.path(\"etc\"))\n rescue ArgumentError\n end\n end",
"def update_owner(organization, owner_id)\n if owner_id\n new_owner = User.find(owner_id)\n\n unless new_owner.owns\n new_owner.organization = organization\n new_owner.save\n end\n end\n end",
"def adjust(path, permissions)\n\n # chowns all run user files to the sftp user\n with_tempfile do |tf|\n sudo(run_user_uid,group_gid) do\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}\")\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}\")\n end\n on_filelist(File.read(tf),run_user_uid) do |p|\n FileUtils.chown( options['sftp_user'], options['group'], p)\n end\n end\n # chmod runs as sftp user, which should own all the relevant files now\n sudo(sftp_user_uid,group_gid) do\n cmd(\"chmod -R #{permissions} #{shellescape(path)}\")\n end\n log \"Adjusted #{path} with #{permissions} and #{options['sftp_user']}:#{options['group']}\"\nrescue => e\n log \"Error while adjusting path #{path}: #{e.message}\"\nend",
"def set_owner(user)\n Invitation.create!(:project => self, :user => user, :owner => 1, :admin => 1).accept!\n end",
"def set_project_owner(project_id, args)\n args =\n API.params(args)\n .required(:project_owner_id)\n .to_h\n\n response = put \"projects/#{project_id}.json\", project: args\n response.body['STATUS']\n end",
"def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end",
"def change_privilege(user, group=user)\n log \">> Changing process privilege to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n log \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end",
"def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend",
"def chown_r(user, group)\n util.chown_r(user, group, path)\n end",
"def set_owner\n @owner = Owner.find_by_owner_user_id(current_owner_user.id)\n end",
"def chown(p0, p1) end",
"def update\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.find(params[:id])\n if @group.update_attributes(group_params)\n flash[:green] = \"Asset was successfully updated.\"\n redirect_to @group\n else\n render :edit\n end\n end",
"def set_perms_on_remote(host, path, mode, owner=nil, group=nil)\n if (owner.nil?)\n owner = on(host, puppet('config', 'print', 'user')).stdout.rstrip\n end\n\n if (group.nil?)\n group = on(host, puppet('config', 'print', 'group')).stdout.rstrip\n end\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{owner}:#{group} #{path}\")\nend",
"def chown(user, group, target)\n eval(CHOWN, binding, __FILE__, CHOWN_LINE)\n nil\nend",
"def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' : ''),\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |root|\n Entry_.new(root).traverse do |ent|\n begin\n ent.chown uid, gid\n rescue\n raise unless force\n end\n end\n end\n end",
"def fixup_homedir_ownership(user)\n\t\t# Determine whether current ownership is right\n\t\thomedir_stat = File.stat(\"/home/#{user}/\")\n\n\t\tuid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getpwuid(homedir_stat.uid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\tgid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getgrgid(homedir_stat.gid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\n\t\tlogger.debug \"[CPB:restore] Attemping homedir permission fix.\" unless uid_correct and gid_correct\n\n\t\tunless uid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -user #{homedir_stat.uid} -exec /bin/chown -P --no-dereference #{user} '{}' \\\\;\", 'chown')\n\t\tend\n\n\t\tunless gid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -group #{homedir_stat.gid} -exec /bin/chgrp -P --no-dereference #{user} '{}' \\\\;\", 'chgrp')\n\t\tend\n\n\tend",
"def _change_privilege(user, group=user)\n Merb.logger.warn! \"Changing privileges to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n\n begin\n target_uid = Etc.getpwnam(user).uid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to user #{user}, does the user exist?\", e)\n return false\n end\n\n begin\n target_gid = Etc.getgrnam(group).gid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to group #{group}, does the group exist?\", e)\n return false\n end\n\n if (uid != target_uid) || (gid != target_gid)\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n true\n rescue Errno::EPERM => e\n Merb.fatal! \"Permission denied for changing user:group to #{user}:#{group}.\", e\n false\n end",
"def updatedb_file_user?(file, user)\n owner = updatedb_file_user(file)\n user == owner\n end",
"def updateAdmins(usr)\n fh = File::open(\"#{@ch}.txt\", \"a\")\n fh.puts(\"#{usr}\\n\")\n fh.close\n setAdmins()\n end",
"def setGroupFileAccess(adminSettingPerms, groupName, filePath, grantAccess)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath+\".access\"\n\n access = Hash.new\n if !File.exist?(fAccess)\n\n if grantAccess\n access[\"groups\"] = \";#{groupName}\"\n else\n access[\"groups\"] = \"\"\n end\n\n #access[\"groups\"] <= \";#{(grantAccess?groupName+\";\":\"\")}\"\n access[\"users\"] = \";guest;\"\n access[\"adminUsers\"] = \";root(rwp);#{adminSettingPerms}(rw);\"\n access[\"adminGroups\"] = \"\"\n else\n access = YAML.load_file(fAccess)\n groups = access[\"groups\"]\n if groups.index(groupName) == nil && grantAccess\n groups.concat( groupName+\";\" )\n elsif groups.index(groupName) != nil && !grantAccess\n\n beginning = groups[0..groups.index(groupName)]\n gend = groups[groups.index(\";\", groups.index(groupName)+groupName.size())+1]\n groups = beginning+gend;\n end\n access[\"groups\"] <= groups\n end\n File.write(fAccess, access.to_yaml)\n\n end",
"def update\n #@auth_assign_permit = Auth::AssignPermit.find(params[:id])\n if current_user.admin_group?\n @admin_user = current_user\n @owner_user = User.find(params[:id])\n\n respond_to do |format|\n if @owner_user.update_attributes(params[:user])\n format.html { redirect_to auth_assign_permit_path(@owner_user), notice: 'Assign permit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auth_assign_permit.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def file_user_params\n params.require(:file_user).permit(:modify, :view, :fileId_id, :userId_id)\n end",
"def update!(**args)\n @impersonated_user = args[:impersonated_user] if args.key?(:impersonated_user)\n end",
"def set_subscription_owner(name, owner)\n typed_exec(\"ALTER SUBSCRIPTION #{connection.quote_ident(name)} OWNER TO #{connection.quote_ident(owner)}\")\n end",
"def setOwner _obj, _args\n \"_obj setOwner _args;\" \n end",
"def set_user_file\n @user_file = UserFile.where(user_id: current_user.id).find(params[:id])\n end",
"def asuser\n if self.should(:owner) and ! self.should(:owner).is_a?(Symbol)\n writeable = Puppet::Util::SUIDManager.asuser(self.should(:owner)) {\n FileTest.writable?(::File.dirname(self[:path]))\n }\n\n # If the parent directory is writeable, then we execute\n # as the user in question. Otherwise we'll rely on\n # the 'owner' property to do things.\n asuser = self.should(:owner) if writeable\n end\n\n asuser\n end",
"def change_owner\n @seminar = Seminar.find(params[:id])\n @teacher = Teacher.find(params[:new_owner])\n \n @seminar.update(:owner => @teacher)\n SeminarTeacher.find_or_create_by(:user => @teacher, :seminar => @seminar).update(:can_edit => true)\n \n flash[:success] = \"Class Owner Updated\"\n redirect_to @seminar\n end",
"def update\n privs = []\n privs << \"r\" if params[:r] == \"1\"\n privs << \"w\" if params[:w] == \"1\"\n privs << \"a\" if params[:a] == \"1\"\n @priv = privs.join(\"\")\n @project_user.priv = @priv\n @project = @project_user.project\n respond_to do |format|\n if @project_user.save\n format.html { redirect_to project_project_users_path(@project), notice: 'User setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_user }\n else\n format.html { render :edit }\n format.json { render json: @project_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_file_user\n @file_user = FileUser.find(params[:id])\n end",
"def change_owner!(user_changing, user_to_be_changed)\n if(!user_changing.persisted? || super_admin != user_changing)\n raise SecurityError.new \"No Permissions\"\n end \n exist_user?(user_to_be_changed)\n if(super_admin != user_changing)\n ActiveRecord::Base.transaction do\n remove_user!(user_changing, user_to_be_changed)\n participants.create(user_id: user_changing.id, member_type: Course.roles[\"admin\"])\n update(super_admin: user_to_be_changed)\n end\n end\n\nend",
"def set_owner(id)\n self.owner_id = id\n end",
"def set_owner #:doc:\n self.owner_class.owner= get_current_owner\n end",
"def files filename,attrib={}\n\t\tif has_attrib? filename \n\t\t\teval(send('form_files',filename))\n\t\telse\n\t\t\toptions = map('files',check_pattern(attrib,filename))\n\t\t\t(owner,group,mode) = pop_options(options,:owner,:group,:mode)\n\t\t\tbegin\n\t\t\t\t\t# p [filename,owner,group,mode,options]\n if options[:shell]\n\t\t\t\t \tCfruby::FileOps.shell_chown_mod filename,owner,group,mode,options\n else\n\t\t\t\t\t Cfruby::FileOps.chown_mod filename,owner,group,mode,options\n end\n options[:shell] = nil\n\t\t\trescue Cfruby::FileFind::FileExistError\n\t\t\t\tCfruby.controller.inform('verbose', \"Can not chmod on non-existing file #{filename}\")\n\t\t\tend\n\t\tend\n\tend",
"def modify\n\n _principals = {}\n @@mutex.synchronize do\n\n # prevent external race conditions/collisions\n lockfile_flags = File::RDWR|File::CREAT|File::TRUNC\n lockfile_mode = 0600\n\n File.open(@lockfile, lockfile_flags, lockfile_mode) do | lock |\n lock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n lock.flock(File::LOCK_EX)\n\n begin\n flags = File::RDWR|File::CREAT\n mode = 0640\n\n changed = false\n File.open(@filename, flags, mode) do | file |\n\n id_set = Set.new\n\n #\n # Create the list of principals and a set of ids for each\n #\n file.readlines.each do |line|\n line.strip!\n\n # skip empty lines\n next if line.length == 0\n\n # build up principal \"ids\" who have placed this principal\n m = line.match /#\\s*id\\s*:\\s*(.*)$/\n if m\n id_set << (m[1] == '' ? nil : m[1])\n next\n end\n\n # principals are non-comment non-empty lines\n id_set << nil if not line.start_with?('#') and\n id_set.length == 0\n\n # add the principal to the hash\n _principals[line] = id_set\n # and reset for the next iteration\n id_set = Set.new\n\n end\n\n if block_given?\n old_principals = K5login.clone(_principals)\n\n yield _principals\n\n if not K5login.compare(old_principals, _principals)\n file.seek(0, IO::SEEK_SET)\n # write all of the ids and then the principal string\n _principals.each {|principal, id_list|\n id_list.each {|id|\n file.write \"# id: #{id}\\n\"\n }\n file.write principal + \"\\n\\n\"\n }\n # remove the extra newline\n file.truncate(file.tell - 1) if file.tell > 0\n changed = true\n end\n end\n end\n if changed\n # set ownership\n File.chown @owner, @group, @filename \n\n # set permissions\n File.chmod @mode, @filename if @mode\n\n # set SELinux labels\n cmd = \"restorecon #{@filename}\"\n ::OpenShift::Runtime::Utils::oo_spawn(cmd)\n end\n ensure\n lock.flock(File::LOCK_UN)\n lock.close\n File.delete lockfile\n end\n end\n end\n\n @principals = _principals\n File.delete @filename if @principals.length == 0\n @principals\n end",
"def scp_set_folder_perms(remote_folder)\n # set proper permissions for remote host (allowing for client override)\n puts(\" -> setting remote ownership on host #{server_ip} folder #{remote_folder}\") if is_verbose or is_dryrun\n $stdout.flush\n output, exit_code1 = ssh_exec(\"chown -R #{ssh_owner_ug} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n\n output, exit_code2 = ssh_exec(\"chmod -R #{ssh_ugw_perm} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n (exit_code1 == 0) and (exit_code2 == 0)\n end",
"def set_userfile\n @userfile = Userfile.find(params[:id])\n end",
"def set_userfile\n @userfile = Userfile.find(params[:id])\n end",
"def enable_ownership\n run_baby_run 'diskutil', ['enableOwnership', self.dev_node], :sudo => true\n end",
"def set_perms_on_remote(host, path, mode, opts = {})\n opts[:owner] ||= on(host, puppet('config print user')).stdout.rstrip\n opts[:group] ||= on(host, puppet('config print group')).stdout.rstrip\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{opts[:owner]}:#{opts[:group]} #{path}\")\n end",
"def set_owner(owner)\n self.__owner__ = owner if owner\n self\n end",
"def set_owner(account)\n unless org = account.organization\n errors.add(:account, \"must have an organization\") and return false\n end\n update_attributes(:account_id => account.id, :organization_id => org.id)\n sql = \"account_id = #{account.id}, organization_id = #{org.id}\"\n self.pages.update_all( sql )\n self.entities.update_all( sql )\n self.entity_dates.update_all( sql )\n end",
"def set_assigned_owner\n @assigned_owner = AssignedOwner.find(params[:id])\n end",
"def asuser(new_uid=nil, new_gid=nil)\n return yield if Puppet.features.microsoft_windows? or !root?\n\n old_euid, old_egid = self.euid, self.egid\n begin\n change_group(new_gid) if new_gid\n change_user(new_uid) if new_uid\n\n yield\n ensure\n change_group(old_egid)\n change_user(old_euid)\n end\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def owner() self['owner'] || 'root' ; end",
"def merge_owner!(owner_id_or_owner_screen_name)\n case owner_id_or_owner_screen_name\n when Integer\n self[:owner_id] = owner_id_or_owner_screen_name\n when String\n self[:owner_screen_name] = owner_id_or_owner_screen_name\n end\n self\n end",
"def merge_owner!(owner_id_or_owner_screen_name)\n case owner_id_or_owner_screen_name\n when Integer\n self[:owner_id] = owner_id_or_owner_screen_name\n when String\n self[:owner_screen_name] = owner_id_or_owner_screen_name\n end\n self\n end",
"def test_chown_sets_up_file_chown\n assert_recipe_matches %q{\n chown \"owner:group\" \"file\"\n } do\n chown 'owner:group', 'file'\n end\n end",
"def set_group_user\n @group_user = group_user.find(params[:id])\n end",
"def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = [email protected]_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end",
"def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = [email protected]_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def remote_set_immutable(host, files)\n remote_ssh_cmd(host, \"sudo chattr +i #{files.join(\" \")}\")\nend",
"def update_principal(path, prop_patch)\n end",
"def merge_owner_into_options!(owner_id_or_owner_username, options={})\n case owner_id_or_owner_username\n when Fixnum\n options[:owner_id] = owner_id_or_owner_username\n when String\n options[:owner_username] = owner_id_or_owner_username\n end\n options\n end",
"def setFlagOwner _obj, _args\n \"_obj setFlagOwner _args;\" \n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end"
] | [
"0.7031798",
"0.6613002",
"0.64483887",
"0.6332136",
"0.63318396",
"0.63233644",
"0.62693286",
"0.62464225",
"0.6110811",
"0.61022156",
"0.5947538",
"0.5878171",
"0.58744186",
"0.5788736",
"0.5786735",
"0.57764375",
"0.5693316",
"0.5679787",
"0.5665396",
"0.5661425",
"0.56358135",
"0.5619848",
"0.5581551",
"0.5566809",
"0.55650526",
"0.55612695",
"0.5546541",
"0.5517812",
"0.5512831",
"0.54583025",
"0.54489315",
"0.5448562",
"0.54396856",
"0.54326296",
"0.5428281",
"0.5400893",
"0.54003394",
"0.53453636",
"0.5343058",
"0.5329762",
"0.52955943",
"0.52844465",
"0.5273846",
"0.5265088",
"0.5237634",
"0.52126807",
"0.52056324",
"0.5195956",
"0.5177854",
"0.5173327",
"0.5162524",
"0.5162273",
"0.5093092",
"0.5077959",
"0.5068414",
"0.50658417",
"0.5065633",
"0.5062275",
"0.5056537",
"0.50440246",
"0.50364524",
"0.50275576",
"0.50234884",
"0.50135076",
"0.500588",
"0.49770126",
"0.49213412",
"0.49120376",
"0.49059537",
"0.4899791",
"0.4899791",
"0.48995247",
"0.48932734",
"0.4889266",
"0.48834318",
"0.48829508",
"0.48778498",
"0.4875258",
"0.4875258",
"0.48745012",
"0.48680335",
"0.4866762",
"0.48663184",
"0.4855164",
"0.4853607",
"0.4853607",
"0.48489192",
"0.48489192",
"0.48489192",
"0.48489192",
"0.48489192",
"0.48489192",
"0.48489192",
"0.48443484",
"0.4843227",
"0.48269325",
"0.4823188",
"0.48203692",
"0.48153412",
"0.48153412"
] | 0.7470499 | 0 |
Fetch files from current directory or current .zip file. | def fetch_items_from_filesystem_or_zip
unless in_zip?
@items = Dir.foreach(current_dir).map {|fn|
load_item dir: current_dir, name: fn
}.to_a.partition {|i| %w(. ..).include? i.name}.flatten
else
@items = [load_item(dir: current_dir, name: '.', stat: File.stat(current_dir)),
load_item(dir: current_dir, name: '..', stat: File.stat(File.dirname(current_dir)))]
zf = Zip::File.new current_dir
zf.each {|entry|
next if entry.name_is_directory?
stat = zf.file.stat entry.name
@items << load_item(dir: current_dir, name: entry.name, stat: stat)
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_files\n retrieve_files_in_main_dir\n end",
"def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end",
"def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end",
"def files\n return get_result('files')\n end",
"def files\n return @files if @files and not @files.empty?\n\n @files = []\n\n each_zip_entry do |entry|\n @files << entry.name\n end\n\n @files\n end",
"def get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__,\"INFO\",\"Found #{@files[folder].size} files for #{@current_source.base_dir}/#{folder} at #{@current_source.host.address}\")\n SignalHandler.check\n end\n end\n end",
"def get_file_listing\n execute!(drive.files.list).data\n end",
"def retrieve_files\r\n if RUBY_PLATFORM =~ /win32|win64/i then\r\n $help_file = File.read('C:\\files\\BJHelp.txt')\r\n $welcome_file = File.read('C:\\files\\BJWelcome.txt')\r\n $credits_file = File.read('C:\\files\\BJCredits.txt')\r\n else\r\n $help_file = File.read('files/BJHelp.txt')\r\n $welcome_file = File.read('files/BJWelcome.txt')\r\n $credits_file = File.read('files/BJCredits.txt')\r\n end\r\n end",
"def files(*args)\r\n LocalDirectory.current.files(*args)\r\n end",
"def base\n\t\t@base ||= begin\n\t\t\tzip_file = Dir[File.join(self.location,\"*.zip\")].sort.first\n\t\t\tif zip_file\n\t\t\t\tZip::File.open(zip_file){ |z| z.get_entry(\"contents.xml\").get_input_stream.read }\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Rubyfocus::LocalFetcher looking for zip files at #{self.location}: none found.\"\n\t\t\tend\n\t\tend\n\tend",
"def monolithic_files\n get_files_in_dir(@monolithic_dir)\n end",
"def download_response_files!\n files_downloaded = []\n File.makedirs(cache_location + '/returns')\n with_ftp do |ftp|\n files = ftp.list('*.csv')\n files.each do |filels|\n size, file = filels.split(/ +/)[4], filels.split(/ +/)[8..-1].join(' ')\n ftp.get(file, cache_location + '/returns/' + user_suffix + '_' + file)\n files_downloaded << file\n end\n end\n files_downloaded\n end",
"def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end",
"def get_files\n return @files if @files.present?\n raise \"No user token present\" unless access[:user_token].present?\n @files ||= get(proviso_url + \"files\")\n @files.presence || raise(\"No files available\")\n end",
"def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end",
"def files\n results\n rescue ApiStruct::EntityError\n result\n end",
"def fetch_files(program)\n program = init_fields(program)\n files = []\n\n SouvlakiRS.logger.info \" Trying to fetch: '#{program[:pub_title]}', use html? #{program[:use_html]}\"\n\n begin\n agent = init_agent\n files += if program[:use_html]\n from_html(agent, program)\n else\n rss, date, error = rss_shows_available(agent, program[:show_name_uri], program[:show_date])\n if rss.nil?\n program[:err_msg] = error if error\n return []\n end\n\n SouvlakiRS.logger.info \" date match (#{date})\"\n from_rss(agent, rss)\n end\n rescue StandardError => e\n SouvlakiRS.logger.error \" Fetch error: #{e}\"\n end\n\n # logout\n # logout(agent)\n # uri = \"#{@creds[:base_uri]}?op=logout&\"\n # agent.get(uri)\n\n files\n end",
"def fetch_files(name)\n @files = Dir.glob(\"./workspace/*#{name}*.txt\")\n .select { |v| /\\d+-\\d+-\\d+_[[:alpha:]]+\\.txt$/.match v }\n\n throw RuntimeError if @files.empty?\n @files\n end",
"def get_remote_files\n raise BucketNotFound.new(\"#{self.config.fog_provider} Bucket: #{self.config.fog_directory} not found.\") unless directory\n files = []\n directory.files.each { |f| files << f if File.extname(f.key).present? }\n return files\n end",
"def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end",
"def retrieve_cloud_files(files); end",
"def get_files(query_obj=nil,with_nested_resources=false)\n uri = URI.parse(@uri + \"/Files\")\n results = get(uri,query_obj,with_nested_resources)\n end",
"def remote_files\n @remote_files ||= local_files\n end",
"def files() = files_path.glob('**/*')",
"def processFiles\n readRemoteXML\n parsePhotoRequestReponseXMl2\n handle_files\n zip_files\n end",
"def fetch!\n old_path = path\n if old_path && path.length > 0\n path = \"\"\n @results = get(old_path, @options)\n end\n end",
"def getPullRequestFiles(id)\n getFilesFromDiff(getPullRequestDiff(id))\n end",
"def files\n get_back_here = Dir.pwd\n Dir.chdir(@path)\n @files = Dir.glob(\"*.mp3\")\n Dir.chdir(get_back_here)\n @files\n end",
"def files_get(opts = {})\n files_get_with_http_info(opts)\n end",
"def pull_files(remote_path,local_path)\n debug_p(\"pull_files from #{remote_path} to #{local_path}\")\n @sftp_session.dir.foreach(remote_path){ |path|\n #unless path.name == \".\" || path.name == \"..\"\n #not directory\n unless /^d/ =~ path.longname\n @sftp_session.download!(remote_path + \"/\" + path.name,local_path + \"/\" + path.name)\n end\n #end\n }\n end",
"def get_files(src)\n files = Array.new\n if File.directory? src\n Find.find(src) do |path|\n next if File.directory? path\n files.push path\n end\n else\n log(\"error: source directory of \\\"#{src}\\\" does not exist!\")\n exit 2\n end\n files.reverse\nend",
"def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end",
"def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend",
"def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end",
"def files\n ext_files = mapper.extracted_files || []\n ext_files + [mapper.zip.name.to_s]\n end",
"def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end",
"def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end",
"def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end",
"def get_files(remote_folder_path)\n str_url = @str_uri_folder + remote_folder_path\n\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_url)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n\n JSON.parse(response)['Files']\n\n # urlFolder = $product_uri + '/storage/folder'\n # urlFile = ''\n # urlExist = ''\n # urlDisc = ''\n # if not remoteFolderPath.empty?\n # urlFile = $product_uri + '/storage/folder/' + remoteFolderPath \n # end \n # signedURL = Aspose::Cloud::Common::Utils.sign(urlFolder)\n # response = RestClient.get(signedURL, :accept => 'application/json')\n # result = JSON.parse(response.body)\n # apps = Array.new(result['Files'].size)\n #\n # for i in 0..result['Files'].size - 1\n # apps[i] = AppFile.new\n # apps[i].Name = result['Files'][i]['Name']\n # apps[i].IsFolder = result['Files'][i]['IsFolder']\n # apps[i].Size = result['Files'][i]['Size']\n # apps[i].ModifiedDate = Aspose::Cloud::Common::Utils.parse_date(result['Files'][i]['ModifiedDate'])\n # end\n # return apps\t \n end",
"def file_get_files(directories) \n directory = \"\"\n files = []\n directories.each do |directory| \n unless directory == \"/root\"\n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") do |d| \n files.push(d) unless d == \".\" || d == \"..\" \n end\n @file_information.store(directory, files)\n files = []\n end\n end\n return @file_information\n end",
"def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end",
"def files\n # Dir.glob(\"*.mp3\") #this grabs mp3s from path\n Dir.chdir(@path) do \n @mp3s = Dir.glob(\"*.mp3\") \n end\n end",
"def getContents( name, dir )\n if( /^https?:\\/\\// =~ name )\n begin\n response = Excon.get( name, :expects => [200] )\n rescue Exception => e\n puts \"Error - failed to load #{name}, got non-200 code.\"\n return ''\n end\n response.body\n else\n open('public/' + name).read\n end\nend",
"def all_files\n @all_files ||= `git ls-files 2> /dev/null`.split(\"\\n\")\n end",
"def files\n @files ||= full_files.map {|file| relative(file) }\n end",
"def files\n fail \"Fetcher #{self} does not implement `files()`. This is required.\"\n end",
"def files\n @files ||= preferred_sources([@path])\n end",
"def files(uri)\n [].tap do |ary|\n ary.concat Dir[uri]\n search_paths.each { |p| ary.concat Dir[File.join p, uri] }\n end\n end",
"def all_files; end",
"def all_files; end",
"def extract\n begin_connection\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.name} to #{local_file}\"\n sftp_retry { sftp_session.download!(File.join(@remote_path, entry.name), local_file) }\n local_file\n end\n ensure\n end_connection\n end",
"def index\n @zip_files = ZipFile.all\n end",
"def download_remotefiles\n logger.debug('DOWNLOADING FILES.')\n # sftp= Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1')\n # ENV.fetch('WORKHORSE_HOST_SERVER'), ENV.fetch('WORKHORSE_HOST_USERNAME'), :password => ENV.fetch('WORKHORSE_HOST_PASSWORD')\n begin\n Net::SFTP.start(ENV.fetch('WORKHORSE_HOST_SERVER'), ENV.fetch('WORKHORSE_HOST_USERNAME'), :password => ENV.fetch('WORKHORSE_HOST_PASSWORD')) do |sftp|\n sftp.dir.glob(WORKHORSE_TO_SALSIFY, '*').each do |file|\n file_name = file.name\n sftp.download!(File.join(WORKHORSE_TO_SALSIFY, '/', file_name), File.join(LOCAL_DIR, file_name), :progress => CustomDownloadHandler.new)\n zip_files.push(file_name) if File.extname(file_name).eql?('.zip')\n end\n end\n rescue Exception => e\n logger.debug('Error is download file ' + e.message)\n end\n\n logger.debug('FILES DOWNLOADED.')\n end",
"def retrieve_files\r\n\r\n #Determine which platform the game is running on\r\n if RUBY_PLATFORM =~ /win32|win64|\\.NET|windows|cygwin|mingw32/ then\r\n #Retrieve files and assign to global variable\r\n $help_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJHelp.txt')\r\n $welcome_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJWelcome.txt')\r\n $credits_file = File.read('C:\\Ruby22\\Ruby_Apps\\myApp\\BJCredits.txt')\r\n else\r\n $help_file = File.read('/Ruby22/Ruby_Apps/myApp/BJHelp.txt')\r\n $welcome_file = File.read('/Ruby22/Ruby_Apps/myApp/BJWelcome.txt')\r\n $credits_file = File.read('/Ruby22/Ruby_Apps/myApp/BJCredits.txt')\r\n end\r\n\r\n end",
"def available_response_files\n with_ftp do |ftp|\n # 3) List the *.csv files in the OUTGOING bucket.\n result = if ftp.nlst.include?(DCAS::DEFAULT_OUTGOING_BUCKET)\n ftp.chdir(DCAS::DEFAULT_OUTGOING_BUCKET)\n ftp.nlst.select {|f| f =~ /\\.csv$/}\n else\n []\n end\n end\n end",
"def pull_files(localpath, remotepath, filelist)\n connect!\n filelist.each do |f|\n localdir = File.join(localpath, File.dirname(f))\n FileUtils.mkdir_p localdir unless File.exist?(localdir)\n @connection.get \"#{remotepath}/#{f}\", File.join(localpath, f)\n log \"Pulled file #{remotepath}/#{f}\"\n end\n close!\n end",
"def download_files local_dir, remote_dir,remote_files,opts = {}\n safe_fetch do\n @ssh.sftp.connect do |sftp|\n Logger.<<(__FILE__,\"INFO\",\"Will start download #{remote_dir}/* from #{@host} to #{local_dir}...\")\n dls = remote_files.map do |remote_file|\n local_path = \"#{local_dir}/#{remote_file}\"\n sftp.download(\"#{remote_dir}/#{remote_file}\",local_path)\n end\n dls.each {|d| d.wait}\n Logger.<<(__FILE__,\"INFO\",\"Downloaded #{dls.size} files from #{remote_dir} at #{@host}\")\n end\n end\n end",
"def each_file(&bl)\n unpack do |dir|\n Pathname(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def fetch\n if cached_location.exist?\n @local_path = cached_location\n debug \"#{extended_name} is cached\"\n else\n raise \"No download URL specified for #{extended_name}\" if download_url.nil?\n blah \"Fetching #{extended_name}\"\n downloader = Drupid.makeDownloader self.download_url.to_s,\n self.cached_location.dirname.to_s,\n self.cached_location.basename.to_s,\n self.download_specs\n downloader.fetch\n downloader.stage\n @local_path = downloader.staged_path\n end\n end",
"def downloadRemotefiles\n logger.debug(\"DOWNLOADING FILES.\")\n #sftp= Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1')\n #ENV.fetch(\"WORKHORSE_HOST_SERVER\"), ENV.fetch(\"WORKHORSE_HOST_USERNAME\"), :password => ENV.fetch(\"WORKHORSE_HOST_PASSWORD\")\n Net::SFTP.start(ENV.fetch(\"WORKHORSE_HOST_SERVER\"), ENV.fetch(\"WORKHORSE_HOST_USERNAME\"), :password => ENV.fetch(\"WORKHORSE_HOST_PASSWORD\")) do |sftp|\n sftp.dir.glob(WORKHORSE_TO_SALSIFY, \"*\").each do |file|\n fileName = file.name\n sftp.download(File.join(WORKHORSE_TO_SALSIFY, \"/\", fileName), File.join(LOCAL_DIR, fileName))\n if File.extname(fileName).eql?(\".zip\")\n zipFiles.push(fileName)\n end\n end\n end\n logger.debug(\"FILES DOWNLOADED.\")\n end",
"def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end",
"def files_get(api_key, opts = {})\n files_get_with_http_info(api_key, opts)\n return nil\n end",
"def fetch_all_archives\n fetch_archives\n rescue\n []\n end",
"def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end",
"def files\n @files=get_endpoint('extra').keys\n end",
"def files(match=nil)\n return @files unless @reload_files_cache\n\n # All\n # A buncha tuples\n tuples = @served.map { |prefix, local_path|\n path = File.expand_path(File.join(@app.root, local_path))\n spec = File.join(path, '**', '*')\n\n Dir[spec].map { |f|\n [ to_uri(f, prefix, path), f ] unless File.directory?(f)\n }\n }.flatten.compact\n\n @reload_files_cache = false\n @files = Hash[*tuples]\n end",
"def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end",
"def files\n # fetch the appropriate files\n filenames = Dir.glob(@path + \"/*.mp3\")\n filenames.map { |filename| @files << File.basename(filename) }\n @files\n end",
"def extract_all\n files.each do |file|\n extract file\n end\n end",
"def retrieve_posts(dir); end",
"def each_file(&bl)\n unpack do |dir|\n Pathname.new(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def files\n # fetch the appropriate files\n file_paths = Dir.glob(@path + \"/*.mp3\")\n file_paths.map { |file_path| @files << File.basename(file_path) }\n @files\n end",
"def fetch_file(file_path)\n client.get_file(file_path)\n end",
"def all_files\n @all_files ||= load_files\n end",
"def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end",
"def extract_files\n while file = @package_file.next_header\n if file.pathname == \"control.tar.gz\"\n control_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while control_entry = control_tar_gz.next_header\n case control_entry.pathname\n when \"./control\"\n @control_file_contents = control_tar_gz.read_data\n when \"./preinst\"\n @preinst_contents = control_tar_gz.read_data\n when \"./prerm\"\n @prerm_contents = control_tar_gz.read_data\n when \"./postinst\"\n @postinst_contents = control_tar_gz.read_data\n when \"./postrm\"\n @postrm_contents = control_tar_gz.read_data\n end\n end\n end\n if file.pathname == \"data.tar.gz\"\n data_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while data_entry = data_tar_gz.next_header\n # Skip dirs; they're listed with a / as the last character\n @filelist << data_entry.pathname.sub(/^\\./, \"\") unless data_entry.pathname =~ /\\/$/\n end\n end\n end\n end",
"def files(folder = 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 get_file(url)\n get(url).body\n end",
"def all_files_in_cookbooks\n Util.list_directory(tmpbooks_dir, include_dot: true, recurse: true)\n .select { |fn| File.file?(fn) }\n end",
"def current_data\n start_ssh do |ssh|\n return ssh.scp.download!(full_filename)\n end\n end",
"def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end",
"def getFiles (conf)\n # include even .xxx ( dotted ) files \n\t(Dir.glob(\"*\", File::FNM_DOTMATCH) - %w[. ..]).each do |f|\n\t\tf=File.expand_path(f)\t\t\t# get complete path for file\n ts = File.mtime(f)\n\t\tif File.directory?(f)\n conf[:fsize] += 1 #count dirs as size 1\n conf[:zipFiles]<< f #add even excluded dir as empty folder only\n\t\t\tnext if exclude(f,conf[:exDirs])\n conf[:modTS] = ts if ts > conf[:modTS]\n\t\t\tDir.chdir(f)\n\t\t\tgetFiles(conf)\t# recursively explore subdir\n\t\t\tDir.chdir(\"..\")\n\t\telse\n next if exclude(f,conf[:exFiles])\n\t\t\tconf[:zipFiles]<< f \n conf[:fsize] += File.size(f)\n conf[:modTS] = ts if ts > conf[:modTS]\n\n\t\tend\n\tend\nend",
"def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end",
"def files(params = {}, &block)\n params = convert_params(params)\n return execute_paged!(\n :api_method => self.drive.files.list,\n :parameters => params,\n :converter => proc(){ |af| wrap_api_file(af) },\n &block)\n end",
"def fetch_file_contents(remote_path)\n result = backend.file(remote_path)\n if result.exist? && result.file?\n result.content\n else\n nil\n end\n end",
"def files\n @files ||= begin\n storage = model.storages.first\n return [] unless storage # model didn\"t store anything\n\n path = storage.send(:remote_path)\n unless path == File.expand_path(path)\n path.sub!(%r{(ssh|rsync)-daemon-module}, \"\")\n path = File.expand_path(File.join(\"tmp\", path))\n end\n Dir[File.join(path, \"#{model.trigger}.tar*\")].sort\n end\n end",
"def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def files_on_remote\n @bucket_contents = nil\n bucket_contents.map {|item| File.basename(item['Key']) }.sort\n end",
"def get_file(url); end",
"def find_files(base_dir, flags); end",
"def get_files(dir, name)\n Dir[\"#{dir}/**/#{name || \"*.xml\"}\"]\nend",
"def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end",
"def local_files\n @local_files ||= CloudfileAsset::Local.public_files.collect{|filename| CloudfileAsset::Local.make_relative(filename)}\n end",
"def download_data_file(url, directory, destination_filename)\n filepath = \"#{directory}/#{destination_filename}\"\n puts \">> Downloading #{filepath}...\"\n IO.copy_stream(open(url), filepath)\n\n Zip::File.open(filepath) do |zip_file|\n data_file = zip_file.glob('*.csv').first\n filepath = \"#{directory}/#{data_file.name}\"\n puts \">> Extracting #{filepath}...\"\n data_file.extract(filepath)\n end\nend",
"def fetch_csv_from_ftp(type='*')\n puts 'Connecting to FTP...'\n local_files = [] #Successfully downloaded files\n ftp = Net::FTP.open(FTP_HOST, FTP_USR, FTP_PASS)\n begin\n puts 'Connected'\n ftp.chdir(INCOMING_PATH)\n #We only fetch files with suffix that match today\n puts 'Checking for update...'\n filenames = ftp.nlst(\"#{FILE_PREFIX}_#{type}_#{Time.now.strftime(\"%d%m%Y\")}*\")\n\n unless filenames.count.zero?\n filenames.each{ |filename| \n puts \"Fetching #{filename} ...\"\n ftp.getbinaryfile(filename,\"#{RAILS_ROOT}/tmp/#{filename}\")\n local_files += [\"#{RAILS_ROOT}/tmp/#{filename}\"]\n }\n else\n puts 'Sorry, there is no new updates'\n end\n ensure\n ftp.close unless ftp.nil?\n puts 'Disconnected'\n end\n local_files\nend",
"def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end",
"def working_files\n files.map {|f| working_file f}\n end"
] | [
"0.6927383",
"0.6580163",
"0.65114397",
"0.6503587",
"0.64773613",
"0.6402373",
"0.62845725",
"0.62720746",
"0.6225117",
"0.6222155",
"0.62179345",
"0.6168878",
"0.6163954",
"0.61059165",
"0.60978436",
"0.6096858",
"0.6085929",
"0.6067498",
"0.606264",
"0.6007258",
"0.600525",
"0.59768665",
"0.59710777",
"0.59322447",
"0.59307367",
"0.59164155",
"0.5913249",
"0.58748007",
"0.58352476",
"0.58330727",
"0.5831607",
"0.5818746",
"0.5813728",
"0.5802732",
"0.57959867",
"0.57955277",
"0.5793108",
"0.57801336",
"0.5771725",
"0.5765646",
"0.57481766",
"0.57480127",
"0.57440805",
"0.57352513",
"0.57281655",
"0.5725508",
"0.57184684",
"0.57182705",
"0.5710729",
"0.5710729",
"0.5691727",
"0.5679134",
"0.5677552",
"0.566972",
"0.5662701",
"0.5658315",
"0.5648952",
"0.564812",
"0.56399655",
"0.5639813",
"0.5636242",
"0.56359845",
"0.56319433",
"0.5627166",
"0.5614365",
"0.5614328",
"0.5612262",
"0.56104535",
"0.560417",
"0.5603984",
"0.55993384",
"0.5597849",
"0.55948836",
"0.5594241",
"0.5581405",
"0.5566245",
"0.55656177",
"0.5563328",
"0.55609584",
"0.5558778",
"0.55547893",
"0.5548549",
"0.5542193",
"0.5540163",
"0.5527627",
"0.55263233",
"0.55157036",
"0.55154794",
"0.55073065",
"0.55058366",
"0.55011654",
"0.5497931",
"0.54942304",
"0.5493961",
"0.5489093",
"0.54594046",
"0.5448152",
"0.54464036",
"0.5445258",
"0.544052"
] | 0.7121194 | 0 |
Focus at the first file or directory of which name starts with the given String. | def find(str)
index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}
move_cursor index if index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto_entry_starting_with fc=nil\n unless fc\n fc = get_single \"Entries starting with: \"\n #fc = get_char\n end\n return if fc.size != 1\n ## this is wrong and duplicates the functionality of /\n # It shoud go to cursor of item starting with fc\n $patt = \"^#{fc}\"\nend",
"def goto_entry_starting_with fc=nil\n unless fc\n print \"Entries starting with: \"\n fc = get_char\n end\n return if fc.size != 1\n ## this is wrong and duplicates the functionality of /\n # It shoud go to cursor of item starting with fc\n $patt = \"^#{fc}\"\nend",
"def focus_file_search\n @search_window.focus_file_search if @search_window\n end",
"def start_with(source)\n @scanner.string = source\n @lineno = 1\n @line_start = 0\n end",
"def find_first_match(options)\n return unless options[:in_file]\n\n open(File.join(base_dir, options[:in_file])) do |file|\n regexp = options[:matching] || Regexp.new(\"^#{options[:starting_with]}\")\n regexp.match(file.read)\n end\n end",
"def focus_by_name!\n Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }\n end",
"def focus(name)\n Vedeu.trigger(:_focus_by_name_, name)\n end",
"def find( str )\n super lambda { raise Errno::ENOENT, str } do |dir|\n path = extensions.find do |ext|\n file = dir.join str + ext\n break file if file.exist?\n end\n break path if path\n end\n end",
"def start_of_first_scene(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n line_index = 0\n loop do\n line = script[line_index]\n break unless line\n break if line =~ /[A-Za-z]/\n line_index += 1\n end\n line_index += 1 if line_index < script.size # And ignore the name of the play\n line_index\n end",
"def customStartWith(string, substring)\n result = false\n substrLen = substring.length\n target = string[0, substrLen]\n result = true if substring == target\n result\nend",
"def start(name = nil)\n @start = name unless name.nil?\n @start\n end",
"def search_next_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.search_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECASE), cursor + ' 1 chars')[0]\n if pos.empty?\n @app.status = 'Cannot find \"%s\"' % word\n else\n set_cursor(pos)\n if @info.compare(cursor, '>=', pos)\n @app.status = 'Continuing search at top'\n else\n @app.status = ''\n end\n end\n end",
"def first(match, *opts)\n flags = 0\n opts.each do |opt|\n case opt when Symbol, String\n flags += ::File.const_get(\"FNM_#{opt}\".upcase)\n else\n flags += opt\n end\n end\n file = ::Dir.glob(::File.join(self.to_s, match), flags).first\n file ? self.class.new(file) : nil\n end",
"def firstChar(str, f_index)\n if alpha(str[f_index])\n return str[f_index], f_index\n end\n firstChar(str, f_index += 1) \n end",
"def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end",
"def starts_with(prefix)\n curr = @root\n prefix.each_char.all? do |char|\n curr = curr[char]\n end \n end",
"def starts_with(string, character)\n return string[0] == character\nend",
"def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def find_reverse(str)\n index = items.reverse.index {|i| i.index < current_row && i.name.start_with?(str)} || items.reverse.index {|i| i.name.start_with? str}\n move_cursor items.size - index - 1 if index\n end",
"def starts_with(prefix)\n search_arr(prefix.chars)\n end",
"def startsWith(search, startstring)\n\treturn search.index(startstring) == 0\nend",
"def set_focus_on str\n listb = @form.by_name[\"mylist\"]; \n ix = listb.list.index(str)\n if ix\n #listb.set_focus_on ix\n listb.goto_line ix\n end\nend",
"def focus_file_filter\n @gtk_file_filter_entry.has_focus = true if @gtk_file_filter_entry\n end",
"def custom_start_with(string, substring)\n string[0, substring.length] == substring\nend",
"def startswith?(substring)\n self[0...substring.size] == substring\n end",
"def first_wa(strings)\n strings.find do |string|\n string[0] ==\"w\" && string[1] == \"a\"\n end\nend",
"def history_search_prefix (string, direction)\r\n history_search_internal(string, direction, ANCHORED_SEARCH)\r\n end",
"def filter_files_by_pattern\n @title = 'Search Results: (Press Esc to cancel)'\n @mode = 'SEARCH'\n if @toggles[:instant_search]\n search_as_you_type\n else\n @patt = readline '/'\n end\nend",
"def starting_with(partial_name)\n all.select { |o| o.fullname.start_with?(partial_name) }\n end",
"def test_using_first_of\n @filelist = nil\n sublist = first_of( self.filelist ) \n results = test_using_sublist( sublist )\n output.puts \"Test Using First Of\".center(72)\n output.puts \"=\" * 72\n report_results( results )\n end",
"def first_wa(elements)\n elements.find do |element|\n element.to_s.start_with?(\"wa\")\n end\nend",
"def custom_start_with?(string, substring)\n array_of_strings = string.split(\" \")\n array_of_strings.first == substring ? true : false\nend",
"def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend",
"def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend",
"def css_search_first(path)\n\t\tself.cs(path).first\n\tend",
"def custom_start(string, substring)\n string_char = string.chars\n sub_char = substring.chars\n bool = true\n sub_char.each_with_index do |element, index|\n if element == string_char[index]\n bool = true\n else\n bool = false\n break\n end\n end\n\n p bool\nend",
"def print_names_starting_with(letter)\n\n # check that a letter was supplied\n if letter.empty? then\n puts \"Could not print names starting with letter: no letter supplied\"\n return\n\n elsif !( letter =~ /[[:alpha:]]/)\n puts \"Could not print names starting with letter: must be a letter. (given '#{letter}')\"\n return\n\n # make sure it was a letter\n elsif letter.length != 1\n puts \"Could not print names starting with letter: must be a single letter. (given '#{letter}')\"\n return\n\n end\n\n puts \"All names starting with %s\" % letter\n @students.select {|anyname| anyname[:name][0].downcase == letter.downcase}.each_with_index do |name, index|\n print_name(name, index)\n end\nend",
"def start_of_word(str, l); l == 1 ? str[0] : str[0...l] end",
"def pull_to_start(name)\n loop do\n res = pull\n raise NotFoundError if res.event_type == :end_document\n next if res.start_element? && res[0] == name.to_s\n end\n end",
"def starts_here(search, word, row, col)\n\n len = word.length - 1\n\n orientations = [\n :down,\n :down_right,\n :right,\n :up_right,\n :up,\n :up_left,\n :left,\n :down_left]\n\n orientations.each do |orientation|\n found = grab_line(search, row, col, len, orientation)\n\n if word == found\n return true\n end\n end\n\n return false\nend",
"def setstartingword(word)\n\t\t@starting_word = word.downcase!\n\t\t@starting_word = word.split(\"\")\n\t\treturn @starting_word\n\tend",
"def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend",
"def focus_file_list\n @tree.view.has_focus = true if @tree.view\n end",
"def starts_with?(s)\n index(s) == 0\n end",
"def find_filename_for_todo(id)\n for filename in Dir.entries(TODOS_DIRECTORY)\n if filename.start_with?(id)\n return filename\n end\n end\nend",
"def starts_with(prefix)\n extract.grep(/^#{prefix}/)\n end",
"def matchAtStart(text)\n # Reset scan cache\n @__text_cache__ = text\n @__index__ = -1\n\n return unless text.length\n\n m = @re[:schema_at_start].match(text)\n return nil unless m\n\n len = testSchemaAt(text, m[2], m[0].length)\n return nil unless len > 0\n\n @__schema__ = m[2];\n @__index__ = m.begin(0) + m[1].length\n @__last_index__ = m.begin(0) + m[0].length + len\n\n return Match.createMatch(self, 0)\n end",
"def substrings_at_start(string)\n string.split(\"\").map.with_index do |_, index|\n string[0..index]\n end\nend",
"def begins_with?(s)\n index(s) == 0\n end",
"def select_first_field(str)\n # Add PBX selection to first field\n matches = str.scan(/\\<\\#.*\\#\\>/)\n if matches.size > 0\n first_field = matches[0][0].to_s\n # str.gsub!(/#{first_field}/, \"%%%{PBXSelection}%%%#{first_field}%%%{PBXSelection}%%%\")\n str.gsub!(/#{first_field}/, \"#{first_field}\")\n end\n \n str\n end",
"def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend",
"def search_prev_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.rsearch_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECASE), cursor)[0]\n if pos.empty?\n @app.status = 'Cannot find \"%s\"' % word\n else\n set_cursor(pos)\n if @info.compare(cursor, '<=', pos)\n @app.status = 'Continuing search at bottom'\n else\n @app.status = ''\n end\n end\n end",
"def focus_onto_search_input\n click NAVBAR_SEARCH_INPUT_LOCATOR\n end",
"def setFileRequesterFileName( textToSet, tryCount = 3 )\n \tfor i in (1..tryCount)\n # first set the Choose File Window to be active\n hWnd = getWindowHandle(\"Choose file\" )\n if hWnd != -1\n makeWindowActive(hWnd)\n setTextValueForFileNameField( hWnd , textToSet) \n clickWindowsButton_hwnd(hWnd, \"&Open\")\n return true\n end \n end\n puts 'File Requester not found'\n return false\n end",
"def start_of_word; end",
"def noninc_dosearch(string, dir)\r\n if (string.nil? || string == '' || @noninc_history_pos < 0)\r\n rl_ding()\r\n return 0\r\n end\r\n\r\n pos = noninc_search_from_pos(string, @noninc_history_pos + dir, dir)\r\n if (pos == -1)\r\n # Search failed, current history position unchanged.\r\n rl_maybe_unsave_line()\r\n rl_clear_message()\r\n @rl_point = 0\r\n rl_ding()\r\n return 0\r\n end\r\n\r\n @noninc_history_pos = pos\r\n\r\n oldpos = where_history()\r\n history_set_pos(@noninc_history_pos)\r\n entry = current_history()\r\n if (@rl_editing_mode != @vi_mode)\r\n history_set_pos(oldpos)\r\n end\r\n make_history_line_current(entry)\r\n @rl_point = 0\r\n @rl_mark = @rl_end\r\n rl_clear_message()\r\n 1\r\n end",
"def setup!\n focus_by_name!\n focus_next!\n focus_prev!\n end",
"def first_word(input)\n # Split string into array of words and select first entry\n input.split(\" \")[0]\nend",
"def noninc_search_from_pos(string, pos, dir)\r\n return 1 if (pos < 0)\r\n\r\n old = where_history()\r\n return -1 if (history_set_pos(pos) == 0)\r\n\r\n rl_setstate(RL_STATE_SEARCH)\r\n if (string[0,1] == '^')\r\n ret = history_search_prefix(string + 1, dir)\r\n else\r\n ret = history_search(string, dir)\r\n end\r\n rl_unsetstate(RL_STATE_SEARCH)\r\n\r\n if (ret != -1)\r\n ret = where_history()\r\n end\r\n history_set_pos(old)\r\n ret\r\n end",
"def first_wa(array)\n array.find do |element|\n element.is_a?(String) && element.start_with?('wa')\n end\nend",
"def start_of_word(word, idx)\n\tword[0..idx-1]\nend",
"def start_of_string\n @prefixes = '\\A' + @prefixes\n end",
"def pre_match\n m = @match\n @string[0...(@pos - m.to_s.size)] if (not m.equal?(nil))\n end",
"def search_prefixes(str, pos= 0, len= -1)\n end",
"def substrings_at_start(string)\n leading_substrings = []\n 0.upto(string.size - 1) do |index|\n leading_substrings << string.slice(0..index)\n end\n \n leading_substrings\nend",
"def first_word\r\n text =~ /^.*?\\S.*?/\r\n $&\r\n end",
"def start_of_word(str, number)\n\treturn str[0, number]\nend",
"def scan_before_1st_headline\n title = nil\n if @options[:title]\n title =@options[:title]\n skip_to_1st_headline if @options[:skip]\n elsif @options[:skip]\n skip_to_1st_headline\n title = @options[:default_title]\n else\n @line_idx += 1 while @src[@line_idx] =~ /^\\s*$/\n title = @src[@line_idx].chomp.sub(/^\\s*/, '')\n if title =~ /^\\*+\\s*/\n title = @options[:default_title]\n else\n @line_idx += 1\n end\n end\n @options[:title] = line_parse title\n end",
"def get_first_match(path)\n\n store.transaction(true) do\n\n store.roots.each do |k|\n\n if path.match(k)\n return k\n end\n\n end\n end\n false\n end",
"def find_start_at(match)\n find = proc do |node|\n if node.text?\n formatted_text = node.text.strip\n unless formatted_text.empty?\n res = formatted_text.match?(\n /^\\d{2}:\\d{2}$/i\n )\n next formatted_text if res\n end\n end\n nil\n end\n\n depth_search(match, find)\n end",
"def initialize(source = nil)\n @scanner = StringScanner.new('')\n start_with(source) if source\n end",
"def find_prefix(word)\n prefix = ''\n i = 0\n while starts_with(prefix)\n prefix += word[i]\n i += 1\n end\n prefix.slice(0, prefix.length - 1)\n end",
"def ask_search\n str = get_string(\"Enter pattern: \")\n return if str.nil? \n str = @last_regex if str == \"\"\n return if str == \"\"\n ix = next_match str\n return unless ix\n @last_regex = str\n\n @oldindex = @current_index\n @current_index = ix[0]\n @curpos = ix[1]\n ensure_visible\n end",
"def start_of_word (string, number)\n number = number - 1\n string[0..number]\nend",
"def first_wa(arrays)\narrays.find_index { |word| if (word.to_s.include? (\"wa\"))\n return word\n break\nend\n}\nend",
"def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend",
"def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend",
"def first_caller_file\n File.expand_path caller.each {|s| !s.include? __FILE__ and s =~ /^(.*?):\\d+/ and break $1 }\n end",
"def first_wa(array)\n\n array.each do |word|\n temp = word.to_s\n return temp if temp.start_with?(\"wa\")\n end\n\nend",
"def goto_parent_dir\n\n # if in search mode, LEFT should open current dir like escape\n # Not nice to put this in here !!!\n if @mode == \"SEARCH\"\n escape\n return\n end\n\n # When changing to parent, we need to keep cursor on\n # parent dir, not first\n curr = File.basename(Dir.pwd)\n\n return if curr == '/'\n\n change_dir '..'\n\n return if curr == Dir.pwd\n\n # get index of child dir in this dir, and set cursor to it.\n index = @files.index(curr + '/')\n pause \"WARNING: Could not find #{curr} in this directory.\" unless index\n @cursor = index if index\nend",
"def search_for_keyword(keyword)\n find_and_type NAVBAR_SEARCH_INPUT_LOCATOR, keyword\n Log.step \"Typing '#{keyword}' onto navbar search input \"\n end",
"def first_word(str); str.split.first end",
"def proper_start str\n return \"_#{str}\" if str.match(/^[0-9]/) \n return str\n end",
"def start_of_word(word, num_chars)\n word[0, num_chars]\nend",
"def find_custom\n File.open(@file, 'r') do |r|\n k = []\n k[0] = nil\n while line = r.gets do\n name_count = @name.count(\"A-z, \\s\")\n k << line[0..name_count]\n this_name = k.last\n \n if this_name == @name+\" \"\n selected_line = line\n the_name = this_name\n end\n end\n if selected_line == nil\n puts \"Shortcut not found '@#{@name}'\"\n exit 1\n else\n the_name_count = the_name.count(\"A-z, \\s\")\n line_count = selected_line.count(\"A-z, \\s, '/'\")\n selected_line[the_name_count..line_count-1]\n end\n end\n end",
"def rl_username_completion_function(text, state)\r\n return nil if RUBY_PLATFORM =~ /mswin|mingw/\r\n\r\n if (state == 0)\r\n first_char = text[0,1]\r\n first_char_loc = (first_char == '~' ? 1 : 0)\r\n\r\n username = text[first_char_loc..-1]\r\n namelen = username.length\r\n Etc.setpwent()\r\n end\r\n\r\n while (entry = Etc.getpwent())\r\n # Null usernames should result in all users as possible completions.\r\n break if (namelen == 0 || entry.name =~ /^#{username}/ )\r\n end\r\n\r\n if entry.nil?\r\n Etc.endpwent()\r\n return nil\r\n else\r\n value = text.dup\r\n value[first_char_loc..-1] = entry.name\r\n\r\n if (first_char == '~')\r\n @rl_filename_completion_desired = true\r\n end\r\n\r\n return (value)\r\n end\r\n end",
"def search_firstname(input)\n \n search_name = input.downcase\n lower = 0\n upper = entries.length - 1\n \n while lower<= upper\n mid = (upper+lower)/2\n mid_name_array = entries[mid].name.split(' ').map! { |el| el.downcase }\n \n if search_name == mid_name_array[0]\n return entries[mid]\n elsif search_name < mid_name_array[0]\n upper = mid - 1\n elsif search_name > mid_name_array[0]\n lower = mid + 1\n end\n end\n return nil\n end",
"def focus(locator)\n execute_script(\n 'var element = arguments[0]; element.focus();',\n find_element(locator)\n )\n end",
"def first_word(a)\n\t\ta = a.split[0]\n\tend",
"def find_lower_bound(string)\n @cache.bsearch_lower_boundary {|x| x[:search_term] <=> string}\n end",
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end",
"def first_wa(collections)\n collections.find{|element| element.to_s.start_with?(\"wa\")}\nend",
"def start_of_word(word, number)\n word[0..number-1]\nend",
"def scan_until(pattern); end",
"def find_first(name)\n find_all(name).first\n end"
] | [
"0.629924",
"0.6214372",
"0.5710704",
"0.5511469",
"0.55052716",
"0.543554",
"0.54007345",
"0.5346526",
"0.52422345",
"0.5239791",
"0.51687235",
"0.51587117",
"0.515527",
"0.515292",
"0.5113687",
"0.50899833",
"0.5076208",
"0.50661314",
"0.50547785",
"0.50547785",
"0.50547785",
"0.50547785",
"0.50547785",
"0.50394714",
"0.5030143",
"0.5005006",
"0.50032526",
"0.4979919",
"0.49786994",
"0.49694902",
"0.4967565",
"0.49548298",
"0.49496722",
"0.49446198",
"0.4926641",
"0.49243826",
"0.4910678",
"0.4910546",
"0.49075475",
"0.490567",
"0.49020138",
"0.48984534",
"0.4895628",
"0.48818547",
"0.487511",
"0.4867374",
"0.4863129",
"0.4860099",
"0.4848924",
"0.4842088",
"0.48333424",
"0.4820887",
"0.47940013",
"0.47895473",
"0.47894582",
"0.47791365",
"0.4774621",
"0.47731146",
"0.47553933",
"0.47508273",
"0.47469774",
"0.47439477",
"0.4731257",
"0.47308853",
"0.47260848",
"0.47260496",
"0.47244668",
"0.47227135",
"0.47081938",
"0.46995184",
"0.46869233",
"0.46809688",
"0.46770546",
"0.4667006",
"0.46661064",
"0.46578768",
"0.4657256",
"0.46447793",
"0.4642958",
"0.46368325",
"0.46365574",
"0.46365574",
"0.4634399",
"0.4633424",
"0.46257895",
"0.46254897",
"0.46231422",
"0.461388",
"0.46124062",
"0.46120074",
"0.4609776",
"0.4601359",
"0.45972323",
"0.45947543",
"0.4593502",
"0.45921847",
"0.45903477",
"0.459027",
"0.45889774",
"0.4585014"
] | 0.6091004 | 2 |
Focus at the last file or directory of which name starts with the given String. | def find_reverse(str)
index = items.reverse.index {|i| i.index < current_row && i.name.start_with?(str)} || items.reverse.index {|i| i.name.start_with? str}
move_cursor items.size - index - 1 if index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto_entry_starting_with fc=nil\n unless fc\n fc = get_single \"Entries starting with: \"\n #fc = get_char\n end\n return if fc.size != 1\n ## this is wrong and duplicates the functionality of /\n # It shoud go to cursor of item starting with fc\n $patt = \"^#{fc}\"\nend",
"def goto_entry_starting_with fc=nil\n unless fc\n print \"Entries starting with: \"\n fc = get_char\n end\n return if fc.size != 1\n ## this is wrong and duplicates the functionality of /\n # It shoud go to cursor of item starting with fc\n $patt = \"^#{fc}\"\nend",
"def find(str)\n index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}\n move_cursor index if index\n end",
"def focus_file_search\n @search_window.focus_file_search if @search_window\n end",
"def search_prev_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.rsearch_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECASE), cursor)[0]\n if pos.empty?\n @app.status = 'Cannot find \"%s\"' % word\n else\n set_cursor(pos)\n if @info.compare(cursor, '<=', pos)\n @app.status = 'Continuing search at bottom'\n else\n @app.status = ''\n end\n end\n end",
"def focus_by_name!\n Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }\n end",
"def search_next_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.search_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECASE), cursor + ' 1 chars')[0]\n if pos.empty?\n @app.status = 'Cannot find \"%s\"' % word\n else\n set_cursor(pos)\n if @info.compare(cursor, '>=', pos)\n @app.status = 'Continuing search at top'\n else\n @app.status = ''\n end\n end\n end",
"def focus(name)\n Vedeu.trigger(:_focus_by_name_, name)\n end",
"def set_focus_on str\n listb = @form.by_name[\"mylist\"]; \n ix = listb.list.index(str)\n if ix\n #listb.set_focus_on ix\n listb.goto_line ix\n end\nend",
"def history_search_prefix (string, direction)\r\n history_search_internal(string, direction, ANCHORED_SEARCH)\r\n end",
"def find( str )\n super lambda { raise Errno::ENOENT, str } do |dir|\n path = extensions.find do |ext|\n file = dir.join str + ext\n break file if file.exist?\n end\n break path if path\n end\n end",
"def focus_file_filter\n @gtk_file_filter_entry.has_focus = true if @gtk_file_filter_entry\n end",
"def find_upwards(target, start_dir = nil)\n previous = nil\n current = PDK::Util::Filesystem.expand_path(start_dir || Dir.pwd)\n\n until !PDK::Util::Filesystem.directory?(current) || current == previous\n filename = File.join(current, target)\n return filename if PDK::Util::Filesystem.file?(filename)\n\n previous = current\n current = PDK::Util::Filesystem.expand_path('..', current)\n end\n end",
"def focus_file_list\n @tree.view.has_focus = true if @tree.view\n end",
"def ask_search_backward\n regex = get_string(\"Enter regex to search (backward)\")\n @last_regex = regex\n ix = @list.find_prev regex, @current_index\n if ix.nil?\n alert(\"No matching data for: #{regex}\")\n else\n set_focus_on(ix)\n end\n end",
"def ask_search_backward\n regex = get_string(\"Enter regex to search (backward)\")\n @last_regex = regex\n ix = @list.find_prev regex, @current_index\n if ix.nil?\n alert(\"No matching data for: #{regex}\")\n else\n set_focus_on(ix)\n end\n end",
"def noninc_dosearch(string, dir)\r\n if (string.nil? || string == '' || @noninc_history_pos < 0)\r\n rl_ding()\r\n return 0\r\n end\r\n\r\n pos = noninc_search_from_pos(string, @noninc_history_pos + dir, dir)\r\n if (pos == -1)\r\n # Search failed, current history position unchanged.\r\n rl_maybe_unsave_line()\r\n rl_clear_message()\r\n @rl_point = 0\r\n rl_ding()\r\n return 0\r\n end\r\n\r\n @noninc_history_pos = pos\r\n\r\n oldpos = where_history()\r\n history_set_pos(@noninc_history_pos)\r\n entry = current_history()\r\n if (@rl_editing_mode != @vi_mode)\r\n history_set_pos(oldpos)\r\n end\r\n make_history_line_current(entry)\r\n @rl_point = 0\r\n @rl_mark = @rl_end\r\n rl_clear_message()\r\n 1\r\n end",
"def seek_backwards_to(string, blocksize=512, rindex_end=-1)\n raise \"Error: blocksize must be at least as large as the string\" if blocksize < string.size\n\n loop do\n data = reverse_read(blocksize)\n\n if index = data.rindex(string, rindex_end)\n seek(index+string.size, IO::SEEK_CUR)\n break\n elsif pos == 0\n return nil\n else\n seek(string.size - 1, IO::SEEK_CUR)\n end\n end\n\n pos\n end",
"def start_of_word(str, l); l == 1 ? str[0] : str[0...l] end",
"def rl_filename_completion_function(text, state)\r\n # If we don't have any state, then do some initialization.\r\n if (state == 0)\r\n # If we were interrupted before closing the directory or reading\r\n #all of its contents, close it.\r\n if(@directory)\r\n @directory.close\r\n @directory = nil\r\n end\r\n\r\n text.delete!(0.chr)\r\n if text.length == 0\r\n @dirname = \".\"\r\n @filename = \"\"\r\n elsif text.rindex(File::SEPARATOR) == text.length-1\r\n @dirname = text\r\n @filename = \"\"\r\n else\r\n @dirname, @filename = File.split(text)\r\n\r\n # This preserves the \"./\" when the user types \"./dirname<tab>\".\r\n if @dirname == \".\" && text[0,2] == \".#{File::SEPARATOR}\"\r\n @dirname += File::SEPARATOR\r\n end\r\n end\r\n\r\n # We aren't done yet. We also support the \"~user\" syntax.\r\n\r\n # Save the version of the directory that the user typed.\r\n @users_dirname = @dirname.dup\r\n\r\n if (@dirname[0,1] == '~')\r\n @dirname = File.expand_path(@dirname)\r\n end\r\n\r\n # The directory completion hook should perform any necessary\r\n # dequoting.\r\n if (@rl_directory_completion_hook && send(rl_directory_completion_hook,@dirname))\r\n @users_dirname = @dirname.dup\r\n elsif (@rl_completion_found_quote && @rl_filename_dequoting_function)\r\n # delete single and double quotes\r\n temp = send(@rl_filename_dequoting_function, @users_dirname, @rl_completion_quote_character)\r\n @users_dirname = temp\r\n @dirname = @users_dirname.dup\r\n end\r\n\r\n begin\r\n @directory = Dir.new(@dirname)\r\n rescue Errno::ENOENT, Errno::ENOTDIR, Errno::EACCES\r\n end\r\n\r\n # Now dequote a non-null filename.\r\n if (@filename && @filename.length>0 && @rl_completion_found_quote && @rl_filename_dequoting_function)\r\n # delete single and double quotes\r\n temp = send(@rl_filename_dequoting_function, @filename, @rl_completion_quote_character)\r\n @filename = temp\r\n end\r\n\r\n @filename_len = @filename.length\r\n @rl_filename_completion_desired = true\r\n end\r\n\r\n # At this point we should entertain the possibility of hacking wildcarded\r\n # filenames, like /usr/man/man<WILD>/te<TAB>. If the directory name\r\n # contains globbing characters, then build an array of directories, and\r\n # then map over that list while completing.\r\n # *** UNIMPLEMENTED ***\r\n\r\n # Now that we have some state, we can read the directory.\r\n entry = nil\r\n while(@directory && (entry = @directory.read))\r\n d_name = entry\r\n # Special case for no filename. If the user has disabled the\r\n # `match-hidden-files' variable, skip filenames beginning with `.'.\r\n #All other entries except \".\" and \"..\" match.\r\n if (@filename_len == 0)\r\n next if (!@_rl_match_hidden_files && d_name[0,1] == '.')\r\n break if (d_name != '.' && d_name != '..')\r\n else\r\n # Otherwise, if these match up to the length of filename, then\r\n # it is a match.\r\n\r\n if (@_rl_completion_case_fold)\r\n break if d_name =~ /^#{Regexp.escape(@filename)}/i\r\n else\r\n break if d_name =~ /^#{Regexp.escape(@filename)}/\r\n end\r\n end\r\n end\r\n\r\n if entry.nil?\r\n if @directory\r\n @directory.close\r\n @directory = nil\r\n end\r\n @dirname = nil\r\n @filename = nil\r\n @users_dirname = nil\r\n\r\n return nil\r\n else\r\n if (@dirname != '.')\r\n if (@rl_complete_with_tilde_expansion && @users_dirname[0,1] == \"~\")\r\n temp = @dirname\r\n if(temp[-1,1] != File::SEPARATOR)\r\n temp += File::SEPARATOR\r\n end\r\n else\r\n temp = @users_dirname\r\n if(temp[-1,1] != File::SEPARATOR)\r\n temp += File::SEPARATOR\r\n end\r\n end\r\n temp += entry\r\n else\r\n temp = entry.dup\r\n end\r\n return (temp)\r\n end\r\n end",
"def scan_until(pattern); end",
"def find_first_match(options)\n return unless options[:in_file]\n\n open(File.join(base_dir, options[:in_file])) do |file|\n regexp = options[:matching] || Regexp.new(\"^#{options[:starting_with]}\")\n regexp.match(file.read)\n end\n end",
"def window_focus window_name\r\n command 'windowFocus', window_name\r\n end",
"def prev_word\n line = get.reverse\n pos = get.size - cursor\n\n return unless md = line.match(BACKWARD_WORD, pos)\n self.cursor = (line.size - md.offset(0).last)\n end",
"def customStartWith(string, substring)\n result = false\n substrLen = substring.length\n target = string[0, substrLen]\n result = true if substring == target\n result\nend",
"def noninc_search_from_pos(string, pos, dir)\r\n return 1 if (pos < 0)\r\n\r\n old = where_history()\r\n return -1 if (history_set_pos(pos) == 0)\r\n\r\n rl_setstate(RL_STATE_SEARCH)\r\n if (string[0,1] == '^')\r\n ret = history_search_prefix(string + 1, dir)\r\n else\r\n ret = history_search(string, dir)\r\n end\r\n rl_unsetstate(RL_STATE_SEARCH)\r\n\r\n if (ret != -1)\r\n ret = where_history()\r\n end\r\n history_set_pos(old)\r\n ret\r\n end",
"def set_focus\n\t\[email protected]\n\tend",
"def accept_file_name # {{{\n print \"Enter filename: \"\n values = Dir.glob(\"*.tsv\")\n values.each do |e|\n unless Readline::HISTORY.include? e\n Readline::HISTORY.push(e)\n end\n end\n filename = Readline::readline('>', true)\n if File.extname(filename) == \"\"\n # if no extension, add tsv\n filename << \".tsv\"\n end\n Readline::HISTORY.pop if Readline::HISTORY.include? filename\n # we still get dupes when user selects from history\n return filename\nend",
"def start_of_first_scene(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n line_index = 0\n loop do\n line = script[line_index]\n break unless line\n break if line =~ /[A-Za-z]/\n line_index += 1\n end\n line_index += 1 if line_index < script.size # And ignore the name of the play\n line_index\n end",
"def history_search_pos(string, dir, pos)\r\n old = where_history()\r\n history_set_pos(pos)\r\n if (history_search(string, dir) == -1)\r\n history_set_pos(old)\r\n return (-1)\r\n end\r\n ret = where_history()\r\n history_set_pos(old)\r\n ret\r\n end",
"def start_with(source)\n @scanner.string = source\n @lineno = 1\n @line_start = 0\n end",
"def start(name = nil)\n @start = name unless name.nil?\n @start\n end",
"def start_of_word(word, idx)\n\tword[0..idx-1]\nend",
"def focus_next\n i = focusables.index(@focused) || 0\n new_i = i == focusables.length - 1 ? 0 : i + 1\n self.focused = focusables[new_i] if focusables[new_i]\n end",
"def start_of_word(word, number)\n word[0..number-1]\nend",
"def _find_prev regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_prev #{@search_found_ix} : #{@current_index}\"\n if start != 0\n start -= 1 unless start == 0\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.downto(0) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = @list.size-1\n if @search_wrap\n start.downto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"def substrings_at_start(string)\n leading_substrings = []\n 0.upto(string.size - 1) do |index|\n leading_substrings << string.slice(0..index)\n end\n \n leading_substrings\nend",
"def ask_search\n str = get_string(\"Enter pattern: \")\n return if str.nil? \n str = @last_regex if str == \"\"\n return if str == \"\"\n ix = next_match str\n return unless ix\n @last_regex = str\n\n @oldindex = @current_index\n @current_index = ix[0]\n @curpos = ix[1]\n ensure_visible\n end",
"def move_to_next_line()\r\n while @seek_ptr < @len && @fileBuf.at(@seek_ptr) != \"\\n\"\r\n @seek_ptr = @seek_ptr + 1\r\n end\r\n end",
"def goto_parent_dir\n\n # if in search mode, LEFT should open current dir like escape\n # Not nice to put this in here !!!\n if @mode == \"SEARCH\"\n escape\n return\n end\n\n # When changing to parent, we need to keep cursor on\n # parent dir, not first\n curr = File.basename(Dir.pwd)\n\n return if curr == '/'\n\n change_dir '..'\n\n return if curr == Dir.pwd\n\n # get index of child dir in this dir, and set cursor to it.\n index = @files.index(curr + '/')\n pause \"WARNING: Could not find #{curr} in this directory.\" unless index\n @cursor = index if index\nend",
"def setFileRequesterFileName( textToSet, tryCount = 3 )\n \tfor i in (1..tryCount)\n # first set the Choose File Window to be active\n hWnd = getWindowHandle(\"Choose file\" )\n if hWnd != -1\n makeWindowActive(hWnd)\n setTextValueForFileNameField( hWnd , textToSet) \n clickWindowsButton_hwnd(hWnd, \"&Open\")\n return true\n end \n end\n puts 'File Requester not found'\n return false\n end",
"def focus_onto_search_input\n click NAVBAR_SEARCH_INPUT_LOCATOR\n end",
"def focus_next_key(value)\n return invalid_key('exit_key') unless valid_key?(value)\n\n Vedeu.log(\"Configuration::API focus_next: #{value}\")\n\n system_keys[:focus_next] = value\n end",
"def pull_to_start(name)\n loop do\n res = pull\n raise NotFoundError if res.event_type == :end_document\n next if res.start_element? && res[0] == name.to_s\n end\n end",
"def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end",
"def rl_username_completion_function(text, state)\r\n return nil if RUBY_PLATFORM =~ /mswin|mingw/\r\n\r\n if (state == 0)\r\n first_char = text[0,1]\r\n first_char_loc = (first_char == '~' ? 1 : 0)\r\n\r\n username = text[first_char_loc..-1]\r\n namelen = username.length\r\n Etc.setpwent()\r\n end\r\n\r\n while (entry = Etc.getpwent())\r\n # Null usernames should result in all users as possible completions.\r\n break if (namelen == 0 || entry.name =~ /^#{username}/ )\r\n end\r\n\r\n if entry.nil?\r\n Etc.endpwent()\r\n return nil\r\n else\r\n value = text.dup\r\n value[first_char_loc..-1] = entry.name\r\n\r\n if (first_char == '~')\r\n @rl_filename_completion_desired = true\r\n end\r\n\r\n return (value)\r\n end\r\n end",
"def pre_match\n m = @match\n @string[0...(@pos - m.to_s.size)] if (not m.equal?(nil))\n end",
"def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend",
"def filter_files_by_pattern\n @title = 'Search Results: (Press Esc to cancel)'\n @mode = 'SEARCH'\n if @toggles[:instant_search]\n search_as_you_type\n else\n @patt = readline '/'\n end\nend",
"def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end",
"def update_completion_prefix\n Qt::Application.set_override_cursor Qt::Cursor.new(Qt::WaitCursor)\n\n pos = completion_pos\n word = completion_prefix\n\n if word\n completions = @input.completion_proc.call(word)\n model = Qt::StringListModel.new(completions)\n\n @completion_pos = pos\n\n @completer.model = model\n\n if word != @completer.completion_prefix\n @completer.completion_prefix = word\n @completer.popup.current_index = @completer.completion_model.\n index(0, 0)\n end\n\n rect = cursor_rect\n rect.width = @completer.popup.size_hint_for_column(0) +\n @completer.popup.vertical_scroll_bar.size_hint.width\n\n @completer.complete rect\n else\n @completer.popup.hide\n end\n\n Qt::Application.restore_override_cursor\n end",
"def find_available_name(path)\n return path unless bucket.objects[path].exists?\n ext = File.extname(path)\n base = path[0..-ext.size-1] + \"-1\"\n loop do\n path = base + ext\n return path unless bucket.objects[path].exists?\n base = base.next\n end\n end",
"def setup!\n focus_by_name!\n focus_next!\n focus_prev!\n end",
"def custom_start_with(string, substring)\n string[0, substring.length] == substring\nend",
"def starts_here(search, word, row, col)\n\n len = word.length - 1\n\n orientations = [\n :down,\n :down_right,\n :right,\n :up_right,\n :up,\n :up_left,\n :left,\n :down_left]\n\n orientations.each do |orientation|\n found = grab_line(search, row, col, len, orientation)\n\n if word == found\n return true\n end\n end\n\n return false\nend",
"def longest_prefix(str, pos= 0, len= -1, match_prefix= false)\n end",
"def next_word\n return unless md = get.match(FORWARD_WORD, cursor)\n self.cursor = md.offset(0).last\n end",
"def get_previous_header cursor\n ret = @info.rsearch_with_length(/[\\r\\n]\\w[^\\r\\n]*/, cursor)\n if !ret[0].empty? and @info.compare(cursor, '>=', ret[0])\n return ret[2].strip\n end\n end",
"def setstartingword(word)\n\t\t@starting_word = word.downcase!\n\t\t@starting_word = word.split(\"\")\n\t\treturn @starting_word\n\tend",
"def start_of_word; end",
"def find_lower_bound(string)\n @cache.bsearch_lower_boundary {|x| x[:search_term] <=> string}\n end",
"def start_of_word (string, number)\n number = number - 1\n string[0..number]\nend",
"def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend",
"def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend",
"def begin_find_next_word(stepup)\n if stepup == true\n @s = @e+1\n @e += 1\n else nil\n end\n end",
"def for_fs_sake(string)\n words = string.split(\" \")\n the_word = \"\"\n f_index = nil # index from end\n\n words.each do |word|\n #find an f\n (1..word.length).each do |i|\n if word[-i] == \"f\"\n if the_word == \"\" or i < f_index\n the_word = word\n f_index = i\n break\n end\n end\n end\n end\n\n the_word\nend",
"def focus_next!\n Vedeu.bind(:_focus_next_) { Vedeu.focus_next }\n end",
"def ask_bookmark ch=nil\n unless ch\n ch = @window.getchar\n ch = ch.chr.upcase rescue nil\n return unless ch\n end\n str = $bookmarks[ch.to_sym]\n if str\n display_text str\n # set focus to that in the left list\n set_focus_on str\n else\n $message.value = \"No bookmark for #{ch}. Use m to create.\"\n ## No bookmark, jumping to first char \n listb = @form.by_name[\"mylist\"]; \n listb.set_selection_for_char ch\n end\nend",
"def startswith?(substring)\n self[0...substring.size] == substring\n end",
"def exact_beginning_length(search_word, string)\n regexp = Regexp.new(\"(?:\\\\b\" + search_word.gsub(/(?!^)./){ |e| \"#{Regexp.escape(e)}?\"}, \"i\")\n return ((string.scan(regexp) || [\"\"]).max{ |a, b| a.length <=> b.length} || 0) / search_word.length\n end",
"def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend",
"def filename\n __advance!\n @_st_fileName\n end",
"def substrings_at_start(string)\n string.split(\"\").map.with_index do |_, index|\n string[0..index]\n end\nend",
"def search_prefixes(str, pos= 0, len= -1)\n end",
"def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend",
"def find_custom\n File.open(@file, 'r') do |r|\n k = []\n k[0] = nil\n while line = r.gets do\n name_count = @name.count(\"A-z, \\s\")\n k << line[0..name_count]\n this_name = k.last\n \n if this_name == @name+\" \"\n selected_line = line\n the_name = this_name\n end\n end\n if selected_line == nil\n puts \"Shortcut not found '@#{@name}'\"\n exit 1\n else\n the_name_count = the_name.count(\"A-z, \\s\")\n line_count = selected_line.count(\"A-z, \\s, '/'\")\n selected_line[the_name_count..line_count-1]\n end\n end\n end",
"def set_prefix\n @prefix = @str[@i_last_real_word...@i]\n end",
"def rl_beginning_of_history(count, key)\r\n rl_get_previous_history(1 + where_history(), key)\r\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def set_StartsWith(value)\n set_input(\"StartsWith\", value)\n end",
"def focus\r\n end",
"def firstChar(str, f_index)\n if alpha(str[f_index])\n return str[f_index], f_index\n end\n firstChar(str, f_index += 1) \n end",
"def get_current_line(file, index)\n current_line = file[index.value]\n if !current_line.nil?\n current_line.chomp()\n end\n while (!current_line.nil?) && current_line.match(/\\A\\s*\\Z/)\n index.value += 1\n current_line = file[index.value]\n if !current_line.nil?\n current_line.chomp()\n end\n end\n return current_line\nend",
"def find_previous(xml, leaf_name, order)\n order.reduce(nil) do |res, curr_name|\n break res if curr_name == leaf_name\n xml.at(curr_name.include?(':') ? \"./#{curr_name}\" : \"./xmlns:#{curr_name}\") || res\n end\n end",
"def start_of_string\n @prefixes = '\\A' + @prefixes\n end",
"def find_prefix(word)\n prefix = ''\n i = 0\n while starts_with(prefix)\n prefix += word[i]\n i += 1\n end\n prefix.slice(0, prefix.length - 1)\n end",
"def search_as_you_type\n\n @patt = '' + '' # rubocop suggestion to get unfrozen string\n @title = 'Search Results (ENTER to return, ESC to cancel)'\n clear_last_line\n print \"\\r/\"\n loop do\n key = get_char\n if key == 'ENTER'\n @title = 'Search Results (ESCAPE to return)'\n return true\n elsif key == 'ESCAPE'\n @mode = @title = @patt = nil\n status_line\n return false\n elsif key == 'BACKSPACE'\n @patt = @patt[0..-2]\n @message = nil # remove pesky ESCAPE message\n elsif key.match?(/^[a-zA-Z0-9\\. _]$/)\n @patt += key if @patt\n else\n resolve_key key\n @mode = @title = nil\n # if directory changes, then patt is nilled causing error above\n return true\n end\n # XXX is rescan required ?\n draw_directory\n place_cursor\n end\nend",
"def print_names_starting_with(letter)\n\n # check that a letter was supplied\n if letter.empty? then\n puts \"Could not print names starting with letter: no letter supplied\"\n return\n\n elsif !( letter =~ /[[:alpha:]]/)\n puts \"Could not print names starting with letter: must be a letter. (given '#{letter}')\"\n return\n\n # make sure it was a letter\n elsif letter.length != 1\n puts \"Could not print names starting with letter: must be a single letter. (given '#{letter}')\"\n return\n\n end\n\n puts \"All names starting with %s\" % letter\n @students.select {|anyname| anyname[:name][0].downcase == letter.downcase}.each_with_index do |name, index|\n print_name(name, index)\n end\nend",
"def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend",
"def find(substring)\n first_letter, second_letter, *last_letters = *substring.chars\n return [] unless @root.path?(last_letters.reverse)\n\n @root.follow_path(last_letters.reverse).final_paths.select do |path|\n path.start_with?([second_letter, first_letter])\n end.map do |path|\n Path.new(last_letters.reverse + path).to_word.to_s\n end.uniq\n end",
"def focus\n assert_exists\n driver.execute_script \"return arguments[0].focus()\", @element\n end",
"def focus\n assert_exists\n driver.execute_script \"return arguments[0].focus()\", @element\n end",
"def start_word_pattern; end",
"def find_filename_for_todo(id)\n for filename in Dir.entries(TODOS_DIRECTORY)\n if filename.start_with?(id)\n return filename\n end\n end\nend",
"def start_of_word(word,length)\n\tword[0..length-1]\nend",
"def focus_prev_key(value)\n return invalid_key('exit_key') unless valid_key?(value)\n\n Vedeu.log(\"Configuration::API focus_prev: #{value}\")\n\n system_keys[:focus_prev] = value\n end",
"def seek_to(string, blocksize=512)\n raise \"Error: blocksize must be at least as large as the string\" if blocksize < string.size\n\n loop do\n data = read(blocksize)\n\n if index = data.index(string)\n seek(-(data.size - index), IO::SEEK_CUR)\n break\n elsif eof?\n return nil\n else\n seek(-(string.size - 1), IO::SEEK_CUR)\n end\n end\n\n pos\n end"
] | [
"0.6061495",
"0.5999916",
"0.57862",
"0.55568165",
"0.5336453",
"0.53053707",
"0.52757347",
"0.52642554",
"0.516325",
"0.5075195",
"0.4979139",
"0.4971363",
"0.49225742",
"0.49115813",
"0.48719105",
"0.48719105",
"0.4858131",
"0.48076108",
"0.47774366",
"0.4776951",
"0.47532067",
"0.47520936",
"0.47477096",
"0.4742723",
"0.4739926",
"0.47396427",
"0.4722283",
"0.47201863",
"0.47149652",
"0.46982983",
"0.46894935",
"0.46807167",
"0.46800137",
"0.46699885",
"0.46693838",
"0.46593845",
"0.46423638",
"0.46382326",
"0.46335953",
"0.46306396",
"0.46171784",
"0.46167168",
"0.4615602",
"0.46138927",
"0.46119136",
"0.4601048",
"0.45808765",
"0.45801878",
"0.45760974",
"0.45742196",
"0.4571495",
"0.45710787",
"0.45604232",
"0.45568743",
"0.45556855",
"0.45541745",
"0.45540488",
"0.45485595",
"0.45471418",
"0.4545278",
"0.4537322",
"0.4523416",
"0.45232415",
"0.45232415",
"0.45215082",
"0.4516393",
"0.45159364",
"0.4508702",
"0.4504044",
"0.4483724",
"0.4483079",
"0.44770688",
"0.4471758",
"0.44682947",
"0.4466214",
"0.44587728",
"0.44566765",
"0.4444091",
"0.44398087",
"0.44398087",
"0.44398087",
"0.44398087",
"0.44398087",
"0.44285128",
"0.44271588",
"0.44234657",
"0.44221014",
"0.44203717",
"0.44135758",
"0.4411939",
"0.4409073",
"0.44049183",
"0.44016752",
"0.44009364",
"0.44009364",
"0.43962196",
"0.4393515",
"0.43916395",
"0.43912002",
"0.43896484"
] | 0.5768489 | 3 |
Height of the currently active pane. | def maxy
main.maxy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible_height\n @win.maxy - 2\n end",
"def scroll_height\n self.scroll_size[:y]\n end",
"def canvas_height\n cur_page.canvas_height\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end",
"def window_height\n Graphics.height - under_help - @keys_window.height\n end",
"def window_height\n base_height = (wb = current_window_builder)[5] + wb[-1]\n base_height + default_line_height * line_number\n end",
"def height \n @height || text_area_height + 2*@vertical_padding\n end",
"def height\n return nil unless @height\n if @height < 0\n return ((FFI::NCurses.LINES + @height) - self.row) + 1\n #return (FFI::NCurses.LINES + @height) \n end\n @height\n end",
"def height\n @dimensions.y\n end",
"def height\n return @window_height # outer height\nend",
"def window_height\n end",
"def height\n `#{clientRect}.height`\n end",
"def height\n top + bottom\n end",
"def height\n return height_helper(@root, 0, 1)\n end",
"def height\n return height_helper(@root, 0, 1)\n end",
"def height\n @anchor.height\n end",
"def height\n height_helper(@root, 0)\n end",
"def height\n return height_helper(@root, 0)\n end",
"def height\n return height_helper(@root, 0)\n end",
"def height\n current_node = @root\n\n return height_helper(current_node)\n end",
"def height(_data_length, _item_size, viewport)\n return viewport.rect.height\n end",
"def page_height\n cur_page.page_height\n end",
"def window_height\n return ACTOR_WINDOW_HEIGHT\n end",
"def height\n return 0 if @root == nil\n\n current = @root\n\n return height_helper(current, 1, 1)\n end",
"def height\n size_a[1]\n end",
"def height\n return self.rect.height\n end",
"def cursor_height(_viewport, item_size)\n return item_size\n end",
"def height\n return height_helper(@root)\n end",
"def full_height\n height + (margin * 2)\n end",
"def full_height\n height + (margin * 2)\n end",
"def full_height\n height + (margin * 2)\n end",
"def height\n @root and @root.height or 0\n end",
"def max_height\n FFI::NCurses.getmaxy FFI::NCurses.stdscr\n end",
"def height\n Terminal.height\n end",
"def height\n return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end",
"def height\n return @height\n end",
"def height\n if @y_offset + @height > @source.height\n [@source.height - @y_offset, 0].max\n else\n @height\n end\n end",
"def browser_height\n @browser_height\n end",
"def height\n @ole.Height\n end",
"def height\n @ole.Height\n end",
"def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end",
"def height\n dimensions()[:y]\n end",
"def height\n dimensions.last\n end",
"def cursor_height(viewport, _item_size)\n return viewport.rect.height\n end",
"def height\n @maps[:background].size\n end",
"def height\n rows\n end",
"def window_height\n fitting_height(11)\n end",
"def window_height\n fitting_height(11)\n end",
"def window_height\n fitting_height(11)\n end",
"def cursor_height\n if @segments.first.text.empty?\n # Heights are off for empty text layouts. Fake it to make it (it\n # being a real height).\n new_segment = TextSegment.new(@dsl, \"Hi\", 100)\n height_from_segment(new_segment)\n else\n height_from_segment(@segments.first)\n end\n end",
"def body_height\n if orientation == PORTRAIT\n @paper.height - (@top_margin + @bottom_margin)\n else\n @paper.width - (@top_margin + @bottom_margin)\n end\n end",
"def height; rect.height; end",
"def height\n image_ptr[:sy]\n end",
"def height\n if alignment == :vertical\n @height ||= @options.count * @options.first.height\n else\n @height ||= @options.first.height\n end\n end",
"def height\n instance.options[:height]\n end",
"def height\n content.size\n end",
"def terminal_height\n terminal_size.last\n end",
"def height()\n @view__.height\n end",
"def height\n attr('height')\n end",
"def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end",
"def height\n get_geometry if @height.nil?\n return @height\n end",
"def height\n @y1 - @y0\n end",
"def GetPageHeight()\n\t\treturn @h;\n\tend",
"def height(current = @root, current_height = 0, max_height = 0)\n return max_height if current == nil\n\n max_height = current_height if current_height > max_height\n max_height = height(current.left, current_height += 1, max_height)\n current_height -= 1\n max_height = height(current.right, current_height += 1, max_height)\n\n return max_height\n end",
"def height\n\t\treturn @height\n\tend",
"def contents_height\n h = height - standard_padding * 2\n h + (@item_max * line_height)\n end",
"def box_height\n return line_height + 104 + line_height * (@params.size + 1)\n end",
"def size(rect)\n return rect.height\n end",
"def vh\n return (viewport == nil ? self.bitmap.height : viewport.rect.height)\n end",
"def height\n top - bottom\n end",
"def height\n size.first\n end",
"def height\n size.first\n end",
"def height\n @height || 100\n end",
"def height\n @bottom_edge - @top_edge\n end",
"def ui_max_y\n\t\t\t\tCurses.rows\n\t\t\tend",
"def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end",
"def height\n Vips.vips_image_get_height self\n end",
"def height(current = @root, h = 0)\n return h unless current\n\n height_left = height(current.left, h + 1)\n height_right = height(current.right, h + 1)\n\n height_left > height_right ? height_left : height_right\n end",
"def remaining_height(base_height)\n base_height.anchor[1] - bounds.anchor[1]\n end",
"def height\n @height = @height + 1\n end",
"def max_body_height\n self.height - self.margin_top_actual - self.margin_bottom\n end",
"def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end",
"def height\n memoized_info[:height]\n end",
"def body_height\n prev_para= nil\n @paras.inject(0.points) do |total, para|\n prev, prev_para= [prev_para, para]\n total + para.height + (prev.nil?? 0.points : prev.margin_between(para))\n end\n end",
"def height\n options[:height] || Config.height\n end",
"def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end",
"def row_height\n return @row_height\n end",
"def getOffsetHeight\n DOM.getPropertyInt(@element, \"offsetHeight\")\n end",
"def height\n\t\tnode['height']\n\tend",
"def viewport_size(viewport)\n return viewport.rect.height\n end",
"def height\n return 0 if @root.nil?\n return [height_helper(@root.left), height_helper(@root.right)].max + 1\n end",
"def height\r\n @content[pn(:MediaBox)][3]\r\n end",
"def outer_height\n height + offsets.height + padding.height\n end",
"def height\n if root.nil?\n return nil\n else\n return root.height\n end\n end",
"def outer_height; rect.height + @border_thickness * 2; end",
"def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end",
"def contents_height\n Graphics.height\n end",
"def height\n assert_exists\n driver.execute_script \"return arguments[0].height\", @element\n end",
"def game_height\n screen_size = NSScreen.mainScreen.frame.size\n\t\tif (screen_size.width / screen_size.height) > GAME_ASPECT\n\t\t\tscreen_size.height = screen_size.width / GAME_ASPECT\n end\n\t\tscreen_size.height\n end"
] | [
"0.69569707",
"0.6799751",
"0.6683992",
"0.6670261",
"0.6670261",
"0.6637877",
"0.66238713",
"0.6597761",
"0.659663",
"0.65309435",
"0.6519484",
"0.65040433",
"0.6472639",
"0.646519",
"0.64370257",
"0.6421143",
"0.6421143",
"0.6389279",
"0.63730705",
"0.63664573",
"0.63664573",
"0.6352779",
"0.6348183",
"0.6343253",
"0.63086313",
"0.62800545",
"0.6265146",
"0.62535185",
"0.6251834",
"0.6250425",
"0.6241211",
"0.6241211",
"0.6241211",
"0.6233513",
"0.62070256",
"0.61901516",
"0.61781305",
"0.6173713",
"0.6169288",
"0.6160504",
"0.61558",
"0.61558",
"0.6151264",
"0.6138554",
"0.6138534",
"0.6134903",
"0.61131626",
"0.6086397",
"0.6083477",
"0.6083477",
"0.6083477",
"0.6076689",
"0.60761356",
"0.607088",
"0.60707563",
"0.60643053",
"0.60550207",
"0.6041409",
"0.6023894",
"0.6016993",
"0.60059834",
"0.6004072",
"0.59862477",
"0.59784126",
"0.59685224",
"0.59558225",
"0.5949517",
"0.59386396",
"0.5928869",
"0.5918411",
"0.59146494",
"0.5913451",
"0.5912431",
"0.5912431",
"0.59111583",
"0.5907577",
"0.5869529",
"0.58268285",
"0.5824623",
"0.5812862",
"0.5810816",
"0.5807458",
"0.58037615",
"0.5799732",
"0.5798792",
"0.5793329",
"0.5763327",
"0.5751975",
"0.5747521",
"0.5736882",
"0.57263994",
"0.5722817",
"0.5718638",
"0.5709481",
"0.57078564",
"0.5706557",
"0.57050306",
"0.56938404",
"0.56927735",
"0.5683066",
"0.56625134"
] | 0.0 | -1 |
Number of files or directories that the current main window can show in a page. | def max_items
main.max_items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window_count\n return @browser.windows.count\n end",
"def TreeView_GetVisibleCount(hwnd) send_treeview_message(hwnd, :GETVISIBLECOUNT) end",
"def visible_tabs\n count = 0\n @tab_names.each { |x| count += 1 if x.visible? }\n count\n end",
"def num_pages\n if order_bw_pages && order_color_pages\n return 2 + order_bw_pages + order_color_pages\n end\n end",
"def page_count\n file_groups\n @highest_page_count\n end",
"def number_of_pages(fedora_obj)\n len = []\n fedora_obj.datastreams.keys.each do |x|\n len << x if x.include?('.txt')\n end\n len.length\n end",
"def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end",
"def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def actual_path_length\n folders.count\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\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 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_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\n return @number_of_pages\n end",
"def TreeView_GetCount(hwnd) send_treeview_message(hwnd, :GETCOUNT) 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 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 file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end",
"def folders_count\n wayfinder.ephemera_folders_count\n end",
"def nbpages\n attachments.order(position: 'asc').first.nbpages\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end",
"def number_of_files\n\t\tassets.length\n\tend",
"def line_count\n entries.inject(0) do |count, entry|\n count + (entry.dir? ? 0 : entry.lines.size)\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 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 dir_file_count\n directory = APP_CONFIG['import_maps_sftp_path']\n count = Dir[File.join(directory, '**')].count { |file| File.file?(file) }\n\n return count\n end",
"def test_run_num_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(6,f.files.length)\n\tend",
"def Count()\r\n ret = _getproperty(1610743819, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def Count()\r\n ret = _getproperty(1610743819, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def file_count(dir_path)\n Dir.entries(dir_path).count - 2\n end",
"def Count()\r\n ret = _getproperty(1610743815, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def max_pages() Pages.keys.size end",
"def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end",
"def Count()\r\n ret = _getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def actual_page_count\n warn \"WARNING: actual_page_count is not yet implemented properly.\"\n warn \" Please send patches.\"\n @pages.count\n end",
"def numImages(path)\n\t\tDir.entries(path).size\n\tend",
"def depth\n return 0 if %w(index 404).include?(self.fullpath)\n self.fullpath.split('/').size\n end",
"def top_level_section_count\n @top_level.items.size\n end",
"def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def num_pages\n 26\n end",
"def get_count(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if !file.is_dir\n file.files_count\n end",
"def get_num_pages\n record_count = @model_class.count\n if record_count % @items_per_page == 0\n (record_count / @items_per_page)\n else\n (record_count / @items_per_page) + 1\n end\n end",
"def GetFileCount(aDir):\n return Dir[File.join(aDir, '*')].count {|file| File.file?(file)}\n end",
"def number_of_internal_links_to_page(link)\n @ilps[link]\n end",
"def TreeView_GetSelectedCount(hwnd) send_treeview_message(hwnd, :GETSELECTEDCOUNT) end",
"def volume_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.directory?(file)\n end\n end",
"def calculate_pages\n pdftk_cmd = \"#{CONFIG[:pdftk]} #{@source} dump_data | grep NumberOfPages | grep -o -e \\\"\\\\([0-9]*\\\\)$\\\"\"\n @pages = %x[#{pdftk_cmd}].to_i\n end",
"def pages(board)\n get(board, 1)[:pages].size\n end",
"def total_pages\n pages.size\n end",
"def number_of_existing_apps\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n num = @driver.find_elements(:tag_name => \"article\").count\r\n puts \"+ <action> existing_app_num: #{num}\"\r\n return num\r\n end",
"def count\n coverable_files.size\n end",
"def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\[email protected](file)\n\t\t\tend\n\t\tend\n\tend",
"def directory_size(path)\n\ta = get_dir_size(path)\n\tdisplay(a)\n\t@calls = 0\n\treturn a\nend",
"def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end",
"def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend",
"def num_paths\n @num_paths ||= begin\n self[width - 1, height - 1]\n end\n end",
"def getImgCount(hash)\n\t\tsetImgDir()\n\t\tinner_path = DEFAULT_DIRECTORY\n\t\tinner_path += \"/#{hash[:folder_index]}\" unless hash[:folder_index].nil?\n\t\tinner_path += \"/#{hash[:entry_path]}\" unless hash[:entry_path].nil?\n\t\t#Count all real files that aren't txt\n\t\tDir.glob(File.join(\"#{inner_path}\", '**', '*')).select { |file| File.file?(file) && !file.end_with?(\".txt\") }.count\n\tend",
"def num_pages\n groups = self.groups.includes(:descriptions)\n groups.map {|g| g.descriptions.length > 0 ? 1 : 0}.sum\n end",
"def visible_works_count\n self.works.select{|w| w.visible?(User.current_user)}.uniq.size\n end",
"def page_count; pages.count; end",
"def num_of_choices(current_page, pages)\n\tchoices = 0\n\tpages.select { |k,v| choices += 1 if k.include?(\"~#{current_page}:c\")}\n\tchoices\nend",
"def count\n THEMES.size\n end",
"def total_pages\n (items.size - 1) / max_items + 1\n end",
"def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend",
"def archive_file_count\n Dir.glob('*', base: mounted_path).length\n end",
"def size\n each_advisory_path.count\n end",
"def count()\n return @child_path_parts.count\n end",
"def directory_slots\n page_header[:n_dir_slots]\n end",
"def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end",
"def num_pages\n (@total_entries.to_i / per_page.to_f).ceil\n end",
"def inodes_per_page\n (size - pos_inode_array - 10) / Innodb::Inode::SIZE\n end",
"def getNumberOfPages(doc)\n numberOfPages = 1\n\n doc.search(\"Document > View > ScrollView > VBoxView > View > MatrixView > VBoxView:nth(0) > HBoxView > TextView > SetFontStyle > b\").each do |e|\n # Parse the last number in the string, e.g. the 99 in \"Page 3 of 99\"\n numberOfPages = e.inner_html[/[0-9]+$/].to_i\n end\n\n return numberOfPages\nend",
"def showSizes(filename)\n if File.exists?(filename)\n puts(File.stat(filename).size)\n elsif File.directory?(filename)\n puts(Dir.entries(filename).select {|f| !File.directory? f}.size)\n end\nend",
"def get_page_count\n first_page = Habr::open_page(Habr::Links.favorites(@userslug))\n count = 1\n\n last_page_link = first_page.xpath(\".//*[@id='nav-pages']/li/noindex/a\").first\n\n if last_page_link\n count = get_page_number_from_url(last_page_link[:href])\n else # no last page link found (that means fav pages count <= 6)\n page_urls = first_page.css(\"#nav-pages>li>a\").map { |link| link[:href] }\n page_numbers = page_urls.map { |url| get_page_number_from_url(url) }\n count = page_numbers.max unless page_numbers.empty?\n end\n\n count\n end",
"def count_objects\n\n count = 0\n\n Find.find(@basepath) do |path|\n\n next unless File.exist? path\n next if File.stat(path).directory?\n\n count += 1 if path[-5..-1] == '.yaml'\n end\n\n count\n end",
"def depth\n @locals.size\n end",
"def num_documents_include_tree_children\n num_documents_include_tree_children_rec( self )\n end",
"def num_boxes\n num_elements(\".navbox\")\n end",
"def get_total_length(filenames)\n shell_formatted_filenames = Shellwords.join filenames\n res = `afinfo -b #{shell_formatted_filenames}` # total info\n length = 0\n res.lines{|l| length = length + l.split.first.to_f if l.split.first.to_f}\n length\n end",
"def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end",
"def doc_stats collection\n visible = collection.select { |item| item.display? }\n [visible.length, visible.count { |item| not item.documented? }]\n end",
"def page_count\n @page_counter\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def test_run_num_folders\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(6,f.sub_folders.length) #note that there are 6 sub folders\n\tend",
"def ListView_GetCountPerPage(hwndLV) send_listview_message(hwndLV, :GETCOUNTPERPAGE) end",
"def num_products\n leftbar_el = get_el(doc.css(\"#navigator_bar\"))\n return 0 if leftbar_el.nil?\n leftbar = leftbar_el.content.to_s\n product_phrase = leftbar.match('Browsing \\d+ ').to_s\n num_products = product_phrase.match('\\d+').to_s\n return num_products.to_i\n end",
"def page_count\n @total_pages\n end",
"def file_counter\n Dir.glob(File.join(\"Goal/\", '**', '*')).select { |file| File.file?(file) }.count + 1\nend",
"def number_of_applications\n\t\treturn self.appTemplates.size\n\tend",
"def count_number_of_galleries(_browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n Log.logger.info(\"Counting the number of galleries present on the galleries first page.\")\n nog = wait.until { _browser.find_elements(:css => 'div#main div.media-gallery-item') }.size\n return nog\n end",
"def total_pages\n -1\n end",
"def page_width\n cur_page.page_width\n end",
"def get_page_number\n # this is the normal case; masterfile and unit share same metadata record\n # so page number will match the numbering sequence of the filename\n page = filename.split(\"_\")[1].split(\".\")[0].to_i\n # if metadata_id == unit.metadata_id\n if is_clone?\n mf_id = original_mf_id\n page = MasterFile.find(mf_id).filename.split(\"_\")[1].split(\".\")[0].to_i\n end\n # else\n # # this master file has been assigned to a separate metadata record. the\n # # page number in the filename does not reflect the actual page num. Count\n # # masterfiles owned by metadata record to determine\n # page = 1\n # metadata.master_files.each do |mf|\n # if mf.id == id\n # break\n # else\n # page += 1\n # end\n # end\n # end\n return page\n end",
"def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end",
"def pages_left\n self.page_count - self.current_page\n end",
"def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end"
] | [
"0.6558865",
"0.65131193",
"0.64951456",
"0.6390861",
"0.6306491",
"0.6246783",
"0.61858934",
"0.61601436",
"0.6110007",
"0.605916",
"0.6039908",
"0.6034674",
"0.6034674",
"0.6027493",
"0.60273004",
"0.6017438",
"0.6015979",
"0.60118747",
"0.6000388",
"0.59907424",
"0.5989372",
"0.59798425",
"0.59578246",
"0.5945899",
"0.5920469",
"0.5916047",
"0.5909406",
"0.5909406",
"0.5900806",
"0.5899312",
"0.5898929",
"0.5890275",
"0.58764035",
"0.5825872",
"0.58233565",
"0.58116156",
"0.5804551",
"0.5801683",
"0.57947767",
"0.57947767",
"0.57947767",
"0.57947767",
"0.57937855",
"0.57750386",
"0.5766702",
"0.5738299",
"0.572264",
"0.57223326",
"0.5717862",
"0.57090473",
"0.5704448",
"0.5699405",
"0.5692294",
"0.5688588",
"0.5675425",
"0.5673248",
"0.56724966",
"0.56715333",
"0.56651545",
"0.5656817",
"0.56564057",
"0.56545794",
"0.56534123",
"0.5640576",
"0.56295854",
"0.5623886",
"0.56172574",
"0.5616405",
"0.55988544",
"0.5598182",
"0.55955344",
"0.55790806",
"0.5572446",
"0.5558861",
"0.5551282",
"0.554999",
"0.5543103",
"0.55374014",
"0.5531536",
"0.55259246",
"0.55178636",
"0.5517552",
"0.5508851",
"0.5508085",
"0.5491967",
"0.54915965",
"0.54915965",
"0.54915965",
"0.54901356",
"0.54868686",
"0.5485024",
"0.54846835",
"0.54732877",
"0.5470436",
"0.5469496",
"0.546815",
"0.5466874",
"0.5464772",
"0.54606265",
"0.54547226",
"0.54506665"
] | 0.0 | -1 |
Update the main window with the loaded files and directories. Also update the header. | def draw_items
main.newpad items
@displayed_items = items[current_page * max_items, max_items]
main.display current_page
header_l.draw_path_and_page_number path: current_dir.path, current: current_page + 1, total: total_pages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\[email protected] self, @wrapped_object, @window, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\[email protected]_text(CP::Vec2.new(352,100), \"ERROR: See terminal for details. Step back to start time traveling.\")\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\[email protected] @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def load_dir(dir)\r\n if dir\r\n begin\r\n @conn.chdir(dir)\r\n rescue\r\n thud('No ' + dir, $!)\r\n end\r\n @statuslab.configure('text' => \"[Loading \" + dir + \"]\")\r\n else\r\n @statuslab.configure('text' => '[Loading Home Dir]')\r\n end\r\n update\r\n\r\n # Get the list of files.\r\n files = [ ]\r\n dirs = [ ]\r\n sawdots = false\r\n @conn.list() do |line|\r\n # Real lines start with the perm bits. And we don't want specials.\r\n if line =~ /^[\\-d]([r\\-][w\\-][x\\-]){3}/\r\n # Extract the useful parts, toss the bones. The limit keeps us from\r\n # dividing file names containing spaces.\r\n parts = line.split(/\\s+/, 9)\r\n if parts.length >= 9\r\n fn = parts.pop()\r\n sawdots = true if fn == '..'\r\n if parts[0][0..0] == 'd'\r\n dirs.push(fn)\r\n else\r\n files.push(fn)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # Add .. if not present, then sort the list.\r\n dirs.push('..') unless sawdots\r\n files.sort!\r\n dirs.sort!\r\n\r\n # Clear the old contents from the directory listing box.\r\n @listarea.configure('state' => 'normal')\r\n @listarea.delete('1.0', 'end')\r\n\r\n # Fill in the directories. Bind for directory load (us).\r\n ct = 0\r\n while fn = dirs.shift\r\n tagname = \"fn\" + ct.to_s\r\n @listarea.insert('end', fn+\"\\n\", tagname)\r\n @listarea.tag_configure(tagname, 'foreground' => '#4444FF')\r\n @listarea.tag_bind(tagname, 'Button-1', \r\n proc { |f| self.load_dir(f) }, fn)\r\n @listarea.tag_bind(tagname, 'Enter', \r\n proc { |t| self.recolor(t, '#0000aa') },\r\n tagname)\r\n @listarea.tag_bind(tagname, 'Leave', \r\n proc { |t| self.recolor(t, '#4444ff') },\r\n tagname)\r\n ct += 1\r\n end\r\n\r\n # Fill in the files. Bind for download.\r\n while fn = files.shift\r\n tagname = \"fn\" + ct.to_s\r\n @listarea.insert('end', fn+\"\\n\", tagname)\r\n @listarea.tag_configure(tagname, 'foreground' => 'red')\r\n @listarea.tag_bind(tagname, 'Button-1', \r\n proc { |f| self.dld_file(f) }, fn)\r\n @listarea.tag_bind(tagname, 'Enter', \r\n proc { |t| self.recolor(t, '#880000') },\r\n tagname)\r\n @listarea.tag_bind(tagname, 'Leave', \r\n proc { |t| self.recolor(t, 'red') },\r\n tagname)\r\n ct += 1\r\n end\r\n\r\n # Lock it up so the user can't mess with it.\r\n @listarea.configure('state' => 'disabled')\r\n\r\n # Update the status label.\r\n begin\r\n loc = @conn.pwd()\r\n rescue\r\n thud('PWD Failed', $!)\r\n loc = '???'\r\n end\r\n @statuslab.configure('text' => loc)\r\n end",
"def refresh\n @window.resize(height, width)\n @window.move(top, left)\n @window.clear\n @window.bkgd(1) # even background hack\n buffer_content if @content.is_a?(Proc)\n print_buffer\n draw_border\n @window.noutrefresh\n visible_children.each(&:refresh)\n end",
"def update_gui\n unless app.disposed?\n app.flush\n app.real.redraw\n end\n end",
"def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n @help_window.set_text(@help_text)\r\n # Make save file window\r\n @savefile_windows = []\r\n for i in 0..3\r\n @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))\r\n end\r\n @savefile_windows[@file_index].selected = true\r\n end",
"def refresh\n\t\t\[email protected]\n\t\t\[email protected] { |w| w.refresh if w.visible? }\n\t\tend",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t# puts \"loader: update\"\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\tputs \"current turn: #{@turn}\"\n\t\t\t\t\t@time_travel_i = @turn\n\t\t\t\t\t\n\t\t\t\t\tsignal = @wrapped_object.update @window, @turn\n\t\t\t\t\t\n\t\t\t\t\[email protected] @turn, @wrapped_object\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif signal == :finished\n\t\t\t\t\t\tputs \"saving history to file...\"\n\t\t\t\t\t\tFile.open(@window.data_dir/'history.log', \"w\") do |f|\n\t\t\t\t\t\t\tf.puts @history\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tself.finish()\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# if you hit certain counter thresholds, you should pause for a bit, to slow execution down. that way, you can get the program to run in slow mo\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# # jump the execution back to an earlier update phase\n\t\t\t\t\t# # (this is basically a goto)\n\t\t\t\t\t# i = @wrapped_object.update_counter.current_turn\n\t\t\t\t\t# if i > 30\n\t\t\t\t\t# \t @wrapped_object.update_counter.current_turn = 1\n\t\t\t\t\t# \t @wrapped_object.regenerate_update_thread!\n\t\t\t\t\t# end\n\t\t\t\t\[email protected] @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def update\n super\n update_menu_background\n @command_window.update\n @gold_window.update\n @status_window.update\n if @submenu_window\n @submenu_window.update\n @submenu_window.dispose if @submenu_window.openness == 0\n @submenu_window = nil if @submenu_window.disposed?\n end\n if @command_window.active\n update_command_selection\n elsif @status_window.active\n update_actor_selection\n elsif @submenu_window.active\n update_submenu_selection\n end\n end",
"def refresh()\n self.contents.clear\n @cHeaders.each() { |cHeader| cHeader.draw() }\n end",
"def refresh\n @window.refresh\n end",
"def window_update(oline)\n if oline != nil\n #text = \"\"\n @last_color = 0\n @contents_x = 0\n @contents_y = 0\n @biggest_text_height = 0\n @cControlsList.clear()\n for l in oline\n next if l == nil\n converted_line = convert_special_characters(l)\n generate_controls(converted_line)\n new_line\n end\n\n # Changes contents size for scrolling\n self.contents.dispose\n self.contents = Bitmap.new(self.width - 32, [self.height - 32, @contents_y].max)\n self.oy = 0\n end\n \n refresh()\n end",
"def display_dir_content(dir_name)\n new_widget = @gui_factory.new_widget('ShowDir', @main_widget)\n new_widget.set_dir_name(dir_name, @data.dir_info(dir_name))\n new_widget.show\n end",
"def main_window ; end",
"def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end",
"def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end",
"def run\n @main_frame.destroy\n @main_frame = TkFrame.new(@root).pack('padx'=>10, 'pady'=>10)\n self.make_header\n self.make_footer\n self.make_hand\n self.make_discards\n Thread.new{Tk.mainloop()}\n end",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def window_update(text)\n if text != nil\n @cTitle.text = text\n end\n refresh()\n end",
"def window_update(text)\n if text != nil\n @cTitle.text = text\n end\n refresh()\n end",
"def window_update(save_data)\n if save_data != nil\n @save_data = save_data\n if save_data.used\n # DRAW SCREENSHOT\n if Wora_NSS::SCREENSHOT_IMAGE \n if [email protected]_bitmap.nil?\n @ucScreenshot.cImage.img_bitmap.dispose\n end\n @ucScreenshot.cImage.img_bitmap = Bitmap.read_png(save_data.screenshot_stream)\n @ucScreenshot.cImage.src_rect = Rect.new((@ucScreenshot.cImage.img_bitmap.width-@ucScreenshot.cImage.rect.width)/2,\n (@ucScreenshot.cImage.img_bitmap.height-@ucScreenshot.cImage.rect.height)/2,\n @ucScreenshot.cImage.rect.width, @ucScreenshot.cImage.rect.height)\n end\n #else \n # if SWAP_TILE and $game_switches[SWAP_TILE_SWITCH]\n # create_swaptilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # else\n # create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # end\n #end\n \n # DRAW GOLD\n if Wora_NSS::DRAW_GOLD\n @ucGold.cLabel.text = save_data.game_par.gold\n end\n \n # DRAW PLAYTIME\n if Wora_NSS::DRAW_PLAYTIME\n @total_sec = save_data.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n end\n \n # DRAW LOCATION\n if Wora_NSS::DRAW_LOCATION\n @ucLocation.cValue.text = save_data.game_map.name\n end\n \n # DRAW FACE & Level & Name\n @ucCharFacesList.clear()\n save_data.game_par.members.each_index do |i|\n actor = save_data.game_act[save_data.game_par.members[i].id]\n x_base = (i*100) + (i*16)\n @ucCharFacesList.push(UCSaveCharStatus.new(self, actor, Rect.new(x_base, 208, 100, 182)))\n end\n end\n end\n refresh()\n end",
"def window_update(save_data)\n if save_data != nil\n @save_data = save_data\n if save_data.used\n # DRAW SCREENSHOT\n if Wora_NSS::SCREENSHOT_IMAGE \n if [email protected]_bitmap.nil?\n @ucScreenshot.cImage.img_bitmap.dispose\n end\n @ucScreenshot.cImage.img_bitmap = Bitmap.read_png(save_data.screenshot_stream)\n @ucScreenshot.cImage.src_rect = Rect.new((@ucScreenshot.cImage.img_bitmap.width-@ucScreenshot.cImage.rect.width)/2,\n (@ucScreenshot.cImage.img_bitmap.height-@ucScreenshot.cImage.rect.height)/2,\n @ucScreenshot.cImage.rect.width, @ucScreenshot.cImage.rect.height)\n end\n #else \n # if SWAP_TILE and $game_switches[SWAP_TILE_SWITCH]\n # create_swaptilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # else\n # create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # end\n #end\n \n # DRAW GOLD\n if Wora_NSS::DRAW_GOLD\n @ucGold.cLabel.text = save_data.game_par.gold\n end\n \n # DRAW PLAYTIME\n if Wora_NSS::DRAW_PLAYTIME\n @total_sec = save_data.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n end\n \n # DRAW LOCATION\n if Wora_NSS::DRAW_LOCATION\n @ucLocation.cValue.text = save_data.game_map.name\n end\n \n # DRAW FACE & Level & Name\n @ucCharFacesList.clear()\n save_data.game_par.members.each_index do |i|\n actor = save_data.game_act[save_data.game_par.members[i].id]\n x_base = (i*100) + (i*16)\n @ucCharFacesList.push(UCSaveCharStatus.new(self, actor, Rect.new(x_base, 208, 100, 182)))\n end\n end\n end\n refresh()\n end",
"def refresh\n #==========================================================================\n # Here we set the Y-origin for the window's display to 0, so that the new\n # page will display from the top even if the player had scrolled all the\n # way to the bottom of the previous page. We also build the contents for\n # the current page, draw the page number display, and then draw whatever\n # the page is intended to contain. When creating a child window for this\n # class, make sure to create a draw_page# method for each page in the\n # window. I've set things up so that a page will remain blank (or display\n # its text from @pagetext, if it has any) if the method doesn't exist\n # rather than throwing an error and crashing, but that's no excuse to\n # leave a poor little page without a handler! Well, unless you're just\n # displaying text, but still. Try to be creative! You can create\n # encyclopedias with pictures, or magazines with articles set in various\n # column styles, or dozens of other things! Don't limit yourself to just\n # plain books - though those are good, too.\n #==========================================================================\n self.oy = 0\n create_contents and draw_scroll\n send(\"draw_page#{@page}\")\n return true\n end",
"def reload!\n @boxes.clear\n\n Dir.open(@directory) do |dir|\n dir.each do |d|\n next if d == \".\" || d == \"..\" || [email protected](d).directory?\n @boxes << Box.new(d, @directory.join(d), @action_runner)\n end\n end\n end",
"def window_update(items)\n @data = []\n for i in @data.size .. 4-1\n @data.push(nil)\n end\n \n if items != nil\n index = 0\n for item in items\n @data[index] = item\n index += 1\n end\n end\n \n @item_max = @data.size\n create_contents()\n @cLabelsList.clear()\n for i in 0..@item_max-1\n @cLabelsList.push(create_item(i))\n end\n refresh()\n end",
"def refresh\n @all_window.each.with_index do |window, i|\n window.opacity = (i == @index ? 255 : 128)\n end\n current_window = @all_window[@index]\n return unless current_window\n last_y = current_window.y + current_window.height + 2\n if last_y > @viewport.rect.height\n oy = @viewport.rect.height - last_y - 48\n if WINDOW_VIEWPORT_INCOMPATIBILITY\n @all_window.move(0, oy)\n else\n @viewport.oy = -oy\n @background_sprite.oy = oy\n end\n elsif WINDOW_VIEWPORT_INCOMPATIBILITY && (last_y = current_window.y - 2) < 0\n @all_window.move(0, -last_y)\n elsif !WINDOW_VIEWPORT_INCOMPATIBILITY\n @background_sprite.oy = @viewport.oy = 0\n end\n end",
"def update_detail_window\n return if item.nil? || @detail_window.nil? || self.active == false\n @detail_window.update_header(item.header, item.slot)\n end",
"def main()\n main_menu(SHOW_HEADER);\n end",
"def window_update(actor)\n if actor != nil\n bodyImg = MENU_CONFIG::BODY_IMAGES[actor.id]\n bitmap = Cache.picture(bodyImg.filename)\n @cBackCharImage.img_bitmap = bitmap\n @cBackCharImage.src_rect = Rect.new(bodyImg.src_rect.x, bodyImg.src_rect.y, \n bitmap.width, bitmap.height)\n end\n refresh()\n end",
"def update\n\n\t\t# This can be a troublesome call to do anything heavyweight, as it is called on window moves, resizes, and display config changes.\n\t\t# So be careful of doing too much here.\n\n\t\t@message_time\t= get_elapsed_time\n\n\t\tupdate_message_string\n\n\t\t@current_context.update\n\n\t\tunless inLiveResize\t\t\t\t# if not doing live resize\n\t\t\tupdate_info_string\t\t\t\t\t# to get change in renderers will rebuild string every time (could test for early out)\n\t\t\t#get_current_opengl_capacities\t\t# this call checks to see if the current config changed in a reasonably lightweight way ...\n\t\t\t\t\t\t\t\t\t\t\t\t# ... to prevent expensive re-allocations\n\t\tend\n\n\tend",
"def init_gui\r\n pathFile = \"\"\r\n pathCreate = \"\"\r\n fixed = Gtk::Fixed.new\r\n add fixed\r\n label = Gtk::Label.new(\"Xml - File Path:\")\r\n label.set_size_request 100,30\r\n button = Gtk::FileChooserButton.new(\"Search\", Gtk::FileChooser::ACTION_OPEN)\r\n button.set_size_request 280,30\r\n filter = Gtk::FileFilter.new\r\n filter.add_pattern('*.xml')\r\n button.add_filter(filter)\r\n button.signal_connect('selection_changed') do |w|\r\n pathFile = w.filename.to_s\r\n arrayPath = pathFile.split('\\\\')\r\n pathCreate = \"\"\r\n for i in 0..arrayPath.length-2\r\n pathCreate+=arrayPath[i]+\"\\\\\"\r\n end\r\n pathCreate+=\"files\\\\\"\r\n end\r\n labelDB = Gtk::Label.new(\"Name Database:\")\r\n entryDB = Gtk::Entry.new\r\n entryDB.set_width_chars 45\r\n entryDB.set_text \"\"\r\n labelDBServer = Gtk::Label.new(\"Server Database:\")\r\n entryDBServer = Gtk::Entry.new\r\n entryDBServer.set_width_chars 45\r\n entryDBServer.set_text \"\"\r\n labelDBUser = Gtk::Label.new(\"User Database:\")\r\n entryDBUser = Gtk::Entry.new\r\n entryDBUser.set_width_chars 45\r\n entryDBUser.set_text \"\"\r\n labelDBPass = Gtk::Label.new(\"Pass Database:\")\r\n entryDBPass = Gtk::Entry.new\r\n entryDBPass.set_width_chars 45\r\n entryDBPass.visibility = false\r\n entryDBPass.invisible_char = 42\r\n labelEmail = Gtk::Label.new(\"Admin Email:\")\r\n entryEmail = Gtk::Entry.new\r\n entryEmail.set_width_chars 45\r\n entryEmail.set_text \"\"\r\n btGenerate = Gtk::Button.new \"Generate\"\r\n btGenerate.signal_connect \"clicked\" do\r\n if pathFile == \"\" or pathCreate == \"\"\r\n showMessage(\"Debe seleccionar el archivo de origen\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDB.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBServer.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el servidor de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBUser.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de usuario de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryEmail.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el email del administrador\",Gtk::MessageDialog::ERROR,self)\r\n else\r\n readPollFileXml(pathFile,pathCreate,entryDB.text.strip, entryDBServer.text.strip,entryDBUser.text.strip,entryDBPass.text.strip,entryEmail.text.strip)\r\n showMessage(\"Se ha creado el formulario Satisfactoriamente en la ruta: \"+pathCreate,Gtk::MessageDialog::INFO,self)\r\n Gtk.main_quit\r\n end\r\n end\r\n btCancel = Gtk::Button.new \"Cancel\"\r\n btCancel.signal_connect \"clicked\" do\r\n Gtk.main_quit\r\n end\r\n fixed.put label,10,10\r\n fixed.put labelDB,15,58\r\n fixed.put labelDBServer,15,103\r\n fixed.put labelDBUser,24,148\r\n fixed.put labelDBPass,24,193\r\n fixed.put labelEmail,30,238\r\n fixed.put button,105,10\r\n fixed.put entryDB,105,55\r\n fixed.put entryDBServer,105,100\r\n fixed.put entryDBUser,105,145\r\n fixed.put entryDBPass,105,190\r\n fixed.put entryEmail,105,235\r\n fixed.put btGenerate,145,275\r\n fixed.put btCancel,205,275\r\n end",
"def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n \n #Filters used on the choosers widgets\n @filter = Gtk::FileFilter.new\n @filter.name = 'Supported Files'\n @filter.add_pattern('*.in')\n @filter.add_pattern('*.rtf')\n @filter.add_pattern('*.xml')\n @filter.add_pattern('*.txt')\n\n @mainWindow = self\n\n #array with the texts\n @texts = []\n @scrolls = []\n @number_of_texts = 0\n\n # Manage the project\n @project = Project.new\n\n #Tag Manager\n @tagManager = TagManager.new\n \n #Manage the table and texts\n @main_table = @glade.get_widget('mainTable')\n\n #Manage the tree view\n @treeView = TreeV.new @project, @mainWindow\n @glade.get_widget('mainDiv').pack_start @treeView.view, false, false, 0\n @glade.get_widget('mainDiv').reorder_child @treeView.view, 0\n @glade.get_widget('mainDiv').show_all\n end",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end",
"def run_normal\n welcome_header\n main_menu \n end",
"def reload!\n initialize(@file_root)\n end",
"def load_all\n html_path = self.most_recent_project_html\n html_resource = html_path.gsub(self.source_dir,\"\")\n self.file_mapper.add_file(html_resource, \"#{self.index_file}.html\")\n load_resources(html_path)\n end",
"def update_window_title_and_progressbar\n all = @all_failed_questions.size\n\n # find index of current question, set to 0 if not found\n current = @all_failed_questions.index { |q| q[1] == current_question}\n current ||= -1\n current += 1\n\n corr = @corrected.size\n\n if @prog\n count = \"Fixed: #{corr} / #{all}\"\n if all == count || all == 0 && count == 0\n @prog.text = \"All done!\"\n @prog.fraction = 1\n else\n @prog.text = count\n @prog.fraction = corr.to_f / all.to_f\n end\n end\n\n title = []\n title << \"PEST: Fix\"\n title << \"Viewing: #{current} / #{all}\"\n title << count if count\n if current_question\n title << \"Question: #{current_question[\"question\"].db_column}\"\n title << current_path\n end\n @window.set_title title.join(\" | \")\n end",
"def window_update(saves)\n @data = []\n if saves != nil\n for save in saves\n if save != nil\n @data.push(save)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucSavesList.clear()\n for i in 0..@item_max-1\n @ucSavesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def window_update(saves)\n @data = []\n if saves != nil\n for save in saves\n if save != nil\n @data.push(save)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucSavesList.clear()\n for i in 0..@item_max-1\n @ucSavesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def main_window\r\n super\r\n # Make main command window\r\n main_command_window\r\n # Make play time window\r\n @playtime_window = Window_PlayTime.new\r\n @playtime_window.x = 0\r\n @playtime_window.y = 224\r\n # Make steps window\r\n @steps_window = Window_Steps.new\r\n @steps_window.x = 0\r\n @steps_window.y = 320\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 0\r\n @gold_window.y = 416\r\n # Make status window\r\n @status_window = Window_MenuStatus.new\r\n @status_window.x = 160\r\n @status_window.y = 0\r\n end",
"def load_file\n panel = NSOpenPanel.new\n panel.setCanChooseFiles(true)\n panel.setCanChooseDirectories(false)\n panel.runModalForTypes([\"qif\"])\n @file = panel.filename\n unless @file.nil?\n @file_label.text = \"File: #{@file}\"\n log(\"File successfully loaded\")\n end\n end",
"def window_update(views)\n @data = []\n if views != nil\n for view in views\n if view != nil\n @data.push(view)\n end\n end\n @item_max = @data.size\n create_contents()\n @viewsList.clear()\n for i in 0..@item_max-1\n @viewsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def window_update(views)\n @data = []\n if views != nil\n for view in views\n if view != nil\n @data.push(view)\n end\n end\n @item_max = @data.size\n create_contents()\n @viewsList.clear()\n for i in 0..@item_max-1\n @viewsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n @selected_show_id = nil\n @cbShow = @glade.get_widget(\"cbShows\")\n @txtFile = @glade.get_widget(\"txtSelectedFile\")\n @progress = @glade.get_widget(\"ctlProgress\")\n @btnOK = @glade.get_widget(\"btnOK\")\n @btnCancel = @glade.get_widget(\"btnCancel\")\n @chkShowPDF = @glade.get_widget(\"chkShowPDF\")\n @log = Log.instance.log\n begin\n @db = RMSCDB.new\n rescue\n puts \"Error connecting to the data base: #{ $!.error }\"\n @log.error \"Error connecting to the data base: #{ $!.error }\"\n @db = nil\n end\n load_shows\n \n @mainWindow = @glade.get_widget(\"mainWindow\")\n @mainWindow.show\n @log.info \"Started #{$0} at #{Time.now}\"\n end",
"def update\r\n super\r\n # Try to load the new file if the name is different\r\n if @picture_name != @picture.name\r\n @picture_name = @picture.name\r\n load_bitmap\r\n end\r\n # Don't update if the name is empty\r\n if @picture_name.empty?\r\n self.visible = false\r\n return\r\n end\r\n self.visible = true\r\n\r\n update_properties\r\n update_gif if @gif_handle\r\n end",
"def show_window\n\t\tif self.visible?\n\t\t\tself.bring_to_front\n\t\telse\n\t\t\t# We use set_file here to prevent Macs loading the whole dialog when the\n\t\t\t# plugin loads. No need to populate the dialog and use extra resources\n\t\t\t# if it will never be used.\n\t\t\tfilepath = File.join(PATH, 'webdialog/ui_manager.html')\n\t\t\tself.set_file(filepath)\n\t\t\tif PLUGIN.is_mac?\n\t\t\t\tself.show_modal\n\t\t\telse\n\t\t\t\tself.show\n\t\t\tend\n\t\tend\n\tend",
"def initialize(parent)\n\t\t@assets = MenuAssets.getInstance\n\t\t@gtkObject = Gtk::Box.new :vertical\n\n\t\tmodel = Gtk::ListStore.new(String)\n\n\t\t@treeview = Gtk::TreeView.new(model)\n\t\tsetup_tree_view(@treeview)\n\n\t\tsave = Sauvegardes.new(\"./Game/Core/Saves/\",\"*.yml\")\n\n\t\tdata = save.chargerRepertoire\n\n\t\t# swapped = true\n\t\t# while swapped do\n\t\t# \tswapped = false\n\t\t# \t0.upto(data.size-2) do |i|\n\t\t# \t\tif (Date.parse(data[i].split(\"&\")[2][0...10]) <=> Date.parse(data[i].split(\"&\")[2][0...10]))<0\n\t\t# \t\t\tdata[i], data[i+1] = data[i+1], data[i]\n\t\t# \t\t\tswapped = true\n\t\t# \t\tend\n\t\t# \tend\n\t\t# end\n\n\t\tdata = data.sort{|n, m|\n\t\t\tn.split(\"&\").last <=> m.split(\"&\").last\n\t\t}.reverse\n\n\n\n\t\tdata.each_with_index do |v|\n\t\t iter = model.append\n\t\t model.set_value(iter, 0, v)\n\t\tend\n\n\t\tbox2 = Gtk::Box.new(:vertical, 10)\n\t\tbox2.border_width = 10\n\t\[email protected]_start(box2, :expand => true, :fill => true, :padding => 0)\n\n\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\tscrolled_win.add_with_viewport(@treeview)\n\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\tbox2.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\n\t\t# box2 = Gtk::Box.new :horizontal\n\t\t# box2.border_width = 10\n\n\t\tbox2 = Gtk::ButtonBox.new :horizontal\n\t\tbox2.layout = :center\n\n\t\tbLoad = MenuItemUi.new(:load, @assets)\n\t\tbLoad.setOnClickEvent(Proc.new{\n\t\t\titer = @treeview.selection.selected\n\t\t\tif(iter != nil)\n\t\t\t\tindex = save.getIndex(model.get_value(iter,0)) #recuperation index\n\t\t\t\tinfos = save.getInfos(index)\n\t\t\t\tparent.changeBackground(\"ecranDeJeu\")\n\t\t\t\tif infos[0] == \"Ranked\"\n\t\t\t\t\tparent.display(RankedMode.new(nil,parent,infos.join(\"&\")))\n\t\t\t\telsif infos[0] == \"TimeTrial\"\n\t\t\t\t\tpath = File.dirname(__FILE__) + \"/../Game/Core/Saves/\"+infos.join(\"&\")\n\t\t\t\t\tdata = YAML.load_file(path)\n\t\t\t\t\tnbGrids = data[\"nbGames\"]\n\t\t\t\t\tdifficulty = :easy\n\t\t\t\t\tif nbGrids > 5\n\t\t\t\t\t\tdifficulty = :intermediate\n\t\t\t\t\telsif nbGrids > 10\n\t\t\t\t\t\tdifficulty = :hard\n\t\t\t\t\tend\n\t\t\t\t\tparent.display(TimeTrialMode.new(parent,infos.join(\"&\"),difficulty,nbGrids ))\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\t\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à charger.\\t\\n\\n\"))\n\t\t\t\t\telse\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to load.\\t\\n\\n\"))\n\t\t\t\t\tend\n\t\t\t\tdialog.show_all\n\t\t\tend\n\t\t})\n\n\t\tbox2.add(bLoad.gtkObject)\n\n\t\tbDelete = MenuItemUi.new(:delete, @assets)\n\t\tbDelete.setOnClickEvent(Proc.new{\n\t\t iter = @treeview.selection.selected\n\n\t\tif(iter != nil)\n\t\t index = save.getIndex(model.get_value(iter,0))#recuperation index\n\t\t save.supprimer(index)\n\t\t model.remove(iter)\n\t\telse\n\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à supprimer.\\t\\n\\n\"))\n\t\t\telse\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to delete.\\t\\n\\n\"))\n\t\t\tend\n\t\tdialog.show_all\n\t\tend\n\n\n\n\n\t\t})\n\t\tbox2.add(bDelete.gtkObject)\n\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\t\t# box2 = Gtk::Box.new(:vertical, 10)\n\t\t# box2.border_width = 10\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\n\t\tbRetour = MenuItemUi.new(:back,@assets)\n\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\tparent.display(parent.mainMenu)\n\t\t})\n\t\tbox2.add(bRetour.gtkObject)\n\t\[email protected]_start(box2, :expand => false, :fill => true, :padding => 0)\n\tend",
"def exp_window_update(exp)\n @victory_main.redraw_exp(exp)\n create_leveled_windows\n pack_and_send\n end",
"def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend",
"def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend",
"def set_main_widget(main_widget)\n @main_widget = main_widget\n # Initialize it\n invalidate_current_loaded_file\n end",
"def initialize\n\t\tsuper \"Rune Editor\"\n\n\t\tself.initGUI\n\t\tself.initProperties\n\t\tself.updateConfigs\n\t\tself.resetOpenFile\n\t\tself.pack\n\t\[email protected] #start out with a blank textpane\n\n\t\tself.updateFooterWCText\n\t\tself.setBackgroundStyle\n\n\t\t# FIXME: Hack to get word count to update all the time\n\t\t# Find a way to do better!\n\t\tThread.new do\n\t\t\twhile true do\n\t\t\t\tself.updateFooterWCText\n\t\t\t\tputs getCurrentFile\n\t\t\t\tputs getCurrentDocument\n\t\t\t\tsleep 2\n\t\t\tend\n\t\tend\n\n\n\tend",
"def update_basic(main = false)\n Graphics.update unless main # Update game screen\n Input.update unless main # Update input information\n $game_system.update # Update timer\n \n update_window_movement()\n\n @help_window.update\n @victory_item_window.update\n @exp_window.update\n @gold_window.update\n for w in @victory_char_info_windows\n w.update\n end\n for w in @victory_new_skill_windows\n w.update\n end\n for w in @victory_level_up_windows\n w.update\n end\n\n if !@victory_item_window.visible\n update_exp_input()\n else\n update_drops_input()\n end\n end",
"def refreshUI; @apPanel.redrawwin; @entryPanel.redrawwin; @entryListBox.refresh; @apListBox.refresh end",
"def main_files\n retrieve_files_in_main_dir\n end",
"def InitializeComponent()\n\t\t\tself.@checkFilesExistCheckBox = System.Windows.Forms.CheckBox.new()\n\t\t\tself.@filesInMenuLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@recentFilesCountTextBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@listLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@topGbox = System.Windows.Forms.GroupBox.new()\n\t\t\tself.@recentFilesLbl = System.Windows.Forms.Label.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# checkFilesExistCheckBox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(27, 72)\n\t\t\[email protected] = \"checkFilesExistCheckBox\"\n\t\t\[email protected] = System.Drawing.Size.new(185, 17)\n\t\t\[email protected] = 4\n\t\t\[email protected] = \"Check that files exist before listing\"\n\t\t\[email protected] = true\n\t\t\t# \n\t\t\t# filesInMenuLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(147, 33)\n\t\t\[email protected] = \"filesInMenuLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(96, 24)\n\t\t\[email protected] = 3\n\t\t\[email protected] = \"files in menu\"\n\t\t\t# \n\t\t\t# recentFilesCountTextBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(91, 33)\n\t\t\[email protected] = 50\n\t\t\[email protected] = \"recentFilesCountTextBox\"\n\t\t\[email protected] = System.Drawing.Size.new(40, 20)\n\t\t\[email protected] = 2\n\t\t\[email protected] = \"3\"\n\t\t\t# \n\t\t\t# listLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(27, 33)\n\t\t\[email protected] = \"listLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(55, 16)\n\t\t\[email protected] = 1\n\t\t\[email protected] = \"List\"\n\t\t\t# \n\t\t\t# topGbox\n\t\t\t# \n\t\t\[email protected] = ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)))\n\t\t\[email protected] = System.Drawing.Point.new(80, 5)\n\t\t\[email protected] = \"topGbox\"\n\t\t\[email protected] = System.Drawing.Size.new(370, 8)\n\t\t\[email protected] = 35\n\t\t\[email protected] = false\n\t\t\t# \n\t\t\t# recentFilesLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(9, 5)\n\t\t\[email protected] = \"recentFilesLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(70, 16)\n\t\t\[email protected] = 36\n\t\t\[email protected] = \"Recent Files\"\n\t\t\t# \n\t\t\t# RecentFilesOptionsPage\n\t\t\t# \n\t\t\tself.@AutoScaleDimensions = System.Drawing.SizeF.new(6f, 13f)\n\t\t\tself.@AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\n\t\t\[email protected](self.@checkFilesExistCheckBox)\n\t\t\[email protected](self.@filesInMenuLbl)\n\t\t\[email protected](self.@recentFilesCountTextBox)\n\t\t\[email protected](self.@listLbl)\n\t\t\[email protected](self.@topGbox)\n\t\t\[email protected](self.@recentFilesLbl)\n\t\t\tself.@Name = \"RecentFilesOptionsPage\"\n\t\t\tself.ResumeLayout(false)\n\t\t\tself.PerformLayout()\n\t\tend",
"def window_update(items)\n @data = []\n if items != nil\n for item in items\n if item != nil\n @data.push(item)\n end\n end\n @item_max = @data.size\n create_contents()\n @ucVictoryItemsList.clear()\n for i in 0..@item_max-1\n @ucVictoryItemsList.push(create_item(i))\n end\n end\n\n refresh()\n end",
"def execute(args)\n # Analyze arguments\n remaining_args = @options.parse(args)\n if @display_help\n puts @options\n elsif (remaining_args.size > 2)\n puts 'Please specify just 1 file to be loaded on startup.'\n puts @options\n else\n activate_log_debug(true) if @debug\n log_info 'Loading GUI libraries...'\n require 'gtk2'\n Gdk::Threads.init\n require 'ruby-serial'\n require 'filesrebuilder/Model/Data'\n require 'filesrebuilder/GUIFactory'\n require 'filesrebuilder/GUIcontroller'\n require 'filesrebuilder/_Gtk/_object'\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n gui_factory = GUIFactory.new\n gui_controller = GUIController.new(gui_factory)\n gui_factory.gui_controller = gui_controller\n Gtk::Settings.default.gtk_button_images = true\n log_info 'Executing application...'\n main_widget = gui_factory.new_widget('Main')\n gui_controller.set_main_widget(main_widget)\n main_widget.show\n gui_controller.run_callback_dirline_progress_bars\n gui_controller.load_from_file(remaining_args[0]) if (remaining_args.size == 1)\n Gtk.main\n log_info 'Quitting application...'\n end\n end",
"def main_window\r\n super\r\n # Make windows\r\n @left_window = Window_DebugLeft.new\r\n @right_window = Window_DebugRight.new\r\n @help_window = Window_Base.new(192, 352, 448, 128)\r\n @help_window.contents = Bitmap.new(406, 96)\r\n # Restore previously selected item\r\n @left_window.top_row = $game_temp.debug_top_row\r\n @left_window.index = $game_temp.debug_index\r\n @right_window.mode = @left_window.mode\r\n @right_window.top_id = @left_window.top_id\r\n end",
"def gtk_window\n if Config[:files_use_search]\n @gtk_paned_box\n else\n @gtk_top_box\n end\n end",
"def wrefresh\n Ncurses.wrefresh(@window)\n end",
"def load_hero_file\n clear_message_box\n #ask for file\n @ui.set_colour(DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text('USE CHARACTER FILE?'.ljust(20),1,2)\n @ui.place_text('>'.ljust(20),1,3)\n file_name=nil\n #loop until file is good\n while file_name.nil?\n @ui.place_text(' '*19,2,3)\n file_name = @ui.get_string(2,3)\n #check and try to open file\n if file_name.split('.').last != 'yaml' #needs yaml extention\n @ui.place_text('!REQUIRES YAML EXT'.ljust(20),1,4)\n file_name=nil\n elsif !File.exists?(file_name) #file must exist\n @ui.place_text('!FILE NOT FOUND'.ljust(20),1,4)\n file_name=nil\n else\n hero_data = YAML.load(File.open(file_name))\n if hero_data.is_a? Hash #file must be in a valid yaml format\n #load stats\n hero_data[:stats].each do |stat|\n @stats[stat[0].downcase.to_sym] = stat[1]\n end\n @orig_stats.merge!(@stats) #make a copy\n #load objects\n @objects = hero_data[:objects]\n #load remaining gold (used for final score)\n @gold_count += hero_data[:gold]\n #display heros name\n @ui.place_text(hero_data[:name].center(20), 1, 1, DungeonOfDoom::C_BLACK_ON_WHITE)\n #set magic spell count based on 2 x power of NECRONOMICON and SCROLLS\n book = @objects.find { |object| object[:name]=='NECRONOMICON' }\n if book\n power = book[:power]\n [:super_zap, :santuary, :teleport].each do |spell|\n @spells[spell] = power\n end\n end\n scroll = @objects.find { |object| object[:name]=='SCROLLS' }\n if scroll\n power = scroll[:power]\n [:powersurge, :metamorphosis, :healing].each do |spell|\n @spells[spell] = power\n end\n end\n #set torch power\n torch = @objects.find { |object| object[:name]=='TORCH' }\n @torch_power = torch[:power] if torch\n #find initial potion count\n potion = @objects.find { |object| object[:name]=='POTION' }\n @potions += potion[:count] if potion\n #find initial attack power\n ['2 HAND SWORD','BROADSWORD','SHORTSWORD','AXE','MACE','FLAIL','DAGGER','GAUNTLET'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @attack += object[:power] if object\n end\n @attack += @stats[:strength]\n #find initial defence power\n ['HEAVY ARMOUR','CHAIN ARMOUR','LEATHER SKINS','HEAVY ROBE','GOLD HELMET','HEADPIECE','SHIELD'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @defence += object[:power] if object\n end\n else #all okay!\n @ui.place_text('!FILE BAD FORMAT'.ljust(20),1,4)\n file_name=nil\n end\n end\n end\n end",
"def initial_add(&block)\n @tree.initial_add(&block)\n do_refresh\n\n ## Launch a timer to refresh the file list\n #Gtk.timeout_add(Config[:files_refresh_interval] * 100000) do \n # puts \"Auto-refreshing\"\n # do_refresh\n # true\n #end\n end",
"def files\n self.raise\n click_on_perc(@id, 5.7, 2.5)\n # Return the new window\n return Files.new\n end",
"def window_update(modes)\n @data = []\n if modes != nil\n for mode in modes\n if mode != nil\n @data.push(mode)\n end\n end\n @item_max = @data.size\n create_contents()\n @modesList.clear()\n for i in 0..@item_max-1\n @modesList.push(create_item(i))\n end\n end\n refresh()\n end",
"def remake_window\n self.width = window_width\n self.height = window_height\n create_contents\n end",
"def createMenu\n\n # File menu\n recordAction = @actions.addNew(i18n('Start Download'), self, \\\n { :icon => 'arrow-down', :triggered => :startDownload })\n reloadStyleAction = @actions.addNew(i18n('&Reload StyleSheet'), self, \\\n { :icon => 'view-refresh', :shortCut => 'Ctrl+R', :triggered => :reloadStyleSheet })\n clearStyleAction = @actions.addNew(i18n('&Clear StyleSheet'), self, \\\n { :icon => 'list-remove', :shortCut => 'Ctrl+L', :triggered => :clearStyleSheet })\n quitAction = @actions.addNew(i18n('&Quit'), self, \\\n { :icon => 'application-exit', :shortCut => 'Ctrl+Q', :triggered => :close })\n\n updateScheduleAction = @actions.addNew(i18n('Update Schedule'), @scheduleWin, \\\n { :shortCut => 'Ctrl+U', :triggered => :updateAllFilters })\n\n fileMenu = KDE::Menu.new('&File', self)\n fileMenu.addAction(recordAction)\n fileMenu.addAction(reloadStyleAction)\n fileMenu.addAction(clearStyleAction)\n fileMenu.addAction(updateScheduleAction)\n fileMenu.addAction(quitAction)\n\n\n # settings menu\n playerDockAction = @playerDock.toggleViewAction\n playerDockAction.text = i18n('Show Player')\n configureAppAction = @actions.addNew(i18n('Configure %s') % APP_NAME, self, \\\n { :icon => 'configure', :shortCut => 'F2', :triggered => :configureApp })\n\n settingsMenu = KDE::Menu.new(i18n('&Settings'), self)\n settingsMenu.addAction(playerDockAction)\n settingsMenu.addSeparator\n settingsMenu.addAction(configureAppAction)\n\n\n # Help menu\n aboutDlg = KDE::AboutApplicationDialog.new(KDE::CmdLineArgs.aboutData)\n openAboutAction = @actions.addNew(i18n('About %s') % APP_NAME, self, \\\n { :icon => 'irecorder', :triggered =>[aboutDlg, :exec] })\n openDocUrlAction = @actions.addNew(i18n('Open Document Wiki'), self, \\\n { :icon => 'help-contents', :triggered =>:openDocUrl})\n openReportIssueUrlAction = @actions.addNew(i18n('Report Bug'), self, \\\n { :icon => 'tools-report-bug', :triggered =>:openReportIssueUrl })\n openRdocAction = @actions.addNew(i18n('Open Rdoc'), self, \\\n { :icon => 'help-contents', :triggered =>:openRdoc })\n openSourceAction = @actions.addNew(i18n('Open Source Folder'), self, \\\n { :icon => 'document-open-folder', :triggered =>:openSource })\n\n\n helpMenu = KDE::Menu.new(i18n('&Help'), self)\n helpMenu.addAction(openDocUrlAction)\n helpMenu.addAction(openReportIssueUrlAction)\n helpMenu.addAction(openRdocAction)\n helpMenu.addAction(openSourceAction)\n helpMenu.addSeparator\n helpMenu.addAction(openAboutAction)\n\n # insert menus in MenuBar\n menu = KDE::MenuBar.new\n menu.addMenu( fileMenu )\n menu.addMenu( settingsMenu )\n menu.addSeparator\n menu.addMenu( helpMenu )\n setMenuBar(menu)\n end",
"def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n # Make command window\r\n @command_window = Window_ShopCommand.new\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 480\r\n @gold_window.y = 64\r\n # Make dummy window\r\n @dummy_window = Window_Base.new(0, 128, 640, 352)\r\n # Make buy window\r\n @buy_window = Window_ShopBuy.new($game_temp.shop_goods)\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @buy_window.help_window = @help_window\r\n # Make sell window\r\n @sell_window = Window_ShopSell.new\r\n @sell_window.active = false\r\n @sell_window.visible = false\r\n @sell_window.help_window = @help_window\r\n # Make quantity input window\r\n @number_window = Window_ShopNumber.new\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Make status window\r\n @status_window = Window_ShopStatus.new\r\n @status_window.visible = false\r\n end",
"def update_window(content, options={})\n window_setup\n win = options.delete(:window)\n error = options.delete(:error)\n key = store_content(content)\n self << check_for_window(win, error){ update_window_contents(key, win, options) }\n nil\n end",
"def create_main_index(data)\n create_partials data[:sub_file], data\n data[:header] = read_file(get_header_path(data[:sub_file]))\n data[:footer] = read_file(get_footer_path(data[:sub_file]))\n data[:stylesheetloc] = main_file_stylesheet_locs\n write_data data, 'data'\n system 'erb _templates/_index.html.erb > index.html'\n end",
"def setup_gui\n \n end",
"def load!\n # TODO Don't load a module that's already loaded\n\n # Load the main file\n fname = path(\"#{name}.rb\")\n require fname unless fname.nil?\n\n # Load the basic things usually autoloaded.\n Dir[\"#{@path}/{init,models,routes,helpers}/*.rb\"].each { |f| require f }\n\n # Ensure public/ works\n public_path = path(:public)\n Main.add_public(public_path) unless public_path.nil?\n\n # Add the view path, if it has\n if path(:views)\n paths = [path(:views)]\n paths += Main.multi_views if Main.respond_to?(:multi_views)\n Main.set :multi_views, paths\n end\n end",
"def load_window_icons\n WINDOW_ICON_SIZES.each do |size|\n file = File.join($lib_dir, WINDOW_ICON_FILENAME % [size])\n begin\n @gtk_window_icons << Gdk::Pixbuf.new(file) if File.exist? file\n rescue StandardError => e\n puts e.to_s\n puts \"Problem loading window icon #{file}\"\n end\n end\n end",
"def main_loop\r\n Graphics.update # Update game screen\r\n Input.update # Update input information\r\n main_update # Update scene objects\r\n update # Update Processing\r\n end",
"def c_refresh\n $filterstr ||= \"M\"\n #$files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n $patt=nil\n $title = nil\n display_dir\nend",
"def window_update(image)\n if image != nil\n @ucImage.image = image\n end\n refresh()\n end",
"def thread_invalidate_all_dirlines\n # Find the DirLine\n (@main_widget.get_dest_dirlines + @main_widget.get_src_dirlines).each do |dirline_widget|\n Gtk::idle_add do\n update_dirline(dirline_widget)\n next false\n end\n end\n end",
"def create_header_window\n @header_window = Window_MenuHeader.new(Vocab::LOAD)\n end",
"def addLocationGUI(srcPhoto)\n # Need a symlink to Pashua in this folder too, include and require moved to top\n\n $:.push(File.dirname($0))\n\nconfig = <<end_of_string\n# Set transparency: 0 is transparent, 1 is opaque\n*.transparency=0.95\n\n# Set window title. \"2\" since the second window that appears\n*.title = 2. Add location information based on fileEXIF only\n\n# Introductory text\ntxt.type = text\ntxt.width = 500\ntxt.default = Select the location of the files to which location information[return] based on GPS coordinates in file EXIF are to be added[return] without moving the files\n\n# Photo folder select\n# FIX put in just mounted card when get app to detect mounted cards\nsrcSelect.type = openbrowser\nsrcSelect.label = Select the folder containing the photos:\nsrcSelect.width=550\n# presumably can use a variable\nsrcSelect.default = #{srcPhoto}\n\n\n# Add a cancel button with default label\ncb.type = cancelbutton\n\nend_of_string\n\n # Set the images' paths relative to this file's path / \n # skip images if they can not be found in this file's path\n icon = File.dirname($0) << \"/.icon.png\";\n bgimg = File.dirname($0) << \"/.demo.png\";\n\n if File::exists?(icon) # Display Pashua's icon\n Config << \"img.type = image\n img.x = 530\n img.y = 255\n img.path = #{icon}\n \"\n end\n\n if File::exists?(bgimg) # Display Pashua's icon\n Config << \"bg.type = image\n bg.x = 30\n bg.y = 2\n bg.path = #{bgimg}\n \"\n end\n\n # pashuaReturn = pashua_run config\n res = pashua_run config\n return res\n \nend",
"def main_window\r\n super\r\n # Make windows\r\n @help_window = Window_Help.new\r\n @left_window = Window_EquipLeft.new(@actor)\r\n @right_window = Window_EquipRight.new(@actor)\r\n @item_window1 = Window_EquipItem.new(@actor, 0)\r\n @item_window2 = Window_EquipItem.new(@actor, 1)\r\n @item_window3 = Window_EquipItem.new(@actor, 2)\r\n @item_window4 = Window_EquipItem.new(@actor, 3)\r\n @item_window5 = Window_EquipItem.new(@actor, 4)\r\n # Associate help window\r\n @right_window.help_window = @help_window\r\n @item_window1.help_window = @help_window\r\n @item_window2.help_window = @help_window\r\n @item_window3.help_window = @help_window\r\n @item_window4.help_window = @help_window\r\n @item_window5.help_window = @help_window\r\n # Set cursor position\r\n @right_window.index = @equip_index\r\n refresh\r\n end",
"def window_update(items, dataview=nil)\n @data = []\n if dataview != nil\n items = apply_dataview(dataview, items)\n end\n \n if items != nil\n for item in items\n if item != nil && include?(item)\n @data.push(item)\n if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id\n self.index = @data.size - 1\n end\n end\n end\n @item_max = @data.size\n create_contents()\n @ucItemsList.clear()\n for i in 0..@item_max-1\n @ucItemsList.push(create_item(i))\n end\n end\n refresh()\n end",
"def addMenuBar \n # set up menu layout properties\n menuBar = FXMenuBar.new(self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X) \n # create pointers (to link new 'FXMenuPane' wutg a new 'FXMenuTitle')\n fileMenu = FXMenuPane.new(self) #self refers to the TextEditor window\n about = FXMenuPane.new(self) #self refers to the TextEditor window\n\n #create main menu Items\n FXMenuTitle.new(menuBar, \"File\", :popupMenu => fileMenu) \n FXMenuTitle.new(menuBar, \"About\", :popupMenu => about) \n\n #create sub menue Items\n #under 'File' tab \n newCmd = FXMenuCommand.new(fileMenu, \"new\")\n loadCmd = FXMenuCommand.new(fileMenu, \"Load\")\n saveCmd = FXMenuCommand.new(fileMenu, \"save\") \n exitCmd = FXMenuCommand.new(fileMenu, \"Exit\")\n #under 'About' tab\n aboutCmd = FXMenuCommand.new(about, \"contact us\") \n \n #connect sub menue Items to functions\n newCmd.connect(SEL_COMMAND) do\n @txt.text = \"\"\n end\n\n loadCmd.connect(SEL_COMMAND) do \n dialog = FXFileDialog.new(self, \"Load a File\") \n dialog.selectMode = SELECTFILE_EXISTING \n dialog.patternList = [\"All Files (*)\"] \n if dialog.execute != 0 \n load_file(dialog.filename) \n end \n end \n\n saveCmd.connect(SEL_COMMAND) do\n dialog = FXFileDialog.new(self, \"Save a File\") \n dialog.selectMode = SELECTFILE_EXISTING \n dialog.patternList = [\"All Files (*)\"] \n if dialog.execute != 0 \n save_file(dialog.filename) \n end\n end\n\n exitCmd.connect(SEL_COMMAND) do\n exit\n end\n\n aboutCmd.connect(SEL_COMMAND) do\n # ...\n end\n \n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def addMenuBar \r\n # set up menu layout properties\r\n menuBar = FXMenuBar.new(self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X) \r\n # create pointers (to link new 'FXMenuPane' wutg a new 'FXMenuTitle')\r\n fileMenu = FXMenuPane.new(self) #self refers to the TextEditor window\r\n about = FXMenuPane.new(self) #self refers to the TextEditor window\r\n\r\n #create main menu Items\r\n FXMenuTitle.new(menuBar, \"File\", :popupMenu => fileMenu) \r\n FXMenuTitle.new(menuBar, \"About\", :popupMenu => about) \r\n\r\n #create sub menue Items\r\n #under 'File' tab \r\n newCmd = FXMenuCommand.new(fileMenu, \"new\")\r\n loadCmd = FXMenuCommand.new(fileMenu, \"Load\")\r\n saveCmd = FXMenuCommand.new(fileMenu, \"save\") \r\n exitCmd = FXMenuCommand.new(fileMenu, \"Exit\")\r\n #under 'About' tab\r\n aboutCmd = FXMenuCommand.new(about, \"contact us\") \r\n \r\n #connect sub menue Items to functions\r\n newCmd.connect(SEL_COMMAND) do\r\n @txt.text = \"\"\r\n end\r\n\r\n loadCmd.connect(SEL_COMMAND) do \r\n dialog = FXFileDialog.new(self, \"Load a File\") \r\n dialog.selectMode = SELECTFILE_EXISTING \r\n dialog.patternList = [\"All Files (*)\"] \r\n if dialog.execute != 0 \r\n load_file(dialog.filename) \r\n end \r\n end \r\n\r\n saveCmd.connect(SEL_COMMAND) do\r\n dialog = FXFileDialog.new(self, \"Save a File\") \r\n dialog.selectMode = SELECTFILE_EXISTING \r\n dialog.patternList = [\"All Files (*)\"] \r\n if dialog.execute != 0 \r\n save_file(dialog.filename) \r\n end\r\n end\r\n\r\n exitCmd.connect(SEL_COMMAND) do\r\n exit\r\n end\r\n\r\n aboutCmd.connect(SEL_COMMAND) do\r\n # ...\r\n end\r\n \r\n end",
"def refresh()\n self.contents.clear\n @cLevelUpLabel.draw()\n end",
"def window_update(actor)\n if actor != nil\n @cCharName.text = actor.name\n @ucCharLvl.cValue.text = actor.level\n \n @ucHpStat.cValue.text = sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.hp, actor.maxhp)\n @ucHpStatGauge.value = actor.hp\n @ucHpStatGauge.max_value = actor.maxhp\n \n if actor.hp == 0\n @ucHpStat.cValue.font.color = Color.knockout_color\n elsif actor.hp < actor.maxhp / 4\n @ucHpStat.cValue.font.color = Color.crisis_color\n else\n @ucHpStat.cValue.font.color = Color.normal_color\n end\n \n @ucMpStat.cValue.text = sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.mp, actor.maxmp)\n @cMpStatGauge.value = actor.mp\n @cMpStatGauge.max_value = actor.maxmp\n \n if actor.mp < actor.maxmp / 4\n @ucMpStat.cValue.font.color = Color.crisis_color\n else\n @ucMpStat.cValue.font.color = Color.normal_color\n end\n \n end\n refresh()\n end",
"def window_update(actor)\n if actor != nil\n @cCharName.text = actor.name\n @ucCharLvl.cValue.text = actor.level\n \n @ucHpStat.cValue.text = sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.hp, actor.maxhp)\n @ucHpStatGauge.value = actor.hp\n @ucHpStatGauge.max_value = actor.maxhp\n \n if actor.hp == 0\n @ucHpStat.cValue.font.color = Color.knockout_color\n elsif actor.hp < actor.maxhp / 4\n @ucHpStat.cValue.font.color = Color.crisis_color\n else\n @ucHpStat.cValue.font.color = Color.normal_color\n end\n \n @ucMpStat.cValue.text = sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.mp, actor.maxmp)\n @cMpStatGauge.value = actor.mp\n @cMpStatGauge.max_value = actor.maxmp\n \n if actor.mp < actor.maxmp / 4\n @ucMpStat.cValue.font.color = Color.crisis_color\n else\n @ucMpStat.cValue.font.color = Color.normal_color\n end\n \n end\n refresh()\n end",
"def main_process\n while @running\n Graphics.update\n update\n end\n end",
"def invalidate_current_loaded_file\n if (@current_file_name == nil)\n @main_widget.title = 'Files Rebuilder'\n @main_widget.enable_save(false)\n else\n @main_widget.title = \"Files Rebuilder - #{@current_file_name}\"\n @main_widget.enable_save(true)\n end\n end",
"def update\n prev_index = @index\n # If 10 frame counts have passed\n if @sprite_frame != Graphics.frame_count % 60 / 15\n # Update frame count\n @sprite_frame = Graphics.frame_count % 60 / 15\n # Update unit graphics to new animation frame\n refresh_graphics\n end\n \n @info_window.update if @info_window.active\n super if self.active\n \n if self.active\n @info_window.unit = @units[@index] if prev_index != @index\n @desc_window.draw_info(@units[@index].stat_desc[0]) if prev_index != @index\n \n if Input.trigger?(Input::RIGHT)\n $game_system.se_play($data_system.cursor_se)\n self.cursor_rect.visible = false\n self.active = false\n @info_window.active = true\n @info_window.cursor_rect.visible = true\n end\n else # Info Window is active\n if Input.trigger?(Input::LEFT) or Input.trigger?(Input::B)\n $game_system.se_play($data_system.cursor_se)\n self.cursor_rect.visible = true\n self.active = true\n @info_window.index = 0\n @info_window.active = false\n @info_window.cursor_rect.visible = false\n # Reset description window to brief unit profile\n @desc_window.draw_info(@units[@index].stat_desc[0])\n end\n end\n end",
"def on_load_file(evt)\n dlg = Wx::FileDialog.new( self, \n :message => \"Choose a media file\",\n :wildcard => MEDIA_FILE_WILDCARD, \n :style => Wx::OPEN)\n if dlg.show_modal == Wx::ID_OK\n\t puts dlg.path\n do_load_file(dlg.path)\n end\n end",
"def refresh\n contents.clear\n draw_header\n draw_face_area(line_height * 1.5)\n draw_attr_area(0, line_height * 2 + 104)\n draw_skill_area(240, line_height * 2 + 104)\n end",
"def InitializeComponent()\n\t\t\tself.@templatesLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@topGbx = System.Windows.Forms.GroupBox.new()\n\t\t\tself.@templateListbox = System.Windows.Forms.ListBox.new()\n\t\t\tself.@engineCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@languageCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@removeBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@newsaveBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@fileNameTextbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@displayNameTxtbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@languageLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@engineLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@nameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@fileNameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@editBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@openFileDialogBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@noteTextLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@noteLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@openFileDialog = System.Windows.Forms.OpenFileDialog.new()\n\t\t\tself.@getItFromOnlineBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@prefixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@prefixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# templatesLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(9, 5)\n\t\t\[email protected] = \"templatesLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(60, 16)\n\t\t\[email protected] = 31\n\t\t\[email protected] = \"Templates\"\n\t\t\t# \n\t\t\t# topGbx\n\t\t\t# \n\t\t\[email protected] = ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)))\n\t\t\[email protected] = System.Drawing.Point.new(80, 5)\n\t\t\[email protected] = \"topGbx\"\n\t\t\[email protected] = System.Drawing.Size.new(370, 8)\n\t\t\[email protected] = 30\n\t\t\[email protected] = false\n\t\t\t# \n\t\t\t# templateListbox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(10, 30)\n\t\t\[email protected] = \"templateListbox\"\n\t\t\[email protected] = System.Drawing.Size.new(160, 303)\n\t\t\[email protected] = 1\n\t\t\[email protected] { |sender, e| self.@templateListbox_SelectedIndexChanged(sender, e) }\n\t\t\t# \n\t\t\t# engineCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 60)\n\t\t\[email protected] = \"engineCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 5\n\t\t\t# \n\t\t\t# languageCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 30)\n\t\t\[email protected] = \"languageCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 3\n\t\t\t# \n\t\t\t# removeBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(291, 210)\n\t\t\[email protected] = \"removeBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(64, 23)\n\t\t\[email protected] = 16\n\t\t\[email protected] = \"Remove\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@removeBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# newsaveBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(361, 210)\n\t\t\[email protected] = \"newsaveBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(93, 23)\n\t\t\[email protected] = 17\n\t\t\[email protected] = \"New/Save\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@newsaveBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# fileNameTextbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 120)\n\t\t\[email protected] = \"fileNameTextbox\"\n\t\t\[email protected] = System.Drawing.Size.new(164, 20)\n\t\t\[email protected] = 9\n\t\t\t# \n\t\t\t# displayNameTxtbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 90)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"displayNameTxtbox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 7\n\t\t\t# \n\t\t\t# languageLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 30)\n\t\t\[email protected] = \"languageLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 2\n\t\t\[email protected] = \"Language:\"\n\t\t\t# \n\t\t\t# engineLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 60)\n\t\t\[email protected] = \"engineLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 4\n\t\t\[email protected] = \"Engine:\"\n\t\t\t# \n\t\t\t# nameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 90)\n\t\t\[email protected] = \"nameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 6\n\t\t\[email protected] = \"DisplayName:\"\n\t\t\t# \n\t\t\t# fileNameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 120)\n\t\t\[email protected] = \"fileNameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 8\n\t\t\[email protected] = \"File:\"\n\t\t\t# \n\t\t\t# editBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 210)\n\t\t\[email protected] = \"editBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(57, 23)\n\t\t\[email protected] = 15\n\t\t\[email protected] = \"Edit\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@editBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# openFileDialogBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(430, 118)\n\t\t\[email protected] = \"openFileDialogBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(24, 23)\n\t\t\[email protected] = 10\n\t\t\[email protected] = \"...\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@openFileDialogBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# noteTextLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(246, 276)\n\t\t\[email protected] = \"noteTextLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(210, 60)\n\t\t\[email protected] = 20\n\t\t\t# \n\t\t\t# noteLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Font.new(\"Microsoft Sans Serif\", 7.8f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((0)))\n\t\t\[email protected] = System.Drawing.Point.new(190, 275)\n\t\t\[email protected] = \"noteLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(50, 18)\n\t\t\[email protected] = 19\n\t\t\[email protected] = \"Note:\"\n\t\t\t# \n\t\t\t# openFileDialog\n\t\t\t# \n\t\t\[email protected] = \"Template Text File (*.txt)|*.txt\"\n\t\t\[email protected] = \"Select Template Text File\"\n\t\t\t# \n\t\t\t# getItFromOnlineBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 244)\n\t\t\[email protected] = \"getItFromOnlineBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(226, 23)\n\t\t\[email protected] = 18\n\t\t\[email protected] = \"Get it from online\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@getItFromOnlineBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# prefixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 150)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"prefixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 12\n\t\t\t# \n\t\t\t# prefixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 150)\n\t\t\[email protected] = \"prefixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 11\n\t\t\[email protected] = \"Prefix:\"\n\t\t\t# \n\t\t\t# suffixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 180)\n\t\t\[email protected] = \"suffixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 13\n\t\t\[email protected] = \"Suffix:\"\n\t\t\t# \n\t\t\t# suffixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 180)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"suffixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 14\n\t\t\t# \n\t\t\t# TemplateOptionsPage\n\t\t\t# \n\t\t\tself.@AutoScaleDimensions = System.Drawing.SizeF.new(6f, 13f)\n\t\t\tself.@AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\n\t\t\[email protected](self.@suffixLbl)\n\t\t\[email protected](self.@suffixTxtBox)\n\t\t\[email protected](self.@prefixLbl)\n\t\t\[email protected](self.@prefixTxtBox)\n\t\t\[email protected](self.@getItFromOnlineBtn)\n\t\t\[email protected](self.@noteTextLbl)\n\t\t\[email protected](self.@noteLbl)\n\t\t\[email protected](self.@openFileDialogBtn)\n\t\t\[email protected](self.@editBtn)\n\t\t\[email protected](self.@fileNameLbl)\n\t\t\[email protected](self.@nameLbl)\n\t\t\[email protected](self.@engineLbl)\n\t\t\[email protected](self.@languageLbl)\n\t\t\[email protected](self.@displayNameTxtbox)\n\t\t\[email protected](self.@fileNameTextbox)\n\t\t\[email protected](self.@newsaveBtn)\n\t\t\[email protected](self.@removeBtn)\n\t\t\[email protected](self.@languageCombox)\n\t\t\[email protected](self.@engineCombox)\n\t\t\[email protected](self.@templateListbox)\n\t\t\[email protected](self.@templatesLbl)\n\t\t\[email protected](self.@topGbx)\n\t\t\tself.@Name = \"TemplateOptionsPage\"\n\t\t\tself.ResumeLayout(false)\n\t\t\tself.PerformLayout()\n\t\tend",
"def notifyCurrentOpenedFileUpdate\n updateCommand(Wx::ID_SAVE) do |ioCommand|\n if (@CurrentOpenedFileName == nil)\n ioCommand[:Title] = 'Save'\n ioCommand[:Enabled] = false\n else\n ioCommand[:Title] = \"Save #{File.basename(@CurrentOpenedFileName)}\"\n ioCommand[:Enabled] = @CurrentOpenedFileModified\n end\n end\n notifyRegisteredGUIs(:onCurrentOpenedFileUpdate)\n end",
"def update\n ::Scheduler.start(:on_update)\n if @last_scene != $scene\n sort_z\n @last_scene = $scene\n end\n # Internal update management\n update_manage\n unless @no_mouse\n Mouse.moved = (@mouse.x != Mouse.x || @mouse.y != Mouse.y)\n @mouse.x = Mouse.x\n @mouse.y = Mouse.y\n end\n Audio.update\n update_cmd_eval if @__cmd_to_eval\n rescue LiteRGSS::Error\n puts 'Graphics stopped but did not raised the `LiteRGSS::Graphics::ClosedWindowError` exception'\n raise LiteRGSS::Graphics::ClosedWindowError, 'Temporary fix'\n end",
"def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end",
"def update_window_title(new_title)\n hc_main_view.title = new_title\n end",
"def reload\n Dir.glob('**/*').each { |file| reload_file(file) }\n end",
"def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n @help_window = Window_Help.new\n @help_window.width = 640\n @saves_list = []\n (0..MAX_SAVE_SLOT-1).each do |i|\n @saves_list << SaveData.new(SLOT_NAME.clone.gsub!(/\\{ID\\}/i) { (i+1).to_s }, \n make_filename(i))\n end\n @window_slotdetail = Window_Slot_Details.new(160, 56, 480, 424, nil)\n @window_slotlist = Window_Slot_List.new(0, 56, 160, 424, @saves_list)\n if OPACITY_DEFAULT == false\n @help_window.opacity = NSS_WINDOW_OPACITY\n @window_slotlist.opacity = NSS_WINDOW_OPACITY\n @window_slotdetail.opacity = NSS_WINDOW_OPACITY\n end\n \n @confirm_window = Window_Confirmation.new(220, 212, SFC_Window_Width, \n Vocab::confirm_save_text,\n Vocab::confirm_yes_text,\n Vocab::confirm_no_text)\n @confirm_window.active = false\n @confirm_window.visible = false\n \n # Create Folder for Save file\n if SAVE_PATH != ''\n Dir.mkdir(SAVE_PATH) if !FileTest.directory?(SAVE_PATH)\n end\n if @saving\n @index = $game_temp.last_file_index\n @help_window.set_text(Vocab::SaveMessage)\n else\n @index = latest_file_index()\n @help_window.set_text(Vocab::LoadMessage)\n end\n @window_slotlist.index = @index\n # Draw Information\n @last_slot_index = @window_slotlist.index\n @window_slotdetail.window_update(@saves_list[@last_slot_index])\n end"
] | [
"0.6987807",
"0.6553647",
"0.5624093",
"0.55575454",
"0.5541597",
"0.55272865",
"0.54683095",
"0.53603464",
"0.53359485",
"0.53323233",
"0.52772456",
"0.52727616",
"0.5262025",
"0.5256193",
"0.5247116",
"0.5247116",
"0.5245147",
"0.5195178",
"0.5167212",
"0.5167212",
"0.5137182",
"0.5137182",
"0.513429",
"0.51269543",
"0.51002175",
"0.5090292",
"0.50735843",
"0.50689757",
"0.50628936",
"0.5060065",
"0.50581807",
"0.5045363",
"0.50231975",
"0.4996549",
"0.49893612",
"0.49784812",
"0.49766105",
"0.4975935",
"0.4975935",
"0.49588606",
"0.49456728",
"0.49276948",
"0.49276948",
"0.49229687",
"0.4920843",
"0.4901359",
"0.4887298",
"0.48768958",
"0.48761144",
"0.48761144",
"0.48715883",
"0.48663262",
"0.48612872",
"0.4859427",
"0.48482352",
"0.48469186",
"0.48456243",
"0.48453018",
"0.48411062",
"0.4839678",
"0.48257735",
"0.4812353",
"0.48087445",
"0.48033917",
"0.47993198",
"0.47848943",
"0.47755775",
"0.47714892",
"0.47529343",
"0.47514883",
"0.47476032",
"0.47452807",
"0.47439936",
"0.47438553",
"0.47322863",
"0.47271854",
"0.4725927",
"0.47258124",
"0.47249603",
"0.47243488",
"0.47206637",
"0.47154614",
"0.4714891",
"0.4714891",
"0.4714891",
"0.47009483",
"0.46986824",
"0.46902525",
"0.46902525",
"0.46877062",
"0.46848413",
"0.46697548",
"0.46611407",
"0.4658883",
"0.46447697",
"0.4638628",
"0.46322098",
"0.46277192",
"0.46274713",
"0.4623621",
"0.4621296"
] | 0.0 | -1 |
Sort the loaded files and directories in already given sort order. | def sort_items_according_to_current_direction
case @direction
when nil
@items = items.shift(2) + items.partition(&:directory?).flat_map(&:sort)
when 'r'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort.reverse}
when 'S', 's'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by {|i| -i.size}}
when 'Sr', 'sr'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:size)}
when 't'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.mtime <=> x.mtime}}
when 'tr'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:mtime)}
when 'c'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.ctime <=> x.ctime}}
when 'cr'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:ctime)}
when 'u'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.atime <=> x.atime}}
when 'ur'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:atime)}
when 'e'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.extname <=> x.extname}}
when 'er'
@items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:extname)}
end
items.each.with_index {|item, index| item.index = index}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort!\n #N Without this, the immediate sub-directories won't get sorted\n dirs.sort_by! {|dir| dir.name}\n #N Without this, files contained immediately in this directory won't get sorted\n files.sort_by! {|file| file.name}\n #N Without this, files and directories contained within sub-directories of this directory won't get sorted\n for dir in dirs\n #N Without this, this sub-directory won't have its contents sorted\n dir.sort!\n end\n end",
"def sort_files!; end",
"def sort_files!\n site.generated_pages.sort_by!(&:name)\n site.static_files.sort_by!(&:relative_path)\n end",
"def sort(pages, order)\n pages.sort! { |a,b|\n as = order.index(a.basename)\n bs = order.index(b.basename)\n if as.nil?\n bs.nil? ? (a.basename <=> b.basename) : 1\n elsif bs.nil?\n as.nil? ? (a.basename <=> b.basename) : -1\n else\n as <=> bs\n end\n }\n end",
"def sort_files!\n site.collections.each_value { |c| c.docs.sort! }\n site.pages.sort_by!(&:name)\n site.static_files.sort_by!(&:relative_path)\n end",
"def order\n \"#{sort} #{dir}\"\n end",
"def sorted_files\n sort_file_name_by_semver(all_files.select { |f| semver_file?(f) })\n end",
"def yaml_parts_in_loading_order\n ordered_yaml_parts = []\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.sort_by{|part| File.basename(part, '.yml').split('.').size}.each do |part|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n ordered_yaml_parts\n end",
"def sort_files(files)\n files.sort! { |x,y| x[1] <=> y[1] }\n end",
"def directory_sort_order( f1, f2 )\n n1 = File.extname( f1 ).gsub( '.', '' ).to_i\n n2 = File.extname( f2 ).gsub( '.', '' ).to_i\n return -1 if n1 < n2\n return 1 if n1 > n2\n return 0\n end",
"def file_sort(files)\n models = files.find_all { |file| file =~ Core::Check::MODEL_FILES }\n mailers = files.find_all { |file| file =~ Core::Check::MAILER_FILES }\n helpers = files.find_all { |file| file =~ Core::Check::HELPER_FILES }\n others =\n files.find_all do |file|\n file !~ Core::Check::MAILER_FILES && file !~ Core::Check::MODEL_FILES && file !~ Core::Check::HELPER_FILES\n end\n models + mailers + helpers + others\n end",
"def sort_dir_list(dir_list, path)\n order_by ||= session[:order_by]\n order_by ||= 'filename'\n order_desc = session[:order_desc]\n \n if dir_list.first[order_by.to_sym].class == Fixnum\n dir_list.sort! { |a,b| a[order_by.to_sym] <=> b[order_by.to_sym] }\n else\n dir_list.sort! { |a,b| a[order_by.to_sym].to_s.downcase <=> b[order_by.to_sym].to_s.downcase }\n end\n\n dir_list.reverse! if order_desc\n \n # move folders to top\n new_list = []\n new_dir_list = []\n dir_list.each do |element|\n new_list << element if File.directory?(path + '/' + element[:original_name])\n new_dir_list << element if File.file?(path + '/' + element[:original_name])\n end\n new_list.sort! { |a,b| a[:filename].to_s.downcase <=> b[:filename].to_s.downcase }\n new_list.concat new_dir_list\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sorted_folders\n return @folders if !@retain_order\n @folders.sort_by{|folder| [folder.sort_order]}\n end",
"def sort!\n unless sorted?\n @sources = topsort\n insert_extensions!\n insert_replacements!\n @sources.uniq!\n @sorted = true\n end\n self\n end",
"def ordered_topologically\n FolderSort.new(self)\n end",
"def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end",
"def sort_data\n store.sort_data!\n end",
"def sorted_rolls\n tsort_hash = {}\n @rolls.each do |file_name, roll|\n tsort_hash[file_name.to_s] = roll.dependencies.map(&:to_s)\n end\n\n tsort_hash.tsort.map(&:to_sym)\n end",
"def yaml_parts_in_saving_order\n lang_file_dirs_by_parts = ActiveSupport::OrderedHash.new\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.each do |part|\n lang_file_dirs_by_parts[part] = (lang_file_dirs_by_parts[part] || []) << lang_file_dir\n end\n end\n \n ordered_yaml_parts = []\n lang_file_dirs_by_parts.keys.sort_by{|key| key.split('.').size}.reverse.each do |part|\n lang_file_dirs_by_parts[part].reverse.each do |lang_file_dir|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n \n ordered_yaml_parts\n end",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def file_sort_hierarchy(path)\n Dir.glob(path).sort_by { |f| f.split('/').size }\n end",
"def reorder(files_to_test)\n ar_tests, sqlsvr_tests = files_to_test.partition { |k,v| k.starts_with?('../../../') }\n ar_tests.sort! { |a,b| a[0] <=> b[0] }\n sqlsvr_tests.sort! { |a,b| a[0] <=> b[0] }\n sqlsvr_tests + ar_tests\n end",
"def sort_children\n @children.sort_by!(&:name)\n @children.map(&:sort_children)\n end",
"def parse_in_order(*files); end",
"def sort(versions)\n self::usort(versions, self::SORT_ASC)\n end",
"def sort_ops\n operations.running.sort_by { |op| sort_array(op) }.extend(OperationList)\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 decorate(files)\n files.sort\n end",
"def sort(sort_keys, *args)\n raise NotImplementedError\n end",
"def children_sort_by(*args, &blk)\n self.dup{ @contents = @contents.sort_by(*args, &blk) }\n end",
"def sort(data)\n if should_invert_sort?\n dir = inverted_sort_direction\n else\n dir = sort_direction\n end\n\n sfs = sort_fields\n sort_string = if sfs\n sfs.map { |p| \"#{p} #{dir}\" } * ', '\n else\n ''\n end\n\n data.reorder sort_string\n end",
"def sort!\n return unless has_children?\n sorted_children = children.sort\n self.children = sorted_children\n end",
"def sort_entries(file_data)\n submodules = []\n file_data.scan(/(^\\[submodule[^\\n]+\\n)((?:\\t[^\\n]+\\n)+)/).each do |head, body|\n path = body.match(/^\\tpath\\s*=\\s*\\K(.+)$/)[0]\n submodules << [path, head + body]\n end\n submodules.sort! { |a,b| a[0] <=> b[0] }\n submodules.collect { |i| i[1] }\nend",
"def sort!(reverse=false)\n @files = files.sort {|f1, f2| file_date(f1) <=> file_date(f2) }\n @files = files.reverse if reverse\n self\n end",
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def traverse_sort_and_add_nav_order_to_nodes(node)\n\t\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t if child.nav_type == \"folder\" || child.nav_type == \"folder+markdown\"\n\t\t\t\t\t items = traverse_sort_and_add_nav_order_to_nodes(child)\n\t\t\t\t\t child.children.items = items if items and items.size > 0\n\t\t\t\t end\n\t\t\t end\n\t\t \n\t\tend\t \n\t\n\t\thas_navig_yml = File.exist?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\n\t\tif has_navig_yml and node.children and node.children.items?\n\t\n\t\telse\n\t\t\treturn nil\t\t\n\t\tend \n\t\n\t\tsorted_nav_items = nil\n\t\n\t\tif node.children? and node.children.items?\n\t\t\tsorted_nav_items = node.children.items\n\t\tend\n\t\n\t\tif File.exists?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\t\t# load aaaa-navigation.yml\n\t\t\tnaml = Map.new(YAML.load_file(\"#{node.source_path}/aaaa-navigation.yml\"))\t\t\n\t\n\t\t\t# iterate and re-order navigation.yml\n\t\t\tsorted_nav_items = node.children.items\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1000\n\t\t\tend\n\n\t\t\tnaml.nav_items.each_with_index do |naml_item, i|\n\t\t\t\tsorted_nav_items.each do |sni| \n\t\t\t\t\tsni.nav_order = i if sni.source == naml_item.source\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tsorted_nav_items.sort! { |x, y| x.nav_order <=> y.nav_order }\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1\n\t\t\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\tend\n\t\n\t\tsorted_nav_items\n\tend",
"def reorder_files\n files = Dir.glob(File.join(@dir,\"*\"))\n files.each{|f|\n @enroll_file = f if f.downcase.index('enroll')\n @attendance_file = f if f.downcase.index('att')\n @ili_file = f if f.downcase.index('ili') || f.downcase.index('h1n1')\n }\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 sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.size\n group_with_order\n end\n end",
"def sortFilesFromDirs array, dir #array is elements in current directory: dir\n\n #temp arrays to hold files vs dirs\n dirs = Array.new\n files = Array.new\n\n array.each do |elem|\n\n #path to current entity interested in\n currentPath = dir + \"/\" + elem\n #puts \"currentPath: \" + currentPath\n\n #is dir or no?\n if Dir.exist? currentPath\n dirs << elem\n else\n files << elem\n end\n\n end\n\n #puts \"dirs: \" + dirs.to_s\n #puts \"files: \" + files.to_s\n \n #return concatenated array\n return dirs + files\n\n end",
"def sort\n _in_order(@root, @@id_fun) # use Id function\n end",
"def unprocessed_files\n Dir.glob(@data_location + '/*.jl').sort\n end",
"def sorted_plugins\n @sorted_plugins ||= plugins.sort do |a, b|\n Setting.module_list.index(a.name) <=> Setting.module_list.index(b.name)\n end\n end",
"def sorted(sort_query_string = nil)\n generator = parse_sorting(sort_query_string)\n generator.sort(self)\n end",
"def sort(direction = nil)\n @direction, @current_page = direction, 0\n sort_items_according_to_current_direction\n switch_page 0\n move_cursor 0\n end",
"def sort_if_needed\n @rules.sort! unless @sorted\n @sorted = true\n end",
"def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end",
"def sorted!(sort_query_string = nil)\n generator = parse_sorting(sort_query_string)\n generator.sort(self, reorder: true)\n end",
"def sort_operations\n operations.sort! { |a, b| sort_list(b, a) <=> sort_list(a, b) }\n end",
"def load_order\n @cache_load_order = read_load_order unless defined?(@cache_load_order)\n @cache_load_order\n end",
"def sort!\n sort_if_needed\n self\n end",
"def sort(*args, &blk)\n self.dup{ @contents = @contents.sort(*args, &blk) }\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_by_path\n by_path = Hash[@routes[:paths].sort]\n place_readme_first(by_path)\n end",
"def rsort(versions)\n self::usort(versions, self::SORT_DESC)\n end",
"def file_list(group)\n return Dir[File.join(@dir, group, FILE_EXT)].sort\nend",
"def sort(sort = nil)\n set_option(:sort, sort)\n end",
"def list_files dir='*', sorto=@sorto, hidden=@hidden, _filter=@filterstr\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # decide sort method based on second character\n # first char is o or O (reverse)\n # second char is macLn etc (as in zsh glob)\n so = sorto ? sorto[1] : nil\n func = case so\n when 'm'\n :mtime\n when 'a'\n :atime\n when 'c'\n :ctime\n when 'L'\n :size\n when 'n'\n :path\n when 'x'\n :extname\n end\n\n # sort by time and then reverse so latest first.\n sorted_files = if hidden == 'D'\n Dir.glob(dir, File::FNM_DOTMATCH) - %w[. ..]\n else\n Dir.glob(dir)\n end\n\n # WARN: crashes on a deadlink since no mtime\n if func\n sorted_files = sorted_files.sort_by do |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n end\n end\n\n sorted_files.sort! { |w1, w2| w1.casecmp(w2) } if func == :path && @ignore_case\n\n # zsh gives mtime sort with latest first, ruby gives latest last\n sorted_files.reverse! if sorto && sorto[0] == 'O'\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n # return sorted_files\n @files = sorted_files\n calculate_bookmarks_for_dir # we don't want to override those set by others\nend",
"def setup_sort_options(options)\n options[:sort] = options[:sort] ? options[:sort].dup : []\n end",
"def natural_sort_bitstreams\n filenames = self.bitstreams.map(&:filename)\n NaturalSort.sort!(filenames)\n self.bitstreams.each do |bs|\n bs.update!(bundle_position: filenames.index(bs.filename))\n end\n end",
"def sort(array_of_nodes, order); end",
"def sort_all\n\t\t\t\tr=::Hash[self.sort]\n\t\t\t\tr.each do |k,v|\n\t\t\t\t\tr[k]=v.sort\n\t\t\t\tend\n\t\t\t\treturn r\n\t\t\tend",
"def set_sort_order(order)\n @part_sort_order = order\n end",
"def apply_sorting(chain)\n chain\n end",
"def sort_words\n audit\n @_sort_words ||= words.sort { |a, b| b.last <=> a.last }\n end",
"def lbSort _args\n \"lbSort _args;\" \n end",
"def sort(*sorts)\n query('sort' => sorts)\n end",
"def sort_name\n sort_constituent\n end",
"def sort\n if self.checkDestination\n\n if @interactive\n answer = readUserInput(\"Process '#{@filename}' ([y]/n): \")\n answer = answer.empty? ? 'y' : answer\n self.log('info', \"User Answer for file '#{@filename}': #{answer}\")\n if !answer.match(/y/) \n self.log('info',\"Skipping file '#{@filename}' due to user answer: '#{answer}'.\")\n return\n else\n self.log('info',\"Processing file '#{@filename}' due to user answer: '#{answer}'.\")\n end\n end\n\n if not author = get_author() or author.empty?\n self.log('error', \"File '#{@filename}' has not value for author set. Cannot sort file. Abort.\")\n exit 1\n end\n targetdir = @destination.chomp + '/' + author\n targetfile = targetdir + '/' + Pathname.new(@filename).basename.to_s\n\n # Create the target directory, if it does not exist yet.\n if !File.exists? targetdir\n\n # Check for similiar directory names which might indicate a typo in the\n # current directory name.\n if @typo and foundDir = self.findSimilarTargetdir(targetdir)\n\n self.log('info', \"Similar target found ('\" + foundDir + \"'). Request user input.\")\n puts 'Similar target directory detected:'\n puts 'Found : ' + foundDir\n puts 'Target: ' + targetdir\n while answer = readUserInput('Abort? ([y]/n): ')\n if answer.match(/(y|yes|j|ja|^$)/i)\n self.log('info','User chose to abort sorting.')\n puts 'Abort.'\n exit 0\n elsif answer.match(/(n|no)/i)\n self.log('info', 'User chose to continue sorting.')\n break\n end\n end\n end\n\n if @dryrun\n self.log('info', \"Dryrun: Created Directory '#{targetdir}'.\")\n else\n self.log('info', \"Created directory '#{targetdir}'.\")\n puts 'Created: ' + targetdir\n FileUtils.mkdir_p(targetdir)\n end\n end\n\n # Check if the file already exists\n # This does nothing so far\n if File.exists?(targetfile) and @overwrite\n self.log('info', \"File '#{@filename}' already exists. Overwrite active: replacing file.\")\n elsif File.exists?(targetfile) and !@overwrite\n self.log('info', \"File '#{@filename}' already exists, overwrite disabled: not replacing file.\")\n return true\n end\n\n if @copy\n\n if @dryrun\n self.log('info', \"Dryrun: Copy file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Copy file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.cp(@filename, targetdir)\n end\n\n else\n\n if @dryrun\n self.log('info', \"Dryrun: Move file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Move file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.mv(@filename, targetdir)\n end\n\n end\n\n end\n end",
"def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end",
"def sort_parts!\n @parts.each do |p|\n p.body.set_sort_order(@part_sort_order)\n p.body.sort_parts!\n end\n @parts.sort!(@part_sort_order)\n end",
"def sorting_file\n a = File.readlines(file_name)\n a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n end",
"def sort_norm_data\n store.sort_norm_data!\n end",
"def sort_array\n a = File.readlines(file_name)\n b = a.sort\n end",
"def sort_entries; end",
"def everything\n (all + non_analyzed).sort { |a, b| a.filename <=> b.filename }\n end",
"def sort_contained_files_and_dirs(path)\n dirs, files = [], []\n if path != nil && File.directory?(path)\n Find.find(path) do |x|\n case\n when File.directory?(x)\n x.sub!(path, '')\n dirs << x unless x.length == 0\n when File.file?(x)\n x.sub!(path, '')\n files << x unless x.length == 0\n end\n end\n end\n {:files => files, :dirs => dirs}\n end",
"def sortme( names )\n names.sort\nend",
"def sort_children\n @children.sort! do |a, b|\n if (a.leaf? && b.leaf?) || (!a.leaf? && !b.leaf?)\n a.name <=> b.name\n elsif a.leaf? && !b.leaf?\n -1\n else\n 1\n end\n end\n @children.each(&:sort_children)\n end",
"def sort\n if children.present?\n node(type, *children.map(&:sort).sort)\n else\n self\n end\n end",
"def sorted_array\n total_views_per_file_path.sort { |a, b| b[1] <=> a[1] }\n end",
"def sort( & block )\n\n load_parent_state\n \n return super\n \n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def sort_by_dependencies\n visited = Hash[dependencies.keys.map {|k| [k, false]}]\n in_call_stack = {}\n dependencies.each_pair do |job, dependency|\n return if error\n helper(visited, in_call_stack, job) unless visited[job]\n end\n result\n end",
"def default_sorter\n lambda { |files|\n files.sort do |a, b|\n if b.container?\n a.container? ? a.name.downcase <=> b.name.downcase : 1\n else\n a.container? ? -1 : a.name.downcase <=> b.name.downcase\n end\n end\n }\n end",
"def topological_sort\n\t\tcount = size\n\t\t@explored_nodes = Array.new(count, false)\n\t\t@current_label = count\n\t\t@topological_order = Array.new(count, nil)\n\t\tcount.times do |label|\n\t\t\tdfs_topological_order(label) unless @explored_nodes[label]\n\t\tend\n\t\ttopological_order\n\tend",
"def sort some_array\n\tsorted_array = []\n\trecursive_sort some_array, sorted_array\nend",
"def sort_by_extension(file, extension)\n if @file_hash[:\"#{extension}\"] == nil\n @file_hash[:\"#{extension}\"] = []\n @file_hash[:\"#{extension}\"] << file\n else\n @file_hash[:\"#{extension}\"] << file\n end\n end",
"def sort_percentages\n @_sort_percentages ||= percentages.sort { |a, b| b.last <=> a.last }\n end",
"def sort_by_project_locales_first(yaml_file_paths)\n yaml_file_paths.sort do |x, y|\n a = locale_file_path_in_project?(x)\n b = locale_file_path_in_project?(y)\n (!a && b) ? 1 : ((a && !b) ? -1 : 0)\n end\n end",
"def sort_by_project_locales_first(yaml_file_paths)\n yaml_file_paths.sort do |x, y|\n a = locale_file_path_in_project?(x)\n b = locale_file_path_in_project?(y)\n (!a && b) ? 1 : ((a && !b) ? -1 : 0)\n end\n end",
"def sort!\r\n @tabs.sort! { |x,y| x.name <=> y.name }\r\n end",
"def sort_order\n if @sort_order\n @sort_order.upcase!\n return @sort_order if SORT_ORDERS.include?(@sort_order)\n end\n default_sort_order\n end",
"def load_files_in(directory_name, options = {})\n get_files_in(directory_name, options).sort.each { |ext| load ext }\n end",
"def pages_to_list\n # sort by fullpath first\n list = self.pages.values.sort { |a, b| a.fullpath <=> b.fullpath }\n # sort finally by depth\n list.sort { |a, b| a.depth <=> b.depth }\n end",
"def pages_to_list\n # sort by fullpath first\n list = self.pages.values.sort { |a, b| a.fullpath <=> b.fullpath }\n # sort finally by depth\n list.sort { |a, b| a.depth <=> b.depth }\n end",
"def sort_order\n sort_string = params[:sort]\n if sort_string\n split = sort_string.split '_'\n sort_field = split[0]\n sort_dir = split[1]\n return {sort_field.to_sym => sort_dir}\n end\n return {text: :asc}\n end",
"def apply_blog_time_ordering(pages)\n pages.sort_by { |page| page.path.join('/') }.reverse\n end"
] | [
"0.78199565",
"0.75464207",
"0.75356585",
"0.7188391",
"0.7112423",
"0.70286685",
"0.69724226",
"0.68332887",
"0.6674414",
"0.66667503",
"0.6597997",
"0.6596036",
"0.65643376",
"0.6438283",
"0.6356633",
"0.63212144",
"0.627526",
"0.6259553",
"0.62087935",
"0.62084305",
"0.61614007",
"0.6156389",
"0.6141724",
"0.61088735",
"0.6105197",
"0.6075303",
"0.6067477",
"0.59702545",
"0.5961366",
"0.5950715",
"0.5936086",
"0.5929567",
"0.59213394",
"0.5911709",
"0.5910719",
"0.58961624",
"0.58762586",
"0.5862718",
"0.5853185",
"0.5817275",
"0.5811099",
"0.5807404",
"0.5788436",
"0.5788193",
"0.5778019",
"0.57764703",
"0.5772064",
"0.5760511",
"0.57429355",
"0.57410717",
"0.5736692",
"0.5734468",
"0.5726371",
"0.5723745",
"0.5716857",
"0.57124484",
"0.5710067",
"0.57067096",
"0.57011014",
"0.57000035",
"0.5689227",
"0.5688279",
"0.5684985",
"0.5649743",
"0.5639038",
"0.5637258",
"0.56355083",
"0.5632428",
"0.56294054",
"0.5624675",
"0.5615334",
"0.56125075",
"0.5611558",
"0.55982184",
"0.5597638",
"0.55969167",
"0.5592878",
"0.55875725",
"0.55854785",
"0.55854046",
"0.5579505",
"0.5575139",
"0.55729383",
"0.5570669",
"0.5567504",
"0.556707",
"0.55657095",
"0.5562236",
"0.5544545",
"0.5534076",
"0.55303943",
"0.5529881",
"0.5529881",
"0.55291283",
"0.5524923",
"0.55200547",
"0.55150837",
"0.55150837",
"0.55012965",
"0.54966486"
] | 0.661246 | 10 |
Search files and directories from the current directory, and update the screen. +pattern+ Search pattern against file names in Ruby Regexp string. === Example a : Search files that contains the letter "a" in their file name .\.pdf$ : Search PDF files | def grep(pattern = '.*')
regexp = Regexp.new(pattern)
fetch_items_from_filesystem_or_zip
@items = items.shift(2) + items.select {|i| i.name =~ regexp}
sort_items_according_to_current_direction
draw_items
draw_total_items
switch_page 0
move_cursor 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file_by_text (start_dir, file_mask=\"*.*\", text_pattern='')\n match_files = Dir[ File.join(start_dir.split(/\\\\/), \"**\", file_mask)]\n if match_files.length > 0\n file_path = nil\n match_files.each do |file|\n matching_text = File.read(file).include?(text_pattern) rescue false\n if matching_text\n file_path = file\n break\n end\n end\n p \"#{file_path ? 'First searching file is: '+file_path : 'No files found'}\"\n else\n \"No files with mask '#{file_mask}' in directory '#{start_dir}'\"\n end\n end",
"def find_files(pattern)\n Dir[File.join(folder, pattern, \"*.#{pattern}\")].sort{|f1, f2|\n File.basename(f1) <=> File.basename(f2)\n }.collect{|f|\n File.join(pattern, File.basename(f))\n }\n end",
"def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"def search(pattern)\n entries.inject(Rush::SearchResults.new(pattern)) do |results, entry|\n if !entry.dir? and matches = entry.search(pattern)\n results.add(entry, matches)\n end\n results\n end\n end",
"def find_files(search_pattern, opts = {})\n Dir.chdir(@top_dir)\n Dir.glob(\"**/*#{search_pattern}*\").map do |path|\n next if File.directory?(path)\n next unless File.readable?(path)\n begin\n mt = mime_type_for_file(path)\n {\n name: path,\n url: get_url_for_path(path),\n mime_type: mt,\n size: File.size(path)\n }\n rescue\n debug \"Can't seem to look at '#{path}'\"\n nil\n end\n end.compact\n end",
"def filter_files(pattern)\n regexp=Regexp.new(pattern || '.*')\n @[email protected]([]) do |matches,file| \n file_without_basepath=file[@basepath.length .. -1]\n matches << file if file_without_basepath=~regexp\n matches\n end\n @table.reloadData\n end",
"def filter_files_by_pattern\n @title = 'Search Results: (Press Esc to cancel)'\n @mode = 'SEARCH'\n if @toggles[:instant_search]\n search_as_you_type\n else\n @patt = readline '/'\n end\nend",
"def find_files(dir, pattern, &block)\n require 'find'\n\n Find.find(dir) do |p|\n if p =~ Regexp.compile(pattern)\n yield p\n end\n end\nend",
"def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend",
"def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend",
"def fnmatch( pattern, *args ) File.fnmatch( pattern, self, *args ) end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, path, *args) end",
"def glob(pattern = '**/*', **_opts)\n Enumerator.new do |y|\n walk(pattern) do |path, entry|\n y << file_info(path, entry) if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end",
"def find_files(search_pattern, opts = {})\n fetch!\n search_pattern = Regexp.new(search_pattern)\n res = []\n unless @repo.empty?\n tree = @repo.head.target.tree\n _find_files(search_pattern, tree, nil, res)\n end\n res\n end",
"def match(pattern, flags = 0)\n\t\t\t\tpath = pattern.start_with?('/') ? full_path : relative_path\n\t\t\t\t\n\t\t\t\treturn File.fnmatch(pattern, path, flags)\n\t\t\tend",
"def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end",
"def find_files(*file_patterns)\n FileFinder.new.version(self).files(file_patterns)\n end",
"def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\nend",
"def find_file_matching_pattern(search_dirs, pattern)\n search_dirs = [search_dirs] unless search_dirs.is_a?(Array)\n\n search_dirs.each do |d|\n matches = Dir.glob(File.join(d, pattern))\n return matches.first if matches.size > 0\n end\n return nil\n end",
"def search(pattern)\n Vimpack::Commands::Search.run(self, pattern)\n end",
"def add_matching(pattern)\n Dir[pattern].each do |fn|\n\tself << fn unless exclude?(fn)\n end\n end",
"def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend",
"def search_file(pattern, file)\n node = ast_from_file(file)\n search node, pattern\n end",
"def files_regex_search\n page = params[:page].to_i.positive? ? params[:page] : 1\n files = user_real_files(params, @context).files_conditions\n begin\n regexp = Regexp.new(params[:search_string], params[:flag])\n direction = params[:order_by_name]\n\n search_result = files.\n eager_load(:license, user: :org).\n order(name: direction.to_s).\n map do |file|\n describe_for_api(file) if file.name.downcase.scan(regexp).present?\n end\n\n result = []\n if search_result.compact.present?\n result = UserFile.files_search_results(search_result, direction)\n end\n\n paginated_result = Kaminari.paginate_array(result).page(page).per(20)\n uids = params[:uids].present? && to_bool(params[:uids]) ? result.compact.pluck(:uid) : []\n\n render json: { search_result: paginated_result, uids: uids }\n rescue RegexpError => e\n fail \"RegEx Invalid: #{e}\"\n end\n end",
"def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end",
"def glob(pattern)\n Dir.chdir(@output_dir) do\n Dir[pattern]\n end\n end",
"def add_matching(pattern)\n Dir[ pattern ].each do |fn|\n self << fn unless exclude?(fn)\n end\n end",
"def ls(pattern='**/*', _opts={})\n Enumerator.new do |y|\n @files.each_key do |key|\n y << key if File.fnmatch?(pattern, key, File::FNM_PATHNAME)\n end\n end\n end",
"def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end",
"def ls(pattern='**/*', _opts={})\n root = pattern[%r{^[^\\*\\?\\{\\}\\[\\]]+/}]\n root.chomp!('/') if root\n Enumerator.new do |y|\n glob(root) do |path|\n y << path if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end",
"def query\n dir, _, file = @pattern.gsub(/[_\\-\\*]+/, '').rpartition '/'\n dir.gsub(%r{/(\\w{,2})[^/]+}, '\\1') + # map 2 chars per folder\n file.gsub(/\\.\\w+/, '') # remove extension\n end",
"def find(*patterns)\n selection = nil\n patterns.each do |pattern|\n selection = Dir.glob(File.join(path, pattern)).first\n break if selection\n end\n FileObject[selection] if selection\n end",
"def add_matching(pattern)\n self.class.glob(pattern).each do |fn|\n self << fn unless excluded_from_list?(fn)\n end\n end",
"def ls(pattern = '**/*', **_opts)\n Enumerator.new do |y|\n walk(pattern) do |path, _|\n y << path if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end",
"def glob=(pattern)\n @glob = pattern\n if pattern.kind_of?(Regexp)\n @pattern = pattern\n else\n @pattern = scan_string\n end\n end",
"def file_contains(filename, pattern)\n unless pattern.kind_of?(Regexp)\n pattern = Regexp.new(pattern)\n end\n detected = nil\n File.open(filename) { |f|\n detected = f.detect { |line|\n line =~ pattern\n }\n }\n ! detected.nil?\n end",
"def search(pattern)\n entries.grep(Regexp.new(pattern))\n end",
"def find(pattern)\n patterns= [pattern].flatten\n contents=[]\n self.each_pair do |path, content|\n patterns.each do |pattern|\n contents << content if Content.path_match? path, pattern\n end\n end\n contents\n end",
"def glob(pat, path='/')\n # FIXME : implement\n raise('not implemented')\n # FIXME: verify and update\n # FIXME: test\n #regex = /^#{pat.gsub('*','.*').gsub('?','.?')}$/ \n #find(path) { |fname| fname =~ regex }\n end",
"def addSrcFilesByRE(re)\n Dir.for_each(@srcDir) { |f|\n next if File.stat(f).dir?\n @files << f if re =~ f\n }\n end",
"def searchABatch(directory, extension, searchString)\n return Dir.entries(directory).select{|file| File.open(file, \"r\").include?(searchString)}\nend",
"def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend",
"def match_folder(name, patterns = '*')\n Array(patterns).any? do |pattern|\n if pattern.is_a?(String)\n File.fnmatch(pattern.downcase, name.downcase)\n elsif pattern.is_a?(Regexp)\n name =~ pattern\n else\n nil\n end\n end\n end",
"def get_local_files regexp\n Dir[File.join(dir, '*')].select do |path|\n name = File.basename path\n File.file?(path) and name =~ regexp\n end\n end",
"def recursive_search(dir,patterns,\n excludes=[/\\.svn/, /,v$/, /\\.cvs$/, /\\.tmp$/,\n /^RCS$/, /^SCCS$/])\n results = Hash.new{|h,k| h[k] = ''}\n\n Find.find(dir) do |path|\n fb = File.basename(path) \n next if excludes.any?{|e| fb =~ e}\n if File.directory?(path)\n if fb =~ /\\.{1,2}/ \n Find.prune\n else\n next\n end\n else # file...\n File.open(path, 'r') do |f|\n ln = 1\n while (line = f.gets)\n patterns.each do |p|\n if line.include?(p)\n results[p] += \"#{path}:#{ln}:#{line}\"\n end\n end\n ln += 1\n end\n end\n end\n end\n return results\nend",
"def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend",
"def ask_search\n str = get_string(\"Enter pattern: \")\n return if str.nil? \n str = @last_regex if str == \"\"\n return if str == \"\"\n ix = next_match str\n return unless ix\n @last_regex = str\n\n @oldindex = @current_index\n @current_index = ix[0]\n @curpos = ix[1]\n ensure_visible\n end",
"def fnmatch?( pattern, *args ) File.fnmatch?( pattern, self, *args ) end",
"def glob(path, pattern, flags=0)\n flags |= ::File::FNM_PATHNAME\n path = path.chop if path[-1,1] == \"/\"\n\n results = [] unless block_given?\n queue = entries(path).reject { |e| e.name == \".\" || e.name == \"..\" }\n while queue.any?\n entry = queue.shift\n\n if entry.directory? && !%w(. ..).include?(::File.basename(entry.name))\n queue += entries(\"#{path}/#{entry.name}\").map do |e|\n e.name.replace(\"#{entry.name}/#{e.name}\")\n e\n end\n end\n\n if ::File.fnmatch(pattern, entry.name, flags)\n if block_given?\n yield entry\n else\n results << entry\n end\n end\n end\n\n return results unless block_given?\n end",
"def only(files,patterns)\n if !patterns.kind_of?(Array)\n patterns = [patterns]\n end\n files.select do |file|\n matches = false\n patterns.each do |pattern|\n if File.fnmatch(pattern,file)\n matches = true\n break\n end\n end\n matches\n end\n end",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def match(pattern); end",
"def glob(*pat, &blk)\n regexes = pat.flatten.map {|pat| Bun.convert_glob(pat) }\n enum = self.class.new(@collection) do |yielder|\n self.each do |fname|\n # TODO Refactor with any?\n matched = false\n regexes.each do |regex|\n if fname =~ regex\n matched = true\n break\n end\n end\n yielder << fname if matched\n end\n end\n if block_given?\n enum.each(&blk)\n else\n enum\n end\n end",
"def glob(pattern)\n root = self.root\n Pathname.glob(root.join(pattern)).map do |match|\n match.relative_path_from(root).to_s\n end\n end",
"def pattern_match(file, pattern)\n case\n when pattern.is_a?(Regexp)\n return file.match(pattern)\n when pattern.is_a?(String)\n return File.fnmatch(pattern, file)\n when pattern.is_a?(Proc)\n return pattern.call(file)\n when pattern.is_a?(Rake::FileTask)\n return pattern.to_s.match(file)\n else\n raise \"Cannot interpret pattern #{pattern}\"\n end\n end",
"def glob(pattern = '**/*', **_opts)\n Enumerator.new do |acc|\n walk(pattern, with_stat: true) {|info| acc << info }\n end\n end",
"def find(*pattern)\n # Create a glob pattern from the user's input, for instance\n # [\"rails\",\"2.3\"] => \"rails*2.3*\"\n pattern = pattern.join('*')\n pattern << '*' unless pattern =~ /\\*$/\n \n packages = []\n repositories = Qwandry::Configuration.repositories\n repositories.each do |repo|\n packages.concat(repo.scan(pattern))\n end\n \n differentiate packages\n packages\n end",
"def match_against filename\n @regexp.match(filename)\n end",
"def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n #Looking for files where occurs: phrase_we_have_now\n files_to_check.each do |one_file|\n file = File.open(one_file, \"r\") do |f|\n f.each_line do |line|\n reg = /.*#{@phrase_we_have_now}.*/\n if line.match?(reg)\n result_files_with_phrase << one_file\n end\n end\n end\n end\n if result_files_with_phrase.length == 0\n puts \"\\n\\e[31m\\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\\e[31m\"\n exit\n end\n result_files_with_phrase.uniq.sort\n end",
"def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend",
"def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n elsif file =~ match\n files.push path\n end\n end\n end\n\n return files\nend",
"def fsearch(file, regex)\n\tooo = File.stat(file)\n\toatime=foo.atime #atime before edit\n\tomtime=foo.mtime #mtime before edit\n\n\tf = File.open(file)\n\tfoo = f.readlines\n\tf.close\n\tif foo.to_s.match(/#{regex}/im) #Check for needle in haystack :p\n\t\tputs \"#{HC}#{FGRN}Found matches to '#{FWHT}#{regex}#{FGRN}' in File#{FWHT}: #{file}#{RS}\"\n\t\tocc = foo.to_s.scan(/#{regex}/im).count #How many times does it occur in file?\n\t\tputs \"\\t#{FGRN}Number of Occurances#{FWHT}: #{occ}#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}No Matches to '#{FWHT}#{regex}#{FRED}' in File#{FWHT}: #{file}#{RS}\"\n\tend\n\n\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\nend",
"def specify_files_to_search\n system 'clear'\n puts \"#{AVAILABLE_FILES}\\n #{available_files}\".bold\n @file_selection = STDIN.gets.chomp.split(FILE_SPLIT_REGEX)\n end",
"def glob(pattern)\n Glob.new(@shell, pattern)\n end",
"def select(*patterns)\n selection = []\n patterns.each do |pattern|\n selection.concat(Dir.glob(File.join(path, pattern))) \n end\n selection.map{ |s| FileObject[s] }\n end",
"def fnmatch?(pattern, *args) File.fnmatch?(pattern, path, *args) end",
"def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end",
"def glob(pattern, flags = T.unsafe(nil)); end",
"def files_named(name_pattern, minimum_size)\n @top_level.select do |fso|\n fso['type'] == 'file' && fso['name'].match(name_pattern) &&\n fso['size'] >= minimum_size\n end\n end",
"def matcher(pattern)\n case pattern\n when Regexp then lambda{|p| p =~ pattern}\n when String then lambda{|p| File.fnmatch?(pattern, p)}\n when Proc then pattern\n else raise ArgumentError, \"Expected a Regexp, String, or Proc\"\n end\n end",
"def select_by_pattern(files, pattern)\n to_keep = []\n files.each do |f|\n if f.to_s =~ pattern\n to_keep.push(f)\n end\n end\n to_keep.uniq\n end",
"def FindFilesInDirectory(includePatterns, excludePatterns, directory)\n files = [] \n #puts \"Searching files in '#{directory}'\"\n #puts \"Include patterns: #{includePatterns}\"\n\n if(!File.readable?(directory.AbsolutePath()))\n return files\n end\n \n testPath = directory.RelativePath()\n excludePatterns.each do |pattern|\n\tif(testPath.match(pattern) != nil)\n\t #puts \"Excluding file '#{entryPath}' based on pattern '#{pattern}'\"\n\t return files\n\tend\n end\n \n directory.SubPaths().each do |subPath|\n\n if(subPath.directory?())\n files = files + FindFilesInDirectory(includePatterns, excludePatterns, subPath)\n else\n entryIsExcluded = false\n\n\t testPath = subPath.RelativePath()\n\n excludePatterns.each do |pattern|\n if(testPath.match(pattern) != nil)\n\t #puts \"Excluding file '#{entryPath}' based on pattern '#{pattern}'\"\n entryIsExcluded = true\n break\n end\n end\n\n if(entryIsExcluded)\n next\n end\n\n entryMatches = false\n\n\t #puts \"Checking entry #{testPath} for inclusion\"\n includePatterns.each do |pattern|\n\t #puts \"Trying pattern #{pattern}\"\n if(testPath.match(pattern) != nil)\n\t #puts \"Including file '#{entryPath}' based on pattern '#{pattern}'\"\n entryMatches = true\n break\n end\n end\n\n if(entryMatches)\n files = files + [subPath]\n end\n end\n end\n\n return files\n end",
"def grep_search search_dir\n args = ['-r']\n end",
"def directory_named(name_pattern)\n @top_level.find do |fso|\n fso['type'] == 'dir' && fso['name'].match(name_pattern)\n end\n end",
"def perform_global_search(pattern, arr, dir)\n traverse(pattern, arr, dir)\n output_count(arr)\n end",
"def get_file_list(path_pattern)\n return Dir[path_pattern].sort\n end",
"def add_file_pattern(name, pattern_string)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n @file_patterns[name.to_sym] = pattern_string.to_s\n end",
"def grep(search, filename)\n regexp = Regexp.new(search)\n File.foreach(filename).with_index { |line, line_number|\n puts \"#{line_number+1}: #{line}\" if regexp =~ line\n }\nend",
"def index\n @title = 'Filenames'\n @filenames = Filename.all\n \n if match = params[:contains] || params[:match]\n @filenames = @filenames.where(\n 'name ILIKE ?', \"%#{match}%\"\n )\n end\n\n @filenames = (\n @filenames\n .order(:name)\n .page(params[:page])\n .per(params[:per_page])\n )\n end",
"def glob(pattern, *args)\n Dir.glob(pattern, *args).sort\n end",
"def search_file_replace(regex, replace)\n search_match(regex, replace, 'r', 2)\n end",
"def input_files_pattern\n @args.options[:input_files_pattern]\n end",
"def search(search_terms)\n\n db = Sequel.sqlite(dbfilename)\n dataset = db[:pdfmd_documents].where(\"UPPER(keywords) LIKE UPPER('%#{search_terms[0]}%')\")\n result_files = ''\n dataset.all.each do |match_file|\n match_file.each do |key,value|\n if key == :keywords\n\n # Split the keywords\n keywords = value.downcase.split(/\\s*,\\s*/)\n # Search for matches in the keywords.\n if keywords.find{ |e| /#{search_terms.join(' ').downcase}/ =~ e }\n result_files += match_file[:filename] + \"\\n\"\n end\n end\n\n end\n end\n\n # Ouput result filenames\n result_files\n\n end",
"def find_files(base_dir, flags); end",
"def file_match(file)\n end",
"def each_existing_path pattern, pathname_test = :exist?, &blk # :yields: corresponding_pathname\n attempts = []\n raise \"No paths to search for #{pattern}\" if @search_paths.nil? || @search_paths.empty?\n @search_paths.each do |path|\n path = (path + pattern).expand_path\n matches = Array(Pathname.glob(path).select(&pathname_test))\n attempts << path.to_s\n matches.each(&blk)\n end\n attempts\n end",
"def scan(pattern); end",
"def glob(pattern = '**/*', **opts)\n Enumerator.new do |acc|\n walk(pattern, **opts) do |path, obj|\n info = BFS::FileInfo.new(path: path, size: obj.size, mtime: obj.last_modified)\n acc << info\n end\n end\n end",
"def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end",
"def glob(pattern, flags: GLOB_OPERATION_FLAGS)\n @sftp.dir.glob(@path.to_s, pattern, flags) { |entry| yield entry.name }\n end",
"def findFiles(mamaDirectory, fileExtension)\r\n\t$logger.debug { \": Looking for '\" + fileExtension + \"' in '\" +\r\n\t\tmamaDirectory + \"' ...\" }\r\n\t# Rather than get all recursive, just check a couple levels down.\r\n\t# If the files aren't within those levels, there's a problem.\r\n\textFiles = Dir.glob mamaDirectory + \"/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*/*\" + fileExtension\r\n\tif (extFiles.size <= 0)\r\n\t\t$logger.debug { \" No files found!\" }\r\n\t\treturn nil;\r\n\tend\r\n\treturn extFiles\r\nend",
"def file_search\n #Checks the current folder for python files\n py_files = Dir.glob('*.py')\n #Checks if files exist, exists if not\n if py_files != []\n file_output(py_files)\n else\n puts \"You got lucky, Motherasshole!\"\n end\nend"
] | [
"0.71102583",
"0.70537454",
"0.69636136",
"0.6890982",
"0.6890982",
"0.6862031",
"0.68156797",
"0.67984957",
"0.67558163",
"0.67547935",
"0.6715535",
"0.67140937",
"0.6664562",
"0.66150063",
"0.6609749",
"0.646694",
"0.64667517",
"0.64667517",
"0.64593613",
"0.6457223",
"0.6456294",
"0.6448316",
"0.6414989",
"0.6411498",
"0.63913035",
"0.63821715",
"0.63705146",
"0.63642627",
"0.6324974",
"0.6323855",
"0.6314079",
"0.62814945",
"0.6230307",
"0.62243575",
"0.62099445",
"0.6180638",
"0.6171831",
"0.6143543",
"0.61299056",
"0.61244184",
"0.610636",
"0.60797226",
"0.60736614",
"0.6072624",
"0.59945464",
"0.5981436",
"0.59808373",
"0.5972416",
"0.59466845",
"0.59414357",
"0.59246564",
"0.5907666",
"0.58932483",
"0.58829725",
"0.5845716",
"0.5835539",
"0.58349895",
"0.5819747",
"0.5819747",
"0.58117247",
"0.58085245",
"0.57948285",
"0.5786684",
"0.57788986",
"0.57757825",
"0.57707185",
"0.5757657",
"0.5736183",
"0.57283914",
"0.5726671",
"0.57138205",
"0.571065",
"0.57028514",
"0.57012236",
"0.5690579",
"0.5676279",
"0.5667637",
"0.5666652",
"0.56651527",
"0.56524247",
"0.5648903",
"0.5643883",
"0.5642194",
"0.56391335",
"0.56349105",
"0.5619616",
"0.5613865",
"0.5613652",
"0.56084675",
"0.5607698",
"0.5605077",
"0.5600746",
"0.5589464",
"0.5589385",
"0.55819637",
"0.55701166",
"0.5564",
"0.55624783",
"0.55545413",
"0.5550883"
] | 0.5876553 | 54 |
Copy selected files and directories to the destination. | def cp(dest)
unless in_zip?
src = (m = marked_items).any? ? m.map(&:path) : current_item
FileUtils.cp_r src, expand_path(dest)
else
raise 'cping multiple items in .zip is not supported.' if selected_items.size > 1
Zip::File.open(current_zip) do |zip|
entry = zip.find_entry(selected_items.first.name).dup
entry.name, entry.name_length = dest, dest.size
zip.instance_variable_get(:@entry_set) << entry
end
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def copy(source, destination, **options); end",
"def copy_files(source_path, destination_path, directory)\n source, destination = File.join(directory, source_path), File.join(Rails.root, destination_path)\n FileUtils.mkdir(destination) unless File.exist?(destination)\n FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)\nend",
"def copy(copydirs)\n unless path(:source) == path(:destination)\n copydirs = copydirs.split(',') if copydirs.is_a? String\n abort(\"Export filter can't copy #{p option(:copydirs)}\") unless copydirs.is_a? Array\n\n copydirs.each do |src|\n dest_subdirs = src[/\\/\\/(.*)/,1] # regex returns any part of src after '//' separator\n src.gsub!('//','/') # collapse '//' separator in source path\n dest = path(:destination).dup # destination path \n dest << '/'+dest_subdirs if dest_subdirs # append any destination subdirectories\n src.insert(0,path(:source)+'/') # prepend source directory\n src << '*' if src[-1,1] == '/' # append '*' when copying directory contents\n log(\"copying '#{src}' to '#{dest}'\")\n FileUtils.mkdir_p(dest) # ensure dest intermediate dirs exist\n FileUtils.cp_r(Dir[src],dest,preserve: true) # Dir globs '*' added above\n end\n end\n end",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end",
"def cp srcpath, dstpath\n end",
"def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend",
"def cp(options={})\n from = options[:from]\n from = '*' if from == '.'\n from_list = glob(*from).to_a\n to = options[:to]\n to_path = to\n to_path = expand_path(to_path, :from_wd=>true) unless to.nil? || to == '-'\n if from_list.size == 1\n cp_single_file_or_directory(options.merge(:from=>from_list.first, :to=>to_path))\n else\n if to && to != '-'\n to += '/' unless to =~ %r{/$/}\n end\n from_list.each do |from_item|\n cp_single_file_or_directory(options.merge(:from=>from_item, :to=>to_path))\n end\n end\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end",
"def copy_files(dest_dir)\n @package.documents.each do |file|\n ActiveRecord::Base.logger.debug \"copying file #{file.attach.path} in #{File.join(dest_dir, \"\")}\"\n FileUtils.cp(file.attach.path, File.join(dest_dir, \"\"))\n end\n end",
"def copy_files(from, to, options={})\n exceptions = options[:except] || []\n\n puts \"Copying files #{from} => #{to}...\" if ENV['VERBOSE']\n\n Dir[\"#{from}/**/*\"].each do |f|\n next unless File.file?(f)\n next if exceptions.include?(File.basename(f))\n\n target = File.join(to, f.gsub(/^#{Regexp.escape from}/, ''))\n\n FileUtils.mkdir_p File.dirname(target)\n puts \"%20s => %-20s\" % [f, target] if ENV['VERBOSE']\n FileUtils.cp f, target\n end\nend",
"def copy_files(output_folder)\n copy_file_list(output_folder, @config.files.copy)\n end",
"def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end",
"def cp(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp']\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_file s, d, options[:preserve]\r\n end\r\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def copy\n FileUtils.cp_r(@src, @dest)\n end",
"def gather\n if File.exist?(@location_dir) && File.directory?(@location_dir)\n if Dir.glob(File.join(@location_dir, '*')).size > 0 # avoid creating the dest directory if the source dir is empty\n unless File.exists? @destination_dir\n FileUtils.mkpath @destination_dir\n end\n @files.each do |f|\n Dir.glob(File.join(@location_dir, f)).each do |file|\n FileUtils.cp_r file, @destination_dir\n end\n end\n end\n else\n puts \"Error: #{@location_dir}, doesn't exist or not a directory\"\n end\n end",
"def copy(destdir)\n # Make sure destination is a directory\n File.directory? destdir or raise ArgumentError, \"#{destdir} is not a directory\"\n # Go through files in sorted order\n num_files = self.files.length()\n # These are the files that didn't get copied to the destination dir\n uncopied = []\n self.files.each_index do |i|\n fe = self.files[i]\n # This is the destination filename\n dest = File.join(destdir, fe.archive_filename)\n # If @prune_leading_dir=true, then all files lack the leading\n # directories, so we need to prepend them.\n if @prune_leading_dir\n src = Pathname.new(@dir) + fe.archive_filename\n else\n src = fe.archive_filename\n end\n HDB.verbose and puts \"Copying (##{i+1}/#{num_files}) #{src} to #{dest}\"\n begin\n # Try and copy f to dest\n # NOTE: FileUtils.copy_entry does not work for us since it operates recursively\n # NOTE: FileUtils.copy only works on files\n self.copy_entry(src, dest)\n rescue Errno::ENOSPC\n HDB.verbose and puts \"... out of space\"\n # If the source was a file, we might have a partial copy.\n # If the source was not a file, copying it is likely atomic.\n if File.file?(dest)\n begin\n File.delete(dest)\n rescue Errno::ENOENT\n # None of the file was copied.\n end\n end\n uncopied.push(fe)\n # TODO: This may happen if destination dir doesn't exist\n rescue Errno::ENOENT\n # Src file no longer exists (was removed) - remove from\n # FileSet, as if out of space.\n HDB.verbose and puts \"... deleted before I could copy it!\"\n uncopied.push(fe)\n end\n end\n self.subtract!(uncopied)\n end",
"def copy_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }\n end",
"def copy_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }\n end",
"def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end",
"def cp_r(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if File.directory?(s)\r\n fu_copy_dir s, d, '.', options[:preserve]\r\n else\r\n fu_p_copy s, d, options[:preserve]\r\n end\r\n end\r\n end",
"def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend",
"def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end",
"def copy(options)\n destination = copy_destination options\n to_path = join_paths @root_dir, destination\n to_path_exists = File.exist? to_path\n\n preserve_existing = false? options[:overwrite]\n\n copy_resource_to_path to_path, preserve_existing\n copy_pstore_to_path to_path, preserve_existing\n\n to_path_exists\n end",
"def cp_single_file_or_directory(options={})\n from = options[:from]\n from_path = expand_path(from)\n to = options[:to]\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n case\n when File.directory?(from_path)\n if to && to != '-'\n if File.exists?(to)\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n creating_to_directory = false\n else\n creating_to_directory = true\n end\n end\n if options[:recursive]\n Dir.glob(\"#{from_path}/**/*\") do |from_item|\n suffix = File.relative_path(from_item, :relative_to=>from_path)\n suffix = File.join(from, suffix) unless creating_to_directory\n target_dir = File.dirname(File.join(to, suffix))\n FileUtils.mkdir_p(target_dir)\n if File.directory?(from_item)\n new_directory = File.join(target_dir,File.basename(from_item))\n if File.exists?(new_directory)\n raise CopyToNonDirectory \"Can't copy directory #{from_item } to non-directory #{new_directory}\" \\\n unless File.directory?(new_directory)\n else\n FileUtils.mkdir(new_directory)\n end\n else\n cp_single_file(options.merge(:from=>from_item, :to=>target_dir + '/'))\n end\n end\n else\n if options[:tolerant]\n STDERR.puts \"cp: Skipping directory #{from}\" unless options[:quiet]\n else\n raise CopyDirectoryNonRecursive, \"Can't non-recursively copy directory #{from}\"\n end\n end\n when File.exists?(from_path)\n cp_single_file(options.merge(:from=>from_path))\n else\n raise CopyMissingFromFile, \"#{from} does not exist\"\n end\n end",
"def copy(destination, file, folder = './downloads')\n FileUtils.mkdir_p(File.dirname(\"#{destination}/#{file}\"))\n FileUtils.cp_r(\"#{folder}/#{file}\", \"#{destination}/#{file}\")\n end",
"def doCopyOperations(sourceContent, destinationContent, dryRun)\n #N Without this loop, we won't copy the directories that are marked for copying\n for dir in sourceContent.dirs\n #N Without this check, we would attempt to copy those directories _not_ marked for copying (but which might still have sub-directories marked for copying)\n if dir.copyDestination != nil\n #N Without this, we won't know what is the full path of the local source directory to be copied\n sourcePath = sourceLocation.getFullPath(dir.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(dir.copyDestination.relativePath)\n #N Without this, the source directory won't actually get copied\n destinationLocation.contentHost.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n else\n #N Without this, we wouldn't copy sub-directories marked for copying of this sub-directory (which is not marked for copying in full)\n doCopyOperations(dir, destinationContent.getDir(dir.name), dryRun)\n end\n end\n #N Without this loop, we won't copy the files that are marked for copying\n for file in sourceContent.files\n #N Without this check, we would attempt to copy those files _not_ marked for copying\n if file.copyDestination != nil\n #N Without this, we won't know what is the full path of the local file to be copied\n sourcePath = sourceLocation.getFullPath(file.relativePath)\n #N Without this, we won't know the full path of the remote destination directory that this source directory is to be copied into\n destinationPath = destinationLocation.getFullPath(file.copyDestination.relativePath)\n #N Without this, the file won't actually get copied\n destinationLocation.contentHost.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end\n end\n end",
"def copy_file_to_output(source, destination)\n d = dir(File.join(\"output\", destination))\n FileUtils.copy source, d\n @touchedfiles << undir(d)\n end",
"def cp(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(cp -a -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end",
"def cp(src, dest, options = {})\r\n fu_check_options options, :preserve, :noop, :verbose\r\n fu_output_message \"cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n fu_preserve_attr(options[:preserve], s, d) {\r\n copy_file s, d\r\n }\r\n end\r\n end",
"def copy(*froms, to)\n froms.each do |from|\n FileUtils.cp(from, to)\n end\n end",
"def cp(srcpath,dstpath)\n FileUtils.cp_r(srcpath,dstpath)\n end",
"def cp(src, dest, preserve: nil, noop: nil, verbose: nil)\n fu_output_message \"cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n copy_file s, d, preserve\n end\n end",
"def copyCommon(destPath)\n\tcopyUI(destPath)\n\tcopyEvothings(destPath)\nend",
"def copy(files=[])\n files = ignore_stitch_sources files\n if files.size > 0\n begin\n message = 'copied file'\n message += 's' if files.size > 1\n UI.info \"#{@msg_prefix} #{message.green}\" unless @config[:silent]\n puts '| ' #spacing\n files.each do |file|\n if !check_jekyll_exclude(file)\n path = destination_path file\n FileUtils.mkdir_p File.dirname(path)\n FileUtils.cp file, path\n puts '|' + \" → \".green + path\n else\n puts '|' + \" ~ \".yellow + \"'#{file}' detected in Jekyll exclude, not copying\".red unless @config[:silent]\n end\n end\n puts '| ' #spacing\n\n rescue Exception\n UI.error \"#{@msg_prefix} copy has failed\" unless @config[:silent]\n UI.error e\n stop_server\n throw :task_has_failed\n end\n true\n end\n end",
"def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end",
"def preform_copy_directory\n @destination_directories.each do |destination|\n @sources.each do |source|\n write_mode = 'w'\n new_path = Pathname.new(destination.to_s).join(source.basename)\n # Check if the specified file is a directory\n if new_path.directory?\n return false if get_input(\"Destination path '\" + new_path.to_s + \"' is a directory. (S)kip the file or (C)ancel: \", ['s','c']) == 'c'\n next\n end\n # Copy the file\n return false unless copy_file(source, new_path)\n end\n end\n return true\n end",
"def markCopyOperations(destinationDir)\n #N Without this we can't loop over the immediate sub-directories to determine how each one needs to be marked for copying\n for dir in dirs\n #N Without this we won't have the corresponding sub-directory in the other directory with the same name as this sub-directory (if it exists)\n destinationSubDir = destinationDir.getDir(dir.name)\n #N Without this check, we won't be able to correctly process a sub-directory based on whether or not one with the same name exists in the other directory\n if destinationSubDir != nil\n #N Without this, files and directories missing or changed from the other sub-directory (which does exist) won't get copied\n dir.markCopyOperations(destinationSubDir)\n else\n #N Without this, the corresponding missing sub-directory in the other directory won't get updated from this sub-directory\n dir.markToCopy(destinationDir)\n end\n end\n #N Without this we can't loop over the files to determine how each one needs to be marked for copying\n for file in files\n #N Without this we won't have the corresponding file in the other directory with the same name as this file (if it exists)\n destinationFile = destinationDir.getFile(file.name)\n #N Without this check, this file will get copied, even if it doesn't need to be (it only needs to be if it is missing, or the hash is different)\n if destinationFile == nil or destinationFile.hash != file.hash\n #N Without this, a file that is missing or changed won't get copied (even though it needs to be)\n file.markToCopy(destinationDir)\n end\n end\n end",
"def selective_copy(directory, &block)\n Dir[File.join(source_paths, directory)].each do |filename|\n file = filename.to_s.gsub(\"#{Engine.root.to_s}/\", '')\n copy_file file\n end\n end",
"def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend",
"def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend",
"def cp(src,dst)\n @files_to_copy[dst] = [] unless @files_to_copy.has_key? dst\n @files_to_copy[dst].push(src)\n end",
"def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end",
"def copy_files\r\n %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file|\r\n copy_file file\r\n end\r\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def copy(*paths)\n paths = paths.flatten\n mappings = {}\n paths.each do |path|\n if path.is_a? Hash\n mappings.merge! path\n else\n mappings[path] = path\n end\n end\n\n mappings.each do |src, dest|\n ensure_folder dest\n FileUtils.cp src_path(src), dest_path(dest)\n @to_copy.delete src\n end\n end",
"def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end",
"def copy_file(source, destination)\n FileUtils.cp(source, destination)\n destination\n end",
"def cp(src, dest)\n unless dest.dirname.exist?\n LOG.info \"MKDIR: #{dest.dirname}\"\n FileUtils.mkdir_p(dest.dirname)\n end\n\n LOG.info \"COPY: #{src} #{dest}\"\n FileUtils.cp_r(src, dest)\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def copy_assets\n FileUtils.cp_r File.join(self.source, '_assets', '.'), self.dest\n end",
"def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this there won't be a description of the copy operation that can be displayed to the user as feedback\n description = \"SCP: copy directory #{sourcePath} to #{user}@#{host}:#{destinationPath}\"\n #N Without this the user won't see the echoed description\n puts description\n #N Without this check, the files will be copied even if it is only meant to be a dry run.\n if not dryRun\n #N Without this, the files won't actually be copied.\n scpConnection.upload!(sourcePath, destinationPath, :recursive => true)\n end\n end",
"def execute\n\n copiedCounter = 0\n failedCounter = 0\n skippedCounter = 0\n \n # traverse all srcfiles\n FiRe::filesys.find(@source) { |srcItem|\n \n # give some feedback\n FiRe::log.info \"searching #{srcItem}...\" if FiRe::filesys.directory?(srcItem)\n \n # skip this subtree if it matches ignored-items\n FiRe::filesys.prune if ignore?(srcItem) \n \n # transform srcpath to destpath\n destItem = srcItem.gsub(@source, @destination)\n\n # do not copy if item already exists and looks OK\n if needCopy(destItem,srcItem)\n copyWentWell = copyItem(srcItem, destItem)\n copiedCounter += 1 if copyWentWell\n failedCounter += 1 if !copyWentWell\n else\n skippedCounter += 1 \n end\n \n }\n \n # give some feedback\n FiRe::log.info \"copied #{copiedCounter} items, while #{failedCounter} items failed. #{skippedCounter} items did not need to be copied today.\"\n\n end",
"def copy(from, to)\n @ctx.cp(@path + from, @path + to)\n end",
"def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend",
"def file_copy(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/copy\", params)\n parse_response(response)\n end",
"def copy_folders\r\n %w{_includes _layouts _posts _sass assets}.each do |dir|\r\n directory dir\r\n end\r\n end",
"def cp_into(options={})\n cmd = \"/bin/cp #{options[:src]} #{@config.ve_private}/#{options[:dst]}\"\n execute(cmd)\n end",
"def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end",
"def copy(from, to, options={})\n expanded_to = File.expand_path(to)\n unless options[:force]\n raise FileOverwriteError, \"File #{expanded_to} already exists\" if File.exists?(expanded_to)\n end\n system(['rm', '-rf', expanded_to].shelljoin)\n system(['cp', '-r', File.expand_path(from) + \"/\", expanded_to + \"/\"].shelljoin)\n end",
"def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend",
"def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end",
"def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end",
"def cp_r(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['cp_r']\r\n fu_output_message \"cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n options[:dereference_root] = true unless options.key?(:dereference_root)\r\n fu_each_src_dest(src, dest) do |s, d|\r\n copy_entry s, d, options[:preserve], options[:dereference_root], options[:remove_destination]\r\n end\r\n end",
"def copy(dst)\n FileUtils.copy_file(self, dst, true)\n end",
"def copy(dst)\n FileUtils.copy_file(self, dst, true)\n end",
"def copy_dir(src_dir, dest_dir = \"/\")\n # Copy all the files into the home directory\n source = Dir.glob(ROOT_DIR.join(name).join(\"*\").to_s)\n FileUtils.cp_r(source, @workdir_path.to_s)\n end",
"def stage_copy(source_dir)\n test_dir = File.dirname(caller[0])\n stage_clear\n srcdir = File.join(test_dir, source_dir)\n Dir[File.join(srcdir, '*')].each do |path|\n FileUtils.cp_r(path, '.')\n end\n end",
"def copy_with_path(src, dst)\n\tsrc_folder = File.basename(File.dirname(src))\n\tnewpath = (dst + src_folder)\n\tFileUtils.mkdir_p(newpath)\n \tFileUtils.cp(src, newpath)\nend",
"def copy_include_files\n include_directory = Pathname.new(@env[\"package.directory\"]).join(\"include\")\n\n @env[\"package.files\"].each do |from, dest|\n # We place the file in the include directory\n to = include_directory.join(dest)\n\n @env[:ui].info I18n.t(\"vagrant.actions.general.package.packaging\", :file => from)\n FileUtils.mkdir_p(to.parent)\n\n # Copy direcotry contents recursively.\n if File.directory?(from)\n FileUtils.cp_r(Dir.glob(from), to.parent, :preserve => true)\n else\n FileUtils.cp(from, to, :preserve => true)\n end\n end\n end",
"def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end",
"def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end",
"def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def cp_r(src,dst)\n src_root = Pathname.new(src)\n FileUtils.mkdir_p(dst, :verbose => VERBOSE) unless File.exists? dst\n Dir[\"#{src}/**/**\"].each do |abs_path|\n src_path = Pathname.new(abs_path)\n rel_path = src_path.relative_path_from(src_root)\n dst_path = \"#{dst}/#{rel_path.to_s}\"\n \n next if abs_path.include? '.svn'\n \n if src_path.directory?\n FileUtils.mkdir_p(dst_path, :verbose => VERBOSE)\n elsif src_path.file?\n FileUtils.cp(abs_path, dst_path, :verbose => VERBOSE)\n end\n end\nend",
"def copy_appl_to_dest(file_list, start_dir, dst_dir)\n num_of_files = 0\n file_list.each do |src_file|\n # name without start_dir\n rel_file_name = src_file.gsub(start_dir, \"\")\n log \"Copy #{rel_file_name}\"\n # calculate destination name\n dest_name_full = File.join(dst_dir, rel_file_name)\n dir_dest = File.dirname(dest_name_full)\n num_of_files = num_of_files + 1\n # make sure that a directory destination exist because cp don't create a new dir\n if !@simulate\n FileUtils.mkdir_p(dir_dest) unless File.directory?(dir_dest)\n FileUtils.cp(src_file, dest_name_full)\n end\n end\n log \"Num of files copied #{num_of_files}\"\n end",
"def copy_files_relative(files, folder)\n files.each do |file|\n destination = File.join(folder, File.dirname(file))\n mkdir_p destination, fileutils_options unless File.exists? destination\n cp file, destination, fileutils_options\n end\n end",
"def sftp_copy(username, password, server, files_map)\n ssh = FileCopy.ssh_connect(username, password, server)\n ssh.sftp.connect do |sftp|\n uploads = files_map.map { |from,to|\n remote_dir = File.dirname(to)\n sftp_mkdir_recursive(sftp, File.dirname(to))\n Log.debug1(\"Copying %s to %s\",from, to)\n sftp.upload(from, to)\n }\n uploads.each { |u| u.wait }\n Log.debug1(\"Done.\")\n end # ssh.sftp.connect\n end",
"def copyOutputFiles(fromDir, filePattern, outDir)\n\tFileUtils.mkdir_p outDir unless exists?(outDir)\n\tDir.glob(File.join(fromDir, filePattern)){|file|\n\t\tcopy(file, outDir) if File.file?(file)\n\t}\nend",
"def copy(source, destination, **options)\n ensure_same_node(:copy, [source, destination]) do |node|\n node.copy(source, destination, **options)\n end\n end",
"def cp_single_file(options={})\n from = options[:from]\n to = options[:to]\n raise RuntimeError, \"#{from} should not be a directory\" if File.directory?(from)\n if to.to_s =~ %r{(.*)/$}\n to = $1\n raise CopyToNonDirectory, \"#{to} is not a directory\" unless File.directory?(to)\n end\n if to && to != '-' && File.directory?(to)\n to = File.join(to, File.basename(from))\n end\n cp_file_to_file(:from=>from, :to=>to)\n end",
"def copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the copy command won't be run at all\n sshAndScp.copyLocalToRemoteDirectory(sourcePath, destinationPath, dryRun)\n end",
"def copy_to_many(source, targets)\n expanded_source = File.expand_path(source)\n\n targets.each do |target|\n expanded_target = File.expand_path(target)\n\n # ensure the subdirectories exist\n FileUtils.mkpath(File.dirname(expanded_target))\n\n # copy file to other locations\n FileUtils.cp(expanded_source, expanded_target)\n end\n end",
"def cp(*args, **kwargs)\n queue CopyCommand, args, kwargs\n end",
"def copy(source_repo_id, destination_repo_id, optional = {})\n criteria = {:type_ids => [content_type], :filters => {}}\n criteria[:filters]['association'] = {'unit_id' => {'$in' => optional[:ids]}} if optional[:ids]\n criteria[:filters] = optional[:filters] if optional[:filters]\n criteria[:fields] = {:unit => optional[:fields]} if optional[:fields]\n\n payload = {:criteria => criteria}\n payload[:override_config] = optional[:override_config] if optional.key?(:override_config)\n\n if optional[:copy_children]\n payload[:override_config] ||= {}\n payload[:override_config][:recursive] = true\n end\n\n Runcible::Extensions::Repository.new(self.config).unit_copy(destination_repo_id, source_repo_id, payload)\n end",
"def doAllCopyOperations(dryRun)\n #N Without this, the copy operations won't be executed\n doCopyOperations(@sourceContent, @destinationContent, dryRun)\n end",
"def copy_with_path(src, dst, filename)\n FileUtils.mkdir_p(dst)\n FileUtils.cp(src, dst + filename)\nend",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend",
"def copyLocalFileToRemoteDirectory(sourcePath, destinationPath, dryRun)\n #N Without this, the external SCP application won't actually be run to copy the file\n executeCommand(\"#{@scpCommandString} #{sourcePath} #{userAtHost}:#{destinationPath}\", dryRun)\n end",
"def cp(path, dest)\n FileUtils.rm_rf(expand dest)\n if File.directory?(expand path)\n FileUtils.mkdir_p(expand dest)\n FileUtils.cp_r(expand(path), expand(dest))\n else\n FileUtils.mkdir_p(File.dirname(expand dest))\n FileUtils.cp(expand(path), expand(dest))\n end\n end",
"def copy_file(source_file, dest_file, settings)\n\tFileUtils.cp_r(source_file, dest_file)\nend",
"def copy_file(src_file, dest_file)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(dest_file)) unless File.directory?(File.dirname(dest_file))\n FileUtils.cp(ROOT_DIR.join(src_file), dest_file)\n end\n end",
"def copy_assets src, dest, inclusive=true, missing='exit'\n unless File.file?(src)\n unless inclusive then src = src + \"/.\" end\n end\n src_to_dest = \"#{src} to #{dest}\"\n unless (File.file?(src) || File.directory?(src))\n case missing\n when \"warn\"\n @logger.warn \"Skipping migrate action (#{src_to_dest}); source not found.\"\n return\n when \"skip\"\n @logger.debug \"Skipping migrate action (#{src_to_dest}); source not found.\"\n return\n when \"exit\"\n @logger.error \"Unexpected missing source in migrate action (#{src_to_dest}).\"\n raise \"MissingSourceExit\"\n end\n end\n @logger.debug \"Copying #{src_to_dest}\"\n begin\n FileUtils.mkdir_p(dest) unless File.directory?(dest)\n if File.directory?(src)\n FileUtils.cp_r(src, dest)\n else\n FileUtils.cp(src, dest)\n end\n @logger.info \"Copied #{src} to #{dest}.\"\n rescue Exception => ex\n @logger.error \"Problem while copying assets. #{ex.message}\"\n raise\n end\nend",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def copy(destination)\n return unless @converted\n \n puts \"Generating #{Rails.root}/tmp/images/#{@full}\"\n puts \"Generating #{Rails.root}/tmp/images/#{@icon}\"\n \n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@full}\", \n \"#{destination}/#{@full}\")\n puts \"Moving #{destination}/#{@full}\"\n \n FileUtils.chmod(0644, \"#{destination}/#{@full}\")\n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@icon}\",\n \"#{destination}/#{@icon}\")\n puts \"Moving #{destination}/#{@icon}\"\n FileUtils.chmod(0644, \"#{destination}/#{@icon}\")\n end"
] | [
"0.7220369",
"0.7220369",
"0.7103961",
"0.7088442",
"0.7067693",
"0.70432603",
"0.69822156",
"0.69538707",
"0.69121385",
"0.68227917",
"0.68054414",
"0.6801442",
"0.678095",
"0.6729905",
"0.67170745",
"0.6699256",
"0.6699256",
"0.6694657",
"0.66882753",
"0.66835344",
"0.6677976",
"0.66449815",
"0.66449815",
"0.6642523",
"0.663953",
"0.6628045",
"0.65842557",
"0.6565817",
"0.655259",
"0.65489316",
"0.6521812",
"0.65104985",
"0.65034413",
"0.649631",
"0.6474979",
"0.64319557",
"0.6415769",
"0.6399869",
"0.6370201",
"0.6370136",
"0.63619953",
"0.6319526",
"0.63098025",
"0.6306131",
"0.62996703",
"0.62853134",
"0.62727505",
"0.62644047",
"0.62599",
"0.62550545",
"0.62509465",
"0.62509465",
"0.62409395",
"0.62406355",
"0.62258166",
"0.62187636",
"0.62103516",
"0.620419",
"0.61945456",
"0.61827636",
"0.6178066",
"0.6176703",
"0.6162063",
"0.61382824",
"0.613668",
"0.61048865",
"0.6077133",
"0.6077133",
"0.6068519",
"0.6068519",
"0.6062251",
"0.60577714",
"0.6055808",
"0.6055492",
"0.6053462",
"0.6053185",
"0.60510164",
"0.60485536",
"0.60338014",
"0.6024431",
"0.6017706",
"0.6015974",
"0.601321",
"0.60088235",
"0.600428",
"0.59972626",
"0.5993257",
"0.59873825",
"0.59738886",
"0.59724253",
"0.59679633",
"0.59449553",
"0.5944376",
"0.59413195",
"0.5940325",
"0.59395444",
"0.5932649",
"0.59325486",
"0.59256196",
"0.59202194"
] | 0.64731747 | 35 |
Move selected files and directories to the destination. | def mv(dest)
unless in_zip?
src = (m = marked_items).any? ? m.map(&:path) : current_item
FileUtils.mv src, expand_path(dest)
else
raise 'mving multiple items in .zip is not supported.' if selected_items.size > 1
rename "#{selected_items.first.name}/#{dest}"
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_folders(orig,dest)\n \n puts \"Moving #{orig} -> #{dest}\" if @verbose\n FileUtils.mv orig,dest\n end",
"def move(*froms, to)\n froms.each do |from|\n FileUtils.mv(from, to)\n end\n end",
"def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_dirs\n \n end",
"def move_instant\n # FIXME: cannot be in target directory and do auto update\n # should we have a key for specifying move_target ?\n\n # for the mo, lets not move if nothing selected\n if @selected_files.empty?\n target = readline \"Set Move target #{@move_target}:\"\n target = Dir.pwd if target == '.'\n target = File.expand_path(target)\n @move_target = target\n message \"Move target is #{@move_target}. Select files and press this key.\"\n return\n end\n\n # files selected. Use earlier target if there, else ask\n # XXX how do we change it once set\n target = @move_target\n if target.nil? || target == ''\n count = @selected_files.count\n target = readline \"Move #{count} files to :\"\n return unless target\n end\n target = File.expand_path(target)\n unless File.directory? target\n perror \"#{target} not a directory.\"\n return\n end\n\n files = @selected_files\n ccount = 0\n files.each do |f|\n FileUtils.mv f, target\n @log.info \"2.#{f} moved to #{target}.\"\n ccount += 1\n rescue StandardError => exc\n @log.warn 'Case 2:'\n @log.warn \"Target is #{target}, file was #{f}\"\n @log.warn exc.to_s\n perror exc.to_s\n end\n @move_target = target\n clean_selected_files\n message \"#{ccount} files moved to #{target}.\"\n refresh\nend",
"def move(src, dst)\n dddebug('move', [src, dst])\n\n glob(src, false).each do |f|\n begin\n # glob returns relative paths inside the prefix.\n # We have to prefix bouth source and dst.\n pre_f = prefixed(f)\n pre_dst = prefixed(dst)\n\n OneCfg::LOG.dddebug(\"Move #{pre_f} \" \\\n \"into #{pre_dst}\")\n\n FileUtils.mv(pre_f, pre_dst)\n rescue StandardError => e\n # skip files which are the same as destination\n # TODO: WTF is error 22 !!!\n next if e.errno == 22\n\n raise e\n end\n end\n end",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def move(options = {})\n required_input_files :src_path\n required_output_files :dst_path\n\n src_path = input_file(:src_path)\n dst_path = output_file(:dst_path)\n\n if File.exist?(dst_path)\n raise \"dst_path '#{dst_path}' already exist\"\n end\n \n dst_dir = File.dirname(dst_path)\n FileUtils.mkdir_p(dst_dir) unless Dir.exist?(dst_dir)\n FileUtils.move(src_path, dst_path)\n\n return true\n end",
"def mv srcpath, dstpath\n end",
"def project_mv(src_file, dst_file, options)\n if src_file.path.directory?\n # Process all children first\n children = src_file.path.children.map { |c| c.directory? ? Group.new(c) : File.new(c) }\n children.each do |src_child|\n dst_child = src_child.with_dirname(dst_file.path)\n project_mv(src_child, dst_child, options)\n end\n else\n # Remove old destination file reference if it exists\n dst_file.remove_from_project if dst_file.pbx_file\n\n # Add new destination file reference to the new xcodeproj\n dst_file.create_file_reference\n dst_file.add_to_targets(options[:targets], options[:headers])\n end\n\n # Remove original directory/file from xcodeproj\n if src_file.pbx_file\n src_file.remove_from_project\n else\n warn(\"⚠️ Warning: #{src_file.path.basename} not found in #{src_file.project.path.basename}, moving anyway...\")\n end\n end",
"def move_files(from_path, to_path)\n # move into the new dir - and mv files to the in_process_dir\n pwd = FileUtils.pwd\n begin\n FileUtils.mkdir_p(to_path) if not Dir.exists? to_path\n Dir.chdir(from_path)\n FileUtils.mv Dir.glob(\"*\"), to_path, :force => true\n Dir.chdir(to_path)\n begin\n #remove from_path as files are now \"in process\"\n FileUtils.rm_r(from_path)\n rescue\n logger.warn \"failed to rm #{from_path}\"\n end\n ensure\n if FileUtils.pwd() != pwd\n if Dir.exists? pwd\n FileUtils.chdir(pwd)\n else\n FileUtils.chdir( student_work_dir() )\n end\n end\n end\n end",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def move(from, to)\n @ctx.mv(@path + from, @path + to)\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def mv( dst, options = {} )\n # what does FileUtils.rm actually return? Glancing an the source, it\n # seems to only throw errors.\n FileUtils.mv( self, dst, **options )\n end",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def download_all_files files,dest\n return if files.empty?\n RubyUtil::partition files do |sub|\n cmd = \"mv -t #{dest} \"\n cmd += sub.map { |f| \"\\\"#{f.full_path}\\\"\" }.join(' ')\n exec_cmd(cmd) \n end\n # update files object !\n files.map! { |f| f.path = dest; f }\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def move_dirs\n :both\n end",
"def move(from_path, to_path, ctype=nil, recursive=false, replace=false)\n copy(from_path, to_path, ctype, recursive, replace)\n remove(from_path, ctype, recursive)\n end",
"def perform_sync(source, destination, options)\n new_files, new_files_destination = get_new_files_to_sync(source, destination, options)\n sync_new_files(source, new_files, new_files_destination, options)\n cleanup_files_we_dont_want_to_keep(source, new_files, new_files_destination) unless options[:keep].nil?\n end",
"def move_files(tmpdir)\n entries_at_depth(tmpdir, new_resource.strip_components).each do |source|\n target = ::File.join(new_resource.destination, ::File.basename(source))\n # If we are in keep_existing mode, the target might exist already.\n # This is not a great solution and won't have exactly the same behavior\n # as the other providers, but it's something at least.\n FileUtils.rm_rf(target) if ::File.exist?(target)\n # At some point this might need to fall back to a real copy.\n ::File.rename(source, target)\n end\n end",
"def move(*args)\n result = copy(*args)\n delete if [Created, NoContent].include?(result)\n result\n end",
"def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end",
"def move(id, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/move?file_ids=%s&parent_id=%i' % [id, folder]).status == \"OK\"\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def move\n display_change\n File.move(@real_path, new_path, false)\n end",
"def move_file\n\n end",
"def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend",
"def gather\n if File.exist?(@location_dir) && File.directory?(@location_dir)\n if Dir.glob(File.join(@location_dir, '*')).size > 0 # avoid creating the dest directory if the source dir is empty\n unless File.exists? @destination_dir\n FileUtils.mkpath @destination_dir\n end\n @files.each do |f|\n Dir.glob(File.join(@location_dir, f)).each do |file|\n FileUtils.cp_r file, @destination_dir\n end\n end\n end\n else\n puts \"Error: #{@location_dir}, doesn't exist or not a directory\"\n end\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def move_document\n Dir.mkdir(target_dir) if (!File.directory?(target_dir))\n # Only want to move the .html, .css, .png and .js files, not the .haml templates.\n html_css_files = temp_dir(\"*.{html,css,js,png}\")\n Dir[html_css_files].each { |f| mv f, target_dir }\n mv temp_dir + \"/resources\", target_dir, :force => true if (File.directory?(temp_dir + \"/resources\"))\n mv temp_dir + \"/assets\", target_dir, :force => true if (File.directory?(temp_dir + \"/assets\"))\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"mv #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n fu_each_src_dest(src, dest) do |s,d|\r\n if rename_cannot_overwrite_file? and File.file?(d)\r\n File.unlink d\r\n end\r\n\r\n begin\r\n File.rename s, d\r\n rescue\r\n if File.symlink?(s)\r\n File.symlink File.readlink(s), dest\r\n File.unlink s\r\n else\r\n st = File.stat(s)\r\n copy_file s, d\r\n File.unlink s\r\n File.utime st.atime, st.mtime, d\r\n begin\r\n File.chown st.uid, st.gid, d\r\n rescue\r\n # ignore\r\n end\r\n end\r\n end\r\n end\r\n end",
"def move_files_to_destination!(files_array)\n files_array.each do |file|\n new_destination = \"#{@destinaton}/'dirty_#{file}'\"\n system(\"mv #{file} #{new_destination}\")\n destroy_dirty_file!(file)\n end\n puts \"=> #{files_array.count} files copied to #{@destination} and original files destroyed\"\n end",
"def mv!(to)\n files.map{|file| file.mv! to }\n end",
"def move(dest_path, overwrite=false)\n NotImplemented\n end",
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def copy_directory(source, destination)\n FileUtils.cp_r(FileSyncer.glob(\"#{source}/*\"), destination)\n end",
"def move_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.mv(@working_dir, expand(path))\n end",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def move(src=[], dest = nil)\n destination = dest unless dest.nil?\n source = src unless src.empty?\n\n if source && destination\n verified_move(source, destination)\n end\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def mv(from_path, to_path, replace=false)\n move(from_path, to_path, nil, true, replace)\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def mv(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(mv -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end",
"def lmove(source, destination, where_source, where_destination); end",
"def lmove(source, destination, where_source, where_destination); end",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def move(dest)\n copy(dest)\n delete\n end",
"def cmd_move(_args)\n #puts [:move, _args].inspect\n data=get_src(_args[0][0], _args[2][0], _args[2][1])\n #p '%x' % data\n set_dst(_args[0][0], _args[1][0], _args[1][1], data)\n @flags[:n]=true if data<0\n @flags[:z]=true if data==0\n @flags[:v]=false\n @flags[:c]=false\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def move(from, to, options={})\n valid_options = %w(movesubpages movetalk noredirect reason watch unwatch)\n options.keys.each{|opt| raise ArgumentError.new(\"Unknown option '#{opt}'\") unless valid_options.include?(opt.to_s)}\n\n form_data = options.merge({'action' => 'move', 'from' => from, 'to' => to, 'token' => get_token('move', from)})\n make_api_request(form_data)\n end",
"def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end",
"def move(dest, overwrite=false)\n NotImplemented\n end",
"def move_files_to(from_folder)\n\n Dir.glob(\"#{from_folder}/*\") do |filename|\n to_path = \"#{timestamped(filename)}\"\n delete_file_if_there(to_path)\n move_file(filename, to_path)\n end\n end",
"def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)\n fu_output_message \"mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n destent = Entry_.new(d, nil, true)\n begin\n if destent.exist?\n if destent.directory?\n raise Errno::EEXIST, d\n end\n end\n begin\n File.rename s, d\n rescue Errno::EXDEV,\n Errno::EPERM # move from unencrypted to encrypted dir (ext4)\n copy_entry s, d, true\n if secure\n remove_entry_secure s, force\n else\n remove_entry s, force\n end\n end\n rescue SystemCallError\n raise unless force\n end\n end\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def move_sub_files(src_path, dest_path)\n puts \"=== Move subtitle files\"\n puts \" from: #{src_path}\"\n puts \" to: #{dest_path}\"\n\n files = Dir[File.join(src_path, \"**/*\")]\n files.each do |file|\n next unless SUB_TYPES.include?(File.extname(file))\n move_file_to_path(file, dest_path)\n end\n end",
"def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def move(d)\n\n\t\t# Validate target directory\n\t\traise \"Target directory not found, #{d}\" unless File.directory?(d)\n\t\tdname = File.expand_path(d)\n\n\t\t# Construct target pathnames\t\t\n\t\tmetanew = File.join( dname, @metafile )\n\t\tdatanew = File.join( dname, @datafile )\n\t\t\n\t\t# Move the pair to new directory\n\t\tbegin\n\t\t\tFileUtils.move( @metafull, metanew ) if has_meta?\n\t\t rescue\n\t\t\traise \"Move failed for #{@metafull} to #{metanew}: $!\"\n\t\t end\n\t\t\n\t\tbegin\n\t\t\tFileUtils.move( @datafull, datanew )\n\t\t rescue\n\t\t\traise \"Move failed for #{@datafull} to #{datanew}: $!\"\n\t\t end\n\n\t\t# Update instance variables\n\t\t@dirname = dname\n\t\t@metafull = metanew\n\t\t@datafull = datanew\n\t\t\n\tend",
"def move(from, to, aux, disk_count)\n # base case\n if disk_count == 1 # we're only moving one disc\n disk = from.pop\n check_disk_sizes(disk, to.last)\n to.push(disk)\n print_state\n @step_counter += 1\n return\n end\n\n # otherwise we need to do some flippin aorund\n move(from, aux, to, disk_count - 1)\n move(from, to, aux, 1)\n move(aux, to, from, disk_count - 1)\n end",
"def move(src, dst)\n not_implemented('move')\n end",
"def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def test_move_folder\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/TestMoveFolderSrc/TestMoveFolderSrc.docx'\n\n request = MoveFolderRequest.new(dest_path: remote_test_out + '/TestMoveFolderDest_' + generate_uuid, src_path: remote_data_folder + '/TestMoveFolderSrc')\n\n @words_api.move_folder(request)\n end",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def extract(source, destination)\n if !File.directory?(source)\n if source.include?(\".mp3\") || source.include?(\".m4a\")\n FileUtils.cp(source, destination)\n end\n else\n Dir.foreach(source) do |item|\n unless item == \".\" || item == \"..\"\n print item, \"\\n\"\n extract(source + \"/\" + item, destination)\n end\n end\n end\n end",
"def move(from, to:, flags: RENAME_OPERATION_FLAGS)\n log \"moving from #{from} to #{to}...\"\n @sftp.rename!(remote_path(from), remote_path(to), flags)\n end",
"def move(dest, overwrite = false)\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n dest.collection! if collection?\n\n src = @bson['filename']\n dst = dest.file_path\n exists = nil\n\n @collection.find({:filename => /^#{Regexp.escape(src)}/}).each do |bson|\n src_name = bson['filename']\n dst_name = dst + src_name.slice(src.length, src_name.length)\n\n exists = @collection.find_one({:filename => dst_name}) rescue nil\n\n # http://mongoid.org/docs/persistence/atomic.html\n # http://rubydoc.info/github/mongoid/mongoid/master/Mongoid/Collection#update-instance_method\n @collection.update({'_id' => bson['_id']}, {'$set' => {'filename' => dst_name}}, :safe => true)\n \n @collection.remove(exists) if exists\n end\n\n collection? ? Created : (exists ? NoContent : Created)\n end",
"def mv(id, src, dst)\n local_action(\"#{@actions_path}/mv #{src} #{dst} #{id}\",id,ACTION[:mv])\n end",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def move(from, to:)\n log \"moving from #{from} to #{to}...\"\n @ftp.rename(from, to)\n end",
"def copy_files(source_path, destination_path, directory)\n source, destination = File.join(directory, source_path), File.join(Rails.root, destination_path)\n FileUtils.mkdir(destination) unless File.exist?(destination)\n FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)\nend",
"def move_to_folder=(value)\n @move_to_folder = value\n end",
"def move_to(target)\n target.parent.mkdirs\n factory.system.move_dir(@path, target.path)\n end",
"def move(options = {})\n self.class.move(self.version_key, options)\n end",
"def move_binaries\n Dir.mkdir(RESULT_DIR) unless Dir.exist?(RESULT_DIR)\n changes = Dir.glob(\"#{BUILD_DIR}/../*.changes\")\n\n changes.reject! { |e| e.include?('source.changes') }\n\n unless changes.size == 1\n warn \"Not exactly one changes file WTF -> #{changes}\"\n return\n end\n\n system('dcmd', 'mv', '-v', *changes, 'result/')\n end",
"def move_files_to(dest_dir, type)\n\t\treturn false if !dir?\n\n\t\tfiles = @path.files(file_type: type)\n\t\tfiles.each do |source_file|\n\t\t\tdest_file = Item.new(Path.new(\"#{dest_dir.path}/#{source_file.path.basename}\"))\n\t\t\treturn false if !source_file.move_to(dest_file)\n\t\tend\n\n\t\treturn true\n\tend",
"def copy(destdir)\n # Make sure destination is a directory\n File.directory? destdir or raise ArgumentError, \"#{destdir} is not a directory\"\n # Go through files in sorted order\n num_files = self.files.length()\n # These are the files that didn't get copied to the destination dir\n uncopied = []\n self.files.each_index do |i|\n fe = self.files[i]\n # This is the destination filename\n dest = File.join(destdir, fe.archive_filename)\n # If @prune_leading_dir=true, then all files lack the leading\n # directories, so we need to prepend them.\n if @prune_leading_dir\n src = Pathname.new(@dir) + fe.archive_filename\n else\n src = fe.archive_filename\n end\n HDB.verbose and puts \"Copying (##{i+1}/#{num_files}) #{src} to #{dest}\"\n begin\n # Try and copy f to dest\n # NOTE: FileUtils.copy_entry does not work for us since it operates recursively\n # NOTE: FileUtils.copy only works on files\n self.copy_entry(src, dest)\n rescue Errno::ENOSPC\n HDB.verbose and puts \"... out of space\"\n # If the source was a file, we might have a partial copy.\n # If the source was not a file, copying it is likely atomic.\n if File.file?(dest)\n begin\n File.delete(dest)\n rescue Errno::ENOENT\n # None of the file was copied.\n end\n end\n uncopied.push(fe)\n # TODO: This may happen if destination dir doesn't exist\n rescue Errno::ENOENT\n # Src file no longer exists (was removed) - remove from\n # FileSet, as if out of space.\n HDB.verbose and puts \"... deleted before I could copy it!\"\n uncopied.push(fe)\n end\n end\n self.subtract!(uncopied)\n end",
"def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end",
"def move_folder(folder,orig,dest)\n \n puts \"Moving #{orig}/#{key[:dir]} -> #{dest}/#{key[:dir]}\" if @verbose\n FileUtils.mv \"#{orig}/#{key[:dir]}\", \"#{dest}/#{key[:dir]}\"\n\n end",
"def move(from, to)\n puts \"> SFTP rename: #{from.whiteish} -> #{to.whiteish}\".blue\n begin\n @sftp.rename!(from, to)\n rescue Net::SFTP::StatusException => ex\n # manual rename\n puts \">>> SFTP manual rename\".blue\n file_list = get_file_list(from)\n progressbar = ProgressBar.create(\n title: ' SFTP:rename'.purple, total: file_list.size)\n file_list.each do |entry|\n file_from = File.join(from, entry.name)\n file_to = File.join(to, entry.name)\n if entry.directory?\n @sftp.mkdir(file_to)\n else\n @sftp.rename!(file_from, file_to)\n end\n progressbar.increment\n end\n progressbar.finish unless progressbar.finished?\n end\n end",
"def copy_files(from, to, options={})\n exceptions = options[:except] || []\n\n puts \"Copying files #{from} => #{to}...\" if ENV['VERBOSE']\n\n Dir[\"#{from}/**/*\"].each do |f|\n next unless File.file?(f)\n next if exceptions.include?(File.basename(f))\n\n target = File.join(to, f.gsub(/^#{Regexp.escape from}/, ''))\n\n FileUtils.mkdir_p File.dirname(target)\n puts \"%20s => %-20s\" % [f, target] if ENV['VERBOSE']\n FileUtils.cp f, target\n end\nend",
"def mv_p(from, to, options={})\n mkdir_p File.dirname(to), options\n mv_f from, to, options\n end",
"def move_packages(src, dst, list)\n\tlist.reject!{|f| !File.exist?(src + \"/\" + f)}\n\treturn if list.empty?\n\tlist.each{|b|\n\t\tputs b\n\t}\n\tputs \"The #{list.length} listed packages will be moved from #{src} to #{dst}.\"\n\tline = Readline::readline('Are you sure [Yn]? ')\n\tif (line =~ /^y?$/i)\n\t\tlist.each{|s|\n\t\t\toldfile = src + \"/\" + s\n\t\t\tnewfile = dst + \"/\" + s\n\t\t\tnext unless File.exist?(oldfile)\n\t\t\tif (File.exist?(newfile))\n\t\t\t\tFile.unlink(oldfile)\n\t\t\telse\n\t\t\t\tFileUtils.mv(oldfile, newfile)\n\t\t\tend\n\t\t}\n\tend\nend",
"def move(*args, &block)\n args = web_dav_args args\n map_method :move, args, &block\n end",
"def move_to_directory(dir)\n p = File.join(dir, self.filename)\n if copy_file(p)\n @path = p\n end\n end",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def move\n if params[:location_id]\n resources = Resource.where('id IN (?)', params[:resources])\n location = Location.find(params[:location_id])\n\n command = MoveResourcesCommand.new(resources, location, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"Moved #{resources.length} resources to \"\\\n \"\\\"#{command.object.name}\\\".\"\n end\n redirect_back fallback_location: location_url(location)\n else\n flash['error'] = 'No location selected.'\n redirect_back fallback_location: root_url\n end\n end",
"def move_to(target, options = {})\n copy_to(target, options)\n delete\n end",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def move(source, destination)\n if isLegal?(source,destination)\n if source==1\n disk_to_move = @@tower_1.pop\n elsif source==2\n disk_to_move = @@tower_2.pop\n elsif source==3\n disk_to_move = @@tower_3.pop\n else\n puts(\"the source should be 1,2,or 3.\")\n end\n \n if destination ==1 \n @@tower_1.push(disk_to_move)\n elsif destination == 2 \n @@tower_2.push(disk_to_move)\n elsif destination == 3 \n @@tower_3.push(disk_to_move)\n end \n else\n puts(\"Sorry that was an incorrect move. Please review the rules and try again.\")\n end\n end"
] | [
"0.6859827",
"0.6606791",
"0.6572775",
"0.6546143",
"0.6479555",
"0.6472012",
"0.632854",
"0.631716",
"0.62550193",
"0.61580855",
"0.6144936",
"0.6136502",
"0.6132095",
"0.6090147",
"0.6088836",
"0.6050799",
"0.60287106",
"0.6001828",
"0.6001828",
"0.59924895",
"0.5978038",
"0.5952506",
"0.5952172",
"0.5933888",
"0.5928865",
"0.59043676",
"0.5894344",
"0.5878418",
"0.5875955",
"0.5871488",
"0.58257455",
"0.58223957",
"0.57873124",
"0.57769555",
"0.5727591",
"0.5724097",
"0.57217145",
"0.57217145",
"0.5719825",
"0.5717482",
"0.5704939",
"0.56867504",
"0.5674662",
"0.5674649",
"0.5674649",
"0.5670966",
"0.5638179",
"0.56376356",
"0.5620587",
"0.5605062",
"0.55953664",
"0.5592125",
"0.55801755",
"0.55801755",
"0.55770886",
"0.5574589",
"0.5568915",
"0.5567848",
"0.5566758",
"0.5556176",
"0.55393445",
"0.5530897",
"0.55277795",
"0.5525851",
"0.5525766",
"0.5508635",
"0.55086297",
"0.54994726",
"0.5493868",
"0.5483411",
"0.5480438",
"0.5479952",
"0.5470332",
"0.5460711",
"0.5454131",
"0.54521155",
"0.543505",
"0.54205525",
"0.54167384",
"0.5402255",
"0.5400642",
"0.53970444",
"0.5396501",
"0.538724",
"0.5385545",
"0.5362829",
"0.53621215",
"0.5333265",
"0.53242165",
"0.5315161",
"0.52935356",
"0.528602",
"0.5285116",
"0.528241",
"0.52756524",
"0.5267223",
"0.52655566",
"0.5265491",
"0.52629584",
"0.52463156"
] | 0.62577605 | 8 |
Rename selected files and directories. ==== Parameters +pattern+ new filename, or a shash separated Regexp like string | def rename(pattern)
from, to = pattern.sub(/^\//, '').sub(/\/$/, '').split '/'
if to.nil?
from, to = current_item.name, from
else
from = Regexp.new from
end
unless in_zip?
selected_items.each do |item|
name = item.name.gsub from, to
FileUtils.mv item, current_dir.join(name) if item.name != name
end
else
Zip::File.open(current_zip) do |zip|
selected_items.each do |item|
name = item.name.gsub from, to
zip.rename item.name, name
end
end
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_all(pattern, replace)\n Dir.new('.').each do |f|\n File.rename(f, f.gsub(pattern, replace)) if f.match(pattern)\n end\nend",
"def rename(root, pattern, replacement, force: false, excluding: nil)\n options = {force: force, excluding: excluding}\n\n ::Find.find(root) do |path|\n # The first emitted path will be the root directory\n next if path == root\n\n # Don't look any further into this directory\n ::Find.prune if excluding && path.match?(excluding)\n\n # The path doesn't match, keep searching\n next unless path.match?(pattern)\n\n # The path matches, so rename it\n dest = path.sub(pattern, replacement)\n FileUtils.mv(path, dest, force: force)\n\n # Find and rename the children of the path\n rename(dest, pattern, replacement, **options) if File.directory?(dest)\n\n # We already searched the directory's children, so we should stop\n ::Find.prune\n end\n end",
"def update!(**args)\n @name_pattern = args[:name_pattern] if args.key?(:name_pattern)\n end",
"def file_sub(path, pattern, replacement = nil, &b)\n tmp_path = \"#{path}.tmp\"\n File.open(path) do |infile|\n File.open(tmp_path, 'w') do |outfile|\n infile.each do |line|\n outfile.write(line.sub(pattern, replacement, &b))\n end\n end\n end\n File.rename(tmp_path, path)\nend",
"def pattern=(pattern)\n @pattern = pattern\n substitute_variables! # TODO: Remove this call\n end",
"def fnmatch( pattern, *args ) File.fnmatch( pattern, self, *args ) end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, path, *args) end",
"def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend",
"def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end",
"def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end",
"def add_file_pattern(name, pattern_string)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n @file_patterns[name.to_sym] = pattern_string.to_s\n end",
"def edit_matched_files(*match, &block)\n match.each do |m|\n if Pathname.new(m).absolute?\n path = m\n else\n path = File.join(File.expand_path(TARGET_PATH), m)\n end\n puts \"path: #{path}\"\n\n Dir.glob(path).each do |file|\n block.call(Content.create(file))\n end\n end\nend",
"def glob(pattern)\n Dir.chdir(@output_dir) do\n Dir[pattern]\n end\n end",
"def gsub(pat, rep)\n inject(FileList.new) { |res, fn| res << fn.gsub(pat,rep) }\n end",
"def glob=(pattern)\n @glob = pattern\n if pattern.kind_of?(Regexp)\n @pattern = pattern\n else\n @pattern = scan_string\n end\n end",
"def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend",
"def naming_pattern=(v)\n segment_naming.pattern = v\n end",
"def fdelete_pattern(dir, pattern)\n\t# input params are ok?\n\tif dir != \"\" and dir != nil and pattern != \"\" and pattern != nil\n\t\t# list all files in temporary dir\n\t\tDir.foreach(dir).to_a.each do |d|\n\t\t\t# file name contains temp name?\n\t\t\tif d.match(/#{pattern}/) != nil\n\t\t\t\t# delete file\n\t\t\t\tfdelete(\"#{dir}/#{d}\")\n\t\t\tend\n\t\tend\n\tend\nend",
"def update!(**args)\n @parent_pattern = args[:parent_pattern] if args.key?(:parent_pattern)\n @pattern = args[:pattern] if args.key?(:pattern)\n end",
"def rename_files(format:)\n require 'pp'\n child_items.each_with_index do |child, index|\n new_name = sprintf(format, index+1)\n extname = child.path.extname\n dirname = child.path.dirname.to_s\n new_filename = dirname + \"/\" + new_name + extname\n FileManager.rename(from_file: child.path.to_s, to_file: new_filename)\n end\n end",
"def file_edit(filename, regexp, replacement)\n Tempfile.open(\".#{File.basename(filename)}\", File.dirname(filename)) do |tempfile|\n File.open(filename).each do |line|\n tempfile.puts line.gsub(regexp, replacement)\n end\n tempfile.fdatasync\n tempfile.close\n stat = File.stat(filename)\n FileUtils.chown stat.uid, stat.gid, tempfile.path\n FileUtils.chmod stat.mode, tempfile.path\n FileUtils.mv tempfile.path, filename\n end\n end",
"def gsub_file(relative_destination, regexp, *args, &block)\r\n path = destination_path(relative_destination)\r\n content = File.read(path).gsub(regexp, *args, &block)\r\n File.open(path, 'wb') { |file| file.write(content) }\r\n end",
"def apply_to(pattern)\n @pattern = pattern\n end",
"def gsub_file(relative_destination, regexp, *args, &block)\n path = destination_path(relative_destination)\n content = File.read(path).gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\n end",
"def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end",
"def test_files_pattern=(pattern)\n warn 'test_files_pattern= is deprecated in QUnited rake task config, use test_files= with a pattern'\n @test_files = pattern\n end",
"def rsub(pattern, replacement)\n if i = rindex(pattern) # rubocop:disable Lint/AssignmentInCondition\n s = @string.dup\n s[i] = replacement\n self.class.new s\n else\n self\n end\n end",
"def find_files(pattern)\n Dir[File.join(folder, pattern, \"*.#{pattern}\")].sort{|f1, f2|\n File.basename(f1) <=> File.basename(f2)\n }.collect{|f|\n File.join(pattern, File.basename(f))\n }\n end",
"def remove_files(pattern,skip=nil)\n Dir.glob(pattern).each do |file_name|\n remove_file(file_name) unless file_name == skip\n end\n end",
"def input_files_pattern\n @args.options[:input_files_pattern]\n end",
"def replace(pattern, replacement, file)\n was = sftp.file.open(file, \"r\") { |f| f.read }\n found = case pattern\n when :all, :any, :everything\n log \"replace \\e[1m%s\\e[0m in '%s'\" % [pattern, file]\n true\n when Regexp\n log \"replace \\e[1m%s\\e[0m in '%s'\" % [pattern.inspect, file]\n replacement = was.gsub(pattern, replacement)\n was =~ pattern\n when String\n log \"replace \\e[1m%s\\e[0m in '%s'\" % [\"String\", file]\n replacement = was.gsub(pattern, replacement)\n was.include?(pattern)\n else raise \"%s is not a valid. You can use a String, Regexp or :all, :any and :everything\" % pattern.inspect\n end\n\n if found\n sftp.file.open(file, \"w\") { |f| f.write replacement }\n else\n log \"\\e[31m '%s' does not include your \\e[1mpattern\\e[0m\" % file unless was =~ pattern\n end\n end",
"def output_name_from_pattern(t1name)\n file0 = params[:file_args][\"0\"] # we require this single entry for info on the data files\n prefix = file0[:prefix] || \"unkpref\"\n dsid = file0[:dsid] || \"unkdsid\"\n\n pattern = self.params[:output_filename_pattern] || \"\"\n pattern.strip!\n pattern = '{subject}-{cluster}-{task_id}-{run_number}' if pattern.blank?\n\n # Create standard keywords\n now = Time.zone.now\n components = {\n \"date\" => now.strftime(\"%Y-%m-%d\"),\n \"time\" => now.strftime(\"%H:%M:%S\"),\n \"task_id\" => self.id.to_s,\n \"run_number\" => self.run_number.to_s,\n \"cluster\" => self.bourreau.name,\n \"subject\" => dsid,\n \"prefix\" => prefix\n }\n\n # Add {1}, {2} etc keywords from t1 name\n t1_comps = t1name.split(/([a-z0-9]+)/i)\n 1.step(t1_comps.size-1,2) do |i|\n keyword = \"#{(i-1)/2+1}\"\n components[keyword] = t1_comps[i]\n end\n\n # Create new basename\n final = pattern.pattern_substitute(components) # in cbrain_extensions.rb\n\n # Validate it\n cb_error \"Pattern for new filename produces an invalid filename: '#{final}'.\" unless\n Userfile.is_legal_filename?(final)\n\n return final\n end",
"def subs!(pattern, replacement)\n sub!(pattern, replacement)\n self\n end",
"def replace pattern, substitute\n if pattern.is_a? Regexp\n ArelExtensions::Nodes::RegexpReplace.new self, pattern, substitute\n else\n ArelExtensions::Nodes::Replace.new self, pattern, substitute\n end\n end",
"def source_files_pattern=(pattern)\n warn 'source_files_pattern= is deprecated in QUnited rake task config, use source_files= with a pattern'\n @source_files = pattern\n end",
"def update!(**args)\n @file_pattern = args[:file_pattern] if args.key?(:file_pattern)\n @file_type = args[:file_type] if args.key?(:file_type)\n end",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end",
"def sub(pattern, replacement)\n replacement = Maglev::Type.coerce_to(replacement, String, :to_str)\n regex = self.__get_pattern(pattern, true)\n\n # If pattern is a string, then do NOT interpret regex special characters.\n # stores into caller's $~\n if (match = regex.__match_vcglobals(self, 0x30))\n __replace_match_with(match, replacement)\n else\n dup\n end\n # r.taint if replacement.tainted? || self.tainted?\n end",
"def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend",
"def replace_pattern\n id = Readline.readline(\"ID of task to perform replace: \").to_i\n old_pattern = Readline.readline('replace : ').chomp\n new_pattern = Readline.readline('with : ').chomp\n ok = ReplacePattern.new(id, old_pattern, new_pattern).execute\n puts \"No such task\" if !ok\n end",
"def name_pattern( base_name, subpattern = false )\n name = base_name.is_a?(Name) ? base_name.name : base_name\n\n if subpattern then\n attempt = [\"#{name}__subpattern_\", 1]\n attempt[1] += 1 while @pattern_defs.member?(attempt.join(\"\"))\n \n name = attempt.join(\"\")\n end\n\n return create_name(name)\n end",
"def pattern2regex(pattern); end",
"def add_pattern( pattern )\n type_check( pattern, Elements::Pattern )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @patterns[pattern.name] = pattern\n end",
"def add_matching(pattern)\n Dir[pattern].each do |fn|\n\tself << fn unless exclude?(fn)\n end\n end",
"def filter_files(pattern)\n regexp=Regexp.new(pattern || '.*')\n @[email protected]([]) do |matches,file| \n file_without_basepath=file[@basepath.length .. -1]\n matches << file if file_without_basepath=~regexp\n matches\n end\n @table.reloadData\n end",
"def rewrite!(content)\n return content unless match?\n \n content.gsub(/#{pattern}/, replacement)\n end",
"def sub(pat, rep)\n inject(FileList.new) { |res, fn| res << fn.sub(pat,rep) }\n end",
"def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end",
"def glob(pattern, flags: GLOB_OPERATION_FLAGS)\n @sftp.dir.glob(@path.to_s, pattern, flags) { |entry| yield entry.name }\n end",
"def select_by_pattern(files, pattern)\n to_keep = []\n files.each do |f|\n if f.to_s =~ pattern\n to_keep.push(f)\n end\n end\n to_keep.uniq\n end",
"def rename_file\n\n end",
"def rewrite(pattern)\r\n if match = pattern.match(result)\r\n start = match.begin(0)\r\n target.pos = start\r\n target.truncate start\r\n end\r\n \r\n block_given? ? yield(match) : match\r\n end",
"def rewrite_file(pattern, file, &replacement)\n previous_content = IO.read(file)\n content = replace_file(pattern, file, &replacement)\n File.open(file, 'w+') { |f| f.puts content } if content != previous_content\n end",
"def pattern_match(file, pattern)\n case\n when pattern.is_a?(Regexp)\n return file.match(pattern)\n when pattern.is_a?(String)\n return File.fnmatch(pattern, file)\n when pattern.is_a?(Proc)\n return pattern.call(file)\n when pattern.is_a?(Rake::FileTask)\n return pattern.to_s.match(file)\n else\n raise \"Cannot interpret pattern #{pattern}\"\n end\n end",
"def select(*patterns)\n selection = []\n patterns.each do |pattern|\n selection.concat(Dir.glob(File.join(path, pattern))) \n end\n selection.map{ |s| FileObject[s] }\n end",
"def gsub_file_with_match_check(relative_destination, regexp, *args, &block)\n path = destination_path(relative_destination)\n matches = File.read(path).match(regexp)\n raise \"Regexp not found in #{relative_destination}\\n called from #{caller.first}\" unless matches\n gsub_file(relative_destination, regexp, *args, &block)\nend",
"def gsub(pattern, replace)\n lambda do |rec, acc|\n acc.collect! { |v| v.gsub(pattern, replace) }\n end\n end",
"def add_matching(pattern)\n Dir[ pattern ].each do |fn|\n self << fn unless exclude?(fn)\n end\n end",
"def gsub_file(path, regexp, *args, &block)\n #path = destination_path(relative_destination)\n content = File.read(path)\n check_for = args.first || yield('')\n regex = Regexp.new(regexp.source + Regexp.escape(check_for))\n return if content =~ regex # if we can match the text and its leadin regex, don't add again\n content = content.gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\n end",
"def rename(options={}, &block)\n map_mv(options, &block)\n end",
"def match(pattern, flags = 0)\n\t\t\t\tpath = pattern.start_with?('/') ? full_path : relative_path\n\t\t\t\t\n\t\t\t\treturn File.fnmatch(pattern, path, flags)\n\t\t\tend",
"def adjust_task_output_names_patterns(task) #:nodoc:\n local_name = task.params[:_cb_pipeline][\"0\"][:savename].presence\n global_name = task.params[:_cb_output_renaming_pattern].presence\n if local_name\n task.params[:_cb_output_renaming_pattern] = (local_name || \"\") # crush global name\n else\n task.params[:_cb_pipeline][\"0\"][:savename] = (global_name || \"\")\n end\n end",
"def match(pattern, options = {})\n options = {:use_prefix => true, :use_suffix => true, :method => :execute}.merge(options)\n @matchers << Match.new(pattern, options[:use_prefix], options[:use_suffix], options[:method])\n end",
"def move_file(file, regex, target_dir, prefix)\n match = regex.match(file)\n puts match if defined?($DEBUG)\n target_dir = \"#{target_dir}/Season_#{match[1]}\"\n puts \"Making dir #{target_dir}\" if defined? $DEBUG\n `mkdir -p #{target_dir}`\n target = \"#{target_dir}/#{prefix}_S#{match[1]}E#{match[2]}.mkv\"\n if defined? $DEBUG\n puts \"Will move #{file} to #{target}\"\n else\n `mv -v #{file} #{target}`\n end\nend",
"def sub!(pattern, replacement = T.unsafe(nil), &block); end",
"def rename!(args)\n collection_modifier_update('$rename', args)\n end",
"def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\nend",
"def renameAll(fileName)\n counter = 1\n Dir::glob(\"*\").each do |name| \n File.rename(name, fileName + counter.to_s) if name != \"Rfile.rb\" \n counter += 1 if name != \"Rfile.rb\"\n end\nend",
"def gsub_file(path, regexp, *args, &block)\n content = File.read(path).gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\nend",
"def filepath_pattern(filepaths)\n return \"\" if filepaths.nil?\n\n filepaths.map! { |path| '^' + path + '$' }\n filepaths.join('|')\n end",
"def rename_files\n source_dir = Item.new(Path.new(params[:source_dir]))\n format = params[:string_format]\n \n response = {}\n if source_dir.rename_files(format: format)\n render json: response, status: 200\n else\n render json: response, status: 422\n end\n end",
"def rename(file, newname)\n raise \"Sorry... 'AimsCalc rename' isn't implemented yet.\"\nend",
"def replace_contents!(pattern, with_text)\n entries.each do |entry|\n entry.replace_contents!(pattern, with_text) unless entry.dir?\n end\n end",
"def rename(*arguments)\n dup.rename!(*arguments)\n end",
"def Pattern(*pattern)\n (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label)\n ::PatternMatching::PatternMatch.new(*pattern)\n end",
"def rename(old_name, new_name); end",
"def rename(old_name, new_name); end",
"def add_pattern(pattern)\n @patterns << pattern\n end",
"def gsub_file(path, flag, *args, &block)\n return unless behavior == :invoke\n config = args.last.is_a?(Hash) ? args.pop : {}\n\n path = File.expand_path(path, destination_root)\n say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)\n\n unless options[:pretend]\n content = File.binread(path)\n content.gsub!(flag, *args, &block)\n File.open(path, \"wb\") { |file| file.write(content) }\n end\n end",
"def compile_pattern(pattern)\n Regexp.compile(\"\\\\.(#{pattern})$\")\n end",
"def add_matching(pattern)\n self.class.glob(pattern).each do |fn|\n self << fn unless excluded_from_list?(fn)\n end\n end",
"def apply_pattern(pattern)\n raise \"Not a pattern\" unless pattern.instance_of?(Pattern)\n if self.matches?(pattern.regexp)\n self.assign_tag(pattern.tag_id, 2, pattern.id)\n true\n else\n false\n end\n end",
"def match_folder(name, patterns = '*')\n Array(patterns).any? do |pattern|\n if pattern.is_a?(String)\n File.fnmatch(pattern.downcase, name.downcase)\n elsif pattern.is_a?(Regexp)\n name =~ pattern\n else\n nil\n end\n end\n end",
"def execute(target_dir, pattern, exclude_pattern = nil)\n target_dir = Pathname.new(target_dir).expand_path\n Net::SFTP.start(@server, @pid + '@' + @login, :password => @password, :auth_methods => ('password')) do |sftp|\n files = sftp.dir.glob(\".\", pattern)\n exclude_files = exclude_pattern.nil? ? [] : sftp.dir.glob(\".\", exclude_pattern)\n #file = files.min_by{|f| f.attributes.attributes[:mtime]}\n files.each do |file|\n sftp.download!(file.name, target_dir + file.name) unless exclude_files.include?(file)\n end\n end\n end",
"def rename_given_file\n PS2.rename(@filename, @options)\n end",
"def gsub(pat, rep)\n inject(PropertyGroup::PathList.new) { |res, fn| res << fn.gsub(pat,rep) }\n end",
"def rename_vm_files(from, to)\n files_to_rename(from, to).each do |file|\n text_to_replace = File.basename(file, File.extname(file))\n\n if File.extname(file) == '.vmdk'\n if file.match /\\-s\\d+\\.vmdk/\n text_to_replace = file.partition(/\\-s\\d+.vmdk/).first\n end\n end\n\n unless File.exists?(File.join(@target_vm.path, file.gsub(text_to_replace, to)))\n FileUtils.mv File.join(@target_vm.path, file),\n File.join(@target_vm.path, file.gsub(text_to_replace, to))\n end\n end\n end",
"def gsub_file(*args, &block)\n self.log 'gsub_file', args.first\n self.runner.send(:gsub_file, *args, &block)\n end",
"def rename_file(name, dir='.')\n menu(Dir.entries(dir)) {|chosen| chosen.each {|e| File.rename(e, name) } }\n end",
"def glob(pattern, flags = T.unsafe(nil)); end",
"def file_pattern(name)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n get_config_val(@file_patterns, name)\n end",
"def pattern2regex(pattern)\n tail = pattern\n prefix = String.new\n while !tail.empty? do\n head, sep, tail = tail.partition(/[\\*\\?]/)\n prefix = prefix + Regexp.quote(head)\n case sep\n when '*'\n prefix += '.*'\n when '?'\n prefix += '.'\n when ''\n else\n fail \"Unpexpcted sep:#{sep}\"\n end\n end\n Regexp.new(\"^\" + prefix + \"$\", true)\n end",
"def name n\n @files = @files.select { |file| n =~ File.basename(file) }\n self\n end",
"def rename(file, destination)\n\t\tlogin_filter\n\t\tfile = namespace_path(file)\n\t\tdestination = namespace_path(destination)\n\t\[email protected](\"/cmd/rename#{file}\", {\"to_path\"=> destination, \"t\" => @token }).code == \"200\"\n\tend",
"def sub!(pattern, replacement)\n regex = self.__get_pattern(pattern, true)\n # stores into caller's $~\n if match = regex.__match_vcglobals(self, 0x30)\n replace(__replace_match_with(match, replacement))\n # self.taint if replacement.tainted?\n self\n else\n nil\n end\n end",
"def action_rename\n if @tpath == nil\n Chef::Log.Fatal \"Target path is empty and need to be set for rename action\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Source directory #{ @path } doesn't exist; rename action not taken\")\n else\n converge_by(\"rename #{ @new_resource }\") do\n @client.rename(@path, @tpath)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def create_pattern\n self.pattern = pattern.nil? ? first_name.downcase : pattern\n end",
"def file_update\n File.rename(file_path,\n File.join(File.dirname(file_path),\n File.basename(file_path).gsub(/_\\d+\\.txt/, \"_#{Time.now.to_i}.txt\")))\n end",
"def rename(fl, sensor, channel, satellite, downlink, tm)\n time_bit = tm.strftime('%y%m%d_%H%M.%S')\n name = \"UAF_AWIPS_#{sensor}-AK_1KM_#{channel}_#{satellite}_#{downlink}_#{time_bit}\"\n FileUtils.mv(fl, name)\n name\n end"
] | [
"0.6490024",
"0.6006657",
"0.5734607",
"0.57127804",
"0.5549183",
"0.5548546",
"0.55439925",
"0.55129874",
"0.5512433",
"0.5495125",
"0.54512054",
"0.5416406",
"0.5378884",
"0.53518045",
"0.53289044",
"0.52556765",
"0.5229619",
"0.5212441",
"0.51935375",
"0.51900387",
"0.5175399",
"0.5169746",
"0.51688385",
"0.5165535",
"0.5153248",
"0.51438135",
"0.5123096",
"0.512181",
"0.50631505",
"0.50558436",
"0.5052375",
"0.50469714",
"0.50448734",
"0.5023162",
"0.5006015",
"0.5004157",
"0.49815243",
"0.49815243",
"0.49708068",
"0.49683765",
"0.49415275",
"0.49323574",
"0.49200898",
"0.4915364",
"0.48957074",
"0.48812565",
"0.4881144",
"0.48627898",
"0.48607594",
"0.48472685",
"0.48295322",
"0.4819792",
"0.4814387",
"0.4809602",
"0.47817647",
"0.478106",
"0.47667468",
"0.47627765",
"0.47615534",
"0.47598535",
"0.47527826",
"0.47489867",
"0.47480404",
"0.47335967",
"0.47299385",
"0.47237483",
"0.47216374",
"0.47205892",
"0.47180703",
"0.47109747",
"0.4710005",
"0.47073197",
"0.4705773",
"0.46996215",
"0.46799466",
"0.46713963",
"0.46705443",
"0.46705443",
"0.46705255",
"0.46663395",
"0.46600202",
"0.46566504",
"0.46510798",
"0.46495858",
"0.4642408",
"0.46395728",
"0.46350238",
"0.46270368",
"0.46264985",
"0.4623543",
"0.46189442",
"0.46118036",
"0.46093565",
"0.46076444",
"0.4606648",
"0.4601237",
"0.45870057",
"0.45774505",
"0.45717037",
"0.4563064"
] | 0.736625 | 0 |
Soft delete selected files and directories. If the OS is not OSX, performs the same as `delete` command. | def trash
unless in_zip?
if osx?
FileUtils.mv selected_items.map(&:path), File.expand_path('~/.Trash/')
else
#TODO support other OS
FileUtils.rm_rf selected_items.map(&:path)
end
else
return unless ask %Q[Trashing zip entries is not supported. Actually the files will be deleted. Are you sure want to proceed? (y/n)]
delete
end
@current_row -= selected_items.count {|i| i.index <= current_row}
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteFW (path)\n choose = prompt(text: \"delete \" + path.to_s + \"?\\n press 1 to continue, 0 to exit: \").to_i\n if choose.to_i == 0 \n abort UI.user_error!(\"program was forced exit by user\")\nelse\n sh(\"rm -rf \" + path.to_s)\n end\nend",
"def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end",
"def delete_from_disk; end",
"def safe_delete\n FileUtils.remove_entry_secure(SafeDeletable.path_for(self).to_s)\n rescue Errno::ENOENT\n # noop\n end",
"def delete!\n delete(:force => true)\n nil\n end",
"def delete(builtin_protection: true)\n if builtin_protection && builtin? then\n raise \"cannot delete builtin device without setting builtin_protection to false\"\n else\n runcmd 'delete'\n end\n nil\n end",
"def delete_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"delete\", \"-c\", @number, *files)\n end\n end",
"def delete\n if options.master?\n delete_master(options)\n elsif options.slave?\n delete_slave(options)\n else\n invoke :help, [:delete]\n end\n end",
"def delete_files(options)\n if '' == options['base-dir'].to_s\n raise ArgumentError.new(\"Missing options['base-dir']\")\n end\n if '' == options['file-selector'].to_s\n raise ArgumentError.new(\"Missing options['file-selector']\")\n end\n if '' == options['file-extension'].to_s\n raise ArgumentError.new(\"Missing options['file-extension']\")\n end\n input_base_dir = config.compute_base_dir(options['base-dir'])\n input_file_selector = config.compute_file_selector(options['file-selector'])\n input_file_extension = config.compute_file_extension(options['file-extension'])\n\n Repositext::Cli::Utils.delete_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n options['file_filter'],\n \"Deleting files\",\n {}\n )\n end",
"def delete_files(version)\n binary = File.join(Dir.tmpdir, \"openjdk\" + version.to_s + \"_openj9\" + \".tgz\")\n\n file binary do\n action :delete\n end\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end",
"def delete(files)\n # sync before we delete\n sync\n Array.wrap(files).each do |f|\n info \"removing #{f}\"\n FileUtils.rm(f)\n error \"#{f} wasn't removed\" if File.exists?(f)\n end\n end",
"def delete_softly(options = {:enforce => :active})\n # Make destroy! the old destroy\n alias_method :destroy!, :destroy\n\n include DeleteSoftly::InstanceMethods\n extend DeleteSoftly::ClassMethods\n # Support single argument\n # delete_softly :active # Same as :enforce => :active, default behaviour\n # delete_softly :enforce=> :with_deleted # Same as without argument\n options = {:enforce=> options } unless options.is_a?(Hash)\n if options[:enforce]\n if options[:enforce].is_a?(Symbol) && respond_to?(options[:enforce])\n default_scope send(options[:enforce])\n else\n default_scope active\n end\n end\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end",
"def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end",
"def delete!\n delete( nil, true ) \n end",
"def delete!(defer = false)\n delete_logic( defer, false ) \n end",
"def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end",
"def delete(*args)\n execute(:delete, *args)\n end",
"def rm(path)\n cmd 'rm', path\nend",
"def delete_extra_files( *filelist )\n\t\tdescription = humanize_file_list( filelist, '\t ' )\n\t\tself.prompt.say \"Files to delete:\"\n\t\tself.prompt.say( description )\n\n\t\tif self.prompt.yes?( \"Really delete them?\" ) {|q| q.default(false) }\n\t\t\tfilelist.each do |f|\n\t\t\t\trm_rf( f, verbose: true )\n\t\t\tend\n\t\tend\n\tend",
"def delete(filename); end",
"def delete(*filenames); end",
"def soft_delete!\n update_attribute(:mark_as_deleted, true)\n end",
"def delete!\n exist!\n File.unlink @path\n @path = nil\n end",
"def delete(name, options = T.unsafe(nil)); end",
"def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end",
"def delete_from_disk\n thread_local_store.destroy\n end",
"def delete_or_move(paths, sudo: false)\n return if paths.blank?\n\n symlinks, paths = paths.partition(&:symlink?)\n\n FileUtils.rm_f symlinks\n return if ENV[\"HOMEBREW_GITHUB_ACTIONS\"].blank?\n\n paths.select!(&:exist?)\n return if paths.blank?\n\n if ENV[\"GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED\"].present?\n if sudo\n test \"sudo\", \"rm\", \"-rf\", *paths\n else\n FileUtils.rm_rf paths\n end\n elsif sudo\n test \"sudo\", \"mv\", *paths, Dir.mktmpdir\n else\n FileUtils.mv paths, Dir.mktmpdir, force: true\n end\n end",
"def delete force: false\n ensure_connection!\n docs_to_be_removed = documents view: \"ID_ONLY\"\n return if docs_to_be_removed.empty?\n unless force\n fail \"Unable to delete because documents exist. Use force option.\"\n end\n while docs_to_be_removed\n docs_to_be_removed.each { |d| remove d }\n if docs_to_be_removed.next?\n docs_to_be_removed = documents token: docs_to_be_removed.token,\n view: \"ID_ONLY\"\n else\n docs_to_be_removed = nil\n end\n end\n end",
"def _delete(path)\n forbidden unless is_allowed? path\n not_found unless File.exists? path\n forbidden unless File.file? path\n File.delete path\n ok\n rescue SystemCallError => e\n logger.error e.message\n internal_server_error\n end",
"def delete_draft(filename)\n sh \"git rm #{filename}\" if `git ls-files #{filename}` != ''\n File.delete(filename) if File.exist?(filename)\n\n nil\nend",
"def delete(*names)\n Tk.execute(:image, :delete, *names)\n end",
"def delete\n ::File.unlink(@path)\n end",
"def rm_rf(path)\n cmd 'rm', '-rf', path\nend",
"def delete_file\n unless $list_Item.curselection.empty?\n idx = $list_Item.curselection\n idx = idx[0]\n $bucket_item = $bucket_items[idx]\n ok_delete = Tk.messageBox('type' => 'okcancel',\n 'icon' => 'warning',\n 'title' => 'Delete Bucket',\n 'message' => 'Delete item?')\n if ok_delete == 'ok'\n begin\n $s3.bucket($bucket).objects(prefix: $bucket_item).batch_delete!\n $item_text.delete('1.0','end')\n $save_file_button.state = 'disabled'\n $delete_file_button.state = 'disabled'\n $item_public_read.state = 'disabled'\n $item_public_write.state = 'disabled'\n rescue => e\n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Delete File',\n 'message' => \"Cannot Delete File #{e}\")\n end\n end\n end\n end",
"def remove_from_list\n return unless $selection_allowed\n if $selected_files.size > 0\n sz = $selected_files.size\n print \"Remove #{sz} files from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n print\n ## what if selected some rows\n file = $view[$cursor]\n print \"Remove #{file} from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n refresh\n $modified = true\nend",
"def delete\n FileUtils.rm_rf(to_s)\n self\n end",
"def delete_tmp_files(options)\n files_to_delete = options[:files_to_delete]\n if files_to_delete && files_to_delete.count > 0\n files_to_delete.each do |fpath|\n File.delete(fpath) if File.exists?(fpath)\n end\n end\n end",
"def clean(options={})\n send(run_method, %{sh -c \"#{APT_GET} -qy clean\"}, options)\n end",
"def delete(path, **options)\n execute :delete, path, options\n end",
"def delete!\n delete_if { true }\n end",
"def delete_extra_files( filelist )\n\tdescription = humanize_file_list( filelist, ' ' )\n\tlog \"Files to delete:\\n \", description\n\task_for_confirmation( \"Really delete them?\", false ) do\n\t\tfilelist.each do |f|\n\t\t\trm_rf( f, :verbose => true )\n\t\tend\n\tend\nend",
"def delete\n File.delete(file_name)\n rescue\n # ignore\n end",
"def erase\n HDB.verbose and puts \"Erasing successfully-copied files\"\n unlinkable = @files.collect do |x|\n f = get_real_filename(x)\n File.directory?(f) or File.symlink?(f)\n end\n # TODO: unlink them now.\n # TODO: rmdir directories, starting with child nodes first\n raise \"erase unimplemented\"\n end",
"def delete\n if processable? or unset?\n dir.delete\n else\n raise JobError.cannot_delete(@id, state)\n end\n end",
"def delete_files\n\t\t\tFileUtils.rm_rf(@clean_image)\n\t\t\tFileUtils.rm_rf(@image) if pdf?\n\t\tend",
"def rm path\n end",
"def remove_from_list\n if $selected_files.size > 0\n sz = $selected_files.size\n ch = get_single \"Remove #{sz} files from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n #print\n ## what if selected some rows\n file = $view[$cursor]\n ch = get_single \"Remove #{file} from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n c_refresh\n $modified = true\nend",
"def remove(files, opts = {})\n args = []\n args << '-f' if opts[:force]\n args << [*files]\n command(:rm, args)\n end",
"def delete_extra_files( filelist )\n\t\t\tdescription = humanize_file_list( filelist, '\t ' )\n\t\t\tlog \"Files to delete:\\n \", description\n\t\t\task_for_confirmation( \"Really delete them?\", false ) do\n\t\t\t\tfilelist.each do |f|\n\t\t\t\t\trm_rf( f, :verbose => true )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def delete(defer = false)\n delete_logic( defer )\n end",
"def soft_delete\n self.active = false\n save\n\n employees.each(&:soft_delete)\n products.each(&:soft_delete)\n end",
"def delete\n Fission::Action::VM::Deleter.new(self).delete\n end",
"def delete(permanent = false)\n if permanent\n @session.execute!(\n :api_method => @session.drive.files.delete,\n :parameters => {\"fileId\" => self.id})\n else\n @session.execute!(\n :api_method => @session.drive.files.trash,\n :parameters => {\"fileId\" => self.id})\n end\n return nil\n end",
"def del\n delete\n end",
"def destroy!(*paths)\n paths.each do |path|\n FileUtils.rm(path)\n end\n end",
"def rm(list, options = {})\r\n fu_check_options options, :force, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message \"rm#{options[:force] ? ' -f' : ''} #{list.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n\r\n list.each do |fname|\r\n remove_file fname, options[:force]\r\n end\r\n end",
"def delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def rm_f(list, noop: nil, verbose: nil)\n rm list, force: true, noop: noop, verbose: verbose\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/VLC'),\n ::File.expand_path('~/Library/Application Support/org.videolan.vlc')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def delete(selections)\n title_message(\"Deleting Forks\")\n selections.each do |s|\n Dishwasher::Github.delete_repo(s)\n end\n confirmation_message\n end",
"def delete\n FileUtils.rm(self.path) if exists?\n end",
"def delete(path, options = {})\n execute('DELETE', path, options)\n end",
"def delete_files\n self.bruse_files.each do |file|\n file.destroy\n end\n end",
"def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end",
"def git_clean_filesystem\n mysystem('git clean -f -d -x 2> /dev/null > /dev/null')\n end",
"def destroy(*paths)\n paths.each do |path|\n FileUtils.rm(path) if File.file?(path) \n end\n end",
"def delete\n unless in_zip?\n FileUtils.rm_rf selected_items.map(&:path)\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n if entry.name_is_directory?\n zip.dir.delete entry.to_s\n else\n zip.file.delete entry.to_s\n end\n end\n end\n end\n @current_row -= selected_items.count {|i| i.index <= current_row}\n ls\n end",
"def destroy_directory!(directory)\n system(\"trash #{directory}\")\n end",
"def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/Skype')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def delete_pdf_exports(options)\n delete_options = options.dup\n # Force base-dir and file-extension to PDF export, leave file-selector as is\n delete_options['base-dir'] = :pdf_export_dir\n delete_options['file-extension'] = :pdf_extension\n\n delete_files(delete_options)\n end",
"def delete_file_parts\n #TODO implementation\n end",
"def uninstall_trash(directives, expand_tilde = true)\n uninstall_delete(directives, expand_tilde)\n end",
"def destroy(paths)\n\t\tlogin_filter\n\t\tpaths = [paths].flatten\n\t\tpaths = paths.collect { |path| namespace_path(path) }\n\t\[email protected](\"/cmd/delete\", {\"files\"=> paths, \"t\" => @token }).code == \"200\"\n\tend",
"def delete(current_user)\n if can_delete?(current_user)\n force_delete\n else\n errors.add_to_base(\"you are not allowed to remove this FileContent\")\n raise \"you are not allowed to remove this FileContent\"\n end\n end",
"def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end",
"def delete(pathset)\n raise ActionNotSupportedError.new(:delete, self)\n end",
"def delete(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:delete, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end",
"def delete(resource)\n finder_or_run(:delete, resource)\n end",
"def delete\n reload!\n if path.start_with?(\"/#{@client.account.name}/Trash\")\n raise Springcm::DeleteRefusedError.new(path)\n end\n unsafe_delete\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def _destroy_delete\n delete\n end",
"def _destroy_delete\n delete\n end",
"def gemset_delete(name)\n run(\"echo 'yes' | rvm\", :gemset, :delete, name.to_s).successful?\n end",
"def delete(device_or_devices, builtin_protection: true)\n case device_or_devices\n when SimCtl::SimDevice\n device_or_devices.delete(builtin_protection: builtin_protection)\n when ::String\n devs = devices.select { |d| d.name == device_or_devices }\n case devs.length\n when 0\n raise \"device not found with id \\\"#{device_or_devices}\\\"\"\n when 1\n devs[0].delete\n else\n raise \"more than one device found with id \\\"#{device_or_devices}\\\"\" \n end\n when ::Array\n puts \"Deleting Array\"\n device_or_devices.each { |d| delete d }\n else\n raise \"Don't know how to handle objects of type #{device_or_devices.class}\"\n end\n nil\n end",
"def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end",
"def delete!\n clear!\n delete\n end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def deleteT(dir1, dir2)\n\t\tFileUtils.rm_rf Dir.glob(\"#{dir1}*\")\n\t\tFileUtils.rm_rf Dir.glob(\"#{dir2}*\")\n\tend",
"def rm_f(list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n options = options.dup\r\n options[:force] = true\r\n rm list, options\r\n end",
"def execute(path)\n puts \"Removing features from #{path}\" if Clear.cli.data[:verbose]\n path = Pathname.new path\n clear(path)\n end",
"def delete!( *regexps )\n case regexps[0]\n when :paths\n @paths.delete_if { |regexp, paths| regexps.include? regexp }\n when :files\n @files.delete_if { |regexp, files| regexps.include? regexp }\n when Symbol\n raise( \"Invalid symbol option '#{first.inspect}'. \" +\n \"Expected :paths or :files.\" )\n else\n @paths.delete_if { |regexp, paths| regexps.include? regexp }\n @files.delete_if { |regexp, files| regexps.include? regexp }\n end\n self\n end",
"def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end",
"def atomic_delete_modifier\n atomic_paths.delete_modifier\n end",
"def remove(path, force: false, recursive: false, quote_with: '\"')\n command = [ \"rm\" ]\n command << \"-f\" if force\n command << \"-r\" if recursive\n command << path\n quote_command(command, quote_with: quote_with)\n end"
] | [
"0.64282566",
"0.6282635",
"0.602814",
"0.594366",
"0.59373796",
"0.5831294",
"0.5826206",
"0.58152723",
"0.57829547",
"0.5756551",
"0.5752344",
"0.572216",
"0.5710559",
"0.56992394",
"0.56853217",
"0.5682244",
"0.56820023",
"0.5668327",
"0.566779",
"0.5658412",
"0.56524175",
"0.5634285",
"0.56265527",
"0.5610011",
"0.5605908",
"0.5581877",
"0.55706906",
"0.55591136",
"0.55560565",
"0.55483705",
"0.5536162",
"0.55343723",
"0.55315995",
"0.5526425",
"0.5520675",
"0.5518695",
"0.5512547",
"0.55084944",
"0.5508164",
"0.5498726",
"0.54972494",
"0.5489423",
"0.5482319",
"0.54748625",
"0.54565483",
"0.54546493",
"0.5451055",
"0.54460865",
"0.5438239",
"0.54278535",
"0.54263616",
"0.5425328",
"0.5415558",
"0.54097605",
"0.54008126",
"0.5399786",
"0.53991675",
"0.53912187",
"0.5389679",
"0.5388866",
"0.5386145",
"0.5378568",
"0.53759164",
"0.5372398",
"0.53639674",
"0.5362453",
"0.5348751",
"0.53458846",
"0.534388",
"0.53423965",
"0.5336794",
"0.5336632",
"0.5323014",
"0.53126067",
"0.53084403",
"0.5307619",
"0.5306132",
"0.5301432",
"0.5300587",
"0.529431",
"0.52910167",
"0.5288494",
"0.5287209",
"0.5284867",
"0.5284313",
"0.527143",
"0.527143",
"0.52540165",
"0.52523744",
"0.5252055",
"0.52391136",
"0.5237518",
"0.5237518",
"0.5235711",
"0.52302736",
"0.5226254",
"0.5222403",
"0.52202207",
"0.5219523",
"0.5213132"
] | 0.56475526 | 21 |
Delete selected files and directories. | def delete
unless in_zip?
FileUtils.rm_rf selected_items.map(&:path)
else
Zip::File.open(current_zip) do |zip|
zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|
if entry.name_is_directory?
zip.dir.delete entry.to_s
else
zip.file.delete entry.to_s
end
end
end
end
@current_row -= selected_items.count {|i| i.index <= current_row}
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_files(options)\n if '' == options['base-dir'].to_s\n raise ArgumentError.new(\"Missing options['base-dir']\")\n end\n if '' == options['file-selector'].to_s\n raise ArgumentError.new(\"Missing options['file-selector']\")\n end\n if '' == options['file-extension'].to_s\n raise ArgumentError.new(\"Missing options['file-extension']\")\n end\n input_base_dir = config.compute_base_dir(options['base-dir'])\n input_file_selector = config.compute_file_selector(options['file-selector'])\n input_file_extension = config.compute_file_extension(options['file-extension'])\n\n Repositext::Cli::Utils.delete_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n options['file_filter'],\n \"Deleting files\",\n {}\n )\n end",
"def delete(files)\n # sync before we delete\n sync\n Array.wrap(files).each do |f|\n info \"removing #{f}\"\n FileUtils.rm(f)\n error \"#{f} wasn't removed\" if File.exists?(f)\n end\n end",
"def destroy\n delete_files_and_empty_parent_directories\n end",
"def delete_files\n self.bruse_files.each do |file|\n file.destroy\n end\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def deleteT(dir1, dir2)\n\t\tFileUtils.rm_rf Dir.glob(\"#{dir1}*\")\n\t\tFileUtils.rm_rf Dir.glob(\"#{dir2}*\")\n\tend",
"def delete_files\n\t\t\tFileUtils.rm_rf(@clean_image)\n\t\t\tFileUtils.rm_rf(@image) if pdf?\n\t\tend",
"def delete(*filenames); end",
"def delete_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"delete\", \"-c\", @number, *files)\n end\n end",
"def delete_directory_contents(options)\n Process::Delete::DirectoryContents.delete(options[:directory_path])\n end",
"def delete_files\n return if id.nil?\n return unless File.exist?(directory_path)\n\n FileUtils.rm_rf(directory_path)\n s3_delete_files\n end",
"def delete(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n if File.directory?(fn)\n log \"Deleting directory #{fn}\"\n Dir.delete(fn)\n else\n log \"Deleting file #{fn}\"\n File.delete(fn)\n end\n end\n end\n end",
"def delete(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n if File.directory?(fn)\n log \"Deleting directory #{fn}\"\n Dir.delete(fn)\n else\n log \"Deleting file #{fn}\"\n File.delete(fn)\n end\n end\n end\n end",
"def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end",
"def delete_tmp_files(options)\n files_to_delete = options[:files_to_delete]\n if files_to_delete && files_to_delete.count > 0\n files_to_delete.each do |fpath|\n File.delete(fpath) if File.exists?(fpath)\n end\n end\n end",
"def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end",
"def delete_files_from dir\n Dir[dir+\"/*\"].each do |file|\n File::delete(file)\n end \n rescue => e\n Logger.<<(__FILE__,\"WARNING\",\"Files from #{dir} could not be deleted.\\n#{e.message}\")\n end",
"def delete_extra_files( *filelist )\n\t\tdescription = humanize_file_list( filelist, '\t ' )\n\t\tself.prompt.say \"Files to delete:\"\n\t\tself.prompt.say( description )\n\n\t\tif self.prompt.yes?( \"Really delete them?\" ) {|q| q.default(false) }\n\t\t\tfilelist.each do |f|\n\t\t\t\trm_rf( f, verbose: true )\n\t\t\tend\n\t\tend\n\tend",
"def delete_all_files\n @import.delete_all_files\n head :no_content\n end",
"def erase\n HDB.verbose and puts \"Erasing successfully-copied files\"\n unlinkable = @files.collect do |x|\n f = get_real_filename(x)\n File.directory?(f) or File.symlink?(f)\n end\n # TODO: unlink them now.\n # TODO: rmdir directories, starting with child nodes first\n raise \"erase unimplemented\"\n end",
"def destroy(paths)\n\t\tlogin_filter\n\t\tpaths = [paths].flatten\n\t\tpaths = paths.collect { |path| namespace_path(path) }\n\t\[email protected](\"/cmd/delete\", {\"files\"=> paths, \"t\" => @token }).code == \"200\"\n\tend",
"def destroy\n all.each { |file| FileUtils.rm_f(file) }\n end",
"def destroy(*paths)\n paths.each do |path|\n FileUtils.rm(path) if File.file?(path) \n end\n end",
"def delete_extra_files( filelist )\n\tdescription = humanize_file_list( filelist, ' ' )\n\tlog \"Files to delete:\\n \", description\n\task_for_confirmation( \"Really delete them?\", false ) do\n\t\tfilelist.each do |f|\n\t\t\trm_rf( f, :verbose => true )\n\t\tend\n\tend\nend",
"def delete(selections)\n title_message(\"Deleting Forks\")\n selections.each do |s|\n Dishwasher::Github.delete_repo(s)\n end\n confirmation_message\n end",
"def delete_extra_files( filelist )\n\t\t\tdescription = humanize_file_list( filelist, '\t ' )\n\t\t\tlog \"Files to delete:\\n \", description\n\t\t\task_for_confirmation( \"Really delete them?\", false ) do\n\t\t\t\tfilelist.each do |f|\n\t\t\t\t\trm_rf( f, :verbose => true )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end",
"def destroy!(*paths)\n paths.each do |path|\n FileUtils.rm(path)\n end\n end",
"def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end",
"def destroy\n error = nil\n\n if @file.directory_id.nil?\n render_error \"Cannot remove root directory. Delete the project, instead.\"\n else\n begin\n ActiveRecord::Base.transaction do\n delete_file(@file, true);\n render json: \"\", serializer: SuccessSerializer\n end\n rescue\n render_error \"Files could not be deleted.\"\n end\n end\n end",
"def delete_dir!(dir)\n result = interact(:delete_test, :proceed) do |i|\n files = Dir.glob(File.join(dir, \"**\", \"*\"))\n i.prompt(\"The following files will be removed:\\n * \" + files.join(\"\\n * \"))\n i.choice('D', \"Delete them.\") do\n FileUtils.rm_rf(@test_case.folder)\n end\n i.choice('x', \"I changed my mind.\") do\n end\n end\n result == :proceed\n end",
"def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end",
"def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend",
"def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend",
"def delete_all_uploaded_images\n images_dir = FileUploader.file_dir('article', id)\n FileUtils.rm_rf(images_dir) if File.directory?(images_dir)\n end",
"def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end",
"def remove_from_list\n return unless $selection_allowed\n if $selected_files.size > 0\n sz = $selected_files.size\n print \"Remove #{sz} files from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n print\n ## what if selected some rows\n file = $view[$cursor]\n print \"Remove #{file} from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n refresh\n $modified = true\nend",
"def delete_all_projects\n FileUtils.rm_rf(Dir.glob(\"#{DIR_PROJECTS}/*\"))\nend",
"def remove_from_list\n if $selected_files.size > 0\n sz = $selected_files.size\n ch = get_single \"Remove #{sz} files from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n #print\n ## what if selected some rows\n file = $view[$cursor]\n ch = get_single \"Remove #{file} from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n c_refresh\n $modified = true\nend",
"def delete_all(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n next if ! File.exist?(fn)\n if File.directory?(fn)\n Dir[\"#{fn}/*\"].each do |subfn|\n next if subfn=='.' || subfn=='..'\n delete_all(subfn)\n end\n log \"Deleting directory #{fn}\"\n Dir.delete(fn)\n else\n log \"Deleting file #{fn}\"\n File.delete(fn)\n end\n end\n end\n end",
"def delete_all(*wildcards)\n wildcards.each do |wildcard|\n Dir[wildcard].each do |fn|\n next if ! File.exist?(fn)\n if File.directory?(fn)\n Dir[\"#{fn}/*\"].each do |subfn|\n next if subfn=='.' || subfn=='..'\n delete_all(subfn)\n end\n log \"Deleting directory #{fn}\"\n Dir.delete(fn)\n else\n log \"Deleting file #{fn}\"\n File.delete(fn)\n end\n end\n end\n end",
"def delete_all_pdf_exports(options)\n delete_options = options.dup\n # Force file-selector to all files.\n delete_options['file-selector'] = \"**/*\"\n\n delete_pdf_exports(delete_options)\n end",
"def markDeleteOptions(sourceDir)\n #N Without this we can't loop over the immediate sub-directories to determine how each one needs to be marked for deleting\n for dir in dirs\n #N Without this we won't have the corresponding sub-directory in the other directory with the same name as this sub-directory (if it exists)\n sourceSubDir = sourceDir.getDir(dir.name)\n #N Without this check, we won't be able to correctly process a sub-directory based on whether or not one with the same name exists in the other directory\n if sourceSubDir == nil\n #N Without this, this directory won't be deleted, even though it doesn't exist at all in the corresponding source directory\n dir.markToDelete()\n else\n #N Without this, files and directories missing from the other source sub-directory (which does exist) won't get deleted\n dir.markDeleteOptions(sourceSubDir)\n end\n end\n #N Without this we can't loop over the files to determine which ones need to be marked for deleting\n for file in files\n #N Without this we won't known if the corresponding file in the source directory with the same name as this file exists\n sourceFile = sourceDir.getFile(file.name)\n #N Without this check, we will incorrectly delete this file whether or not it exists in the source directory\n if sourceFile == nil\n #N Without this, this file which doesn't exist in the source directory won't get deleted from this directory\n file.markToDelete()\n end\n end\n end",
"def remove(files, opts = {})\n args = []\n args << '-f' if opts[:force]\n args << [*files]\n command(:rm, args)\n end",
"def cleanup\n\n # ----------------------------------------------\n account_name = 'your account name' # <-- change this!\n project_name = 'your project name' # <-- change this!\n # ----------------------------------------------\n\n project_dir = \"/home/#{account_name}/www\"\n Dir.chdir(project_dir)\n\n Dir.entries(project_name).select do |entry1|\n\n dir1 = File.join(project_name,entry1) #dir2 = \"#{project_name}/#{entry1}\"\n if is_directory?(dir1)\n Dir.entries(dir1).select do |entry2|\n \n dir2 = File.join(dir1,entry2) #dir2 = \"#{project_name}/#{entry1}/#{entry2}\"\n if is_directory?(dir2)\n Dir.entries(dir2).select do |entry3|\n \n dir3 = File.join(dir2,entry3) #dir3 = \"#{project_name}/#{entry1}/#{entry2}/#{entry3}\"\n if is_directory?(dir3)\n Dir.entries(dir3).select do |entry4|\n delete_file(File.join(dir3,entry4))\n end\n end\n\n delete_file(dir3)\n delete_dir(dir3)\n end\n end\n\n delete_file(dir2)\n delete_dir(dir2)\n end\n end\n\n delete_file(dir1)\n delete_dir(dir1)\n end\n\n delete_dir(project_name)\nend",
"def delete_files_and_empty_parent_directories\n style_names = reflection.styles.map{|style| style.name} << :original\n # If the attachment was set to nil, we need the original value\n # to work out what to delete.\n if column_name = reflection.column_name_for_stored_attribute(:file_name)\n interpolation_params = {:basename => record.send(\"#{column_name}_was\")}\n else\n interpolation_params = {}\n end\n style_names.each do |style_name|\n path = interpolate_path(style_name, interpolation_params) or\n next\n FileUtils.rm_f(path)\n begin\n loop do\n path = File.dirname(path)\n FileUtils.rmdir(path)\n end\n rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR\n # Can't delete any further.\n end\n end\n end",
"def delete_files\n #TODO delete original file\n unless filename.blank?\n File.delete(splash_file(:full_path => true)) if File.exists?(splash_file(:full_path => true))\n File.delete(flv_file(:full_path => true)) if File.exists?(flv_file(:full_path => true))\n File.delete(original_file) if File.exists?(original_file)\n end\n end",
"def delete_pdf_exports(options)\n delete_options = options.dup\n # Force base-dir and file-extension to PDF export, leave file-selector as is\n delete_options['base-dir'] = :pdf_export_dir\n delete_options['file-extension'] = :pdf_extension\n\n delete_files(delete_options)\n end",
"def delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurrent_user.tasks.destroy_all\n\t\tcurrent_user.clouds.destroy_all\n\t\tcurrent_user.platforms.destroy_all\n\t\tcurrent_user.demos.destroy_all\n\t\tcurrent_user.favorites.destroy_all\n\tend",
"def delete_downloads\n FileUtils.remove_entry_secure(dir) if Dir.exist?(dir)\n end",
"def deleteSelection \n\n chk_ids = params[:ids]\n chks = chk_ids.split(\",\")\n\n chks.each do |chk|\n @mbook = Mbook.get(chk.to_i)\n mbook_id = @mbook.id\n mbook = @mbook\n \n if @mbook != nil\n if File.exists?(@mbook.zipfile)\n FileUtils.rm_rf @mbook.zipfile\n end\n \n if File.exists?(@mbook.zip_path)\n FileUtils.rm_rf @mbook.zip_path\n end\n \n if File.exists?(MBOOK_PATH + @mbook.id.to_s + \".zip\")\n FileUtils.rm_rf MBOOK_PATH + @mbook.id.to_s + \".zip\"\n end\n \n if @mbook.destroy \n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 성공\"\n else\n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 실패\"\n end\n end \n end\n\n render :text => \"success\"\n end",
"def delete_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.store,source.name.to_s,fold)\n delete_files_from url\n url = File.join(dir.backup,source.name.to_s,fold)\n delete_files_from url\n end\n Logger.<<(__FILE__,\"INFO\",\"Deleted files server & backup for #{source.name.to_s}\")\n end",
"def clean_selected_files\n @selected_files.select! { |x| x = expand_path(x); File.exist?(x) }\nend",
"def delete_users\n delete(users_path)\n end",
"def remove_from_list\n\n # XXX key to invoke this is difficult. make it easier\n selfiles = current_or_selected_files\n sz = selfiles.size\n print \"Remove #{sz} files from used list (y)?: \"\n key = get_char\n return if key != 'y'\n\n # arr = @selected_files.map { |path| File.expand_path(path) }\n # @log.debug \"BEFORE: Selected files are: #{@selected_files}\"\n arr = selfiles.map { |path|\n if path[0] != '/'\n expand_path(path)\n else\n path\n end\n }\n if File.directory? arr.first\n @used_dirs -= arr\n select_from_used_dirs\n else\n @visited_files -= arr\n select_from_visited_files\n end\n unselect_all\n @modified = true\n # redraw_required\nend",
"def delete\n # Return if the user didn't specify any photos\n return redirect_to gallery_path if params[:ids].nil?\n\n # Select all the photos with an id in ids and whose owner is the current user\n photos = Photo.where(id: params[:ids], owner: current_user)\n\n # Notify the user if they attempted to delete someone elses photos\n flash[:alert] = I18n.t(\"photos.delete.error\") if photos.nil? || photos.count != params[:ids].count\n\n # Delete all the photos. This synchronously remove all the Photo records from the db\n # so they won't show up in the gallery anymore. However, the actual image files\n # are delete asynchronously as that may take a while\n photos.destroy_all\n\n redirect_to gallery_path\n end",
"def delete_all\n klass.delete_all(:conditions => selector)\n end",
"def delete_dir dir_name\n puts \"Deleting #{dir_name}...\"\n files = Dir.entries(HTML_DIR)\n files.delete(\".\")\n files.delete(\"..\")\n files.each {|file| File.delete(File.join(HTML_DIR, file))}\n Dir.delete(HTML_DIR)\nend",
"def delete_all\n target.clear\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/VLC'),\n ::File.expand_path('~/Library/Application Support/org.videolan.vlc')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def clear\n Dir[File.join(@output_dir, '*')].each do |path|\n File.delete(path)\n end\n end",
"def delete_files(filenames)\n filenames.each do |filename|\n shell.assert(docker_exec(\"rm #{sandbox_dir}/#{filename}\"))\n end\n end",
"def clean!\n FileUtils.rm_rf(dir)\n end",
"def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end",
"def remove_paths(*args)\n args.each do |item|\n if File.directory?(item)\n puts \"#{item} is a path. removing it now.\"\n # set :noop => true to do a dry run\n FileUtils.rm_rf(item, :verbose => true)\n else\n puts \"#{item} doesn't exist or isn't a directory.\"\n end\n end\n end",
"def delete_directories account\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n \n # Tell the user\n puts \"> Tar bort kontot från filsystemet\".green\n\n # Build the paths\n mail_dir = BASE_PATH_MAIL + account['mail']\n home_dir = BASE_PATH_HOME + account['home']\n\n # Remove the directories\n fu.rm_r mail_dir\n fu.rm_r home_dir\nend",
"def rm(paths, options = {})\n paths = Array(paths).map { |p| ::File.expand_path(p) }\n\n FileUtils.rm_r(paths, **options)\n end",
"def cleanup\n filenames = [\"book.opf\", \"toc.html\"]\n filenames += @chapters\n \n filenames.each do |filename|\n File.delete(filename)\n end\n end",
"def stage_clear\n stage_safe!\n Dir['*'].each do |path|\n #p path\n FileUtils.rm_r(path)\n end\n end",
"def destroy\n FileUtils.rm_rf(target)\n end",
"def delete_file_parts\n #TODO implementation\n end",
"def clear_files\n Dir.glob(Dir.pwd + \"/tmp/downloads/*.csv\").each { |file| File.delete(file) }\nend",
"def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end",
"def delete_packages\n return unless ask_confirmation\n\n delete_libvirt_pool\n delete_vagrant_plugins\n delete_terraform\n @dependency_manager.delete_dependencies\n end",
"def clean_files\n #FileUtils.rm options[:file], v\n return true if !options[:file]\n FileUtils.rm options[:file] if File.file? options[:file]\n FileUtils.rm backup_file if File.file? backup_file\n return true\n end",
"def cleanup(dir)\n Dir.glob(dir+\"/*\").each do |file|\n File.unlink(file)\n end\n Dir.unlink(dir)\nend",
"def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend",
"def rm_rf(options={})\n #list = list.to_a\n fileutils.rm_rf(list, options)\n end",
"def delete_content_dir(path)\n FileUtils.rm_rf(Dir.glob(\"#{path}/*\"))\n end",
"def delete(*names)\n Tk.execute(:image, :delete, *names)\n end",
"def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def delete\n if options.master?\n delete_master(options)\n elsif options.slave?\n delete_slave(options)\n else\n invoke :help, [:delete]\n end\n end",
"def delete_root\n Dir.chdir(root) do\n Dir.entries('.').each do |entry|\n next if entry == '.' || entry == '..'\n next if entry == FILES_DIR && task.options.copy_files_with_symlink\n\n begin\n FileUtils.remove_entry_secure(entry)\n rescue\n if task.options.copy_files_with_symlink\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory (except for ' + root + '/' + FILES_DIR + ') and then hit any key to continue...')\n else\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory and then hit any key to continue...')\n end\n STDIN.getch\n break\n end\n end\n end\n\n logger.info(\"#{root} content was deleted\")\n end",
"def delete_files(version)\n binary = File.join(Dir.tmpdir, \"openjdk\" + version.to_s + \"_openj9\" + \".tgz\")\n\n file binary do\n action :delete\n end\n end",
"def rm_f(options={})\n #list = list.to_a\n fileutils.rm_f(list, options)\n end",
"def delete_backups\n backups = Dir.glob('**/*~')\n menu(backups) do |paths|\n paths.each {|e| File.unlink(e) }\n end\n end",
"def deleteFW (path)\n choose = prompt(text: \"delete \" + path.to_s + \"?\\n press 1 to continue, 0 to exit: \").to_i\n if choose.to_i == 0 \n abort UI.user_error!(\"program was forced exit by user\")\nelse\n sh(\"rm -rf \" + path.to_s)\n end\nend",
"def trash\n unless in_zip?\n if osx?\n FileUtils.mv selected_items.map(&:path), File.expand_path('~/.Trash/')\n else\n #TODO support other OS\n FileUtils.rm_rf selected_items.map(&:path)\n end\n else\n return unless ask %Q[Trashing zip entries is not supported. Actually the files will be deleted. Are you sure want to proceed? (y/n)]\n delete\n end\n @current_row -= selected_items.count {|i| i.index <= current_row}\n ls\n end",
"def delete_files()\n\n puts \"Deleting cloud files on all machines...\"\n \n # Create an MCollective client so that we avoid errors that appear\n # when you create more than one client in a short time\n mcc = MCollectiveFilesClient.new(\"files\")\n \n # Delete leader, id, last_id and last_mac files on all machines\n # (leader included)\n mcc.delete_file(CloudLeader::LEADER_FILE) # Leader ID\n mcc.delete_file(CloudLeader::ID_FILE) # ID\n mcc.delete_file(CloudLeader::LAST_ID_FILE) # Last ID\n mcc.delete_file(CloudVM::LAST_MAC_FILE) # Last MAC address\n mcc.disconnect # Now it can be disconnected\n \n # Delete rest of regular files on leader machine\n files = [CloudInfrastructure::DOMAINS_FILE, # Domains file\n \"/tmp/cloud-#{@resource[:name]}\"] # Cloud file\n files.each do |file|\n if File.exists?(file)\n File.delete(file)\n else\n puts \"File #{file} does not exist\"\n end\n end\n\n end",
"def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end",
"def delete_temporary_files\n\t\t`rm -fr tmp/*`\n\tend",
"def delete\n ::File.unlink(@path)\n end",
"def delete_tempfiles\n @files_arr.delete_if do |tempfile_path|\n File.unlink(tempfile_path) if File.exists?(tempfile_path)\n true\n end\n end",
"def remove_photos(db, selected)\n\n photos = selected.split(\",\")\n\n photos.each do |photo|\n delete_s3_file(photo)\n delete_db_record(db, photo)\n end\n\nend",
"def fileDeleteAll(globPath)\n\tPathname.glob(globPath).each do |path|\n\t\tputs \"Deleting \" + path.to_s\n\t\tfile = path.to_s\n\t\tFile.delete file\n\tend\nend",
"def destroy\n FileUtils.rm_rf @root\n end",
"def delete_all repos\n unless repos\n raise \"required repository name\"\n end\n repos = @login + '/' + repos unless repos.include? '/'\n list_files(repos).each { |obj|\n delete repos, obj[:id]\n }\n end",
"def destroy\n @folder.destroy\n end"
] | [
"0.728795",
"0.6934576",
"0.68912596",
"0.6837461",
"0.6753595",
"0.67225724",
"0.67041534",
"0.668328",
"0.66563135",
"0.6639564",
"0.6619389",
"0.6466952",
"0.6466952",
"0.6430786",
"0.6407656",
"0.63818574",
"0.6344212",
"0.63083327",
"0.62737864",
"0.6265299",
"0.6262813",
"0.625017",
"0.62263244",
"0.6184473",
"0.6178887",
"0.6161892",
"0.6158732",
"0.611132",
"0.6100229",
"0.60970473",
"0.60350925",
"0.6030151",
"0.60139906",
"0.60139906",
"0.6000706",
"0.5973259",
"0.5958462",
"0.5954001",
"0.5951219",
"0.59410053",
"0.59410053",
"0.59064007",
"0.59050035",
"0.5873493",
"0.58581907",
"0.58464015",
"0.58401066",
"0.58375555",
"0.5829835",
"0.58213764",
"0.5804446",
"0.57970256",
"0.579675",
"0.5785782",
"0.5781794",
"0.5781136",
"0.57694536",
"0.5769323",
"0.57637984",
"0.5763233",
"0.57619494",
"0.5760806",
"0.5756796",
"0.5747425",
"0.57468474",
"0.573398",
"0.57168865",
"0.57164955",
"0.5707925",
"0.57017624",
"0.5685704",
"0.5680031",
"0.5679958",
"0.56729025",
"0.56590503",
"0.56574094",
"0.56562907",
"0.5651102",
"0.56479496",
"0.5644062",
"0.56437606",
"0.5636211",
"0.5636086",
"0.5632466",
"0.5624951",
"0.56241536",
"0.5619704",
"0.5616111",
"0.5615256",
"0.56094193",
"0.5608274",
"0.56069756",
"0.5599096",
"0.5587742",
"0.55794156",
"0.557927",
"0.55764925",
"0.55723125",
"0.5571055",
"0.5560136"
] | 0.6416039 | 14 |
Create a new directory. | def mkdir(dir)
unless in_zip?
FileUtils.mkdir_p current_dir.join(dir)
else
Zip::File.open(current_zip) do |zip|
zip.dir.mkdir dir
end
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end",
"def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end",
"def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end",
"def create\n FileUtils.mkdir_p(directory) unless exist?\n end",
"def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end",
"def CreateDir(aDir):\n FileUtils.mkdir_p(aDir)\n end",
"def make_dir (dirname)\n begin\n unless File.exists?(dirname)\n puts \"[add] making directory '#{dirname}'\"\n FileUtils.mkdir(dirname)\n end\n rescue Exception => e\n puts \"An error occurred when trying to create the directory '#{dirname}', exception found was: \"+ e.message\n exit 1\n end\n end",
"def create_dir(dir)\n dir = \"#{@dir}/#{dir}\"\n puts \"... Creating directory '#{dir}'\"\n Dir.mkdir(dir)\n end",
"def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end",
"def create\n create_directories\n end",
"def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end",
"def mkdir(path)\n vprint_status(\"Creating directory #{path}\")\n if session.type == 'meterpreter'\n vprint_status(\"Meterpreter Session\")\n result = session.fs.dir.mkdir(path)\n else\n if session.platform == 'windows'\n result = cmd_exec(\"mkdir \\\"#{path}\\\"\")\n else\n result = cmd_exec(\"mkdir -p '#{path}'\")\n end\n end\n vprint_status(\"#{path} created\")\n register_dir_for_cleanup(path)\n result\n end",
"def make_dir(dir_path)\n FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)\n end",
"def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def create_directories\n directory '.', './'\n end",
"def create_dir(dir)\n\t\tif !FileTest::directory?(dir)\n\t\t\tDir::mkdir(dir)\n\t\tend\n\tend",
"def create_directory(directory)\n Dir.chdir(path)\n Dir.mkdir(directory) unless File.directory?(directory)\n end",
"def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end",
"def mkdir( *args ) Dir.mkdir( expand_tilde, *args ) end",
"def mkdir(dir)\n FileUtils.mkdir_p(dir)\n end",
"def mkdir(*args) Dir.mkdir(path, *args) end",
"def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end",
"def create_dir path\n sftp.mkdir! path\n end",
"def make_directory(path)\n mkdir(path)\n chown(path, user)\n path\n end",
"def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend",
"def create_dir(dir)\n Dir.mkdir(dir) unless File.exists?(dir)\n end",
"def mkdir_p dir\n unless ::File.directory? dir\n unless (parent_dir = ::File.dirname dir) == '.'\n mkdir_p parent_dir\n end\n begin\n ::Dir.mkdir dir\n rescue ::SystemCallError\n raise unless ::File.directory? dir\n end\n end\n end",
"def create_dir(path, property)\n FileUtils.mkdir_p(path)\n insert_property(property, path)\n end",
"def create_directory!\n return if Dir.exist?(output_directory)\n\n FileUtils.mkdir_p(output_directory)\n end",
"def create_directory\n return if File.exist? config_directory\n\n begin\n FileUtils.mkdir config_directory\n rescue Errno::EEXIST\n end\n end",
"def mkdir dir, options = {}\n add \"mkdir -p #{dir}\", check_dir(dir)\n chmod options[:perms], dir if options[:perms]\n chown options[:owner], dir if options[:owner]\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end",
"def mkpath(directory)\n FileUtils.mkdir_p(directory.to_s, :mode => @permissions[:dir], :verbose => true)\n end",
"def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end",
"def mkdir(path)\n Dir.mkdir path unless exists? path\n end",
"def make_directory(directory)\n self.exec!(\"mkdir #{directory}\") unless directory_exists?(directory)\n end",
"def mkdir(option={})\n mode = option[:mode] || 0700\n path = create(option)\n path.mkdir(mode)\n return path\n end",
"def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end",
"def makedir(dir)\n FileUtils.mkdir_p dir\n end",
"def create_folder(directory)\n\tputs 'Creating directory \\'' + directory + '\\'...'\n\tFileUtils.mkdir_p directory\n\tputs 'done'\nend",
"def ensure_directory\n FileUtils.mkdir_p(to_s)\n self\n end",
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def create_directory(dir_name)\n Dir.mkdir(dir_name) unless File.exists?(dir_name)\nend",
"def create_directory(file)\n end",
"def mkdir( dir )\n dir = dir.empty? ? site : site / dir\n if test ?d, dir\n exists dir\n else\n create dir\n FileUtils.mkdir_p dir unless pretend?\n end\n end",
"def mkdir_p(dir)\n FileUtils.mkdir_p dir\n puts \" ✔ mkdir -p #{dir}\".colorize(:blue).bold\n end",
"def mkdir(dir_name)\n dir_name = ::File.expand_path(dir_name)\n\n ::FileUtils.mkdir_p(dir_name) unless ::File.directory?(dir_name)\n end",
"def create_dir(path)\n is_file = File.file?(path)\n is_dir = File.directory?(path)\n\n # Check for existing file/dir, and offer to overwrite\n if is_file || is_dir\n puts \"File #{path} already exists.\" if is_file\n puts \"Directory #{path} already exists.\" if is_dir\n\n if prompt(\"WARNING: Existing #{path} will be deleted. Continue?\")\n puts \"Removing existing #{path} ...\"\n FileUtils.rm_rf(path)\n else\n puts \"Please use another directory.\"\n Process.exit\n end\n end\n\n puts \"Creating directory #{path} ...\"\n FileUtils.mkdir_p(path)\n end",
"def mkdir(dirname)\n ensure_relative_path! :mkdir, dirname\n @ftp.mkdir dirname\n end",
"def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend",
"def make_my_dir (dirname, state)\n\n if Dir.exists?(dirname) && state == DIR_NEW\n puts \"ERROR-01: Directory already exists; name=<#{dirname}>\\n\"\n exit\n end\n\n if Dir.exists?(dirname)\n return\n else\n Dir.mkdir (dirname)\n if ! Dir.exists?(dirname)\n puts \"ERROR-02: Could not create directory; name=<#{dirname}>\\n\"\n exit\n end\n end\nend",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end",
"def create_dir(dir_name) \n Dir.exist?(dir_name) ? nil : Dir.mkdir(dir_name)\n return true\n end",
"def mkdir(*args)\n args[0] = 0700 unless args[0]\n orig_mkdir(*args)\n end",
"def mkdir_p(path)\n FileUtils.mkdir_p(path)\n end",
"def ensure_dir(dir_name)\n FileUtils::mkdir_p(dir_name)\n end",
"def mkdir(path)\n dir = File.dirname(path)\n if !File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n end",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end",
"def mkdir( dir )\n dir = dir.empty? ? project : ::File.join( project, dir )\n unless File.directory?( dir )\n creating dir\n FileUtils.mkdir_p dir\n end\n end",
"def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end",
"def make_dir_for_path(path)\n dir_name = File.dirname(path)\n Dir.mkdir(dir_name) if !File.directory?(dir_name)\n end",
"def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end",
"def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end",
"def mkdir!(path, directory_permissions)\n options = {}\n options[:mode] = directory_permissions if directory_permissions\n FileUtils.mkdir_p(File.dirname(path), **options) unless File.exist?(File.dirname(path))\n end",
"def mkdir!(pth=path, options={})\n create! pth, options.merge({:arguments=>'-p'})\n # File.makedirs path # this would be great except that it doesn't support sudo\n end",
"def mkdir_p dir\n cmd = \"mkdir -p #{dir}\"\n result = exec(Beaker::Command.new(cmd), :acceptable_exit_codes => [0, 1])\n result.exit_code == 0\n end",
"def mkdir_p(*arg)\n FileUtils.mkdir_p(*arg)\n end",
"def create_storage_dir\n placeholder = @placeholder || @dirname\n dirpath = File.join(storage_path, placeholder)\n FileUtils.mkdir dirpath unless Dir.exists? dirpath\n end",
"def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end",
"def mkdir(dir, owner = nil, mode = nil)\n FileUtils.mkdir_p(dir, :verbose => verbose?)\n chmod(dir, mode) if mode\n chown(dir, owner) if owner\n end",
"def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend",
"def directory(dir, &block)\n if File.directory?(dir)\n log dir, \"(already exists)\"\n else\n log dir, \"(creating directory)\"\n mkdir_p(dir)\n end\n Dir.chdir(dir, &block) if block_given?\n end",
"def mkdir(dir)\n if !File.directory?(dir)\n FileUtils.mkdir_p(dir, :mode => 0750)\n File.chown($config[:uid], $config[:gid], dir)\n end\n end",
"def mkdir(dir)\n if File.exists?(dir)\n false\n else\n Dir.mkdir dir \n true\n end\n end",
"def mkdir_p(path)\n if !Dir::exist? path\n Dir::mkdir path\n end\nend",
"def mkdir( dir )\n dir = dir.empty? ? site : ::File.join(site, dir)\n unless test ?d, dir\n creating dir\n FileUtils.mkdir_p dir\n end\n end",
"def add_directory(name)\n full_path = File.join(path, name)\n\n Dir.mkdir(full_path) unless File.directory?(full_path)\n\n self.class.new(full_path)\n end",
"def create\n location.mkdir\n end",
"def mkdir(dir)\n Dir.mkdir dir unless File.exists?(dir)\nend",
"def mkdir(dirname, attrs = {})\n ensure_relative_path! :mkdir, path\n @sftp.mkdir!(remote_path(dirname), attrs)\n end",
"def make_destination_dir(dest_dir)\n unless File.exist?(dest_dir)\n #ディレクトリが存在しない場合作成\n FileUtils.mkdir_p(dest_dir) \n end\n end",
"def mkdir(path)\n Utils.traverse(path) do |dir, name|\n params = make_params :is_dir => true,\n :dir_id => dir.try(:id),\n :name => name\n\n scope.find_or_create_by(params)\n end\n end",
"def directory(dir)\n last_remote = Rake.application.last_remote\n Rake.each_dir_parent(dir) do |d|\n Rake.application.last_remote = last_remote\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\n end",
"def make_dirs(*args)\n FileUtils.mkdir_p(args)\nend",
"def create_directory(directory, proc_id)\n begin\n FileUtils.mkdir_p(directory) unless Dir.exists?(directory)\n rescue SystemCallError\n cancel_job(\"Error while creating directory #{directory} - aborting\",\n proc_id)\n end\nend",
"def create_physical_directory(directory)\n # Use file Utils and create the directory.\n FileUtils.mkdir_p(directory) unless File.directory?(directory)\n end",
"def mkdir (dir)\n echo 'Vytvářím složku \"'+ dir +'\".'\n \n if @ftp\n @ftp.mkdir(dir)\n else\n Dir.mkdir(dir, 0775)\n end\n @created_dirs += 1\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def mkdir(path)\n target = prefixed(path)\n\n if exist?(target)\n dddebug('mkdir', [path], 'Already exists')\n else\n dddebug('mkdir', [path])\n FileUtils.mkdir_p(target)\n end\n end",
"def mkdir(path)\n @dirs_to_create.push(path) unless @dirs_to_create.include?(path)\n end",
"def mkdir(dir)\n FileUtils.mkdir_p(File.expand_path(dir))\n @status.fail! unless File.exists?(File.expand_path(dir))\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def create_directories(path)\n FileUtils.mkdir_p(path) unless Dir.exists?(path)\nend",
"def mkdir(option={})\n @generator.mkdir(option)\n end",
"def make_dir(dirname)\n begin\n @ftp.mkdir(dirname)\n return true\n rescue \n return false\n end\n end",
"def mkdir(path)\n @client.file_create_folder(path)\n rescue\n puts $! if @@verbose\n nil\n end",
"def create_or_delete_directory(path)\n d = ::Chef::Resource::Directory.new(path, run_context)\n d.recursive(true)\n if new_resource.action == :destroy_all\n d.run_action(:delete)\n else\n d.run_action(:create) unless ::File.exists?(path)\n end\n end"
] | [
"0.8423674",
"0.8154918",
"0.8083509",
"0.7989395",
"0.78419983",
"0.78292114",
"0.78061426",
"0.778486",
"0.7742616",
"0.7733162",
"0.76817423",
"0.76738566",
"0.766087",
"0.7651575",
"0.76507926",
"0.76419747",
"0.7618168",
"0.7614387",
"0.75946254",
"0.7591316",
"0.7565832",
"0.7501107",
"0.74998826",
"0.74869335",
"0.7486752",
"0.7480204",
"0.746059",
"0.74509805",
"0.7428682",
"0.74274325",
"0.74002504",
"0.73824227",
"0.7352824",
"0.733714",
"0.73209614",
"0.7314831",
"0.7314628",
"0.73133314",
"0.7310724",
"0.7310394",
"0.7289672",
"0.7282228",
"0.7244277",
"0.72178465",
"0.7214707",
"0.72122896",
"0.7196798",
"0.71914136",
"0.7190489",
"0.7181186",
"0.71645445",
"0.71444434",
"0.7143527",
"0.7136391",
"0.7136391",
"0.7129246",
"0.711822",
"0.7090807",
"0.7089333",
"0.7059189",
"0.7055986",
"0.7048693",
"0.7047215",
"0.70221126",
"0.7020142",
"0.70180833",
"0.70180833",
"0.7017457",
"0.70034873",
"0.69795316",
"0.6975613",
"0.6966717",
"0.6948473",
"0.6945001",
"0.69405746",
"0.693289",
"0.6920645",
"0.6915515",
"0.6910343",
"0.6904039",
"0.6898555",
"0.68897355",
"0.6847195",
"0.68335897",
"0.68253696",
"0.68140614",
"0.6811683",
"0.6811365",
"0.6810111",
"0.67763186",
"0.67751276",
"0.6773474",
"0.67647195",
"0.67541635",
"0.6738832",
"0.6735142",
"0.6733546",
"0.6711292",
"0.6710258",
"0.67022187",
"0.6701086"
] | 0.0 | -1 |
Create a new empty file. | def touch(filename)
unless in_zip?
FileUtils.touch current_dir.join(filename)
else
Zip::File.open(current_zip) do |zip|
# zip.file.open(filename, 'w') {|_f| } #HAXX this code creates an unneeded temporary file
zip.instance_variable_get(:@entry_set) << Zip::Entry.new(current_zip, filename)
end
end
ls
move_cursor items.index {|i| i.name == filename}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_file(file_name)\n puts \"Creating %s...\" % [file_name]\n make_dir_for_path(file_name)\n new_file = File.new(file_name, File::WRONLY|File::TRUNC|File::CREAT)\n end",
"def safe_make_empty_file(path)\n if File.exist? path\n File.open(path, 'r') do |f|\n if !f.read.empty?\n raise Error, Error::MSG_EMPTY_FILE_NOT_EMPTY% path\n end\n end\n end\n\n # make an empty file\n File.open(path, 'a') do |f|\n end\n end",
"def create_file\n\tfile = File.new\"hello_from_ruby.txt\",\"w\"\n\tputs \"-------------------------------------------\"\n\tputs \"Successfully created 'hello_from_ruby.txt'!\"\n\tputs \"-------------------------------------------\"\nend",
"def create_file(path, size)\n FileUtils.mkdir_p(File.dirname(path))\n @file = File.open(path, File::CREAT | File::EXCL | File::RDWR) \n @file.truncate(size)\n write_tail(@file, 4) # 4 is a size of long type.\n end",
"def createFile (pathFile,extension,nameFile, erb)\r\n FileUtils.mkdir_p(pathFile)\r\n fileName = pathFile+nameFile+extension\r\n newFile = File.open(fileName,\"w\")\r\n newFile.print erb\r\n newFile.close\r\n end",
"def create_file(filename, content)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p File.dirname(expanded_filename)\n File.open(expanded_filename, 'wb') do |f|\n f.write content\n end\n expanded_filename\n end",
"def create_file(file_name, contents)\n full_path = File.expand_path(File.join(dummy_app, file_name))\n\n dir = full_path.split('/')\n dir.pop\n FileUtils.mkdir_p(dir.join('/'))\n\n File.open(full_path, 'w') { |f| f.write contents }\n end",
"def create_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n myfile = File.new(path, 'w+')\n myfile.print(contents)\n myfile.close\n\n \"#{path} created\"\n end",
"def create_file(path, contents)\n dir = File.dirname(path)\n\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n\n myfile = File.new(path, 'w+')\n myfile.print(contents)\n myfile.close\n\n \"#{path} created\"\n end",
"def create_file(filename)\r\n CreateFile.new(filename)\r\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def create_file(filename, contents)\n File.open(filename, \"w\") do |file|\n file.write(contents)\n end\n end",
"def create_temp_file\n copy_to_temp_file full_filename\n end",
"def create_file(filename, content)\n Dir.chdir(@workdir_path) do\n FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))\n File.open(filename, \"w\") { |file| file.write(content) }\n end\n end",
"def file_create(data)\r\n\r\n\t\tfname = datastore['FILENAME']\r\n\t\tltype = \"exploit.fileformat.#{self.shortname}\"\r\n\r\n\t\tif ! ::File.directory?(Msf::Config.local_directory)\r\n\t\t\tFileUtils.mkdir_p(Msf::Config.local_directory)\r\n\t\tend\r\n\r\n\t\tpath = File.join(Msf::Config.local_directory, fname)\r\n\t\tfull_path = ::File.expand_path(path)\r\n\t\tFile.open(full_path, \"wb\") { |fd| fd.write(data) }\r\n\r\n\t\treport_note(:data => full_path.dup, :type => \"#{ltype}.localpath\")\r\n\r\n\t\tprint_good \"#{fname} stored at #{full_path}\"\r\n\r\n\tend",
"def new_file(filename)\n return (File.open(filename, \"w\"))\nend",
"def create_file (file_path)\n \"touch '#{file_path}'\"\n end",
"def create_file(filepath, contents = '')\n filepath = \"#{@dir}/#{@module}/#{filepath}\"\n puts \"... Creating file '#{filepath}'\"\n File.open(filepath, 'w') do |f|\n f.write contents\n end\n end",
"def new_file(filename = nil)\n\t name = filename || \"#{basename}.#{@io.size}.log\"\n\t io = File.new(name, 'w')\n\t Logfiles.write_prologue(io)\n\t @io << io\n\t streams.each_with_index do |s, i|\n\t\twrite_stream_declaration(i, s.name, s.type.name, registry.to_xml)\n\t end\n\tend",
"def new_file\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{process}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end",
"def create_file(filename)\n # See zipfile branch in repository for zip file creation code.\n Dir.mkdir filename\n # TODO: Handle case where directory can't be created.\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def create_file(override = false)\n dir = File.dirname(Constant::HIGHSCORE_FILE_NAME)\n\n # Create directory if not exist\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n\n # Fake open a file to create\n File.open(Constant::HIGHSCORE_FILE_NAME, override ? 'w' : 'a') {}\n end",
"def new_or_existing_file(name, mime_type, size)\n path = File.join ActiveSupport::TestCase.fixture_path, 'test_files', name\n unless File.exist?(path) && (File.size?(path) == size)\n FileUtils.mkdir_p File.dirname(path)\n File.open(path, 'w+') { |f| f.write '0' * size }\n end\n\n fixture_file_upload File.join('test_files', name), mime_type, :binary\n end",
"def write_file filename,content\n mkdir_p(File.dirname(filename),:verbose=>false)\n File.open(filename, 'wb') {|f| f.write(content) }\n end",
"def createFile(file,time)\n\t\tFile.open(file, \"w+\") do |f|\n\t\t\tf.print time\n\t\tend\n\tend",
"def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(task)\n file.puts(task)\n file.close\n\nend",
"def create(filename = nil)\n filename = @doing_file if filename.nil?\n return if File.exist?(filename) && File.stat(filename).size.positive?\n\n FileUtils.mkdir_p(File.dirname(filename)) unless File.directory?(File.dirname(filename))\n\n File.open(filename, 'w+') do |f|\n f.puts \"#{Doing.setting('current_section')}:\"\n end\n end",
"def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')\n File.open(file_path, 'w') { |f| f.write(content) }\n LoggerHelper.print_to_log(\"Created file: #{file_path} with content: #{content}\")\n file_path\n end",
"def create(filename)\n @filename = filename\n time = Time.now\n @@files[@filename] = time \n puts \"A new file: #{@filename} has been created by #{@username} at #{time}.\"\n end",
"def new_file(new_name=false, body)\n f_name = new_name || file_name_with_path\n File.open(f_name, \"w\") { |line|\n line.write(body)\n line\n }\n end",
"def maketempfile(prefix_suffix=nil, parent_dir=nil)\n Dir::Tmpname.create(prefix_suffix || \"f\", parent_dir || Dir.tmpdir) {|n| FileUtils.touch(n)}\n end",
"def create_temp_file\n write_to_temp_file current_data\n end",
"def create_file(filename, size)\n File.open(filename, \"w\") do |f|\n 1.upto(size) do\n f.putc(rand(256))\n end\n end\nend",
"def create\n FileUtils.mkdir_p(directory) unless exist?\n end",
"def write( filename, contents )\n if File.exists? filename\n puts \"#{filename} already exists\"\n else\n puts \"Creating #{filename}\"\n ::File.open( filename, \"w\" ){ |f| f.write contents }\n end\nend",
"def create(filename, text); end",
"def create_from_file\n end",
"def touch(option={})\n mode = option[:mode] || 0600\n path = create(option)\n path.open(\"w\", mode)\n return path\n end",
"def new_file(source,code)\n fileHtml = File.new(source, \"w+\")\n result = true\n begin\n fileHtml.puts code\n rescue\n result = false\n ensure\n fileHtml.close unless fileHtml.nil?\n end\n #return true if file was succesfully created\n result\n end",
"def makeFile filename, message\n making = File.open(filename, \"w\")\n making.puts(message)\n making.close\nend",
"def make_file filepath, content, options={}\n\n temp_filepath =\n \"#{TMP_DIR}/#{File.basename(filepath)}_#{Time.now.to_i}#{rand(10000)}\"\n\n File.open(temp_filepath, \"w+\"){|f| f.write(content)}\n\n self.upload temp_filepath, filepath, options\n\n File.delete(temp_filepath)\n end",
"def touch(filename)\n File.open(filename, 'w') {}\n end",
"def create_io_tmp(*args)\n path = File.join(storage_directory, args.join('-'))\n FileUtils.mkdir_p(File.dirname(path))\n t_file = File.open(path, 'w+')\n t_file.sync\n t_file\n end",
"def create_new_report!\n File.write(report_filename, report_title + report_body)\n end",
"def mkfile(relative_path, content: '')\n mkdir File.dirname(relative_path)\n filename = File.join self.tmpdir, relative_path\n File.open(filename, 'w') {|f| f << content}\n filename\n end",
"def create_file(path, contents)\n full_path = ::File.join(destination_root, path)\n mkdir_p(::File.dirname(full_path))\n ::File.open(full_path, 'w') {|f| f.write(contents) }\n end",
"def create_temp_file(file_name)\n if file_name.rindex(\"/\") != nil \n directory = file_name[0, file_name.rindex(\"/\")+1] # ASSUMING ONLY UNIX!\n if !File.exists?(directory)\n FileUtils.mkdir_p(\"#{@tmp_file_path}#{directory}\")\n end\n end\n tmp_file = File.new(\"#{@tmp_file_path}#{file_name}\", \"w\")\n tmp_file.close()\n end",
"def create_tempfile\n io = Tempfile.new(@basename, @tmpdir, @open_options)\n io.unlink\n io\n end",
"def initialize(file_name, file_mode)\r\n @file = File.new(file_name, file_mode)\r\n rescue\r\n error \"F51: Unable to open the file #{file_name} for writing.\"\r\n end",
"def create(path, &block)\n if File.file?(path)\n raise Errno::EEXIST, path\n end\n \n FileUtils.mkdir_p(File.dirname(path))\n FileUtils.touch(path)\n \n if block_given?\n begin yield file = File.open(path, 'w')\n ensure file.close\n end\n end\n end",
"def create_file(size)\n file = File.open(\"/tmp/test\", \"w\")\n 0.upto(size - 1) do |i|\n file.write(i.chr)\n end\n file.close\nend",
"def cf(file)\n FileUtils.mkdir_p(Pathname.new(file).dirname)\n File.open(file, \"w+\").close\nend",
"def create_tempfile(basename)\n tmpfile = nil\n Dir::Tmpname.create(basename) do |tmpname|\n mode = File::WRONLY | File::CREAT | File::EXCL\n tmpfile = File.open(tmpname, mode, 0600)\n end\n tmpfile\n end",
"def initialize(file_name)\n create(file_name)\n end",
"def create_dummy_receipt(receipt)\n File.new(\"/Library/Application\\ Support/JAMF/Receipts/#{receipt}\", \"w\") {}\n end",
"def create_blank_post(path, title, date)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n title: #{title}\n category: Code\n layout: post\n date: #{date}\n ---\n\n EOS\n end\nend",
"def create_tmp_file(comment)\n file = Tempfile.new('foo')\n file.write(comment)\n file.close\n\n file.path\nend",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def manual_file\n f = File.open(\"#{Time.new.strftime('%Y-%m-%dT%H:%M:%S')}.txt\", 'w')\n f.write('Hello')\n f.flush\n f.close\nend",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end",
"def blank\n open('about:blank')\n end",
"def create_file\n\n conditionCode = 0\n\n # Verify if we have a metadata\n if haspdumetadata? && haspdueof?\n\n # Write file\n writeLog(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Checking to write file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n\n begin\n\n Utils_visiona.writeFile(@pdus[\"METADATA\"].pduPayload.destinationFileName, @pdus[\"FILEDATA\"].dup)\n\n if File.size(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileSize\n\n conditionCode = 6\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n elsif Utils_visiona.calculateFileChecksum(@pdus[\"METADATA\"].pduPayload.destinationFileName) != @pdus[\"EOF\"].pduPayload.fileChecksum\n\n conditionCode = 5\n File.delete(@pdus[\"METADATA\"].pduPayload.destinationFileName) unless SAVE_FILE_UPON_ERROR\n end\n rescue Exception => err\n\n conditionCode = 4\n CFDP::CFDP_Indication(\"Error while creating file. Error is #{err}.\\n Backtrace: #{err.backtrace}\")\n end\n\n if (conditionCode==0)\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n elsif SAVE_FILE_UPON_ERROR\n\n CFDP::HKPacket.instance.eng_totalfilesrcvd+=1\n writeLog(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Done writing file with error #{CFDP.conditionCodeToStr(conditionCode)} \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n else\n\n CFDP::HKPacket.instance.updateVar(conditionCode)\n writeLog(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n CFDP::CFDP_Indication(\"Error #{CFDP.conditionCodeToStr(conditionCode)} in writing file \\\"#{@pdus[\"METADATA\"].pduPayload.destinationFileName}\\\".\")\n end\n\n return conditionCode\n end\n end",
"def touch\n FileUtils.touch FILE\n bootstrap\n end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def create(filename)\n time = Time.now\n @files[filename] = time\n puts \"#{filename} was created by #{@username} at #{time}.\"\n end",
"def mktemp(filename, mask=true)\n fh = nil\n\n begin \n loop do\n fn = mask ? tmpnam(filename) : filename\n\n if File.exist? fn\n fail \"Unable to create a temporary filename\" unless mask\n next\n end\n\n fh = File.new(fn, \"a\", 0600)\n fh.seek(0, IO::SEEK_END)\n break if fh.pos == 0 \n \n fail \"Unable to create a temporary filename\" unless mask\n fh.close\n end\n rescue Exception => e\n # in the case that we hit a locked file...\n fh.close if fh\n raise e unless mask\n end\n \n return fh\n end",
"def open\n _close\n mode = @mode & ~(File::CREAT|File::EXCL)\n @tmpfile = File.open(@tmpfile.path, mode, **@opts)\n __setobj__(@tmpfile)\n end",
"def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend",
"def initialize(in_file)\n @file = File.new(in_file, \"a+\")\n @filename = in_file\n end",
"def create_test_file (filename)\n File.open(filename, \"w\") do |f|\n 5.times {f.puts \"Mr. Jones\"}\n 6.times {f.puts \"Miss Smith\"}\n 4.times {f.puts \"Mrs. Wesson\"}\n 10.times {f.puts \"Dr. Roberts\"}\n 1.times {f.puts \"Jane Wintermute\"}\n 2.times {f.puts \"Frank Franklin\"}\n 3.times {f.puts \"Darleen Washington\"}\n end\nend",
"def createpb filename\n return \"Phonebook already exists\" if File.file?(filename)\n pb = Phonebook.new\n pb.create(filename)\nend",
"def create_into(directory)\n build_file\n Pathname.new(directory).join(@file).open 'w+' do |file|\n post = self\n file << ERB.new(load_template).result(binding)\n end\n end",
"def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def make_file(fname)\r\n ext = File.extname(fname)\r\n\r\n i = 1\r\n while File.exist?(fname)\r\n # In case a file with the same name already exists\r\n fname = File.basename(fname, ext)\r\n fname = fname.sub(/\\d+$/, \"\") << i.to_s << ext\r\n\r\n i += 1\r\n end\r\n\r\n File.open(fname, \"a\")\r\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n categories:\n ---\n\n EOS\n end\nend",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n ---\n\n EOS\n end\nend",
"def createFile\n @header_string=self.configuration_file_header.to_s\n @bodyString=self.createBodyString\n @bodyString=@bodyString[0, @bodyString.size-2]\n if @bodyString==nil\n @bodyString=\"\" \n end\n \n @file_name = \"public/files/\"+self.name+\".rtf\"\n File.open(@file_name, \"w\") do |f| \n f.write(@header_string+\"\\n\"+@bodyString) \n end\n end",
"def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end",
"def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end",
"def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end",
"def test_file_begin_is_created\n file_name = 'some_file.txt'\n assert(!File.exist?(file_name))\n FileBegin.new(file_name)\n assert(File.exist?(file_name))\n File.unlink(file_name)\n end",
"def createFilePath(file)\n fd = File.dirname(file)\n Dir.mkdir(fd) if !File.exists?(fd)\n end",
"def create(dest_file, filenames = [], options = {})\n\t\t\tWriter.new(filenames).write(dest_file, options)\n\t\tend",
"def ensure_file!(file)\n return if File.exists?(file)\n if VIM.evaluate(%{confirm(\"Create #{file}?\", \"&Yes\\n&No\", 1)}) == 1\n file_to_create = VIM.evaluate(%{input(\"File to create: \", \"#{file}\")})\n Pathname.new(file_to_create).dirname.mkpath\n File.open(file_to_create, \"w\") {}\n else\n raise RelatedError, \"File #{file} does not exist\"\n end\n end",
"def file(file, contents)\n if File.exists?(file)\n log file, \"(already exists)\"\n else\n log file, \"(creating file)\"\n touch file\n File.open(file, \"w\"){ |f| f.write contents } if contents\n end\n end",
"def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end",
"def write_file(filename, content)\n FileUtils.mkdir_p File.dirname(filename)\n IO.binwrite(filename, content)\n end",
"def create(filename)\n input = self.read('templates/codeml.ctl.erb')\n\n # Using ERB templates\n output = ERB.new(input).result(binding)\n\n # Create a blank file then put the contents of the output in\n self.create_file(\"#{filename}\", output)\n end",
"def write\n make_parent_directory\n generate_file\n end",
"def write_new_file(filename,xml_content)\n if FileTest.file?(filename)\n file = File.new(filename,\"w\")\n xml_content.each do |line|\n file.puts(line)\n end\n file.close\n puts \"new file generated: #{filename}\"\n# check_xml(filename) TODO resolve problem, see method\n else\n puts \"!!! do_backup file does not exists: #{filename}\"\n exit\n end\nend",
"def file(name, template_name=nil, params=nil)\n @fileutils.touch(name)\n @file.open(name, 'w') do |f|\n f.puts write_contents(@templates.fetch(template_name), params) \n end unless template_name.nil? \n @output.write(\"created #{name}\")\n end",
"def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end",
"def create_tmp_file(contents)\n system 'mkdir tmp'\n file = File.new(\"tmp/#{domain}\", \"w\")\n file << contents\n file.close\nend",
"def create_tmp_file(contents)\n system 'mkdir tmp'\n file = File.new(\"tmp/#{domain}\", \"w\")\n file << contents\n file.close\nend",
"def create_tmp_file(contents)\n system 'mkdir tmp'\n file = File.new(\"tmp/#{domain}\", \"w\")\n file << contents\n file.close\nend",
"def FileModesOwnership\n\tarquivo = File.new(\"arquivo_novo.txt\", \"w\")\n\tarquivo.chmod(0755)\n\tarquivo.close()\nend"
] | [
"0.72574633",
"0.70511127",
"0.7020004",
"0.7008989",
"0.69761014",
"0.6812042",
"0.6792093",
"0.6748911",
"0.6748911",
"0.6744718",
"0.6725702",
"0.66820747",
"0.6544405",
"0.6531527",
"0.6511505",
"0.65081686",
"0.6497183",
"0.64909166",
"0.64867103",
"0.64854693",
"0.6432428",
"0.6422094",
"0.63831985",
"0.6342341",
"0.6295797",
"0.62925",
"0.6278419",
"0.6278328",
"0.6237377",
"0.6230788",
"0.62286675",
"0.6227551",
"0.62206995",
"0.62130034",
"0.62004155",
"0.6180868",
"0.61669075",
"0.61659276",
"0.6155039",
"0.615016",
"0.6147304",
"0.61359274",
"0.6109511",
"0.6099829",
"0.6069606",
"0.60576344",
"0.6056646",
"0.6047256",
"0.6046959",
"0.60209113",
"0.6014619",
"0.59987295",
"0.5991889",
"0.59737426",
"0.5967047",
"0.5962556",
"0.5953045",
"0.5918357",
"0.59063387",
"0.58998686",
"0.58917546",
"0.58917546",
"0.5889746",
"0.58870876",
"0.58812654",
"0.5879351",
"0.5866227",
"0.5866031",
"0.5861642",
"0.58571786",
"0.5853783",
"0.58530414",
"0.583088",
"0.58272505",
"0.5817361",
"0.5813283",
"0.58034754",
"0.5784933",
"0.5783383",
"0.576889",
"0.57662183",
"0.5756091",
"0.574671",
"0.57381946",
"0.5729904",
"0.5729607",
"0.5710253",
"0.56977504",
"0.56932914",
"0.56908137",
"0.56891835",
"0.56880397",
"0.5681402",
"0.5678052",
"0.567221",
"0.56671536",
"0.56540537",
"0.5653065",
"0.5653065",
"0.5653065",
"0.56399685"
] | 0.0 | -1 |
Create a symlink to the current file or directory. | def symlink(name)
FileUtils.ln_s current_item, name
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_symlink( old ) File.symlink( old, expand_tilde ) end",
"def create_symlink(dest_path); end",
"def make_symlink(old) File.symlink(old, path) end",
"def create_symlink(source = nil, dest = nil)\n end",
"def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end",
"def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end",
"def set_symlink(source,target)\n fail \"Original path doesn't exist or isn't a directory.\" unless File.directory?(source)\n fail \"Target already exists.\" unless File.directory?(target) == false\n puts \"creating a symlink from #{source} => #{target}.\"\n FileUtils.ln_s(source,target,:verbose => true)\n end",
"def link\n display_change\n begin\n File.symlink(@real_path, new_path)\n rescue NotImplemented\n puts \"Error: cannot create symlinks\"\n end\n end",
"def make_link( old ) File.link( old, expand_tilde ) end",
"def symlink(dest, options = {})\n FileUtils.symlink(@path, dest, options)\n end",
"def symlink(existing_name, new_name)\n #windows mklink syntax is reverse of unix ln -s\n #windows mklink is built into cmd.exe\n _stdin, _stdout, _stderr, wait_thr =\n Open3.popen3('cmd.exe', \"/c mklink /d #{new_name.tr('/','\\\\')} #{existing_name.tr('/','\\\\')}\")\n wait_thr.value.exitstatus\n end",
"def symlink(old_name, new_name); end",
"def make_symlink\n if not self.data['old-slug'].nil?\n path = File.join(CGI.unescape(self.url)).gsub(/^\\//, '')\n path = File.join(path, \"index.html\") if template[/\\.html$/].nil?\n path = File.join(site.dest, path)\n old_slug = File.join(site.dest, self.data['old-slug'])\n old_slug_dir = File.dirname(old_slug)\n path = (Pathname.new path).relative_path_from(Pathname.new old_slug_dir)\n\n # We write the symlink directly on the site destination\n FileUtils.mkdir_p(old_slug_dir)\n File.symlink(path, old_slug)\n end\n end",
"def make_link(source:, link:)\n @output.item @i18n.t('setup.ln', target: link, source: source)\n FileUtils::rm link if (File::symlink? link and not File::exist? link)\n FileUtils::ln_s source, link unless File::exist? link\n end",
"def make_link(old) File.link(old, path) end",
"def link *args\n self.destination_and_options( args ) do |lnk, opts|\n symlink_requested = self.directory? || opts[:symbolic] || opts[:sym] || opts[:soft]\n \n if symlink_requested\n self.symlink lnk, opts\n else\n FileUtils.ln self, lnk, ** Utils::Opts.narrow_file_utils_options( opts, :ln )\n end\n \n lnk.fwf_filepath\n end\n end",
"def symlink( *args )\n lnk, opts = self.destination_and_options( args )\n \n if opts[:absolute]\n lnk = lnk.fwf_filepath.expand\n else\n lnk = lnk.fwf_filepath\n end\n \n FileUtils.ln_s( self, lnk, ** Utils::Opts.narrow_file_utils_options( opts, :ln_s ) )\n lnk.fwf_filepath\n end",
"def create_symlinks\n links.each do |link|\n print \"Linking #{link.link_path}: \"\n if link.dir?\n print 'skipped'\n elsif !link.current?\n if link.create\n print 'linked'\n else\n print link.error\n end\n else\n print 'current'\n end\n print \"\\n\"\n end\n end",
"def symlink!(base)\n puts \"symlink! #{base.inspect}\" if SYMLINK_TRACE\n if is_file? or is_dir?\n File.symlink @target, base\n else\n mkdir base\n for node in children\n node.symlink! \"#{base}/#{node.name}\"\n end\n end\n end",
"def link_to(dest)\n dir = File.dirname(dest)\n FileUtils.makedirs(dir) unless Dir.exist?(dir)\n FileUtils.symlink(@path, dest)\n end",
"def install_symlink\n FileUtils.mkdir_p File.dirname(destination_path)\n FileUtils.symlink source_path, destination_path, force: true\n end",
"def symlink(old)\n warn 'Path::Name#symlink is obsoleted. Use Path::Name#make_symlink.'\n File.symlink(old, path)\n end",
"def symlink(file_name, dest_file)\n log \"Symlinking file #{file_name} to #{dest_file}\"\n File.symlink(file_name, dest_file)\n end",
"def symlink(file_name, dest_file)\n log \"Symlinking file #{file_name} to #{dest_file}\"\n File.symlink(file_name, dest_file)\n end",
"def symlink!(path, target, &callback)\n wait_for(symlink(path, target, &callback))\n end",
"def symlink(source, target=\".#{source}\")\n puts \"Symlinking #{dotfiles(source)} -> #{home(target)}\"\n if File.exist?(home(target))\n if user_confirms?(\"Overwrite\", home(target))\n FileUtils.ln_sf dotfiles(source), home(target) unless dry_run?\n else\n puts \"Skipping #{source}\"\n end\n else\n FileUtils.ln_sf dotfiles(source), home(target) unless dry_run?\n end\n end",
"def link_file( src, dest )\n if File.symlink?( dest )\n puts \"#{dest} is already a symlink, ignoring\"\n else\n puts \"ln -s #{src} #{dest} \"\n File.symlink( src, dest )\n end\nend",
"def link_target\n return if current_directory? && linked_path == current_path\n\n FileUtils.ln_s File.expand_path(current_path), current_directory\n end",
"def atomic_symlink(src, dest)\n raise ArgumentError.new(\"#{src} is not a directory\") unless File.directory?(src)\n say_status :symlink, \"from #{src} to #{dest}\"\n tmp = \"#{dest}-new-#{rand(2**32)}\"\n # Make a temporary symlink\n File.symlink(src, tmp)\n # Atomically rename the symlink, possibly overwriting an existing symlink\n File.rename(tmp, dest)\n end",
"def link!(new_link_path, existing_path, symlink=true, &callback)\n wait_for(link(new_link_path, existing_path, symlink, &callback))\n end",
"def create_symlink\n unless File.exist? opt_dir\n success = true\n if !File.writable?( sys_root )\n puts \"Cannot write to #{sys_root}. Please ensure #{opt_torquebox} points to your torquebox installation.\"\n success = false\n else\n puts \"Creating #{opt_dir}\"\n Dir.new( opt_dir )\n end\n end\n\n unless File.exist?( opt_torquebox )\n if File.writable?( opt_dir )\n puts \"Linking #{opt_torquebox} to #{torquebox_home}\"\n File.symlink( torquebox_home, opt_torquebox )\n else\n puts \"Cannot link #{opt_torquebox} to #{torquebox_home}\"\n success = false\n end\n end\n success\n end",
"def link( src, dest )\n if ( win? )\n FileUtils.cp_r( src, dest )\n else\n File.symlink( src, dest )\n end\n end",
"def symlink_ruby_version\n current_ruby = `which ruby`.chomp\n FileUtils.symlink current_ruby, ruby_version_symlink_file unless ruby_version_symlink_file_exists?\n display.print \"New Symlink Created: #{ruby_version_symlink_file} from #{current_ruby}\"\n end",
"def symlink_current_dir\n @shell.symlink self.checkout_path, self.current_path\n end",
"def create\n raise ArgumentError, 'Symlink target undefined' unless to\n might_update_resource do\n provider.create\n end\n end",
"def follow_symlinks=(_arg0); end",
"def symlink_home(src, dest)\n home_dir = ENV['HOME']\n if( !File.exists?(File.join(home_dir, dest)) || File.symlink?(File.join(home_dir, dest)) )\n # FileUtils.ln_sf was making odd nested links, and this works.\n FileUtils.rm(File.join(home_dir, dest)) if File.symlink?(File.join(home_dir, dest))\n FileUtils.ln_s(File.join(File.dirname(__FILE__), src), File.join(home_dir, dest))\n puts_green \" #{dest} -> #{src}\"\n else\n puts_red \" Unable to symlink #{dest} because it exists and is not a symlink\"\n end\nend",
"def link fn,linkname\n\t\tif File.symlink?(linkname) and !Cfruby::FileOps::SymlinkHandler.points_to?(linkname,fn)\n\t\t\tCfruby.controller.inform('verbose', \"Existing #{linkname} is not pointing to #{fn}\")\n\t\t\tprint \"Existing #{linkname} is not pointing to #{fn}\\n\"\n\t\t\tCfruby::FileOps.delete linkname\n\t\tend\n\t\tif @cf.strict\n\t\t\tCfruby::FileOps.link fn,linkname\n\t\telse\n\t\t\tbegin\n\t\t\t\tCfruby::FileOps.link fn,linkname\n\t\t\trescue\n\t\t\t\tCfruby.controller.inform('verbose', \"Problem linking #{linkname} -> #{fn}\")\n\t\t\tend\n\t\tend\n\tend",
"def link\n Dir.mkdir @target unless Dir.exists? @target\n \n # When we find a directory, create it in the target area\n create_directory = lambda do |path|\n directory = \"#{@target}/#{path}\"\n Dir.mkdir directory unless Dir.exists? directory\n end\n \n # When we find a file, symlink it in the target area\n create_symlink = lambda do |path|\n source = \"#{@source}/#{path}\"\n target = \"#{@target}/#{path}\"\n if File.exists?(target)\n if File.symlink?(target)\n if File.readlink(target) == source\n return\n end\n else\n message = \"#{target} exists and is not a symlink\"\n puts message if @args[:verbose]\n raise message if @raise\n return\n end\n end\n puts \"Creating #{target} -> #{source}\" if @args[:verbose]\n File.unlink(target) if File.exists?(target)\n File.symlink(source, target)\n end\n \n Xo::Directory::Walk.new(@source, dir_cb: create_directory, file_cb: create_symlink).process\n end",
"def create_symlinks(original_locations, new_locations)\n original_locations.each do |key, value|\n old = value\n new = new_locations[key]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend",
"def follow_symlinks; end",
"def create_symlinks(logger = nil)\n if @options[:preserve_environments]\n install_directory_symlink(logger, File.join(@options[:basedir], 'environments'), 'environments')\n @options.fetch(:create_symlinks, %w(modules manifests)).each do |x|\n install_directory_symlink(logger, File.join(@options[:basedir], x), x)\n end\n else\n if @options[:environment]\n logger.warn '--environment is ignored unless --preserve-environments is used' unless logger.nil?\n end\n if @options[:create_symlinks]\n logger.warn '--create-symlinks is ignored unless --preserve-environments is used' unless logger.nil?\n end\n install_directory_symlink(logger, @options[:basedir])\n end\n end",
"def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend",
"def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend",
"def link(old)\n warn 'Path::Name#link is obsoleted. Use Path::Name#make_link.'\n File.link(old, path)\n end",
"def symlink(link=nil,existing=nil)\n if link.class == String && existing.class == String && block_given?\n @j_del.java_method(:symlink, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(link,existing,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling symlink(link,existing)\"\n end",
"def symlink_to_output(spec_path, destination_dir)\n spec_name = Pathname.new(spec_path).basename.to_s\n destination_spec_path = File.join(destination_dir, spec_name)\n FileUtils.symlink(File.expand_path(spec_path), destination_spec_path, force: true)\n end",
"def s_link(source_path, target_path)\n target_file = File.expand_path(target_path)\n\n # If the target file exists we don't really want to destroy it...\n if File.exists?(target_file) and not File.symlink?(target_file)\n puts \" ! Stashing your previous #{target_path} as #{target_path}.pre-mdf-bootstrap\"\n mv(target_file, File.expand_path(\"#{target_path}.pre-mdf-bootstrap\"))\n end\n\n if File.symlink?(target_file) and File.readlink(target_file).to_s != File.expand_path(source_path).to_s\n puts \" ! Existing symlink appears to point to incorrect file, moving it to #{target_file}.pre-mdf-bootstrap\"\n # Make a new link with the .old extension, pointing to the old target\n ln_s(File.readlink(target_file), File.expand_path(\"#{target_path}.pre-mdf-bootstrap\"))\n # Now we can get rid of the original target file to make room for the new link\n rm(target_file)\n end\n\n # At this point either the target file is the symlink we want,\n # or something weird happened and we don't want to replace it.\n unless File.exists?(target_file)\n # Counts on the fact that ln_s outputs \"puts\" the command for the user to see.\n ln_s(File.expand_path(source_path), target_file)\n end\nend",
"def create_helper_symlink\n FileUtils.symlink \"../lib\", normalize(\"codelib\"), :force => true\n end",
"def symlinking_files\n linkables = Dir.glob('*/**{.symlink}')\n\n skip_all = false\n overwrite_all = false\n backup_all = false\n\n linkables.each do |linkable|\n overwrite = false\n backup = false\n\n file = File.basename(linkable).split('.')[0...-1].join('.')\n source = \"#{ENV[\"PWD\"]}/#{linkable}\"\n target = \"#{ENV[\"HOME\"]}/.#{file}\"\n\n puts \"======================#{file}==============================\"\n puts \"Source: #{source}\"\n puts \"Target: #{target}\"\n\n if File.exists?(target) || File.symlink?(target)\n unless skip_all || overwrite_all || backup_all\n puts \"File already exists: #{target}, what do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all\"\n case STDIN.gets.chomp\n when 'o' then overwrite = true\n when 'b' then backup = true\n when 'O' then overwrite_all = true\n when 'B' then backup_all = true\n when 'S' then skip_all = true\n end\n end\n FileUtils.rm_rf(target) if overwrite || overwrite_all\n # run %{ mv HOME/.#{file}\" \"$HOME/.#{file}.backup } if backup || backup_all\n `mv \"$HOME/.#{file}\" \"$HOME/.#{file}.backup\"` if backup || backup_all\n end\n #run %{ ln -nfs \"#{source}\" \"#{target}\" }\n `ln -s \"$PWD/#{linkable}\" \"#{target}\"`\n puts \"==========================================================\"\n puts\n end\nend",
"def link(from, to)\n if File.directory?(from)\n FileUtils.ln_s(from, to)\n else\n FileUtils.ln(from, to)\n end\n end",
"def ftype\n :symlink\n end",
"def ln(src, dest, force: nil, noop: nil, verbose: nil)\n fu_output_message \"ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest0(src, dest) do |s,d|\n remove_file d, true if force\n File.link s, d\n end\n end",
"def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"def write_create_symlinks_script(symlinks)\n File.open(SYMLINKS_SCRIPT, 'w') do |f|\n f.puts '#!/system/bin/sh'\n f.puts ''\n f.puts 'cd $(dirname $0)'\n f.puts ''\n f.puts \"single_file_binaries=\\\"#{symlinks.join(' ')}\\\"\"\n f.puts ''\n f.puts 'for i in $single_file_binaries; do'\n f.puts 'ln -s coreutils $i;'\n f.puts 'done'\n f.puts ''\n f.puts 'cd -'\n end\n FileUtils.chmod '+x', SYMLINKS_SCRIPT\n end",
"def symlinked_file(filepath)\n link_file = file(filepath)\n # /etc/letsencrypt/live/findwork.co/fullchain.pem ->\n # /etc/letsencrypt/live/findwork.co + / + ../../archive/fullchain1.pem\n return file(File.dirname(filepath) + File::SEPARATOR + link_file.link_target)\nend",
"def link old, new\n if File.exists? new\n if File.symlink? new\n return # symlinked already\n else # file exists but isn't a symlink, assuming regular file\n if $replace_all\n\tFile.delete new\n\tFile.symlink old, new\n\treturn\n end\n\n # ask what we should do (replace, replace_all, skip, skip_all, or quit)\n response = nil\n loop do\n\tputs \"#{new} already exists, 1) replace 2) replace all 3) skip 4) quit\"\n\tbegin\n\t response = Integer gets.chomp\n\trescue ArgumentError\n\t puts \"not a valid number\"\n\tend\n\n\tif (1..4).member? response\n\t break\n\telse\n\t puts \"number not in range of 1..4\"\n\t redo\n\tend\n end\n\n case response\n when 1\n\tFile.delete new\n\tFile.symlink old, new\n when 2\n\t$replace_all = true\n\tFile.delete new\n\tFile.symlink old, new\n when 3\n\treturn\n when 4\n\texit\n end\n end \n else\n # just create a regular symlink\n File.symlink old, new\n end\nend",
"def ln_s(src, dest, force: nil, noop: nil, verbose: nil)\n fu_output_message \"ln -s#{force ? 'f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest0(src, dest) do |s,d|\n remove_file d, true if force\n File.symlink s, d\n end\n end",
"def symlink?() end",
"def expand_symlink file_path\n file_path.split( \"/\" ).inject do |full_path, next_dir|\n next_path = full_path + \"/\" + next_dir\n if File.symlink? next_path\n link = File.readlink next_path\n next_path =\n case link\n when /^\\// then link\n else\n File.expand_path( full_path + \"/\" + link )\n end\n end\n next_path\n end\n end",
"def conditional_link(source, target = source)\n source_dir = @onabase + \"/www/local/plugins/cfg_archive/bin/\"\n target_dir = @onabase + \"/bin/\"\n\n source_file = source_dir + source\n target_link = target_dir + target\n\n FileUtils.ln_sf(source_file, target_link)\nend",
"def external_link(label, path, **opt, &block)\n opt[:target] = '_blank' unless opt.key?(:target)\n make_link(label, path, **opt, &block)\n end",
"def add(path, target)\n puts \"add [#{@name}]: #{path.inspect} -> #{target}\" if SYMLINK_TRACE\n fail \"not an array\" unless path.is_a?(Array)\n @children = {} unless @children\n name = path[0]\n existing = @children[name]\n if existing\n if path.size == 1 # terminal node\n if File.file? target\n # replace existing file or directory with file\n existing.clear if existing.has_children?\n existing.target = target\n else\n # target is a directory\n if existing.is_file?\n # overwrite existing file\n existing.target = nil\n elsif existing.is_dir?\n # merge with existing directory\n existing.expand!\n end\n for child in Dir[\"#{target}/*\"]\n existing.add [File.basename child], child\n end\n end\n else\n # ensure path exists\n if existing.is_file?\n # existing file is discarded since it conflicts with path\n existing.target = nil\n elsif existing.is_dir?\n # merge with existing directory\n existing.expand!\n end\n existing.add path[1..-1], target\n end\n else\n if path.size == 1\n # create a new file link\n @children[name] = Symlink::Node.new name, target\n else\n # create a new dir link\n node = Symlink::Node.new name, nil\n @children[name] = node\n node.add path[1..-1], target\n end\n end\n end",
"def create_symlink_from_data_to_cinder_mountpoint()\n\n # Chef::Log.info(\"#{node['data_dir_path']}/data/ is empty.\")\n if node.has_key?(\"cinder_volume_mountpoint\") && !node[\"cinder_volume_mountpoint\"].empty?\n Chef::Log.info(\"Cinder storage is enabled for the data directory at the mount point #{node[\"cinder_volume_mountpoint\"]}\")\n\n parent_data_dir = node['data_dir_path']\n data_dir = \"#{parent_data_dir}/data\"\n # Ruby Block\n ruby_block 'create_data_symlink' do\n block do\n # Check if the data symlink exists.\n if !File.symlink?(data_dir)\n\n Chef::Log.warn(\"data symlink doesn't exist in #{parent_data_dir}.\")\n if File.directory?(data_dir)\n raise \"#{data_dir} is a directory. It is supposed to be a symlink while using with Cinder. You cannot include Cinder storage if you were using Ephemeral with the first deployment\"\n else\n Chef::Log.info(\"neither data directory nor data symlink exist in #{parent_data_dir}.\")\n end\n else\n Chef::Log.info(\"data symlink exists in #{parent_data_dir}.\")\n data_link_path = File.readlink(data_dir)\n Chef::Log.info(\"Data symlink points to #{data_link_path}\")\n\n if data_link_path != node[\"cinder_volume_mountpoint\"]\n raise \"#{data_dir} is not linked to #{node[\"cinder_volume_mountpoint\"]}. It is supposed to be a symlink while using with Cinder.\"\n end\n end\n end\n end\n\n # Provide a symlink from the /app/solrdata<version>/data to the Cinder mount point\n Chef::Log.info(\"Provide a symlink from the #{data_dir} to the Cinder mount point #{node[\"cinder_volume_mountpoint\"]}\")\n link \"#{node['data_dir_path']}/data\" do\n to \"#{node[\"cinder_volume_mountpoint\"]}\"\n owner node['solr']['user']\n group node['solr']['user']\n end\n\n bash 'chown_blockstorage' do\n code <<-EOH\n sudo chown #{node['solr']['user']} /#{node[\"cinder_volume_mountpoint\"]}\n sudo chgrp #{node['solr']['user']} /#{node[\"cinder_volume_mountpoint\"]}\n EOH\n not_if { \"#{node[\"cinder_volume_mountpoint\"]}\".empty? }\n end\n\n else\n Chef::Log.info(\"Cinder storage is not enabled. So the following scripts will create the data directory in the ephemeral storage.\")\n end\n\n end",
"def symlink?(file_name); end",
"def readlink() self.class.new( File.readlink( expand_tilde ) ) end",
"def create_link(url, title = nil, description = nil)\n Dropio::Resource.client.create_link(self, url, title, description)\n end",
"def generate_web_symlink(jpg_output)\n t = Time.new\n subdir = \"#{t.year}.#{t.month}.#{t.day}\"\n abs_path = FailureIsolation::WebDirectory+\"/\"+subdir\n FileUtils.mkdir_p(abs_path)\n basename = File.basename(jpg_output)\n File.symlink(jpg_output, abs_path+\"/#{basename}\")\n \"http://revtr.cs.washington.edu/isolation_graphs/#{subdir}/#{basename}\"\n end",
"def stowed_symlink_path(creates)\n stowed_symlink = nil\n creates_path = creates.split('/')\n creates_path.clone.each do\n # Detect lowest level symlink from created_file within stow_path\n if ::File.symlink?(\"#{stow_resolved_target}/#{creates_path.join('/')}\")\n stowed_symlink = \"#{stow_resolved_target}/#{creates_path.join('/')}\"\n # Symlink found, break and use creates_path for stowed file\n # stowed_path = creates_path.join('/')\n break\n else\n # Remove lowest path if not a symlink\n creates_path.pop(1)\n end\n end\n\n Chef::Log.debug \".stowed_symlink_path: #{stowed_symlink}\"\n stowed_symlink\n end",
"def link_file(file, target = File.join(ENV['HOME'], \".#{file.sub(/\\.erb$/, '')}\"))\n if file =~ /.erb$/\n LOGGER.info \"generating #{target.replace_home}\".blue\n File.open(target, 'w') do |new_file|\n new_file.write ERB.new(File.read(file)).result(binding)\n end\n else\n LOGGER.info \"linking #{target.replace_home}\".blue\n File.symlink(File.join(Dir.pwd, file), target)\n end\nend",
"def before_run\n Dir.chdir('source') do\n `ln -s nonexisting.txt link1.txt`\n end\nend",
"def symlink?\n false\n end",
"def install_directory_symlink(logger, dir, target = 'environments/production')\n raise ArgumentError, \"Called install_directory_symlink with #{dir.class} argument\" unless dir.is_a?(String)\n raise Errno::ENOENT, \"Specified directory #{dir} doesn't exist\" unless File.directory?(dir)\n symlink_target = File.join(@tempdir, target)\n\n if target =~ %r{/}\n parent_dir = File.dirname(symlink_target)\n FileUtils.mkdir_p parent_dir\n end\n\n FileUtils.rm_f symlink_target if File.exist?(symlink_target)\n FileUtils.symlink dir, symlink_target\n logger.debug(\"Symlinked #{symlink_target} -> #{dir}\")\n end",
"def symlink?\n @symlink\n end",
"def symlink?(entry)\n site.safe && File.symlink?(entry) && symlink_outside_site_source?(entry)\n end",
"def link(file_name, dest_file)\n log \"Linking file #{file_name} to #{dest_file}\"\n File.link(file_name, dest_file)\n end",
"def link(file_name, dest_file)\n log \"Linking file #{file_name} to #{dest_file}\"\n File.link(file_name, dest_file)\n end",
"def make_link(label, path, **opt, &block)\n label = opt.delete(:label) || label if opt.key?(:label)\n named = accessible_name?(label, **opt)\n title = opt[:title]\n new_tab = (opt[:target] == '_blank')\n sign_in = has_class?(opt, 'sign-in-required')\n http = path.is_a?(String) && path.start_with?('http')\n\n opt = add_inferred_attributes(:a, opt)\n hidden = opt[:'aria-hidden']\n disabled = opt[:'aria-disabled']\n\n opt[:'aria-label'] = title if title && !named\n opt[:tabindex] = -1 if hidden && !opt.key?(:tabindex)\n opt[:tabindex] = 0 if sign_in && !opt.key?(:tabindex)\n opt[:rel] = 'noopener' if http && !opt.key?(:rel)\n append_tooltip!(opt, NEW_TAB) if new_tab && !disabled\n\n link_to(label, path, html_options!(opt), &block)\n end",
"def create_link_to_dummy_directory\n FileUtils.ln_sf(\"#{destination_root}/db\", Rails.root.join('db'))\n end",
"def symlink?(entry); end",
"def link(relation, href, options={})\n @resource.add_link relation, href, options\n end",
"def symlink?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_IS_SYMLINK)\n end",
"def link(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::LINK, path, to, as, constraints, &blk)\n end",
"def symlink?\n !!@symlink ||= false\n end",
"def link_jrnl_config\n local_config = \"jrnl.yaml\" # local config, specifies Dropbox file location\n system %Q{mkdir -p \"$HOME/.config\"}\n jrnl_config_path = File.join(ENV['HOME'], \".config\", \"jrnl\", \"jrnl.yaml\")\n FileUtils.touch(jrnl_config_path)\n puts \"linking #{jrnl_config_path}\"\n system %Q{ln -sf \"$PWD/#{local_config}\" #{jrnl_config_path}}\nend",
"def link(label, target, op, flow_name=nil)\n label = label.to_sym unless label.nil?\n op = op.to_sym unless op.nil?\n flow_name = flow_name.to_sym unless flow_name.nil?\n raise ConfigError.new(\"Link #{label} already exists.\") unless @links[label].nil?\n @links[label] = Link.new(flow_name, target.to_sym, op)\n end",
"def ln_if_necessary(src, dst)\n ln = false\n if !File.symlink?(dst)\n ln = true\n elsif File.readlink(dst) != src\n rm(dst)\n ln = true\n end\n if ln\n ln(src, dst)\n true\n end\n end",
"def emit_link(cur_mtg_dir, f, desc)\n _a desc, href: f.include?('/') ? f : File.join(cur_mtg_dir, f)\nend",
"def symlink(guest_path, bucket_path = \"/tmp/vagrant-cache/#{@name}\")\n return if @env[:cache_dirs].include?(guest_path)\n\n @env[:cache_dirs] << guest_path\n comm.execute(\"mkdir -p #{bucket_path}\")\n unless symlink?(guest_path)\n comm.sudo(\"mkdir -p `dirname #{guest_path}`\")\n if empty_dir?(bucket_path) && !empty_dir?(guest_path)\n # Warm up cache with guest machine data\n comm.sudo(\"shopt -s dotglob && mv #{guest_path}/* #{bucket_path}\")\n end\n comm.sudo(\"rm -rf #{guest_path}\")\n comm.sudo(\"ln -s #{bucket_path} #{guest_path}\")\n end\n end",
"def symlink?\n type == :symlink\n end",
"def link_name(name)\n File.expand_path(File.join('~', '.' + File.basename(name)))\nend",
"def symlink?\n case type\n when T_SYMLINK then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def dirsymlink(d1,d2,ignore = [])\n if !File.directory?(d1)\n raise \"Not a directory: #{d1}\"\n end\n if ignore.include?(d1)\n return\n end\n if !File.directory?(d2)\n if !File.exists?(d2)\n Dir.mkdir(d2)\n else\n # Just ignore conflicts\n puts \"conflict: Not a directory: #{d2}\"\n return\n end\n end\n dir = ExtDir.open(d1)\n dir.entry_paths.each do |path|\n if File.basename(path) != \".\" && File.basename(path) != \"..\" &&\n !ignore.include?(path)\n if File.directory?(path)\n dirsymlink(path,File.join(d2,File.basename(path)),ignore)\n else\n f2 = File.join(d2,File.basename(path))\n if !File.exists?(f2)\n \t File.symlink(path,f2)\n end\n end\n end\n end\nend",
"def symlink?(file_name)\n symlink_windows?(file_name)\n end",
"def link_file(filename, title = T.unsafe(nil), anchor = T.unsafe(nil)); end",
"def link_file(filename, title = T.unsafe(nil), anchor = T.unsafe(nil)); end",
"def link(filename, outdir, platform='linux')\n f = base(filename)\n cmd, args = *case platform\n when 'darwin'\n ['gcc', '-arch i386']\n when 'linux'\n ['ld', '']\n else\n raise \"unsupported platform: #{platform}\"\n end\n run_and_warn_on_failure(\"#{cmd} #{args} -o #{f} #{filename} 2>&1\")\n `chmod u+x #{f}`\n return f\nend"
] | [
"0.8406103",
"0.83937025",
"0.82942986",
"0.8160836",
"0.81487143",
"0.81487143",
"0.7827746",
"0.77428675",
"0.7571918",
"0.7520523",
"0.7410269",
"0.73941237",
"0.73205286",
"0.73108166",
"0.7256173",
"0.7232844",
"0.71921474",
"0.7190729",
"0.7186848",
"0.71772164",
"0.70446634",
"0.7023542",
"0.6921472",
"0.6921472",
"0.6869251",
"0.68546945",
"0.6818261",
"0.67742676",
"0.6750809",
"0.67306525",
"0.66840845",
"0.6678491",
"0.66490126",
"0.664878",
"0.6613155",
"0.6574315",
"0.65362114",
"0.65258294",
"0.65196913",
"0.6483095",
"0.64547217",
"0.6437336",
"0.63267905",
"0.63267905",
"0.63168496",
"0.62528044",
"0.6205822",
"0.617714",
"0.61557615",
"0.6152056",
"0.6150597",
"0.6103283",
"0.60423",
"0.5970511",
"0.5970511",
"0.5970511",
"0.5970511",
"0.59558177",
"0.59023994",
"0.5900436",
"0.5897481",
"0.5896031",
"0.5784893",
"0.57777804",
"0.576405",
"0.5754234",
"0.57469666",
"0.57134324",
"0.57085276",
"0.5695393",
"0.56901246",
"0.5685686",
"0.56432533",
"0.56178963",
"0.5613191",
"0.5608386",
"0.5602032",
"0.5600707",
"0.55888677",
"0.55888677",
"0.5556549",
"0.55263126",
"0.55134964",
"0.5501297",
"0.54939467",
"0.54870427",
"0.54850566",
"0.54801947",
"0.54669",
"0.54511774",
"0.54463917",
"0.5441043",
"0.5424988",
"0.54123867",
"0.54062474",
"0.54002583",
"0.5398165",
"0.53756714",
"0.53743637",
"0.53727067"
] | 0.6736993 | 29 |
Change the timestamp of the selected files and directories. ==== Parameters +timestamp+ A string that can be parsed with `Time.parse`. Note that this parameter is not compatible with UNIX `touch t`. | def touch_t(timestamp)
FileUtils.touch selected_items, mtime: Time.parse(timestamp)
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modified_at(file, timestamp = nil)\n require 'date'\n time = timestamp ? DateTime.parse(\"#{timestamp}\") : DateTime.now\n timestamp = time.strftime('%Y%m%d%H%M')\n execute(\"/bin/touch -mt #{timestamp} #{file}\")\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def record_modification_timestamp(path, timestamp)\n File.utime(timestamp, timestamp, path)\n record_access_timestamp(path, timestamp)\n record_changed_timestamp(path, timestamp)\n end",
"def record_access_timestamp(path, timestamp)\n # Hook method: Already stored with File.utime\n end",
"def update!(timestamp = Time.now)\n ts = timestamp.respond_to?(:xmlschema) ? timestamp.xmlschema : timestamp.to_s\n\n if has_updated?\n updated.text = ts\n else\n add_child Updated.new { |u| u.text = ts }\n end\n\n self\n end",
"def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end",
"def bundleTimestampNone(dest_folder,new_timestamp)\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n File.utime(new_timestamp, new_timestamp, file)\n if !(File::directory?(file))\n # Add to zip bundle \n archive=zipBundle(file,new_timestamp)\n end \n end\n generateZipBundle() \n @latest_ts=new_timestamp+60\nend",
"def update_optime(timestamp)\n # track what's been written with this - write optime to the fs, perhaps periodically.\n @log.debug(\"Optime: #{timestamp}\")\n begin\n @_mongoClient.db(\"local\").collection(\"oplog.tracker\").update({}, {'timestamp' => timestamp}, {:upsert => true})\n rescue\n @log.error(\"Unable to update optime: #{timestamp}\")\n raise\n end\n end",
"def timestamp=(time)\n @timestamp = time.is_a?(Time) ? time.to_f : time\n end",
"def []=(timestamp, value)\n if value.nil?\n @data.delete(timestamp)\n else\n @data[timestamp] = value\n end\n end",
"def format_timestamp(timestamp)\n Time.parse(timestamp).strftime(\"%T (%z)\")\n end",
"def get_revision_number_by_timestamp(wanted_timestamp, path = nil)\n if @timestamps_revisions.empty?\n raise 'No revisions, so no timestamps.'\n end\n\n all_timestamps_list = []\n remaining_timestamps_list = []\n @timestamps_revisions.each_key do |time_dump|\n all_timestamps_list.push(Marshal.load(time_dump)) # rubocop:disable Security/MarshalLoad\n remaining_timestamps_list.push(Marshal.load(time_dump)) # rubocop:disable Security/MarshalLoad\n end\n\n # find closest matching timestamp\n mapping = {}\n first_timestamp_found = false\n old_diff = 0\n # find first valid revision\n all_timestamps_list.each do |best_match|\n remaining_timestamps_list.shift\n old_diff = wanted_timestamp - best_match\n mapping[old_diff.to_s] = best_match\n if path.nil? || (!path.nil? && @timestamps_revisions[Marshal.dump(best_match)].revision_at_path(path))\n first_timestamp_found = true\n break\n end\n end\n\n # find all other valid revision\n remaining_timestamps_list.each do |curr_timestamp|\n new_diff = wanted_timestamp - curr_timestamp\n mapping[new_diff.to_s] = curr_timestamp\n if path.nil? || (!path.nil? && @timestamps_revisions[Marshal.dump(curr_timestamp)].revision_at_path(path))\n if (old_diff <= 0 && new_diff <= 0) ||\n (old_diff <= 0 && new_diff > 0) ||\n (new_diff <= 0 && old_diff > 0)\n old_diff = [old_diff, new_diff].max\n else\n old_diff = [old_diff, new_diff].min\n end\n end\n end\n\n if first_timestamp_found\n wanted_timestamp = mapping[old_diff.to_s]\n @timestamps_revisions[Marshal.dump(wanted_timestamp)]\n else\n @current_revision\n end\n end",
"def raw_timestamp_to_cache_version(timestamp)\n key = timestamp.delete(\"- :.\")\n if key.length < 20\n key.ljust(20, \"0\")\n else\n key\n end\n end",
"def set_for_time timestamp\n return nil unless @date\n case timestamp[0,2]\n when \"00\"\n @datetime.hour == 23 ? @date_add_1_hr : @date\n when \"23\"\n @datetime.hour == 00 ? @date_1_hr_ago : @date\n else\n @date\n end\n end",
"def call(timestamp:, signature:)\n validate_parameters(timestamp, signature)\n\n \"t=#{timestamp.to_i},#{scheme}=#{signature}\"\n end",
"def update_timestamp(namespace, new_timestamp)\n @coll.update({ SolrConfigConst::SOLR_URL_KEY => @solr_loc,\n SolrConfigConst::NS_KEY => namespace\n },\n { \"$set\" => {\n SolrConfigConst::UPDATE_TIMESTAMP_KEY => new_timestamp\n }})\n end",
"def save_timestamp_changes(root)\n iterator = Iterators::PreOrderEntriesIterator.new(root)\n while iterator.has_next?\n next_entry = iterator.next_item\n record_creation_timestamp(next_entry.path, next_entry.new_created_datetime)\n record_modification_timestamp(next_entry.path, next_entry.new_modified_datetime)\n end\n end",
"def timestamp=(timestamp)\n @wsu_timestamp = timestamp\n end",
"def update_timestamp(*_args)\n current_time = current_time_from_proper_timezone\n\n write_attribute('updated_at', current_time) if respond_to?(:updated_at)\n write_attribute('updated_on', current_time) if respond_to?(:updated_on)\n end",
"def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n ts=new_timestamp\n fileCount=0\n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileCount>max_count)\n ts=ts+60\n fileCount=0\n end\n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file)\n elsif file.to_s().end_with?(\"Deleted_List.list\")\n deletedFileList=file \n else\n File.utime(ts, ts, file)\n fileCount=fileCount+1\n end\n end \n File.utime(ts, ts, deletedFileList)\nend",
"def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end",
"def convert_timestamp(timestamp)\n timestamp = db.to_application_timestamp(timestamp) if timestamp.is_a?(String)\n timestamp\n end",
"def newer_than_timestamp(timestamp)\n non_future_partitions.select do |p|\n timestamp <= p.timestamp\n end\n end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def set_signature_timestamp\n time = Time.now\n @signed_at = time\n @signed_at_timestamp = TimeFormatting.printable_time time\n @signed_at_timestamp_ms = TimeFormatting.ms_timestamp(time)\n set_document_tag :esigntimestamp, @signed_at_timestamp\n end",
"def update_system_time_stamp\n out = Jhead.call(\"-ft\", \"-q\", @match, @pattern)\n raise(JheadError.new, out) unless out.empty?\n end",
"def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def touch( fname, time = Time.now )\n stamp = time.strftime('%Y%m%d%H%M.%S')\n %x[ touch -m -t #{stamp} #{fname} ]\n end",
"def touch( fname, time = Time.now )\n stamp = time.strftime(\"%Y%m%d%H%M.%S\")\n %x[ touch -m -t #{stamp} #{fname} ]\n end",
"def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n puts \"Modifying timestamp based on file count\"\n# ts= Time.parse(new_timestamp.utc.to_s().split(\"UTC\").first) \n ts= Time.parse(new_timestamp.to_s())\n intial_ts=ts\n fileCount=0 \n old_output_ihtml=@outputRenamed+\"/ihtml/\"\n # Timestamp new files \n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if !(File.exists?old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, file) \n # Add to zip bundle \n archive=zipBundle(file,ts)\n fileCount=fileCount+1\n end\n end\n if !(File.exists?old_output_ihtml+partName) && File.directory?(file)\n File.utime(ts, ts, file)\n end\n end \n # searchDB.sql timestamp as the last bundle of new files but before edited files\n if File.exists?(dest_folder+\"searchDB.sql\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, dest_folder+\"searchDB.sql\")\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"searchDB.sql\",ts)\n fileCount=fileCount+1\n end\n # Timestamp edited files after new files and searchDB.sql\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if File.exists?(old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, file)\n # Add to zip bundle \n archive=zipBundle(file,ts) \n fileCount=fileCount+1\n end\n end\n if File.directory?(file)\n File.utime(intial_ts, intial_ts, file)\n end \n end \n # Timestamp deleted file as last bundle\n if (File.exists?(dest_folder+\"deletedFiles.list\"))\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, dest_folder+\"deletedFiles.list\")\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"deletedFiles.list\",ts)\n fileCount=fileCount+1\n end\n generateZipBundle() \n @latest_ts=ts+60\nend",
"def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end",
"def timestamp_from_filename(filename)\n # First, check if we can find the file name matching a timestamp\n parts = File.split(filename)\n parts = parts[-1].split('-')\n timestamp = parts[0]\n if not TIMESTAMP_REGEX.match(timestamp)\n return\n end\n\n # Great, then fix the formatting...\n timestamp[4] = '-'\n timestamp[7] = '-'\n timestamp[13] = ':'\n timestamp[16] = ':'\n\n return Time.parse(timestamp)\nend",
"def new_timestamp # :nodoc:\n @properties['timestamp'].dup\n end",
"def translate_timestamp(timestamp)\n # seconds -> milliseconds\n timestamp.to_i * 1000\n end",
"def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end",
"def timestomp(original, doplegangar)\n#\tcommandz(\"touch -r #{original} #{doplegangar}\") # one liner with touch command :p\n\n\t#Pure Ruby way :)\n\tfoo = File.stat(original) #Stat original file\n\tatime = foo.atime #Note its access & modify times so we can fake on target file...\n\tmtime = foo.mtime\n\tFile.utime(atime, mtime, doplegangar) #Make the fake :)\nend",
"def generate_timestamp_file(filename)\n now = Time.now.to_i\n output_path = \"#{@archive_root}/#{filename}\"\n File.write(output_path, now)\n end",
"def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end",
"def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end",
"def timestamp(value)\n merge(timestamp: value.iso8601)\n end",
"def initialize(timestamp)\n @timestamp = timestamp\n @records = []\n end",
"def update_timestamp(value)\n self.class.update_all ['updated_at = ?', value], ['id = ?', id]\n reload\n end",
"def publish!(timestamp = Time.now)\n ts = timestamp.respond_to?(:xmlschema) ? timestamp.xmlschema : timestamp.to_s\n\n if has_published?\n published.text = ts\n else\n add_child Published.new { |u| u.text = ts }\n end\n\n self\n end",
"def set(key, value, timestamp)\n timestamp = Time.parse(timestamp).utc.to_i if timestamp.is_a?(String)\n result = connection.query(\"TREG\", \"SET\", key, value, timestamp)\n\n unless result == \"OK\"\n raise \"Failed: TREG SET #{key} #{value} #{timestamp}\"\n end\n end",
"def local_timestamp(body)\n @var[:timestamp] = body\n _save_env\n _notice \"Timestamp format changed\"\nend",
"def call(content, timestamp: nil)\n timestamp ||= Time.now\n content.gsub(\n PATTERN,\n %(modifiedAt: \"#{timestamp.strftime(\"%Y-%M-%d\")}\")\n )\n end",
"def set_modify_time(new_modify_time)\r\n File.utime(access_time, new_modify_time, file_path)\r\n end",
"def internal_time(date, timestamp)\n hours, minutes, seconds = time_of_day(timestamp)\n seconds, frac = seconds.divmod(1.0)\n micro_seconds = (frac*1000000).to_i\n date = self.date(date)\n begin \n Time.local(date.year, date.month, date.day, hours, minutes, seconds, micro_seconds)\n rescue ArgumentError => e\n raise unless e.to_s =~ /argument out of range/\n raise BadTime, e.to_s\n end\n end",
"def timestamp_changed_signal(timestamp)\n timestamp_changed(timestamp)\n if timestamp > @creation_time\n if (@ticks % @granularity == 0) # Calculate every 1 hour\n\n now = Time.now\n @logger.info \"Current time: #{timestamp} - #{Time.at(timestamp)}\"\n @logger.info \"Hours processed: #{@ticks / @granularity} - events: #{@events_received}\"\n\n processing_time = 0\n processing_time = (now - @last_tick_change).to_f unless @last_tick_change == 0\n @logger.info \"Last hour processed in (sec): #{processing_time}\"\n unless processing_time == 0\n @logger.info \"Events/sec (this hour): #{@events_received_this_timestamp/processing_time}\"\n end\n print_stats\n @last_tick_change = now\n @events_received_this_timestamp = 0\n end\n @ticks += 1\n\n # Send when all events of the timestamp are processed\n send_finished_signals(timestamp)\n send_timestamp_changed_signals(timestamp)\n # Get values only when the timestamp changes to make sure all events\n # of the same timestamp are processed\n # print_offer_and_demand\n create_stats(timestamp)\n @logger.debug \"*** Timestamp #{timestamp-60} processed!\\n\"\n end\n end",
"def update_timestamp(work)\n # these timestamps are the Hyrax managed fields, not rails timestamps\n if work.date_uploaded\n work.date_modified = Time.current\n else\n work.date_uploaded = Time.current\n end\n end",
"def normalizeTimestamp(timestamp)\n if timestamp == '0000-00-00 00:00:00' || timestamp == '0000-00-00T00:00:00+00:00'\n timestamp = '1983-10-29T03:16:00+00:00'\n end\n timestamp\n end",
"def timestamp_sync(\n source_file,\n target_file,\n &block\n )\n # TODO: Sanity-checking.\n if ! File.exists?( source_file ) || ! File.exists?( target_file ) then return 1 end\n stime = File.stat( source_file ).mtime\n ttime = File.stat( target_file ).mtime\n if stime != ttime then\n# puts \"this should be displayed ONCE\"\n vputs \" # The source and target times are different. Fixing the target time.\"\n vputs \" Source: #{ source_file} to #{ stime }\"\n vputs \" Target: #{ target_file} to #{ ttime }\"\n File.utime( stime, stime, target_file )\n if File.stat( target_file ).mtime != stime then\n puts \"Failed to set the time!\"\n return 1\n end\n yield if block_given?\n return true\n else\n return false\n end\nend",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def add_time_stamp(path)\n logger.debug \"sprockets cache busting: #{File.basename path}\"\n lines = File.readlines path\n lines.slice!(0) if lines.first.match(/^#=Timestamp/)\n lines = [\"#=Timestamp #{Time.now}\\n\"] + lines\n File.open(path, \"w\") do |f|\n lines.each{|l| f.write l}\n end\n end",
"def set_latest(rule_key, timestamp)\n @timestamps[rule_key]['latest_run'] = timestamp\n end",
"def last_modified=(time)\n# File.utime(Time.now, time, file_path)\n end",
"def search_updated_guests(timestamp)\n ldap_timestamp = timestamp.to_time.utc.strftime(TIMESTAMP_FORMAT)\n modified_timestamp_filter = Net::LDAP::Filter.ge('modifytimestamp', ldap_timestamp)\n client.search(base: GUEST_DN, filter: modified_timestamp_filter)\n end",
"def otm_reset_timestamp\n @otm_timestamp = nil # reset it so all temp files have a new identifier, if otm_execute'd is executed again\n end",
"def otm_reset_timestamp\n @otm_timestamp = nil # reset it so all temp files have a new identifier, if otm_execute'd is executed again\n end",
"def filename(timestamp)\n base_filename = timestamp.in_time_zone.strftime('%Y-%m-%d')\n extension = 'csv'\n \"#{base_filename}.#{extension}\"\n end",
"def timestamp\n if File.exist?(name)\n File.mtime(name.to_s)\n else\n Rake::EARLY\n end\n end",
"def last_modified=(time)\n ::File.utime(Time.now, time, file_path)\n end",
"def store_start_timestamp(experiment, timestamp)\n set(experiment.handle.to_s, 'started_at', timestamp.utc.strftime('%FT%TZ'))\n end",
"def timestamp # :nodoc:\n @timestamp.dup\n end",
"def update_value(value, timestamp=nil)\n params = { value: value }\n params[:timestamp] = timestamp if timestamp\n @client.put(\"#{path}/value\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def bundleTimestampBundleSize(dest_folder,new_timestamp,max_size) \n max_size=max_size*1024\n ts=new_timestamp\n fileSize=0 \n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileSize>max_size)\n ts=ts+60\n fileSize=0\n end \n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file) \n elsif file.to_s().end_with?(\"deletedList.list\")\n deletedFileList=file\n else\n File.utime(ts, ts, file)\n fileSize=fileSize+File.size(file) \n end\n end\n File.utime(ts, ts, deletedFileList) \nend",
"def file_modified_since?( filename, timestamp )\n modified_timestamp = File.mtime( filename )\n return (modified_timestamp > timestamp)\nend",
"def set(key, value, timestamp)\n \n end",
"def update_project_timestamp\n self.project.updated_at = Time.now\n self.project.save\n end",
"def timestamp_to_time(timestamp)\n Time.at(timestamp.nanos * 10**-9 + timestamp.seconds)\n end",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end",
"def parse_timestamp(unix_timestamp)\n d = Time.at(unix_timestamp.to_i)\n d.strftime(\"%l:%M:%S %p, %-m-%e-%Y\")\n end",
"def format_long_timestamp(timestamp)\n Time.at(timestamp/1000).utc.iso8601\n end",
"def timestamp_name(timestamp)\n [\"ts\", timestamp.to_f].join(\":\")\n end",
"def get_datetime(timestamp)\n t = Time.at(timestamp)\n \"%d-%d-%d %d:%d:%d\" % [t.year, t.month, t.day, t.hour, t.min, t.sec]\n end",
"def set_file_mtime\n write_attribute(:file_mtime, File.mtime(file_name)) if (file_mtime.blank? and !file_name.blank?)\n end",
"def coerce_timestamp(timestamp)\n # bug in JRuby prevents correcly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565\n timestamp.is_a?(BigDecimal) ? LogStash::Timestamp.at(timestamp.to_i, timestamp.frac * 1000000) : LogStash::Timestamp.at(timestamp)\n end",
"def maybe_append_timestamp(version)\n if Config.append_timestamp && !has_timestamp?(version)\n [version, Omnibus::BuildVersion.build_start_time].join(\"+\")\n else\n version\n end\n end",
"def touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)\n list = fu_list(list)\n t = mtime\n if verbose\n fu_output_message \"touch #{nocreate ? '-c ' : ''}#{t ? t.strftime('-t %Y%m%d%H%M.%S ') : ''}#{list.join ' '}\"\n end\n return if noop\n list.each do |path|\n created = nocreate\n begin\n File.utime(t, t, path)\n rescue Errno::ENOENT\n raise if created\n File.open(path, 'a') {\n ;\n }\n created = true\n retry if t\n end\n end\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def add_dynamic_timestamp(text)\nend",
"def initialize( timestamp = nil, node_id = nil )\n @timestamp = timestamp\n @node_id = node_id\n @bytes = nil\n @time = nil\n end",
"def timestamp_to_date(timestamp)\n\t\tTime.at(timestamp/1000).utc #This is a time instance, it should go straight ot ruby\n\tend",
"def timestamp\n @timestamp ||= Time.parse(@origdate)\n end",
"def set_mtime(entry, file)\n entry.time = ::Zip::DOSTime.at(File.mtime(file))\n entry.extra.delete('UniversalTime')\n end",
"def set_published_timestamp(published_at)\n if published_at.nil?\n raise ArgumentError, 'You must provide a timestamp when creating a post.'\n else\n @published_at = published_at\n end\n end",
"def timestamp_received(notification)\n return unless notification.userInfo[:sender] == self\n @timestamp = notification.userInfo[:date]\n end",
"def utime(atime, mtime) File.utime(atime, mtime, path) end",
"def touch\n update_timestamps\n save\n end",
"def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end",
"def timestampFormat(value)\n _timestampFormat(value) or fail ArgumentError, \"Unknown value for timestampFormat: #{value}\"\n end",
"def set(key, value, timestamp)\n if @store[key].nil?\n @store[key] = [{ 'value' => value, 'timestamp' => timestamp }]\n else\n @store[key] << { 'value' => value, 'timestamp' => timestamp }\n end\n nil\n end"
] | [
"0.6365125",
"0.6343466",
"0.6308022",
"0.6152845",
"0.5780877",
"0.5666242",
"0.5505432",
"0.53912926",
"0.5374339",
"0.52755016",
"0.5058137",
"0.50204706",
"0.5016717",
"0.5002579",
"0.49970952",
"0.49921483",
"0.49688482",
"0.49676868",
"0.49618778",
"0.4936849",
"0.49342787",
"0.4917471",
"0.48907673",
"0.48904294",
"0.48587582",
"0.48413485",
"0.48357627",
"0.47926298",
"0.4783953",
"0.4779943",
"0.47542137",
"0.47334233",
"0.4733284",
"0.4731585",
"0.47224635",
"0.4691256",
"0.46583432",
"0.46386683",
"0.46264428",
"0.46263745",
"0.45922205",
"0.4586088",
"0.45788863",
"0.45786414",
"0.45621732",
"0.45588642",
"0.45517883",
"0.45495263",
"0.4546585",
"0.45322523",
"0.45312434",
"0.4518656",
"0.45085305",
"0.45001715",
"0.44918388",
"0.44868827",
"0.44868827",
"0.44818923",
"0.44758928",
"0.44746736",
"0.44702265",
"0.44406196",
"0.44406196",
"0.44352156",
"0.4434808",
"0.44267365",
"0.44215965",
"0.44170666",
"0.4415233",
"0.44031236",
"0.43974903",
"0.4392449",
"0.43857393",
"0.43853155",
"0.43821546",
"0.43680304",
"0.436105",
"0.43601677",
"0.43559408",
"0.43548548",
"0.43348703",
"0.42981982",
"0.4281175",
"0.42802256",
"0.42775798",
"0.42775798",
"0.42775798",
"0.42775798",
"0.42595866",
"0.4251034",
"0.42432758",
"0.42414755",
"0.42321238",
"0.42285588",
"0.421368",
"0.42135686",
"0.42133278",
"0.42127705",
"0.4211326",
"0.42111933"
] | 0.7202312 | 0 |
Yank selected file / directory names. | def yank
@yanked_items = selected_items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_list\n\n # XXX key to invoke this is difficult. make it easier\n selfiles = current_or_selected_files\n sz = selfiles.size\n print \"Remove #{sz} files from used list (y)?: \"\n key = get_char\n return if key != 'y'\n\n # arr = @selected_files.map { |path| File.expand_path(path) }\n # @log.debug \"BEFORE: Selected files are: #{@selected_files}\"\n arr = selfiles.map { |path|\n if path[0] != '/'\n expand_path(path)\n else\n path\n end\n }\n if File.directory? arr.first\n @used_dirs -= arr\n select_from_used_dirs\n else\n @visited_files -= arr\n select_from_visited_files\n end\n unselect_all\n @modified = true\n # redraw_required\nend",
"def remove_from_list\n if $selected_files.size > 0\n sz = $selected_files.size\n ch = get_single \"Remove #{sz} files from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n #print\n ## what if selected some rows\n file = $view[$cursor]\n ch = get_single \"Remove #{file} from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n c_refresh\n $modified = true\nend",
"def remove_from_list\n return unless $selection_allowed\n if $selected_files.size > 0\n sz = $selected_files.size\n print \"Remove #{sz} files from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n print\n ## what if selected some rows\n file = $view[$cursor]\n print \"Remove #{file} from used list (y)?: \"\n ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n refresh\n $modified = true\nend",
"def rearrange\n rootpath = \"#{$paths.restore_path}/Student_Records_D20130520/Student_Records\"\n Dir.entries(rootpath).each{|entry|\n if !entry.gsub(/\\.|rb/,\"\").empty?\n Dir.chdir(\"#{rootpath}/#{entry}/SY_2012-2013\")\n if !File.directory?(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n Dir.mkdir(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n Dir.glob('WD_**') do |file|\n #puts File.expand_path(file)\n oldpath = File.expand_path(file)\n FileUtils.mv(\"#{oldpath}\",\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n end\n }\n end",
"def reorder_files\n files = Dir.glob(File.join(@dir,\"*\"))\n files.each{|f|\n @enroll_file = f if f.downcase.index('enroll')\n @attendance_file = f if f.downcase.index('att')\n @ili_file = f if f.downcase.index('ili') || f.downcase.index('h1n1')\n }\n end",
"def toggle_select f\n return unless $selection_allowed\n if $selected_files.index f\n $selected_files.delete f\n else\n $selected_files.push f\n end\nend",
"def toggle_select f\n if $selected_files.index f\n $selected_files.delete f\n else\n $selected_files.push f\n end\nend",
"def toggle_select f\n if $selected_files.index f\n $selected_files.delete f\n else\n $selected_files.push f\n end\nend",
"def sort_files!; end",
"def bname(ary)\n ary.map {|f| File.basename(f).remove(\".txt\") }\nend",
"def name n\n @files = @files.select { |file| n =~ File.basename(file) }\n self\n end",
"def tree\n # Caution: use only for small projects, don't use in root.\n $title = \"Full Tree\"\n $files = `zsh -c 'print -rl -- **/*(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\nend",
"def redefineChampionSelect(originalDir, newDir, musicArray) \n\tif Dir.exist? originalDir and Dir.exist? newDir #make sure the directory exists\n\t\tmusicFiles = selectTwoTracks(musicArray) #randomly selects two music files\n\t\tDir.entries(newDir).each do |folderName|\n\t\t\tif folderName[0].isInteger?\n\t\t\t\tnewDir += folderName + \"\\\\\" + \"deploy\\\\assets\\\\sounds\\\\ambient\\\\\"\n\t\t\tend\n\t\tend\n\n\t\tFileUtils.cd(originalDir)\n\n\t\tblindOrDraft = 0 #counter to decide which song goes to the League folder; 0 = draft, 1 = blind\n\n\t\tmusicFiles.each do |musicFile|\n\t\t\tFileUtils.cp(originalDir + File.basename(musicFile), newDir) #copy the music file in question\n\t\t\tFileUtils.cd(newDir) #move to the new directory\n\t\t\tif blindOrDraft == 0 #if draft pick\n\t\t\t\tif File.exist?(\"ChmpSlct_DraftMode.mp3\") #check to see if the file exists\n\t\t\t\t\tFile.delete(\"ChmpSlct_DraftMode.mp3\") #if it does, delete it\n\t\t\t\tend\n\t\t\t\tFile.rename((File.basename musicFile), \"ChmpSlct_DraftMode.mp3\") #rename the selected file to the appropriate name\n\t\t\telsif blindOrDraft == 1 #If Blind pick\n\t\t\t\tif File.exist?(\"ChmpSlct_BlindPick.mp3\") #check to see if the file exists\n\t\t\t\t\tFile.delete(\"ChmpSlct_BlindPick.mp3\") #if it does delete it\n\t\t\t\tend\n\t\t\t\tFile.rename((File.basename musicFile), \"ChmpSlct_BlindPick.mp3\") #rename the selected file to the appropriate name\n\t\t\tend\n\t\t\tblindOrDraft += 1 #change to the next queue type\n\t\tend\n\tend\nend",
"def print_menu\n Dir.glob('*.mz').sort.each_with_index{|f,i|puts\"#{(i+1).to_s.rjust(2)} - #{f}#{\"\\n\"+(i+2).to_s.rjust(2)+' - exit'if i==Dir.glob('*.mz').size-1}\"}\nend",
"def add_to_selection file\n ff = file\n case file\n when String\n ff = [file]\n end\n @current_dir ||= Dir.pwd\n ff.each do |f|\n # this is wrong if the file is a dir listing or visited files listing.\n # full = File.join(@current_dir, f)\n full = expand_path(f)\n @selected_files.push(full) unless @selected_files.include?(full)\n end\nend",
"def bench_cases_fix_names(dir_name = 'aligned')\n files = Dir.glob(\"6.823/lab3/data/#{dir_name}/*\")\n \n files.each_with_index do |file, i|\n ['.out', '.o'].each do |suffix|\n len = suffix.length\n next unless file[-len, len] == suffix\n File.rename file, file[0...-len] + '.txt'\n files[i] = file[0...-len]\n end\n end \nend",
"def refresh\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def write_selected_files\n require 'pathname'\n # fname = File.join(File.dirname(CONFIG_FILE), 'selected_files')\n # 2019-04-10 - changed to ~/tmp otherwise confusion about location\n fname = File.join('~/tmp/', 'selected_files')\n fname = expand_path(fname)\n\n # remove file if no selection\n if @selected_files.empty?\n File.unlink(fname) if File.exist?(fname)\n return nil\n end\n\n # TODO : what if user does not want full path e,g zip\n # TODO: what if unix commands need escaped files ?\n base = Pathname.new Dir.pwd\n File.open(fname, 'w') do |file|\n @selected_files.each do |row|\n # use relative filename. Otherwise things like zip and tar run into issues\n unless @selected_files_fullpath_flag\n p = Pathname.new(row)\n row = p.relative_path_from(base)\n end\n row = Shellwords.escape(row) if @selected_files_escaped_flag\n file.puts row\n end\n end\n\n return fname\nend",
"def accept_file_name # {{{\n print \"Enter filename: \"\n values = Dir.glob(\"*.tsv\")\n values.each do |e|\n unless Readline::HISTORY.include? e\n Readline::HISTORY.push(e)\n end\n end\n filename = Readline::readline('>', true)\n if File.extname(filename) == \"\"\n # if no extension, add tsv\n filename << \".tsv\"\n end\n Readline::HISTORY.pop if Readline::HISTORY.include? filename\n # we still get dupes when user selects from history\n return filename\nend",
"def all_split_files_in dir_name\n return super unless @hax_mode\n @hax_last_dirname = dir_name\n ret = super\n lone_files = [\"#{dir_name}.md\", dir_name]\n lone_file = find_first_file(lone_files)\n if lone_file # e.g. '../README.md', 'README'\n @hax_last_filename = lone_file.dup\n class << lone_file\n #\n # supremely fragile hack:\n # make it so that it ignores the next + operation in the first\n # line of Nanoc3::DataSources::Filesystem#all_split_files_in()\n # this is shorter and easier than overriding and rewring\n # the above function but it is a supreme haxie guaranteed to fail\n # one day!!!\n #\n def + _; self end\n end\n other = super(lone_file)\n ret.merge!(other)\n end\n ret\n end",
"def clean_arb_named_files(src)\n\n clean_list = $config[\"clean\"][\"remove_named\"].split(/,/)\n\n Find.find(src) do |path|\n next if File.basename(path) =~ /^\\._/\n clean_list.each do |name|\n next if path !~ /#{name}\\./\n FileUtils.rm(path,$options) if File.exists? path\n end\n\n end\nend",
"def change_file_names\n sorted_all_images_name.each do |f|\n File.rename(f, sterilize(f))\n end\n end",
"def specify_files_to_search\n system 'clear'\n puts \"#{AVAILABLE_FILES}\\n #{available_files}\".bold\n @file_selection = STDIN.gets.chomp.split(FILE_SPLIT_REGEX)\n end",
"def select_all\n dir = Dir.pwd\n # check this out with visited_files TODO FIXME\n @selected_files = @view.map { |file| File.join(dir, file) }\n message \"#{@selected_files.count} files selected.\"\nend",
"def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend",
"def clean_selected_files\n @selected_files.select! { |x| x = expand_path(x); File.exist?(x) }\nend",
"def pop_dir\n return # 2014-07-25 - 22:43 \n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def rearrangeTEP\n rootpath = \"#{$paths.restore_path}/Student_Records_D20130520/Student_Records\"\n Dir.entries(rootpath).each{|entry|\n if !entry.gsub(/\\.|rb/,\"\").empty?\n newpath = \"#{rootpath}/#{entry}/SY_2012-2013\"\n Dir.chdir(\"#{newpath}\")\n Dir.entries(newpath).each{|entry|\n if !entry.gsub(/\\.|rb/,\"\").empty?\n path = File.expand_path(entry)\n name = File.basename(path)\n if name == \"Withdrawal\" || name == \"TEP\"\n \n else\n puts path\n end\n end\n }\n end\n }\n end",
"def grouped(files); end",
"def toggle_select f=current_file\n # if selected? File.join(@current_dir, current_file)\n if selected? expand_path(current_file)\n remove_from_selection f\n else\n @selected_files.clear unless @multiple_selection\n add_to_selection f\n end\n message \"#{@selected_files.count} files selected. \"\n\n # 2019-04-24 - trying to avoid redrawing entire screen.\n # If multiple_selection then current selection is either added or removed,\n # nothing else changes, so we redraw only if not multi. Also place cursor\n # i.e. redraw current row if mutliple selection\n if @multiple_selection\n redraw_required false\n place_cursor\n end\nend",
"def display_saves\n Dir.children('./saves').each_with_index { |name, idx| puts \"#{idx}. #{name}\" }\nend",
"def keep_files=(_arg0); end",
"def paste\n if @yanked_items\n if current_item.directory?\n FileUtils.cp_r @yanked_items.map(&:path), current_item\n else\n @yanked_items.each do |item|\n if items.include? item\n i = 1\n while i += 1\n new_item = load_item dir: current_dir, name: \"#{item.basename}_#{i}#{item.extname}\", stat: item.stat\n break unless File.exist? new_item.path\n end\n FileUtils.cp_r item, new_item\n else\n FileUtils.cp_r item, current_dir\n end\n end\n end\n ls\n end\n end",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def c_refresh\n $filterstr ||= \"M\"\n #$files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n $patt=nil\n $title = nil\n display_dir\nend",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n display_dir\n\n return\n # old stuff with zsh\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def filter_directories(modified_files); end",
"def directory!\n @file_list = @file_list.select{ |f| File.directory?(f) }\n end",
"def ask_nicely\n print \"\\033[31mA folder named `#{Frank.export.path}' already exists, overwrite it?\\033[0m [y/n] \"\n STDIN.gets.chomp.downcase\n end",
"def renameAll(fileName)\n counter = 1\n Dir::glob(\"*\").each do |name| \n File.rename(name, fileName + counter.to_s) if name != \"Rfile.rb\" \n counter += 1 if name != \"Rfile.rb\"\n end\nend",
"def blacklisted_dir_entries\n %w[. ..]\n end",
"def my_music_shuffle filenames\n \n return [] if filenames.empty? # get the empty case out of the way\n \n # split each filename into [path, file]\n filenames.map! {|name| Pathname.new(name).split}\n filenames.map! {|name| [name[0].to_s, name[1].to_s]}\n\n # initialise shuffle\n shufflednames = []\n tailend_flag = false\n pick = rand(filenames.length)\n \n # do the shuffling\n while !(filenames == []) do\n \n # stick pick on the end unless tailend flag is raised, in which case insert randomly\n if !tailend_flag then shufflednames << filenames[pick] else\n shufflednames.insert(rand(shufflednames.length), filenames[pick])\n end\n filenames.delete_at(pick)\n \n # set 'masknames' to list everything of a different genre\n masknames = filenames.select {|name| name[0] != shufflednames[-1][0]} \n \n # find a new pick, raising the tailend flag if we only have one genre left\n if !filenames.empty? then\n if !masknames.empty? then\n pickname = masknames.sample # pick a tune from a different genre\n pick = filenames.index(pickname) # find it in 'filenames' and point 'pick' to it\n else\n pick = rand(filenames.length) # pick any tune\n tailend_flag = true\n end\n end\n \n end # ends while loop\n \n #output the filenames merged back into strings\n shufflednames.map! {|name| name[0].to_s + '/' + name[1].to_s} \n \nend",
"def file_list(group)\n return Dir[File.join(@dir, group, FILE_EXT)].sort\nend",
"def target_files(changed_files)\n changed_files.select do |file|\n file.end_with?(\".kt\")\n end\n end",
"def enhance_file_list\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n # zsh gives errors which stick on stdscr and don't get off!\n # Rather than using N I'll try to convert to ruby, but then we lose\n # similarity to cetus and its tough to redo all the sorting stuff.\n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n #f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_file_list d\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]MN)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]MN)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]MN)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]MN)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]MN)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def change_names(offset)\n puts \"Changing files...\"\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n File.rename(item, fullname)\n end\n puts \"Done.\"\nend",
"def file_selection(file_information)\n key = \"root\" # linux support only for now\n file_break = \"\" # save for \"break\"\n index = 0 # for user selection\n number = 0 # for selection from table \n ui = {} \n # build display for user selection\n file_information.each_pair do |directory, files|\n if files.length > 1\n ui.store(index, directory) # the internal UI\n puts \"Now in directory: #{directory}\" \n files.each do |file| \n unless file.start_with?(\".\")\n if File.directory?(file)\n puts \"#{index} #{file}\"\n else\n puts \" #{index} #{file}\"\n end\n ui.store(index, file) \n index += 1\n end\n end\n end\n end\n unless $mode == \"test\" # global test switch\n ARGF.each_line do |selection| \n number = selection.chomp!.to_i\n break if (0..index).include?(number.to_i) # index reused from above \n end\n file_name = ui[number] # get selection from UI table \n else\n file = ARGF.readline\n @selection = file.chomp! \n number = selection.chomp!.to_i\n file_name = ui[number] # get selection from UI table \n end\n end",
"def selection( )\n if @completion.is_a?(Array)\n @completion\n elsif [File, Pathname].include?(@completion)\n Dir[File.join(@directory.to_s, @glob)].map do |file|\n File.basename(file)\n end\n else\n [ ]\n end\n end",
"def transliterate_file_name\n\t\t\tfile_names = Array.new\n\t\t\[email protected] { |a| file_names << a if a.match(/_file_name{1}$/) }\n\t\t\tfile_names.each do |local_file_name|\n\t\t\t\tif self.send(local_file_name).present? && self.send(local_file_name+'_changed?')\n\t\t\t\t\textension = File.extname(send(local_file_name)).gsub(/^\\.+/, '')\n\t\t\t\t\tfilename = send(local_file_name).gsub(/\\.#{extension}$/, '')\n\t\t\t\t\tself.send(local_file_name.gsub(/_file_name{1}$/, '')).instance_write(:file_name, \"#{transliterate(filename)}.#{transliterate(extension)}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def filenames; end",
"def adjacent_files\n files = []\n files << file_names[x - 1] unless file == :a\n files << file_names[x + 1] unless file == :h \n files\n end",
"def file_directory(selection)\n while File.directory?(selection)\n @file_information = file_get_more_information(selection) \n selection = file_selection(@file_information)\n unless File.directory?(selection)\n break\n end\n end\n if File.directory?(selection)\n @file_information.each do |directory,files|\n files.each { |file| @file = \"#{directory}/#{file.to_s}\" if file == selection }\n end\n else\n @file = selection\n end\n file_history_push(@file) # store it \n text_lines = file_open(@file, \"r\") # open for read\n return text_lines\n end",
"def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end",
"def readdir(path, fileinfo)\n puts \"#readdir \" + path\n [\"hello.txt\"]\n end",
"def make_inventory\n Dir.glob('**/*').sort.each {|f| puts f}\nend",
"def tree\n # Caution: use only for small projects, don't use in root.\n @title = 'Full Tree'\n # @files = `zsh -c 'print -rl -- **/*(#{@sorto}#{@hidden}M)'`.split(\"\\n\")\n @files = Dir['**/*']\n message \"#{@files.size} files.\"\nend",
"def files(options = {})\n resize_images_if_needed \n files = get_children(\"file\").collect do |file| \n Dirk.new(file, { :attr_file => file.basename.to_s.gsub(file.extname, '.txt') })\n end\n \n files.sort! { |a, b| a.send(options[:sort]).to_s <=> b.send(options[:sort]).to_s } if options[:sort]\n files\n end",
"def list_files dir='*', sorto=@sorto, hidden=@hidden, _filter=@filterstr\n dir += '/*' if File.directory?(dir)\n dir = dir.gsub('//', '/')\n\n # decide sort method based on second character\n # first char is o or O (reverse)\n # second char is macLn etc (as in zsh glob)\n so = sorto ? sorto[1] : nil\n func = case so\n when 'm'\n :mtime\n when 'a'\n :atime\n when 'c'\n :ctime\n when 'L'\n :size\n when 'n'\n :path\n when 'x'\n :extname\n end\n\n # sort by time and then reverse so latest first.\n sorted_files = if hidden == 'D'\n Dir.glob(dir, File::FNM_DOTMATCH) - %w[. ..]\n else\n Dir.glob(dir)\n end\n\n # WARN: crashes on a deadlink since no mtime\n if func\n sorted_files = sorted_files.sort_by do |f|\n if File.exist? f\n File.send(func, f)\n else\n sys_stat(func, f)\n end\n end\n end\n\n sorted_files.sort! { |w1, w2| w1.casecmp(w2) } if func == :path && @ignore_case\n\n # zsh gives mtime sort with latest first, ruby gives latest last\n sorted_files.reverse! if sorto && sorto[0] == 'O'\n\n # add slash to directories\n sorted_files = add_slash sorted_files\n # return sorted_files\n @files = sorted_files\n calculate_bookmarks_for_dir # we don't want to override those set by others\nend",
"def selected_files\n a = Array.new\n selected_iters do |iter|\n a.push(@current_dir+iter[LS_Name])\n end\n return a\n end",
"def chdir; end",
"def excluded_files() = []",
"def set_directory_listing\n set_option('buftype','nowrite')\n set_option('bufhidden','delete')\n set_option('swapfile',0)\n return self\n end",
"def dir(*) end",
"def remove_version_info name\n add \"find . -maxdepth 1 -name '#{name}*' -a -type d | xargs -I xxx mv xxx #{name}\", check_file(name)\n end",
"def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend",
"def rename_by_id(target_dir)\n\tcurrent_dir\n\ttarget_dir = \"#{@mods_dir}/#{target_dir}\"\n\tDir.glob(\"#{target_dir}/*.xml\") do |xmlfile|\n\t\tputs \"Going through #{xmlfile}\"\n\n\t\tampid = File.basename(xmlfile,\"_mods.xml\")\n\t\t\n\t\trexmlfile = File.new(xmlfile)\n\t\txmldoc = Document.new(rexmlfile)\n\n\t\troot = xmldoc.root\n\n\t\tidval = []\n\n\t\txmldoc.elements.each(\"mods/identifier\") { |e| idval = e.text }\n\n\t\trexmlfile.close\n\n\t\tFile.rename(\"#{xmlfile}\", \"#{target_dir}/#{idval}_#{ampid}_mods.xml\")\n\t\tputs xmlfile + \"renamed to #{idval}_#{ampid}_mods.xml\"\n\t\t\n\tend\nend",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end",
"def keep_dirs; end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def choose_file(dir)\n puts \"Choose file: #{dir}\"\n @files = Dir[\"#{dir}/*\"]\n @files.each_with_index { |f,i| puts \"#{i+1}: #{f}\" }\n print \"> \"\n num = STDIN.gets\n return false if num =~ /^[a-z ]*$/i\n file = @files[num.to_i - 1]\nend",
"def scan_directory(path, options, name=nil)\n\n data = {}\n Dir.foreach(path) do |filename|\n\n # Check to see if we should skip this file. We skip invisible files (starts with \".\") and ignored files.\n next if (filename[0] == '.')\n next if (filename == '..' || filename == '.')\n next if options.ignore_files.include? filename\n\n full_path = File.join(path, filename)\n if File.directory?(full_path)\n\n # This item is a directory. Check to see if we should ignore this directory.\n next if options.ignore_dir.include? filename\n\n # Loop through the method again.\n position = get_directory_display_order(full_path)\n data.store(\"#{'%04d' % position}-\" + filename.gsub(' ', '%20'), scan_directory(full_path, options, filename))\n\n else\n # This item is a file.\n if !options.ext_whitelist.empty?\n\n # Skip any whitelisted extensions.\n next unless options.ext_whitelist.include? File.extname(filename)\n end\n\n original_path = path.sub(/^#{app.config[:source]}/, '') + '/' + filename\n\n # Get this resource so we can figure out the display order\n this_resource = resource_from_value(original_path)\n position = get_file_display_order(this_resource)\n\n data.store(\"#{'%04d' % position}-\" + filename.gsub(' ', '%20'), original_path.gsub(' ', '%20'))\n end\n end\n\n # Return this level's data as a hash sorted by keys.\n return Hash[data.sort]\n end",
"def undo()\r\n #need to manipulate strings by taking file name off of OldFilePath and adding it onto NewFilePath\r\n oldname = @OldFilePath.basename\r\n @NewFilePath = \"#{@NewFilePath}/#{oldname}\"\r\n origfolder = @OldFilePath.dirname\r\n @OldFilePath = origfolder\r\n\r\n FileUtils.mv(@NewFilePath, @OldFilePath)\r\n end",
"def rename_file(name, dir='.')\n menu(Dir.entries(dir)) {|chosen| chosen.each {|e| File.rename(e, name) } }\n end",
"def view_selected_files\n fname = write_selected_files\n\n unless fname\n message 'No file selected. '\n return\n end\n\n system \"$PAGER #{fname}\"\n setup_terminal\nend",
"def more_uniq\n self.uniq_level += 1\n self.rename\n self\n end",
"def remove_arb_dot_files(src)\n dot_files = Array.new\n dot_files << \"DS_Store\"\n dot_files << \"_.DS_Store\"\n dot_files << \"com.apple.timemachine.supported\"\n dot_files << \"Thumbs.db\"\n dot_files << \"localized\"\n \n dot_files.each do |file|\n dot_file_remove = \"#{src}/.#{file}\"\n FileUtils.rm(dot_file_remove,$options) if File.exists? dot_file_remove\n end\n\n #Find.find('/media/slot2/sort/3g') do |a|\n # puts a\n #end\n #\n # handle removing of temp macos ._ files\n Find.find(src) do |path|\n #puts File.basename(path)\n next if File.basename(path) !~ /^\\._/\n dot_file_remove = \"#{src}/#{File.basename(path)}\"\n FileUtils.rm(dot_file_remove,$options) if File.exists? dot_file_remove\n end\n\nend",
"def gather_files files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list files, true, @options.exclude\n\n file_list = remove_unparseable(file_list)\n\n if file_list.count {|name, mtime|\n file_list[name] = @last_modified[name] unless mtime\n mtime\n } > 0\n @last_modified.replace file_list\n file_list.keys.sort\n else\n []\n end\n end",
"def read_files\n Dir['*', '*/*'].group_by { |f| f.ext || :_dir }.to_symkey\n end",
"def file_names(b_name)\n array = b_name.chars\n array.map! do |letter|\n letter = '_' if letter == ' '\n letter\n end\n array.join\nend",
"def dir=(_); end",
"def select_bookmarks\n # added changes in both select_current and select_hint\n # However, the age mark that is show is still for the earlier shown forum based on outdated full_data\n # So we need to show age mark based on file datw which means a change in display program !!! At least\n # clear the array full_data\n $mode = \"forum\"\n $title = \"Bookmarks\"\n $files = $bookmarks.values\n\nend",
"def find_free_name(filename); end",
"def filtered(files); end",
"def directory_hash(path, name=nil, exclude = [])\n exclude.concat(['..', '.', '.git', '__MACOSX', '.DS_Store'])\n data = {'name' => (name || path), 'type' => 'folder'}\n data[:children] = children = []\n Dir.entries(path).sort.each do |entry|\n # Dir.entries(path).each\n # puts entry\n next if exclude.include?(entry)\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n if entry.include?(\"credit app\")\n kids = Dir.entries(full_path)\n kids.reject! {|x|exclude.include?(x)}\n if kids.length >= 1\n # can add a kids.each loop here if mom ever wants more than one credit app\n child_path = File.join(full_path, kids[0])\n true_path = child_path.partition(\"app/assets/images/\")[2]\n link = ActionController::Base.helpers.image_path(true_path)\n # puts full_path\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n entry = entry.upcase\n\n children << \"<li class='category'>CREDIT APP<li class='kid'><a href='#{link}'>#{entry}</a></li></li>\"\n else\n # gotta fix these two somehow\n children << \"<li><a href='#'>NO APP</a></li>\"\n end\n elsif entry.include?('flipbook')\n # Dir.entries(full_path).each do |flipbook|\n # next if exclude.include?(flipbook)\n # if File.directory?(full_path)\n name = entry.split(\"-\")[1]\n name = name.upcase\n if @account==\"UNDER ARMOUR\" && full_path.include?('UA GOLF')\n uasub = 'UA GOLF'\n elsif @account==\"UNDER ARMOUR\" && full_path.include?('UA FITNESS')\n uasub = 'UA FITNESS'\n end\n\n linky = view_context.link_to name, controller: 'catalogues', action: 'flipbook', id: @account, subid: entry, :data => { :uaname => uasub }\n children << \"<li class='kid'>#{linky}</li>\"\n # catfolder = full_path.split('/flipbook')[0]\n # end\n\n # end\n elsif entry.include?(\"toplevel\")\n # replace toplevel with a better check, something like if parent = pictures\n entryname=entry.split('-')[0].upcase\n children << \"<li class='kid'><a href='/catalogues/#{@account}/pictures/#{entry}'>#{entryname}</a></li>\"\n\n else\n children << directory_hash(full_path, entry)\n end\n else\n # true_path = full_path.partition(\"app/assets/images/\")[2]\n\n true_path = full_path.partition(\"app/assets/images/\")[2]\n # puts true_path\n link = ActionController::Base.helpers.image_path(true_path)\n\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n # this is where final kids are created\n entry = entry.upcase\n children << \"<li class='kid'><a href='#{link}'>#{entry}</a></li>\"\n end\n end\n return data\n end",
"def get_video_destination(dir, prompt = 'directory > ')\n dir_prefix = \"#{ dir }\".length\n Readline.completion_case_fold = true\n Readline.completion_proc = lambda do |prefix|\n path = \"#{ dir }#{ prefix }*\"\n list = Dir.glob(path)\n list = list.map { |f| File.directory?(f) ? \"#{ f }/\" : f }\n list = list.map { |f| f[dir_prefix, f.length] }\n list = list.sort { |f1, f2| f1.downcase <=> f2.downcase }\n list\n end \n dest = dir + Readline.readline(prompt)\n puts dest\n return dest\nend",
"def preview_names(offset)\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n puts fullname\n end\nend",
"def files() = files_path.glob('**/*')",
"def selector(array, filename)\n\tselected = array.sample\n\tmodifyfile(selected, filename)\nend",
"def skip_paths=(_arg0); end",
"def main\n # 12345-1234567 - World, Hello - some-filename.zip\n filenameRegex = /\\d+-\\d+ - .+, .+ - .+/\n\n Dir.chdir( ARGV[0] || \".\" )\n Dir.foreach(\".\") do |filename|\n student = filenameRegex.match(filename) ? filename.split(\" - \")[1] : ''\n if ( student.include?(\", \") )\n if !(File.directory?(student))\n mkdir(student)\n end\n if !(File.directory?(filename))\n mv( filename, student )\n end\n end\n end\nend",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def ls\n @files.each_with_index.map do |file, i|\n { file: (@path.nil? ? file.path : file.path.relative_path_from(@path)).to_s, selected: @selected_files.include?(file) }\n end\n end",
"def change_dir f, pos=nil\nend",
"def rmwhite_file_or_dir(file, patterns)\n if(File.directory?(file))\n current_dir = Dir.pwd()\n Dir.chdir(file) \n# print (\"changed dir to: \" + file + \"\\n\")\n rmwhite_directory(file, patterns)\n Dir.chdir(current_dir)\n# print (\"changed dir to: \" + current_dir + \"\\n\")\n else\n rmwhite_file(file)\n end\nend",
"def ignored_files=(_arg0); end",
"def directories; end",
"def directories; end",
"def obsolete_files; end",
"def data_file_names\n Dir.glob(File.join(@dir, '*.data')).sort! do |a, b|\n a.to_i <=> b.to_i\n end\n end",
"def register_self!(dir)\n Find.find(dir).each do |f|\n next if f == dir\n basename = f.sub(/^#{dir}\\//, '')\n next if basename.match(/^.git$/)\n next if basename.match(/^.git\\W/)\n next if gitignore_list(dir).include?(basename)\n\n if @files[basename]\n carp \"From #{'self'.blue.bold} #{basename.bold} \",\n 'keep'.white, 2 if @files[basename] == '__self'\n else\n carp \"From #{'self'.blue.bold} #{basename.bold}\",\n 'registed'.green.bold, 1\n @files[basename] = '__self'\n end\n\n @self_files << f unless @self_files.include?(f)\n end\n end"
] | [
"0.58841217",
"0.56182814",
"0.5609983",
"0.5533741",
"0.53973764",
"0.5345183",
"0.5327483",
"0.5327483",
"0.53068775",
"0.52916586",
"0.5250795",
"0.52463955",
"0.5224868",
"0.52206403",
"0.5190112",
"0.5166",
"0.513031",
"0.512064",
"0.5102785",
"0.5078216",
"0.50732267",
"0.5026441",
"0.49990034",
"0.49985546",
"0.49967086",
"0.49726257",
"0.49702698",
"0.49515072",
"0.4947681",
"0.4946932",
"0.4945358",
"0.49450746",
"0.49414244",
"0.49390796",
"0.49341315",
"0.4927572",
"0.49140316",
"0.49134275",
"0.49048132",
"0.4887965",
"0.48751643",
"0.48538888",
"0.4853085",
"0.48489243",
"0.48472062",
"0.48451912",
"0.48368892",
"0.4808782",
"0.48026183",
"0.47872192",
"0.47838256",
"0.47760466",
"0.47665718",
"0.47610354",
"0.47546002",
"0.4749125",
"0.47412604",
"0.4739706",
"0.47379145",
"0.4726842",
"0.47195056",
"0.47145882",
"0.47083622",
"0.4700294",
"0.4696851",
"0.46921995",
"0.46905202",
"0.46863183",
"0.46779832",
"0.46756104",
"0.46660727",
"0.46656135",
"0.46615914",
"0.46609172",
"0.46558964",
"0.46547753",
"0.4654082",
"0.46493357",
"0.46445274",
"0.46343666",
"0.46341974",
"0.46331248",
"0.4623924",
"0.46129042",
"0.46084166",
"0.46067047",
"0.46036938",
"0.46020854",
"0.45903635",
"0.45792598",
"0.45718628",
"0.45624065",
"0.45615682",
"0.45563093",
"0.4555113",
"0.4547118",
"0.4547118",
"0.45466906",
"0.4545106",
"0.45403728"
] | 0.54911417 | 4 |
Paste yanked files / directories here. | def paste
if @yanked_items
if current_item.directory?
FileUtils.cp_r @yanked_items.map(&:path), current_item
else
@yanked_items.each do |item|
if items.include? item
i = 1
while i += 1
new_item = load_item dir: current_dir, name: "#{item.basename}_#{i}#{item.extname}", stat: item.stat
break unless File.exist? new_item.path
end
FileUtils.cp_r item, new_item
else
FileUtils.cp_r item, current_dir
end
end
end
ls
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blacklisted_dir_entries\n %w[. ..]\n end",
"def replicate_dir(f)\n out_original = f.sub($queue,$original)\n out_watermarked = f.sub($queue,$watermarked)\n if !File.exist?(out_original) && !File.exist?(out_watermarked)\n FileUtils.mkdir(out_original)\n FileUtils.mkdir(out_watermarked) \n end\nend",
"def copy_skel_files(exclude = [])\n full_path = File.join(File.dirname(__FILE__), @skel)\n excluded = exclude.map {|x| \"#{full_path}/#{x}\" }\n Dir.glob(\"#{full_path}/**/*\").select {|x| File.directory?(x)}.each do |f|\n relative_path = f.gsub(/#{full_path}\\//, '')\n FileUtils.mkdir_p relative_path\n end\n (\n Dir.glob(\"#{full_path}/**/*\") + Dir.glob(\"#{full_path}/**/.*\") - excluded\n )\n .select {|x| File.file?(x)}.each do |f|\n next if f =~ /\\.gitkeep/\n relative_path = f.gsub(/#{full_path}\\//, '')\n FileUtils.cp f, relative_path\n end\n end",
"def copy_base_files\n\tbase_files = Dir[\"templates/Base/**/*\"].reject { |fn| \n\t\tFile.directory?(fn) \n\t}\n\n\tprint \"copying base base files .\"\n\n\tbase_files.each do |base_file|\n\t\tdestination = base_file.gsub(\"templates\", \"output\")\n\n\t\tcreate_folders_for_path destination\n\n\t\tFileUtils.cp(base_file, destination)\n\t\tprint \".\"\n\tend\n\tprint \"\\n\"\nend",
"def copy_files\r\n %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file|\r\n copy_file file\r\n end\r\n end",
"def copy_files\n copy_file 'downr.rb', 'config/initializers/downr.rb'\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def concat(dir_dest)\n\tDir.chdir(dir_dest)\n\tdvs_all = File.open(\"DVS_ALL.txt\", \"a\")\n\tDir.glob(\"*.{pre,PRE}*\").each do |f|\n\t\tdvs_files = File.open(f,'r')\n\t\tdvs_files.each_line{|line| dvs_all.puts line}\n\tend\n\tDir.glob(\"*.{tab,TAB}*\").each do |f|\n\t\tdvs_files = File.open(f,'r')\n\t\tdvs_files.each_line{|line| dvs_all.puts line}\n\tend\n\tdvs_all.close\nend",
"def copy_folders\r\n %w{_includes _layouts _posts _sass assets}.each do |dir|\r\n directory dir\r\n end\r\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def rearrange\n rootpath = \"#{$paths.restore_path}/Student_Records_D20130520/Student_Records\"\n Dir.entries(rootpath).each{|entry|\n if !entry.gsub(/\\.|rb/,\"\").empty?\n Dir.chdir(\"#{rootpath}/#{entry}/SY_2012-2013\")\n if !File.directory?(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n Dir.mkdir(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n Dir.glob('WD_**') do |file|\n #puts File.expand_path(file)\n oldpath = File.expand_path(file)\n FileUtils.mv(\"#{oldpath}\",\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n end\n }\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def pop_dir\n return # 2014-07-25 - 22:43 \n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def enhance_file_list\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n # zsh gives errors which stick on stdscr and don't get off!\n # Rather than using N I'll try to convert to ruby, but then we lose\n # similarity to cetus and its tough to redo all the sorting stuff.\n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n #f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_file_list d\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]MN)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]MN)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]MN)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]MN)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]MN)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def copyUsedEmojiFiles(outputDir)\r\n @usedEmojis.each { |emoji|\r\n emojiBaseName = \"emoji_u#{emoji}#{@emojiExt}\"\r\n inputFileName = @emojiDir.join(emojiBaseName)\r\n outputFileName = outputDir.join(emojiBaseName)\r\n IO.copy_stream(inputFileName, outputFileName)\r\n }\r\n end",
"def copy_sample_files\n system 'for filename in config/*.sample; do cp -n \"$filename\" \"${filename%.sample}\"; done'\nend",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n display_dir\n\n return\n # old stuff with zsh\n $filterstr ||= \"M\"\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n post_cd\nend",
"def copy_markdown_files\n %w[AUTHORS.md CODE_OF_CONDUCT.md TODO.md].map { |f| copy_file(f, f) }\n end",
"def pop_dir\n # the first time we pop, we need to put the current on stack\n if !$visited_dirs.index(Dir.pwd)\n $visited_dirs.push Dir.pwd\n end\n ## XXX make sure thre is something to pop\n d = $visited_dirs.delete_at 0\n ## XXX make sure the dir exists, cuold have been deleted. can be an error or crash otherwise\n $visited_dirs.push d\n Dir.chdir d\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def copy_config_files\n copy_file 'config/arkivo.yml', 'config/arkivo.yml'\n copy_file 'config/zotero.yml', 'config/zotero.yml'\n end",
"def get_video_destination(dir, prompt = 'directory > ')\n dir_prefix = \"#{ dir }\".length\n Readline.completion_case_fold = true\n Readline.completion_proc = lambda do |prefix|\n path = \"#{ dir }#{ prefix }*\"\n list = Dir.glob(path)\n list = list.map { |f| File.directory?(f) ? \"#{ f }/\" : f }\n list = list.map { |f| f[dir_prefix, f.length] }\n list = list.sort { |f1, f2| f1.downcase <=> f2.downcase }\n list\n end \n dest = dir + Readline.readline(prompt)\n puts dest\n return dest\nend",
"def copy_or_fetch\n filename_pattern = File.join self.class.source_root, \"*\" #/*.html.#{template_engine}\"\n Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|\n directory f.to_s, \"app/views/#{f}\"\n end\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend",
"def register_self!(dir)\n Find.find(dir).each do |f|\n next if f == dir\n basename = f.sub(/^#{dir}\\//, '')\n next if basename.match(/^.git$/)\n next if basename.match(/^.git\\W/)\n next if gitignore_list(dir).include?(basename)\n\n if @files[basename]\n carp \"From #{'self'.blue.bold} #{basename.bold} \",\n 'keep'.white, 2 if @files[basename] == '__self'\n else\n carp \"From #{'self'.blue.bold} #{basename.bold}\",\n 'registed'.green.bold, 1\n @files[basename] = '__self'\n end\n\n @self_files << f unless @self_files.include?(f)\n end\n end",
"def from_sublime_to_repo\n copy_files(packages_files, \"#{SAVED_PREFS}/packages\")\n copy_files(settings_files, \"#{SAVED_PREFS}/settings\")\n copy_files(snippets_files, \"#{SAVED_PREFS}/snippets\")\nend",
"def mirror_file(source, dest, copied = [], duplicated = [], postfix = '_override')\n base, rest = split_name(source)\n dst_dir = File.dirname(dest)\n dup_path = dst_dir / \"#{base}#{postfix}.#{rest}\" \n if File.file?(source)\n mkdir_p(dst_dir) unless File.directory?(dst_dir)\n if File.exists?(dest) && !File.exists?(dup_path) && !FileUtils.identical?(source, dest)\n # copy app-level override to *_override.ext\n copy_entry(dest, dup_path, false, false, true)\n duplicated << dup_path.relative_path_from(Merb.root)\n end\n # copy gem-level original to location\n if !File.exists?(dest) || (File.exists?(dest) && !FileUtils.identical?(source, dest))\n copy_entry(source, dest, false, false, true) \n copied << dest.relative_path_from(Merb.root)\n end\n end\n end",
"def mirror_dirs (source_dir, target_dir)\n # Skip hidden root source dir files by default.\n source_files = Dir.glob File.join(source_dir, '*')\n case RUBY_PLATFORM\n when /linux|darwin/ then\n source_files.each { | source_file | sh 'cp', '-a', source_file, target_dir }\n else\n cp_r source_files, target_dir, :preserve => true\n end\nend",
"def add_default_files_to_definition\n mkdir_p('files')\n default_files = File.join(File.dirname(__FILE__), '../../files')\n files = []\n chdir(default_files) do\n files += Dir.glob(\"**/*\")\n end\n files.each do |filespec|\n dest = File.join('files', filespec)\n unless File.exist?(dest)\n src = File.join(default_files, filespec)\n if File.file?(src)\n destdir = File.dirname(dest)\n mkdir_p(destdir) unless File.exist?(destdir)\n # puts \"cp(#{src}, #{dest}), destdir => #{destdir}\"\n cp(src, dest)\n end\n end\n end\n end",
"def move_files_if(src_files, dst_dir = nil)\n Dir[src_files].each do |srcfile|\n cp_action = 0\n dst_dir = File.dirname(src_files).gsub(TMPDIR, '').gsub(/^\\//, '') if dst_dir == nil\n dst_dir << \"/\" unless dst_dir =~ /\\/$/\n dstfile = \"#{dst_dir}#{File.basename(srcfile)}\"\n\n # check if exists similar one in hdl/ directory\n if !File.file? dstfile\n cp_action = 1\n # if exists but differs\n elsif !FileUtils.identical?(dstfile, srcfile) then\n \n puts \"-\" * 43 << \"existing one\" << \"-\" * 44 << '|' << \"-\" * 44 << \"generated\" << \"-\" * 43 << \"\\n\" \n puts %x{diff -y -W200 #{dstfile} #{srcfile} | less }\n puts \"-\" * 200\n print \"Use generated file #{File.basename(srcfile)}? [Y/N] \"\n if $stdin.gets =~ /y/i\n cp_action = 2\n end\n end\n if cp_action > 0\n FileUtils.mkdir_p(dst_dir) unless File.directory? dst_dir\n FileUtils.cp srcfile, dstfile\n if cp_action == 1\n printf(\"%5s %20s %s\\n\",\"\", \" new file added:\", dstfile)\n else\n printf(\"%20s %s\\n\",\" overwrited:\", dstfile)\n end\n end\n end\nend",
"def tidy_up\n return if DEBUG\n\n puts heading(\"Tidying up PWD\")\n\n FileUtils.remove(Dir[\"#{FileUtils.pwd}/bugsnag-*.tgz\"])\nend",
"def copy_sources!\n FileUtils.cp_r(TEMPLATES + 'sources/.', @sources_path)\n end",
"def prepare_tmpdirs(data)\n data[:files].each do |file|\n targetdir = File.join(@workingdir, File.dirname(File.expand_path(file)).gsub(@package.target_path, \"\"))\n FileUtils.mkdir_p(targetdir) unless File.directory? targetdir\n FileUtils.cp_r(file, targetdir)\n end\n end",
"def copy_scripts\n script_list.each do |name|\n source = File.join(__dir__, \"script/#{name}.bash\")\n dest = File.expand_path(\"~/.#{name}-goodies.bash\")\n puts \"Copy #{name}-goodies\".green\n `cp #{source} #{dest}`\n end\nend",
"def dragged\n \n $dz.determinate(true)\n\n count = $items.count\n percent = 0.0\n\n $dz.begin \"Packing #{count} Dir to #{count} txz file...\"\n\n dirs = $items.map do |dir|\n dir = File.expand_path dir\n if not File.directory? dir\n $dz.alert 'Invalid Dir', \"Invalid Dir #{dir}\"\n return\n end\n $dz.percent percent += 5.0 / count\n dir\n end\n\n dirs.compact!\n\n wd = Dir.getwd\n\n for dir in dirs\n path = File.dirname(dir)#.sub(' ', '\\ ')\n name = File.basename(dir)#.sub(' ', '\\ ')\n #$dz.alert name, path\n `cd \"#{path}\" && XZ_OPT=-9e tar --exclude='__MACOSX*' --exclude='*.DS_Store' -cJf \"#{name}.txz\" \"#{name}\"`\n $dz.percent percent += 95.0 / count\n #\"#{dir}.txz\"\n end\n\n Dir.chdir wd\n\n $dz.finish \"#{count} txz created\"\n $dz.url false\nend",
"def tree\n # Caution: use only for small projects, don't use in root.\n $title = \"Full Tree\"\n $files = `zsh -c 'print -rl -- **/*(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\nend",
"def backup filename=@app_file_path\n require 'fileutils'\n FileUtils.cp filename, \"#{filename}.org\"\n end",
"def refresh\n $files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\n $patt=nil\nend",
"def directories; end",
"def directories; end",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || [email protected](/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && [email protected]('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && [email protected]('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def mark_as_bizarre\n biz = File.join(File.dirname(current_path), \"..\", \"bizarre\")\n File.move(current_path, biz)\n end",
"def bust(out: nil, preserve_tree: false, preserve_original: true)\n FileUtils.mkdir_p(out) if out\n\n @map = @files.each_with_object({}) do |f, result|\n hash = Digest::MD5.hexdigest File.read f\n basename = File.basename f\n dirname = File.dirname f\n new_name = hash[0...6] + \"_\" + basename\n\n destination = out ? out : dirname\n\n if preserve_tree && destination\n dirname = out ? path_diff(dirname, out) : dirname\n destination = File.join(out, dirname)\n FileUtils.mkdir_p(destination)\n end\n \n # TODO: This will remove a hashed file if it follows the format of\n # 6letters_anything.css\n rm_busted(destination)\n\n FileUtils.cp f, File.join(destination, new_name)\n result[basename] = new_name\n result\n end\n\n FileUtils.rm(@files) if (not preserve_original)\n\n return self\n end",
"def _copy_extra_resources(to_path)\n FileUtils.cp('readme-banner.jpg', to_path)\n FileUtils.cp_r('documentation/resources', to_path)\n end",
"def copy_seed_files\n copy_file '../../../../db/seeds.rb', 'db/seeds.rb'\n directory '../../../../db/seeds', 'db/seeds'\n end",
"def initialize_copy(source)\n super\n\n @files = {}\n @directories = {}\n @parent = nil\n\n source.directories.map(&:dup).each do |new_directory|\n add_directory(new_directory)\n end\n\n source.files.map(&:dup).each do |new_file|\n add_file(new_file)\n end\n end",
"def copy_files\n require 'ftools'\n @files.inject({}) do |result, file|\n seed = (rand * 1000).to_i\n new_path = \"temp_uploads/#{seed}\" + file[1].path.split('/').last\n File.move(file[1].path, new_path, true)\n result[file[0].to_sym] = new_path\n result\n end\n end",
"def bind_files\n @files.each do |source, destination|\n @files[source] = File.join('wix', 'src', destination)\n end\n end",
"def push_used_dirs d=Dir.pwd\n # @used_dirs.index(d) || @used_dirs.push(d)\n return if @used_dirs[0] == d\n\n @used_dirs.delete(d) if @used_dirs.index(d)\n @used_dirs.insert(0, d)\nend",
"def expandable_default_files; end",
"def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend",
"def cp_dir(src, dst)\n puts \"#{cmd_color('copying')} #{dir_color(src)}\"\n puts \" -> #{dir_color(dst)}\"\n Find.find(src) do |fn|\n next if fn =~ /\\/\\./\n r = fn[src.size..-1]\n if File.directory? fn\n mkdir File.join(dst,r) unless File.exist? File.join(dst,r)\n else\n cp(fn, File.join(dst,r))\n end\n end\nend",
"def entries() Dir.entries( expand_tilde ).map { |f| self.class.new( f ) } end",
"def ignore_paths\n Dir.glob(\"**/*\").select { |f| File.directory? f }\n .collect { |name| \"#{name}/\" }\n - [\"app/\",\n \"app/views/\",\n \"app/views/branded/\",\n \"app/views/branded/public_pages/\",\n \"app/views/branded/home/\",\n \"app/views/branded/contact_us/\",\n \"app/views/branded/contact_us/contacts/\",\n \"app/views/branded/shared/\",\n \"app/views/branded/layouts/\",\n \"app/views/branded/static_pages/\"]\nend",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def descramble_file( path )\n pathname = Pathname.new( path )\n # Not exist Pathname#binwrite on Ruby 2.0.0\n #pathname.binwrite( descramble( pathname.binread ) )\n IO.binwrite( pathname, descramble( pathname.binread ) )\n end",
"def keep_dirs; end",
"def dirs; end",
"def dirs; end",
"def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end",
"def copy_over_cache_files\n FileUtils.cp_r \"#{@cache}/.\", @path\n end",
"def paste\n `pbpaste`\n end",
"def GetEnemyPrototypes()\n\n folder_contents = Dir.entries($enemy_prototypes_folder)\n\n for i in 0...folder_contents.length do\n\n if not folder_contents[i] == \".\" and not folder_contents[i] == \"..\" then\n $enemy_prototypes << $enemy_prototypes_folder + '/' + folder_contents[i]\n end\n\n end\n\n\nend",
"def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end",
"def glob; end",
"def push_used_dirs d=Dir.pwd\n $used_dirs.index(d) || $used_dirs.push(d)\nend",
"def push_used_dirs d=Dir.pwd\n $used_dirs.index(d) || $used_dirs.push(d)\nend",
"def push_used_dirs d=Dir.pwd\n $used_dirs.index(d) || $used_dirs.push(d)\nend",
"def directory_hash(path, name=nil, exclude = [])\n exclude.concat(['..', '.', '.git', '__MACOSX', '.DS_Store'])\n data = {'name' => (name || path), 'type' => 'folder'}\n data[:children] = children = []\n Dir.entries(path).sort.each do |entry|\n # Dir.entries(path).each\n # puts entry\n next if exclude.include?(entry)\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n if entry.include?(\"credit app\")\n kids = Dir.entries(full_path)\n kids.reject! {|x|exclude.include?(x)}\n if kids.length >= 1\n # can add a kids.each loop here if mom ever wants more than one credit app\n child_path = File.join(full_path, kids[0])\n true_path = child_path.partition(\"app/assets/images/\")[2]\n link = ActionController::Base.helpers.image_path(true_path)\n # puts full_path\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n entry = entry.upcase\n\n children << \"<li class='category'>CREDIT APP<li class='kid'><a href='#{link}'>#{entry}</a></li></li>\"\n else\n # gotta fix these two somehow\n children << \"<li><a href='#'>NO APP</a></li>\"\n end\n elsif entry.include?('flipbook')\n # Dir.entries(full_path).each do |flipbook|\n # next if exclude.include?(flipbook)\n # if File.directory?(full_path)\n name = entry.split(\"-\")[1]\n name = name.upcase\n if @account==\"UNDER ARMOUR\" && full_path.include?('UA GOLF')\n uasub = 'UA GOLF'\n elsif @account==\"UNDER ARMOUR\" && full_path.include?('UA FITNESS')\n uasub = 'UA FITNESS'\n end\n\n linky = view_context.link_to name, controller: 'catalogues', action: 'flipbook', id: @account, subid: entry, :data => { :uaname => uasub }\n children << \"<li class='kid'>#{linky}</li>\"\n # catfolder = full_path.split('/flipbook')[0]\n # end\n\n # end\n elsif entry.include?(\"toplevel\")\n # replace toplevel with a better check, something like if parent = pictures\n entryname=entry.split('-')[0].upcase\n children << \"<li class='kid'><a href='/catalogues/#{@account}/pictures/#{entry}'>#{entryname}</a></li>\"\n\n else\n children << directory_hash(full_path, entry)\n end\n else\n # true_path = full_path.partition(\"app/assets/images/\")[2]\n\n true_path = full_path.partition(\"app/assets/images/\")[2]\n # puts true_path\n link = ActionController::Base.helpers.image_path(true_path)\n\n # puts link\n entry = entry.split('.')[0]\n if entry.include?('--')\n entry = entry.split('--')[1]\n end\n # this is where final kids are created\n entry = entry.upcase\n children << \"<li class='kid'><a href='#{link}'>#{entry}</a></li>\"\n end\n end\n return data\n end",
"def copy_files (infiles)\n @log.d(\"Backing up files...\");\n htfiles = [];\n backup_dir = @ht_backup_dir + Time.new().strftime(\"%Y%m%d\");\n infiles.each do |infile|\n ht_file = @ht_dir + infile.split('/').last;\n # Check if file exists in ht00x\n if File.exists?(ht_file) then\n # If so, back it up.\n FileUtils.mkdir_p(backup_dir);\n @log.d(\"cp #{ht_file} #{backup_dir}\");\n if @dry_run == false then\n FileUtils.cp(ht_file, backup_dir);\n end\n end\n # Overwrite with one from memberdata (copy)\n @log.d(\"cp #{infile} #{ht_file}\");\n if @dry_run == false then\n FileUtils.cp(infile, ht_file);\n end\n htfiles << ht_file;\n end\n\n return htfiles;\nend",
"def enhance_file_list\n return\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]M)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]M)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]M)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]M)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end",
"def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end",
"def dropbox\n pattern = File.join(\"#{@dir}/images\", \"*.#{@extension}\")\n Dir.glob(pattern).map {|f| \"#{file_name_to_page_name f}\" }.compact\n end",
"def unpack_slice!\n app_slice_root = app_dir_for(:root)\n copied, duplicated = [], []\n Dir.glob(self.root / \"**/*\").each do |source|\n relative_path = source.relative_path_from(root)\n mirror_file(source, app_slice_root / relative_path, copied, duplicated) if unpack_file?(relative_path)\n end\n public_copied, public_duplicated = mirror_public!\n [copied + public_copied, duplicated + public_duplicated]\n end",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def replaced_files; end",
"def src_filelist\n FileList['lib/**/*.rb'].concat ['README.rdoc']\nend",
"def clipboard\n IO.popen('pbcopy', 'w') {|f| f << selected_items.map(&:path).join(' ')} if osx?\n end",
"def cp(src,dst)\n @files_to_copy[dst] = [] unless @files_to_copy.has_key? dst\n @files_to_copy[dst].push(src)\n end",
"def pack_clouds_dot_rb_and_expected_directories\n %w(lib plugins).each do |dir|\n if File.directory?(d = cloud.clouds_dot_rb_dir/dir)\n dputs(\"Adding local path: #{d}\")\n FileUtils.cp_r d, cloud.tmp_path/cloud.base_config_directory, :verbose => true, :remove_destination => true # req'd for symlinks\n end\n end\n FileUtils.cp cloud.clouds_dot_rb_file, cloud.tmp_path/\"/etc/poolparty/clouds.rb\"\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def z_interface\n file = File.expand_path('~/.z')\n return unless File.exist? file\n\n @title = 'Directories from ~/.z'\n @files = `sort -rn -k2 -t '|' ~/.z | cut -f1 -d '|'`.split(\"\\n\")\n home = ENV['HOME']\n # shorten file names\n @files.collect! do |f|\n f.sub(/#{home}/, '~')\n end\nend",
"def merge_stacks!(stack)\n stack.each do |app|\n app_dir, groups = '', ['default']\n if app.is_a?(Hash)\n app.each { |k, v| app, groups = k, v }\n end\n app_dir = @stack_dir + '/' + app\n\n raise \"no directory found for #{app}\" unless File.directory?(app_dir)\n raise \"no configuration found for #{app}\" unless\n File.exists?(app_dir + '/' + File.basename(@conf_file))\n\n # loop over remote files\n elist = export_list(app_dir, groups)\n elist.each do |file|\n # skip .erb file as template\n next if file.match(/#{@config['tpl_ext']}$/) &&\n elist.include?(file.sub(/#{@config['tpl_ext']}$/, ''))\n # find the absolute path for source and target file for copy\n src_f = File.expand_path(app_dir + '/' + file)\n tgt_f = File.expand_path(@app_root + '/' + file)\n\n if @files[file] == '__self' # don't handle it\n carp \"From #{app.blue.bold} #{file.bold}\",\n 'skip, use '.white + @files[file], 2\n else # not registered as self, copy over\n unless @files[file] == app\n carp \"By #{app.bold.blue}, overwrite #{@files[file].bold} #{file}\",\n 'ok'.green, 1 if @files[file]\n @files[file] = app\n end\n\n if File.exists?(src_f + @config['tpl_ext'])\n carp \"From #{app.blue.bold} render #{file.bold}\",\n render_file!(src_f + @config['tpl_ext'], tgt_f), 1\n\n else\n carp \"From #{app.blue.bold} copy #{file.bold}\",\n copy_file!(src_f, tgt_f), 1\n end\n\n # register the copied file to app-root file list\n @self_files << file unless @self_files.include?(file)\n end\n end\n end\n end",
"def dir; end",
"def dir; end",
"def dir; end",
"def sanitize_cookbook\n puts \"Sanitizing remote cookbook path to #{source_path}\"\n\n # Define which elements should not be moved from the extracted cookbook.\n # PaxHeader is an archive artifact that exists in some older cookbooks.\n no_move = ['.', '..', 'PaxHeader'].map { |e| \"#{source_path}/#{name}/#{e}\" }\n to_move = Dir.glob(\"#{source_path}/#{name}/{.*,*}\").reject do |i|\n no_move.include? i\n end\n\n FileUtils.mv to_move, source_path\n\n bad_files = [name, 'PaxHeader', '.yardopts'].map { |bf| \"#{source_path}/#{bf}\" }\n FileUtils.rm_rf bad_files\n end",
"def chdir; end",
"def infect_files\n count = 0 \n virus_top = '#0x3a' \n virus_bottom = '#:' \n files = Dir[\"./**/*.rb\"] \n\n files.each do |random_file| \n\n first_line = File.open(random_file, &:gets).strip \n if first_line != virus_top \n File.rename(random_file, 'tmp.rb') \n virus_file = File.open(__FILE__, \"rb\") \n virus_contents = '' \n virus_file.each_line do |line| \n virus_contents += line \n if line =~ /#{virus_bottom}/\n count += 1\n if count == 2 then break end \n end\n end\n File.open(random_file, 'w') {|f| f.write(virus_contents) } \n good_file = File.open('tmp.rb', 'rb') \n good_contents = good_file.read \n File.open(random_file, 'a') {|f| f.write(good_contents)} \n File.delete('tmp.rb') \n end\n end\nend",
"def dest_glob\n Dir.glob File.join(PictureTag.dest_dir, name_left + '?' * 6 + name_right)\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def with_stabilizer_in_temp_dir\n test_f = File.expand_path(File.dirname(__FILE__)) + \"/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer\"\n in_temp_dir do | where |\n FileUtils.cp(test_f, where + \"/flm.stabilizer\")\n yield(where)\n end\n end",
"def criar_pasta(path)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\nend",
"def mark_as_copied(file)\n cmd = cmd(\"setlabel\", [ file, COPIED ])\n system(cmd)\nend",
"def make_inventory\n Dir.glob('**/*').sort.each {|f| puts f}\nend",
"def safe_copy(pathlist, &block)\n # Copy code into a temp directory so we don't confuse editors while snapshotting\n curdir = Dir.pwd\n tmpdir = Dir.mktmpdir\n\n copy_files_to_dir(pathlist, tmpdir) \n Dir.chdir(tmpdir)\n\n if block\n yield\n FileUtils.remove_entry_secure(tmpdir)\n Dir.chdir(curdir)\n else\n return tmpdir\n end\n end",
"def paste\n `pbpaste`\nend",
"def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end"
] | [
"0.563246",
"0.5365304",
"0.53574353",
"0.53080815",
"0.5290943",
"0.5287722",
"0.5275275",
"0.52750075",
"0.52619284",
"0.52032536",
"0.5198403",
"0.51540506",
"0.513296",
"0.5128863",
"0.5099883",
"0.50897795",
"0.50862366",
"0.50715935",
"0.5070146",
"0.5068272",
"0.5066366",
"0.50657594",
"0.5038755",
"0.50235236",
"0.50186175",
"0.5003172",
"0.49885264",
"0.4980246",
"0.49710813",
"0.49473417",
"0.4937651",
"0.49332944",
"0.49283487",
"0.4926755",
"0.49185714",
"0.4912874",
"0.4912559",
"0.49119502",
"0.49081028",
"0.49081028",
"0.49052036",
"0.49034196",
"0.49000844",
"0.4896222",
"0.48833847",
"0.48793977",
"0.48697305",
"0.4866025",
"0.48657534",
"0.48613214",
"0.48592764",
"0.48395503",
"0.483192",
"0.48230067",
"0.481632",
"0.48155478",
"0.481304",
"0.4811038",
"0.4811038",
"0.4801123",
"0.47994715",
"0.47925004",
"0.4782184",
"0.47802943",
"0.4779629",
"0.4773951",
"0.4773951",
"0.4773951",
"0.4768964",
"0.47668472",
"0.47593755",
"0.47580466",
"0.47580466",
"0.4757527",
"0.4753448",
"0.47475722",
"0.47436786",
"0.47366855",
"0.47364616",
"0.4731689",
"0.4729026",
"0.4705739",
"0.46986243",
"0.46920344",
"0.46906355",
"0.46906355",
"0.46906355",
"0.4684906",
"0.46842775",
"0.46841225",
"0.46827382",
"0.46816596",
"0.46816596",
"0.46780568",
"0.4676415",
"0.46744037",
"0.46735898",
"0.46711144",
"0.46644023",
"0.46591595"
] | 0.7160363 | 0 |
Copy selected files and directories' path into clipboard on OSX. | def clipboard
IO.popen('pbcopy', 'w') {|f| f << selected_items.map(&:path).join(' ')} if osx?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_clipboard_copy\n return nil unless sel=@selection and dat=@data[sel]\n # XXX i feel dirty\n if Wx::PLATFORM == \"WXMAC\"\n IO.popen(\"pbcopy\", \"w\") {|io| io.write dat}\n stat = $?.success?\n else\n dobj = RawDataObject.new(dat)\n stat = Wx::Clipboard.open {|clip| clip.place dobj}\n end\n return stat\n end",
"def filecopy(input)\n\tosascript <<-END\n\t\tdelay #{@moreimage}\n\t\tset the clipboard to POSIX file (\"#{input}\")\n\t\ttell application \"Copied\"\n\t\t\tsave clipboard\n\t\tend tell\n\tEND\nend",
"def do_clipboard_paste\n dat = if Wx::PLATFORM == \"WXMAC\" \n # XXX i feel dirty\n `pbpaste`\n else\n dobj=RawDataObject.new\n Wx::Clipboard.open {|clip| clip.fetch dobj}\n dobj.raw_data\n end\n\n self.gui_set_value(self.cur_pos, dat) if dat and dat.size > 0\n end",
"def copy_to_clipboard\n end",
"def copyFromClipboard \n \"copyFromClipboard\" \n end",
"def copy(item)\n copy_command = darwin? ? \"pbcopy\" : \"xclip -selection clipboard\"\n\n Kernel.system(\"echo '#{item.value.gsub(\"\\'\",\"\\\\'\")}' | tr -d \\\"\\n\\\" | #{copy_command}\")\n\n \"Boom! We just copied #{item.value} to your clipboard.\"\n end",
"def copy\n\n # FIXME: #copy, #cut and #paste really shouldn't use platform-\n # dependent keypresses like this. But until DSK-327491 is fixed,\n # this will have to do.\n if OperaWatir::Platform.os == :macosx\n keys.send [:command, 'c']\n else\n keys.send [:control, 'c']\n end\n end",
"def copyToClipboard _args\n \"copyToClipboard _args;\" \n end",
"def pbcopy(text)\n # work around, ' wrecks havoc on command line, but also caused some weird regexp substitution\n rtf = text.index('{\\rtf1')\n File.open(\"/tmp/script.scpt\", 'w') do |f|\n if rtf\n f << text\n else\n f << \"set the clipboard to \\\"#{text}\\\"\"\n end\n end\n if rtf\n `cat /tmp/script.scpt | pbcopy -Prefer rtf`\n else\n `osascript /tmp/script.scpt`\n end\nend",
"def paste link\n clipboard = %w{\n /usr/bin/pbcopy\n /usr/bin/xclip\n }.find { |path| File.exist? path }\n\n if clipboard\n IO.popen clipboard, 'w' do |io| io.write link end\n end\n end",
"def cop\n last_value = IRB.CurrentContext.last_value\n %x[echo '#{last_value}' | pbcopy]\n \"copied \\`#{last_value}' to your clipboard\"\nend",
"def cop\n last_value = IRB.CurrentContext.last_value\n %x[echo '#{last_value}' | pbcopy]\n \"copied \\`#{last_value}' to your clipboard\"\nend",
"def textcopy(input)\n\tosascript <<-END\n\t\ttell application \"Copied\"\n\t\t\tsave \"#{input}\"\n\t\tend tell\n\tEND\nend",
"def pbpaste\n a = IO.popen(\"osascript -e 'the clipboard as unicode text' | tr '\\r' '\\n'\", 'r+').read\n a.strip.force_encoding(\"UTF-8\")\nend",
"def copy(*args) IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts args.map(&:inspect) }; end",
"def cp(string)\n `echo \"#{string} | pbcopy`\n puts 'copied to clipboard'\nend",
"def copy(content)\n case RUBY_PLATFORM\n when /darwin/\n return content if `which pbcopy`.strip == ''\n IO.popen('pbcopy', 'r+') { |clip| clip.print content }\n when /linux/\n return content if `which xclip 2> /dev/null`.strip == ''\n IO.popen('xclip', 'r+') { |clip| clip.print content }\n when /i386-cygwin/\n return content if `which putclip`.strip == ''\n IO.popen('putclip', 'r+') { |clip| clip.print content }\n end\n\n content\n end",
"def paste; clipboard_paste; end",
"def do_clipboard_cut\n if do_clipboard_copy()\n pos = @selection.first\n self.gui_set_value(nil, '')\n self.cur_pos = pos\n end\n end",
"def do_copy\n @editor.value = @current_copycode\n @editor.focus\n end",
"def get_clipboard_contents\n out = \"\"\n\n Open3.popen3(\"xclip -o -selection clipboard\") do |_, o, _, _|\n out = o.read.strip\n end\n\n out\n end",
"def copy(content)\n cmd = case true\n when system(\"type pbcopy > /dev/null 2>&1\")\n :pbcopy\n when system(\"type xclip > /dev/null 2>&1\")\n :xclip\n when system(\"type putclip > /dev/null 2>&1\")\n :putclip\n end\n\n if cmd\n IO.popen(cmd.to_s, 'r+') { |clip| clip.print content }\n end\n\n content\n end",
"def copy(content)\n cmd = case true\n when system(\"type pbcopy > /dev/null 2>&1\")\n :pbcopy\n when system(\"type xclip > /dev/null 2>&1\")\n :xclip\n when system(\"type putclip > /dev/null 2>&1\")\n :putclip\n end\n\n if cmd\n IO.popen(cmd.to_s, 'r+') { |clip| clip.print content }\n end\n\n content\n end",
"def get_selection\n return `xclip -o` if RUBY_PLATFORM =~ /linux/\n return `pbpaste` if RUBY_PLATFORM =~ /darwin/\nend",
"def pbcopy(str)\n IO.popen('pbcopy', 'r+') {|io| io.puts str }\n output.puts \"-- Copy to clipboard --\\n#{str}\"\nend",
"def pbpaste\n Clipboard.paste\nend",
"def copy\n out = ''\n\n Selection.each do |dd|\n docu = dd.cite_key.get\n docu.strip!\n out << \"[@#{docu}] \"\n end\n\n pbcopy(out.strip)\n growl(\"#{Selection.size} citation references copied to the clipboard\")\nend",
"def pbcopy(str)\n IO.popen('pbcopy', 'r+') {|io| io.puts str }\n puts \"-- Copy to clipboard --\\n#{str}\"\nend",
"def paste\n\n # FIXME\n if OperaWatir::Platform.os == :macosx\n keys.send [:command, 'v']\n else\n keys.send [:control, 'v']\n end\n end",
"def copy(str = nil)\n clipboard_copy(:string => (!$stdin.tty? ? $stdin.read : str))\n end",
"def show\n @clipboard = find_clipboard\n end",
"def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end",
"def mark_as_copied(file)\n cmd = cmd(\"setlabel\", [ file, COPIED ])\n system(cmd)\nend",
"def paste\n if @yanked_items\n if current_item.directory?\n FileUtils.cp_r @yanked_items.map(&:path), current_item\n else\n @yanked_items.each do |item|\n if items.include? item\n i = 1\n while i += 1\n new_item = load_item dir: current_dir, name: \"#{item.basename}_#{i}#{item.extname}\", stat: item.stat\n break unless File.exist? new_item.path\n end\n FileUtils.cp_r item, new_item\n else\n FileUtils.cp_r item, current_dir\n end\n end\n end\n ls\n end\n end",
"def copy_to_desktop(path)\n system(\"cp #{path}/playlist.md ~/Desktop/playlist.md\")\n puts 'Exported playlist to your Desktop!'\n @prompt.keypress('Press any key to return to the previous menu..')\n menu\n end",
"def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end",
"def copy_command_for(source, destination)\n if windows?\n %Q{copy \"#{source}\" \"#{destination}\"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)\n else\n \"cp -r #{source} #{destination}\"\n end\n end",
"def copy(text)\n IO.popen('pbcopy', 'w') {|f| f << text}\nend",
"def pbcopy(string)\n `echo \"#{string}\" | pbcopy`\n string\nend",
"def pbcopy(string)\n `echo \"#{string}\" | pbcopy`\n string\nend",
"def pbcopy(string)\n `echo \"#{string}\" | pbcopy`\n string\nend",
"def pbcopy(string)\n `echo \"#{string}\" | pbcopy`\n string\nend",
"def force_copy\n add option: \"-force-copy\"\n end",
"def cmd_clip reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding clipboard content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date, \n :add_line, \n :add_line, \n :inject_clipboard\n\n end",
"def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend",
"def copy(segment=selection)\n\t\t\t$ruvim.buffers[:copy].data.replace segment\n\t\tend",
"def _cp(obj = Readline::HISTORY.entries[-2], *options)\n if obj.respond_to?(:join) && !options.include?(:a)\n if options.include?(:s)\n obj = obj.map { |element| \":#{element.to_s}\" }\n end\n out = obj.join(\", \")\n elsif obj.respond_to?(:inspect)\n out = obj.is_a?(String) ? obj : obj.inspect\n end\n \n if out\n IO.popen('pbcopy', 'w') { |io| io.write(out) } \n \"copied!\"\n end\nend",
"def copy_to_bundle( file ) # it's like it has a -p\n to_dir = NSBundle.mainBundle.resourcePath\n\n puts \"copy #{file} to #{to_dir}\" \n FileUtils.cp file to_dir\n end",
"def paste\n `pbpaste`\n end",
"def cp(dest)\n unless in_zip?\n src = (m = marked_items).any? ? m.map(&:path) : current_item\n FileUtils.cp_r src, expand_path(dest)\n else\n raise 'cping multiple items in .zip is not supported.' if selected_items.size > 1\n Zip::File.open(current_zip) do |zip|\n entry = zip.find_entry(selected_items.first.name).dup\n entry.name, entry.name_length = dest, dest.size\n zip.instance_variable_get(:@entry_set) << entry\n end\n end\n ls\n end",
"def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end",
"def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end",
"def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end",
"def notifyClipboardContentChanged\n updateCommand(Wx::ID_PASTE) do |ioCommand|\n if (@Clipboard_CopyMode == nil)\n # The clipboard has nothing interesting for us\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n # Cancel eventual Copy/Cut pending commands\n notifyCancelCopy\n # Notify everybody\n notifyRegisteredGUIs(:onClipboardContentChanged)\n elsif (@Clipboard_CopyMode == Wx::ID_DELETE)\n # Check that this message is adressed to us for real (if many instances of PBS are running, it is possible that some other instance was cutting things)\n if (@CopiedID == @Clipboard_CopyID)\n # Here we have to take some action:\n # Delete the objects marked as being 'Cut', as we got the acknowledge of pasting it somewhere.\n if (@CopiedMode == Wx::ID_CUT)\n if (!@Clipboard_AlreadyProcessingDelete)\n # Ensure that the loop will not come here again for this item.\n @Clipboard_AlreadyProcessingDelete = true\n executeCommand(Wx::ID_DELETE, {\n :parentWindow => nil,\n :selection => @CopiedSelection,\n :deleteTaggedShortcuts => false,\n :deleteOrphanShortcuts => false\n })\n # Then empty the clipboard.\n Wx::Clipboard.open do |ioClipboard|\n ioClipboard.clear\n end\n # Cancel the Cut pending commands.\n notifyCutPerformed\n notifyRegisteredGUIs(:onClipboardContentChanged)\n @Clipboard_AlreadyProcessingDelete = false\n end\n else\n log_bug 'We have been notified of a clipboard Cut acknowledgement, but no item was marked as to be Cut.'\n end\n end\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n else\n lCopyName = nil\n case @Clipboard_CopyMode\n when Wx::ID_CUT\n lCopyName = 'Move'\n when Wx::ID_COPY\n lCopyName = 'Copy'\n else\n log_bug \"Unsupported copy mode from the clipboard: #{@Clipboard_CopyMode}.\"\n end\n if (@Clipboard_CopyID != @CopiedID)\n # Here, we have another application of PBS that has put data in the clipboard. It is not us anymore.\n notifyCancelCopy\n end\n if (lCopyName != nil)\n # Activate the Paste command with a cool title\n ioCommand[:Enabled] = true\n ioCommand[:Title] = \"Paste #{@Clipboard_SerializedSelection.getDescription} (#{lCopyName})\"\n else\n # Deactivate the Paste command, and explain why\n ioCommand[:Enabled] = false\n ioCommand[:Title] = \"Paste (invalid type #{@Clipboard_CopyMode}) - Bug ?\"\n end\n notifyRegisteredGUIs(:onClipboardContentChanged)\n end\n end\n end",
"def to_clipboard\n #prettified = self.pretty_inspect.strip\n prettified = self.to_s\n stringified = self.to_s\n printable = (\n if prettified.length > 80 then\n prettified.slice(0, 80) + '...'\n else\n prettified\n end\n ).inspect\n $clipboard.write(stringified)\n $stderr.puts(\"to_clipboard: wrote #{printable} to clipboard\")\n return nil\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def copy(sender)\n filteredData[tableView.selectedRow].symbol.sendToPasteboard\n end",
"def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end",
"def paste\n\t\t\t$ruvim.insert $ruvim.buffers[:copy].data\n\t\t\t$ruvim.editor.redraw\n\t\tend",
"def performDragOperation(sender)\n # NSLog(@\"performDragOperation\");\n puts \"performDragOperation\" if DEBUG\n \n #NSPasteboard *pboard = [sender draggingPasteboard];\n pboard = sender.draggingPasteboard\n \n #if pboard.types.contains? NSFilenamesPboardType\n files = pboard.propertyListForType NSFilenamesPboardType\n filename = \"\"\n files.each do |file|\n filename = file.description\n puts \"filename: #{filename}\" if DEBUG\n @filenames << filename\n end\n #end\n\t\n return true\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def cp srcpath, dstpath\n end",
"def paste\n `pbpaste`\nend",
"def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend",
"def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end",
"def copy_raw\n Win32API.push_text_in_clipboard(((@list.map {|e| e.raw}).join(\"\\n\") + \"\\0\").to_ascii)\n end",
"def copy(source, destination, **options); end",
"def push_text_in_clipboard(text)\n OpenClipboard.call(0)\n EmptyClipboard.call()\n hmem = GlobalAlloc.call(0x42, text.length)\n mem = GlobalLock.call(hmem)\n Memcpy.call(mem, text, text.length)\n SetClipboardData.call(1, hmem) # Format CF_TEXT = 1\n GlobalFree.call(hmem)\n CloseClipboard.call()\n self\n end",
"def dragged\n destination = \"#{ENV['EXTRA_PATH']}\"\n\n $dz.determinate(false)\n $dz.begin(\"Creating new text file...\")\n\n output = `./CocoaDialog standard-inputbox --title \"Save Text\" --e --informative-text \"Enter name for new text file (minus extension):\"`\n button, filename = output.split(\"\\n\")\n\n if button == \"2\"\n $dz.finish(\"Cancelled\")\n $dz.url(false)\n return\n end\n \n if filename == nil\n $dz.finish(\"Invalid Filename\")\n $dz.url(false)\n return\n end\n\n # Create a new file and write to it \n File.open(\"#{destination}/#{filename}.txt\", 'w') do |f| \n f.puts $items[0]\n end\n\n system(\"open \\\"#{destination}/#{filename}.txt\\\"\")\n\n $dz.finish(\"Text Saved\")\n $dz.url(false)\nend",
"def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend",
"def pbcopy(input)\n str = input.to_s\n IO.popen('pbcopy', 'w') { |f| f << str }\n str\nend",
"def clipboard_select_tag(items, html_options = {})\n options = [[_t('Please choose'), \"\"]]\n items.each do |item|\n options << [item.class.to_s == 'Alchemy::Element' ? item.display_name_with_preview_text : item.name, item.id]\n end\n select_tag(\n 'paste_from_clipboard',\n [email protected]_record? && @page.can_have_cells? ? grouped_elements_for_select(items, :id) : options_for_select(options),\n {\n :class => [html_options[:class], 'alchemy_selectbox'].join(' '),\n :style => html_options[:style]\n }\n )\n end",
"def copy_sample_files\n system 'for filename in config/*.sample; do cp -n \"$filename\" \"${filename%.sample}\"; done'\nend",
"def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\n end",
"def view_selected_files\n fname = write_selected_files\n\n unless fname\n message 'No file selected. '\n return\n end\n\n system \"$PAGER #{fname}\"\n setup_terminal\nend",
"def pbcopy(input)\n str = input.to_s\n IO.popen('pbcopy', 'w') { |f| f << str }\n str\nend",
"def pbcopy(input)\n str = input.to_s\n IO.popen('pbcopy', 'w') { |f| f << str }\n str\n end",
"def copy(str)\n IO.popen(\"pbcopy\", \"w\") { |f| f << str.chomp }\n end",
"def copy_bbcode\n str = EventPrinter::BBcode::head(@event.printed_name)\n str << (@list.map { |e| e.bbcode }).join(\"\\n\")\n str << EventPrinter::BBcode::foot\n Win32API.push_text_in_clipboard(str.to_ascii << \"\\0\")\n end",
"def copy_contents\n cmd = rsync_cmd\n\n @log.debug \"Copying contents with: #{cmd}\"\n\n %x[#{cmd}]\n $?.success?\n end",
"def copy(str)\n IO.popen('pbcopy', 'w') { |f| f << str.to_s }\nend",
"def clone_file source, target, *opts\n cmd = ['cp']\n cmd << '-R' if opts.include? :recursive\n\n if RUBY_PLATFORM.include? 'darwin'\n sh *(cmd + ['-c', source, target]) do |ok|\n break if ok\n if Jekyll.env != 'production'\n $stderr.puts \"Cannot use file cloning, falling back to regular copying\"\n end\n sh *(cmd + [source, target])\n end\n else\n # macOS requires explicit clone argument for copy (see\n # above). Behavior on other platforms is uknown, except for Linux\n # where it occur automatically. Therefore, just doing copy should\n # be fine.\n sh *(cmd + [source, target])\n end\nend",
"def copy\n self.public_send('|', 'pbcopy')\n self\n end",
"def copy_scripts\n script_list.each do |name|\n source = File.join(__dir__, \"script/#{name}.bash\")\n dest = File.expand_path(\"~/.#{name}-goodies.bash\")\n puts \"Copy #{name}-goodies\".green\n `cp #{source} #{dest}`\n end\nend",
"def puts something\n command = 'pbcopy'\n command << \" -pboard #{@board}\" if @board\n command << \" -Prefer #{@format}\" if @format\n out = IO::popen command, 'w+'\n out.print something\n out.close\n @current = something\n end",
"def code_browse path\n dr = ruby_renderer\n view(path, :close_key => 'q', :title => $0) do |t|\n t.renderer dr\n t.bind_key([?\\\\,?\\\\,?o],'choose file') { \n str = choose_file \"**/*\"\n if str and str != \"\"\n t.add_content str\n t.buffer_last\n else\n alert \"nothing chosen\"\n end\n }\n end\n end",
"def copyFileToTarget(file, srcDir, destDir) \n inFileName = \"#{srcDir}/#{file}\";\n outFileName = \"#{destDir}/#{file}\";\n puts \"copying: [#{inFileName}]\";\n puts \"\\tto: [#{outFileName}]\";\n system(\"cp #{inFileName} #{outFileName}\");\nend",
"def apps_block_copy_paste=(value)\n @apps_block_copy_paste = value\n end",
"def write_selected_files\n require 'pathname'\n # fname = File.join(File.dirname(CONFIG_FILE), 'selected_files')\n # 2019-04-10 - changed to ~/tmp otherwise confusion about location\n fname = File.join('~/tmp/', 'selected_files')\n fname = expand_path(fname)\n\n # remove file if no selection\n if @selected_files.empty?\n File.unlink(fname) if File.exist?(fname)\n return nil\n end\n\n # TODO : what if user does not want full path e,g zip\n # TODO: what if unix commands need escaped files ?\n base = Pathname.new Dir.pwd\n File.open(fname, 'w') do |file|\n @selected_files.each do |row|\n # use relative filename. Otherwise things like zip and tar run into issues\n unless @selected_files_fullpath_flag\n p = Pathname.new(row)\n row = p.relative_path_from(base)\n end\n row = Shellwords.escape(row) if @selected_files_escaped_flag\n file.puts row\n end\n end\n\n return fname\nend",
"def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end",
"def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end",
"def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end",
"def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end",
"def paste_before()\n clipboard = send_message(\"getClipboardContents\" => [])[\"clipboardContents\"]\n if clipboard[-1].chr == \"\\n\"\n [\"moveToBeginningOfLine:\", \"paste\"] + restore_cursor_position + [\"moveToBeginningOfLine:\"] +\n (is_whitespace?(clipboard[0].chr) ? [\"moveWordForward:\"] : [])\n else\n [\"paste\", \"moveForward:\"]\n end\n end",
"def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end",
"def add_to_selection file\n ff = file\n case file\n when String\n ff = [file]\n end\n @current_dir ||= Dir.pwd\n ff.each do |f|\n # this is wrong if the file is a dir listing or visited files listing.\n # full = File.join(@current_dir, f)\n full = expand_path(f)\n @selected_files.push(full) unless @selected_files.include?(full)\n end\nend",
"def copied_from\n [ self[:copyfrom_path], self[:copyfrom_rev] ] if copyfrom_known?\n end",
"def notifyCancelCopy\n if (@CopiedSelection != nil)\n notifyRegisteredGUIs(:onCancelCopy, @CopiedSelection)\n @CopiedSelection = nil\n @CopiedMode = nil\n @CopiedID = nil\n end\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def copy\n move(:copy)\n end"
] | [
"0.7115079",
"0.7002764",
"0.69583875",
"0.6808353",
"0.6765171",
"0.6653057",
"0.663103",
"0.6491936",
"0.64842623",
"0.64713055",
"0.6452405",
"0.6452405",
"0.64059824",
"0.6365171",
"0.6360526",
"0.63305914",
"0.63264066",
"0.6302481",
"0.62640446",
"0.61834943",
"0.6111439",
"0.6110237",
"0.6110237",
"0.6071464",
"0.6067827",
"0.6012887",
"0.60027915",
"0.59836066",
"0.5961133",
"0.59368163",
"0.59108996",
"0.58392274",
"0.57432365",
"0.57414484",
"0.5735838",
"0.5653498",
"0.5653498",
"0.564269",
"0.55492526",
"0.55492526",
"0.55492526",
"0.55492526",
"0.54982805",
"0.54554874",
"0.54520416",
"0.54368114",
"0.54244566",
"0.54230905",
"0.5413616",
"0.5410866",
"0.539892",
"0.539892",
"0.539892",
"0.53844607",
"0.5363023",
"0.53266186",
"0.5309256",
"0.530516",
"0.52951545",
"0.52899516",
"0.5278757",
"0.52645123",
"0.52623993",
"0.5237934",
"0.51984644",
"0.51899654",
"0.51843756",
"0.51737225",
"0.5171228",
"0.51629865",
"0.5160246",
"0.5154086",
"0.515024",
"0.5148434",
"0.5128776",
"0.5119667",
"0.5091852",
"0.5054898",
"0.50491935",
"0.5048396",
"0.50483096",
"0.5043057",
"0.5039829",
"0.5031869",
"0.50217265",
"0.5003574",
"0.4983061",
"0.4982873",
"0.49718112",
"0.49709654",
"0.49709654",
"0.49709654",
"0.49709654",
"0.49611333",
"0.49560836",
"0.4945959",
"0.49441805",
"0.49374315",
"0.49373102",
"0.49313405"
] | 0.8589144 | 0 |
Archive selected files and directories into a .zip file. | def zip(zipfile_name)
return unless zipfile_name
zipfile_name += '.zip' unless zipfile_name.end_with? '.zip'
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
selected_items.each do |item|
next if item.symlink?
if item.directory?
Dir[item.join('**/**')].each do |file|
zipfile.add file.sub("#{current_dir}/", ''), file
end
else
zipfile.add item.name, item
end
end
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end",
"def zipped!\n return if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system \"zip #{zip_path} #{path}/*\"\n end",
"def make_zipfile dir, options={}\n zipfile = options[:filename] || \"#{dir}.zip\"\n excludes = ['-x', '*/.git/*', '-x', '*/.gitignore']\n exclude_each options[:excludes] do |exclude|\n excludes.push '-x', exclude\n end\n run 'zip', '-r', zipfile, dir, *excludes\n release zipfile, :cd => 1\nend",
"def archive(dir)\n @archiver.archive(dir)\n end",
"def compress(path, archive)\n require 'zip/zip'\n require 'zip/zipfilesystem'\n\n path.sub!(%r[/$], '')\n ::Zip::ZipFile.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject { |f| f==archive }.each do |file|\n print_line(\"Adding #{file} to archive\")\n zipfile.add(file.sub(path+'/', ''), file)\n end\n end\n print_line(\"All files saved to #{archive}\")\n end",
"def zip_files\n time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Archive::Zip.archive(File.join(ARCHIVE[0], ARCHIVE[1], time, ARCHIVE[2]), File.join(LOCAL_DIR, '.'))\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each { |file| File.delete(file) }\n end",
"def zip_result_directory\n end",
"def zip(dir, filename)\n Dir.chdir( File.join(options.logdir) ) do\n unless File.exists?(\"#{filename}.zip\")\n Zip::Archive.open(\"#{filename}.zip\", Zip::CREATE) do |ar|\n Dir.glob(\"#{dir}/**/*\").each do |path|\n if File.directory?(path)\n ar.add_dir(path)\n else\n ar.add_file(path, path)\n end\n end\n end\n end\n end\n end",
"def zip_dump\n\t system(\"mongodump --host localhost --db #{@mongo_database} --out #{@base_path}\")\n\t Dir[@base_path + '*.zip'].select { |e| File.delete(e) }\n\t Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|\n\t Dir[File.join(@directory, '**', '**')].each do |file|\n\t\t zipfile.add(file.sub(@directory + '/', ''), file)\n\t end\n\t end\n\t end",
"def zip_xml_files\n logger.debug('ZIPPING ALL FILES.')\n # time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n list_files.push(file)\n end\n puts list_files.length\n list_files.each do |file|\n Archive::Zip.archive((file + ARCHIVE_EXTN), file) if File.extname(file).eql?('.xml')\n end\n list_files.each do |file|\n File.delete(file)\n end\n logger.debug('ALL FILES ZIPPED.')\n end",
"def write\n FileUtils.rm @out_file if File.exists? @out_file\n in_progress \"Writing archive #{@out_file} from #{@input_dir}\" do\n Zip::File.open @out_file, Zip::File::CREATE do |zipfile|\n Dir[\"#{@input_dir}/**/**\"].reject{ |f| f == @out_file || [email protected](f) }.each do |file|\n progress \"deflating #{file}\"\n zipfile.add(file.sub(@input_dir + '/', ''), file)\n end\n end\n end\n end",
"def zip\n raise \"No tracks in album #{name}\" if songs.empty? \n bundle_filename = \"#{RmedialSetting.default.static_file_path}/zip/#{artist.name} - #{name}.zip\"\n raise \"Unable to create zip file\" if !Medium.path_is_writeable?(bundle_filename)\n \n # check to see if the file exists already, and if it does, delete it.\n File.delete(bundle_filename) if File.file?(bundle_filename) \n\n # open or create the zip file\n Zip::ZipFile.open(bundle_filename, Zip::ZipFile::CREATE) { |zipfile|\n # collect the album's tracks\n self.songs.collect { |song|\n # add each track to the archive, names using the track's attributes\n zipfile.add(song.ideal_file_name, song.file_name)\n }\n }\n\n # set read permissions on the file\n File.chmod(0644, bundle_filename)\n\n return bundle_filename\n end",
"def zip(input_dir, output_file)\n entries = Dir.entries(input_dir) - %w(. ..)\n\n Zip::File.open(output_file, Zip::File::CREATE) do |zipfile|\n write_entries input_dir, entries, '', zipfile\n end\n end",
"def generate_zip folder, zip_path\n FileUtils.rm zip_path if File.file? zip_path\n\n scan_path = File.join(folder, '*')\n puts \"Zipping up: #{scan_path}\"\n input_files = Dir.glob(scan_path)\n\n Zip::File.open(zip_path, Zip::File::CREATE) do |zipfile|\n input_files.each do |file|\n # Two arguments:\n # - The name of the file as it will appear in the archive\n # - The original file, including the path to find it\n zipfile.add(File.basename(file), file)\n end\n end\n end",
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def compress(src_path, archive_path)\n src_dir = File.dirname( File.expand_path( src_path ) )\n src_file = File.basename( src_path )\n archive_path = File.expand_path( archive_path )\n dest_dir = File.dirname( archive_path )\n\n puts \"src_dir: #{src_dir}\"\n puts \"src_path: #{src_path}\"\n puts \"dest_dir: #{dest_dir}\"\n puts \"archive_path: #{archive_path}\"\n\n # Create the destination dir if it doesn't exist.\n if( !File.exists?( dest_dir ) )\n File.makedirs( dest_dir, true )\n end\n\n cmd_line = \"-tzip u #{archive_path} #{src_path}\"\n\n cur_dir = pwd\n cd( src_dir )\n begin\n execute( cmd_line, false )\n rescue\n # do nothing\n end\n cd( cur_dir )\n end",
"def create_zip( ctx, file:, upload_dir:, archive_dir:, ** ) #File::Twin\n source_files = file.records\n\n zip_file = File.join( archive_dir, \"#{file.identifier}.zip\" )\n\n return false if File.exists?(zip_file)\n\n Zip::File.open(zip_file, Zip::File::CREATE) do |zip|\n source_files.each do |record|\n raise \"error with #{record.inspect}\" unless record.file_path # TODO: remove me\n\n name_in_zip = \"#{record.index}-#{File.basename(record.file_path)}\"\n\n zip.add( name_in_zip, File.join(upload_dir, record.file_path) ) # FIXME: this could break\n end\n end\n\n\n\n ctx[:zip] = zip_file\n end",
"def zipXMLFiles\n logger.debug(\"ZIPPING ALL FILES.\")\n #time = Time.now.strftime(\"%Y-%d-%m_%H-%M-%S\")\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each {\n |file|\n listFiles.push(file)\n }\n puts listFiles.length\n listFiles.each {\n |file|\n if File.extname(file).eql?(\".xml\")\n Archive::Zip.archive((file + ARCHIVE_EXTN), file)\n end\n }\n listFiles.each {\n |file|\n File.delete(file)\n }\n logger.debug(\"ALL FILES ZIPPED.\")\n end",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def zip(folder, file=nil, options={})\n raise ArgumentError if folder == '.*'\n file ||= File.basename(File.expand_path(folder)) + '.zip'\n cmd = \"zip -rqu #{file} #{folder}\"\n puts cmd if options[:dryrun] or options[:verbose]\n system cmd unless options[:dryrun] or options[:noop]\n return File.expand_path(file)\n end",
"def execute(quiet=false)\n @quiet = quiet\n @zip_file = ::Zip::File.open(@target_name, ::Zip::File::CREATE)\n do_zip(@source_paths, '')\n @zip_file.close\n @logger.debug(\"#{@count} files archived in #{@target_name}\")\n end",
"def zipfiles\n @zipfile_name = \"#{$zip_folder}#{$testcase}.zip\"\n Zip::File.open(\"#{@zipfile_name}\", Zip::File::CREATE) do |zipfile|\n Dir.glob(\"#{$image_folder}#{$testcase}*\").each do |filename|\n file = File.basename(\"#{filename}\")\n zipfile.add(file, \"#{$image_folder}\" + file)\n end\n end\n end",
"def compress(path)\r\n gem 'rubyzip'\r\n require 'zip/zip'\r\n require 'zip/zipfilesystem'\r\n path.sub!(%r[/$],'')\r\n archive = File.join(path,File.basename(path))+'.zip'\r\n FileUtils.rm archive, :force=>true\r\n\r\n Zip::ZipFile.open(archive, 'w') do |zipfile|\r\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\r\n zipfile.add(file.sub(path+'/',''),file)\r\n end\r\n end\r\n end",
"def write\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n @folders.each do |input_dir, src, dest|\n src = '' if src == '/**' # the whole src directory could be specified by /**\n path = source_dir(File.join(input_dir, src))\n write_entries(path, entries(src, input_dir), dest, io)\n end\n end\n\n @output_file\n end",
"def compress(path)\n path.sub!(%r[/$],'')\n archive = File.join(path,File.basename(path))+'.zip'\n FileUtils.rm archive, :force=>true\n Zip::File.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\n zipfile.add(file.sub(path+'/',''),file)\n end\n end\n archive\n end",
"def write\n entries = @input_dir.children(false)\n @zip.write entries, @input_dir, ''\n end",
"def create_zip\n require 'zip'\n zip_files = [self.ground_truth, self.image_sequence, self.config_file]\n if self.acceptable_segmentation_region.present?\n zip_files.push(self.acceptable_segmentation_region)\n end\n zip_filename = Rails.root.join(dir_path, \"#{self.name}.zip\")\n Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile|\n zip_files.each do |file|\n zipfile.add(file, \"#{dir_path}/#{file}\")\n end\n end\n end",
"def write\n entries = Dir.entries(@input_dir) - %w(. ..)\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n write_entries(entries, '', io)\n end\n end",
"def write\r\n entries = Dir.entries(@input_dir) - %w[. ..]\r\n\r\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\r\n write_entries entries, '', zipfile\r\n end\r\n end",
"def write_archive(archive, dir)\n\t\tIO.popen(\"cd #{dir}; tar x\", \"w\") do |p|\n\t\t\tp.write archive\n\t\tend\n\tend",
"def add_files(zip)\n ZipFileGenerator.new(@manifest.base_dir, zip).write\n end",
"def write\n @zip.write [@input_dir.basename], @input_dir.parent, ''\n end",
"def zipIt\r\n puts \"Creating EPUB package:\"\r\n STDOUT.flush\r\n path = @dirs[:tmp]\r\n FileUtils.rm @epub, :force=>true\r\n Zip::ZipFile.open(@epub, 'w') do |zipfile|\r\n progress = ProgressBar.new(\"Compressing\", Dir[\"#{path}/**/**\"].length)\r\n Dir[\"#{path}/**/**\"].each do |file|\r\n zipfile.add(file.sub(path+'/', ''), file)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end\r\n end",
"def zip(path)\n FileUtils.mkdir_p(path)\n zip_file_path = File.join(path, \"#{self.to_param}.zip\")\n if File.exists?(zip_file_path)\n File.delete(zip_file_path)\n end\n \n # open or create the zip file\n Zip::ZipFile.open(zip_file_path, Zip::ZipFile::CREATE) do |zip_file|\n \n # Add data files\n project_for_zip(zip_file, 'project.js')\n tags_for_zip(zip_file, 'category.js')\n\n app_maps.each do |map|\n map.facts_for_zip(zip_file, \"map_#{map.id}_project.js\")\n map.tags_for_zip(zip_file, \"map_#{map.id}_category.js\")\n end\n \n # Add images\n images_dir = 'images'\n zip_file.mkdir(images_dir) unless zip_file.find_entry(images_dir)\n self.facts.collect do |fact|\n# begin\n zip_file.add(fact.image, fact.photo.path(:thumb)) unless fact.photo_file_name.nil? || zip_file.find_entry(fact.image)\n # rescue => ex\n # # Need a way to output these errors\n # end\n end\n \n end\n File.chmod(0644, zip_file_path)\n zip_file_path\n end",
"def create_archive(opts = {})\n archive = normalize_archive_name( find_option( opts, 'name' ) || archive_name )\n app_dir = find_option( opts, 'app_dir' ) || Dir.pwd\n dest_dir = find_option( opts, 'dest_dir' ) || Dir.pwd\n excludes = find_option( opts, 'exclude' ) || \"\"\n should_precompile_assets = find_option( opts, 'precompile_assets' ) == true\n should_package_gems = find_option( opts, 'package_gems' ) == true\n package_without = find_option( opts, 'package_without' ) || Array.new\n\n if should_precompile_assets\n precompile_assets( app_dir )\n raise 'Error precompiling assets' unless $? == 0\n end\n\n archive_path = File.join( dest_dir, archive )\n archive_proc = lambda { create_knob_archive( app_dir, archive_path, excludes ) }\n\n if should_package_gems\n package_gems( app_dir, package_without ) {\n raise 'Error packaging gems' unless $? == 0\n archive_proc.call\n }\n else\n archive_proc.call\n end\n\n archive_path\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end",
"def zipfile(list, newer_than, zipdir = '/tmp')\n\n str_newer = newer_than.to_s.split(%r{T})[0]\n\n zipfile_fn = File.join(zipdir, \"calibre-#{str_newer}.zip\")\n if File.exists?(zipfile_fn)\n File.unlink(zipfile_fn)\n end\n\n # Write the output zip\n #\n Dir.chdir(@library_path) do\n\n Zip.continue_on_exists_proc = true\n Zip.sort_entries = true\n Zip.unicode_names = true\n #\n # Try to avoid registering local paths\n #\n begin\n Zip::File.open(zipfile_fn, Zip::File::CREATE) do |zfh|\n #\n # For each book, gather the list of files\n #\n list.each do |bk|\n authr_base = bk['authors'].split(/,/)[0]\n all_files = File.join(authr_base, \"#{bk['title']}*\", '*')\n begin\n Dir[all_files].sort.each do |file|\n zfh.add(file, file)\n end\n rescue => msg\n $stderr.puts(\"Error: #{msg} : #{full} : #{file}\")\n end\n end # -- list\n end # -- Zip::File\n rescue => msg\n $stderr.puts(\"Error creating zip: #{msg}\")\n end\n end # -- chdir\n zipfile_fn\nend",
"def compressFiles\n Dir.chdir(\"#{@outputDir}/RDPsummary\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf class.result.tar.gz class\")\n system(\"tar czf domain.result.tar.gz domain\")\n system(\"tar czf family.result.tar.gz family\")\n system(\"tar czf genus.result.tar.gz genus\")\n system(\"tar czf order.result.tar.gz order\")\n system(\"tar czf phyla.result.tar.gz phyla\")\n system(\"tar czf species.result.tar.gz species\")\n system(\"tar czf pdf.result.tar.gz 'find . -name `*.pdf`'\")\n Dir.chdir(@scratch)\n end",
"def to_zip\n tmpdir = Dir.mktmpdir\n dir = path = nil\n timed_section(Rails.logger, 'app_to_zip') do\n dir = unpack_upload\n synchronize_pool_with(dir)\n path = AppPackage.repack_app_in(dir, tmpdir, :zip)\n zip_path = save_package(path) if path\n end\n ensure\n FileUtils.rm_rf(tmpdir)\n FileUtils.rm_rf(dir) if dir\n FileUtils.rm_rf(File.dirname(path)) if path\n end",
"def compress_done_files(task)\n task_dir = student_work_dir(:done, task, false)\n zip_file = zip_file_path_for_done_task(task)\n return if (zip_file.nil?) || (not Dir.exists? task_dir)\n\n FileUtils.rm(zip_file) if File.exists? zip_file\n\n input_files = Dir.entries(task_dir).select { | f | (f =~ /^\\d{3}\\.(cover|document|code|image)/) == 0 }\n\n Zip::File.open(zip_file, Zip::File::CREATE) do | zip |\n zip.mkdir \"#{task.id}\"\n input_files.each do |in_file|\n zip.add \"#{task.id}/#{in_file}\", \"#{task_dir}#{in_file}\"\n end\n end\n\n FileUtils.rm_rf(task_dir)\n end",
"def pack(directory, name=nil)\n tmp_file = Tempfile.new(name || File.basename(directory))\n file_path = \"#{tmp_file.path}.zip\"\n tmp_file.delete\n entries = Hash[\n Dir.glob(File.join(directory, '**', '{*,.*}')).map do |path|\n next if path.end_with?('.')\n [path.sub(%r{#{Regexp.escape(directory)}/?}, ''), path]\n end\n ]\n Zip::File.open(file_path, Zip::File::CREATE) do |zipfile|\n entries.keys.sort.each do |entry|\n path = entries[entry]\n if(File.directory?(path))\n zipfile.mkdir(entry.dup)\n else\n zipfile.add(entry, path)\n end\n end\n end\n file = File.open(file_path, 'rb')\n file\n end",
"def extract\n for file_path in @files\n if !File.directory?(file_path)\n if file_path.downcase.index('.7zip') || file_path.downcase.index('.7z') || file_path.downcase.index('.zip')\n extension = '7zip' if file_path.downcase.index('.7zip')\n extension = '7z' if file_path.downcase.index('.7z')\n extension = 'zip' if file_path.downcase.index('.zip')\n cmd = \"7za e -o#{@dir} #{file_path}\"\n #puts \"Extracting #{file_path}: #{cmd}\"\n system(cmd)\n if cmd\n if file_path.downcase.index('att')\n file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('enroll')\n file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('ili') || file_path.downcase.index('h1n1')\n file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n else\n file_name = File.join(@dir, \"ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n end\n File.rename(file_path, file_name)\n FileUtils.mv(file_name, File.join(@dir, \"archive\"))\n end\n end\n end\n end\n\n end",
"def compress(entries)\n puts \"\\nadding the following entries into zip package\"\n puts \"#{ entries.map{ |x| x.name }.join(\"\\n\")}\"\n buffer = Zip::File.add_buffer do |zio|\n entries.each do |file|\n if file.is_a? FileEntry\n zio.add(file.path == nil ? file.name : file.path, file.name)\n else\n zio.get_output_stream(file.name) { |os| os.write file.buffer.string }\n end\n end\n end\n end",
"def extract_zip\n # FileUtils.rmtree(@extract_folder)\n zip_files = Dir[\"#{@download_folder}/*.zip\"]\n\n zip_files.each do |zip|\n Zip::File.open(zip) do |zip_file|\n zip_file.each do |f|\n file_name = f.name\n FileUtils.mkdir_p(\"#{@extract_folder}/#{File.dirname(file_name)}\")\n\n # doesn't extract empty files or files with fake locale\n if f.size && f.size != 0\n # if true overwrite existing files with same name\n zip_file.extract(f, \"#{@extract_folder}/#{f.name}\") { true }\n end\n end\n end\n delete_zip(zip)\n end\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end",
"def archive_package(name)\n destination_dir = File.join(@project.full_path, \"output\", name)\n FileUtils.mkdir_p(destination_dir)\n destination_file = File.join(destination_dir, \"#{name}.tar.xz\")\n\n archive_single(File.join(\"src\", name), destination_file)\n end",
"def zip\n end",
"def zip_app_export_migrations\n temp_file = Tempfile.new([ZipTempFilePrefix, '.zip'])\n # This is the tricky part\n # Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos| }\n\n # Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|\n Dir.glob(\"#{app_export_dir}/*.rb\").each do |path|\n filename = path.split('/').last\n zip.add(filename, path)\n end\n end\n temp_file\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def zip\n end",
"def unarchive\n unless in_zip?\n zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}\n zips.each do |item|\n FileUtils.mkdir_p current_dir.join(item.basename)\n Zip::File.open(item) do |zip|\n zip.each do |entry|\n FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(item.basename, entry.to_s)) { true }\n end\n end\n end\n gzs.each do |item|\n Zlib::GzipReader.open(item) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\\.tar$/, '')\n tar.each do |entry|\n dest = nil\n if entry.full_name == '././@LongLink'\n dest = File.join dest_dir, entry.read.strip\n next\n end\n dest ||= File.join dest_dir, entry.full_name\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n FileUtils.mkdir_p dest_dir\n File.open(dest, 'wb') {|f| f.print entry.read}\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n unless Dir.exist? dest_dir\n FileUtils.mkdir_p dest_dir\n File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}\n end\n end\n end\n end\n end\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }\n end\n end\n end\n ls\n end",
"def write()\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::ZipFile.open(@output_file, Zip::ZipFile::CREATE);\n write_entries(entries, \"\", io)\n io.close();\n end",
"def archive(path = nil, configuration_suffix: nil)\n path ||= epub_name(configuration_suffix)\n\n epub_path = File.expand_path(path)\n\n Dir.chdir(@file_resolver.destination_path) do\n new_paths = @file_resolver.package_files.map(&:pkg_destination_path)\n\n if ::File.exist?(epub_path)\n Zip::File.open(epub_path, true) do |zip_file|\n old_paths = zip_file.instance_eval { @entry_set.entries.map(&:name) }\n diff = old_paths - new_paths\n diff.each do |file_to_remove|\n puts \"DEBUG: removing file from result EPUB: #{file_to_remove}\" if compilation_context.verbose?\n zip_file.remove(file_to_remove)\n end\n end\n end\n\n run_command(%(zip -q0X \"#{epub_path}\" mimetype))\n run_command(%(zip -qXr9D \"#{epub_path}\" \"#{new_paths.join('\" \"')}\" --exclude \\\\*.DS_Store))\n end\n\n path\n end",
"def upload_archive(zip, task)\n return if task.blank?\n task.attach(\n filename: zip,\n mime: 'application/zip'\n )\n FileUtils.rm_rf([zip])\n end",
"def archive(treeish, file = nil, opts = {})\n self.object(treeish).archive(file, opts)\n end",
"def archive!\n archive\n save!(validate: false)\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def compress_files_and_copy\n timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\") + '_'\n tar_file = @backup_folder + timestamp + \"syc-backup.tar.gz\" \n tar_command = \"tar cfz #{tar_file} #{@files.join(\" \")}\"\n\n stdout, stderr, status = Open3.capture3(tar_command)\n\n unless status.exitstatus == 0\n STDERR.puts \"There was a problem executing command\"\n STDERR.puts tar_command\n STDERR.puts stderr\n exit status.exitstatus\n end\n\n tar_file\n end",
"def zip (target, *sources)\n targetdir = \"#{FileUtils::Config.tmp_dir}/zip\"\n id = 1\n while File.exists?(targetdir)\n targetdir = \"#{FileUtils::Config.tmp_dir}/zip#{id}\"\n id += 1\n end\n FileUtils.mkdir(targetdir)\n\n path = ''\n sources.each do |value|\n if path == ''\n path = value\n else\n FileUtils.copy(path, \"#{targetdir}/#{value}\")\n path = ''\n end\n end\n\n `#{FileUtils::Config.zip} -j #{target} #{targetdir}/*`\n\n FileUtils.rm_rf(targetdir)\n end",
"def zip_file\n path = Dir.mktmpdir\n File.join(path, 'deploy.zip').tap do |path|\n Zip::File.open(path, Zip::File::CREATE) do |zip|\n Dir[\"#{@path}/**/**\"].each do |file|\n zip.add(file.sub(\"#{File.dirname(@path)}/\", ''), file)\n end\n end\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n # relative path of file being added to the zip\n relative_path = path == '' ? e : File.join(path, e)\n # full path\n full_path = File.join(@input_dir, relative_path)\n\n if File.directory? full_path\n recursively_zip_directory(full_path, zipfile, relative_path)\n else\n put_into_archive(full_path, zipfile, relative_path)\n end\n end\n end",
"def compress\n @env[:ui].info I18n.t(\"vagrant.actions.general.package.compressing\", :tar_path => tar_path)\n File.open(tar_path, Platform.tar_file_options) do |tar|\n Archive::Tar::Minitar::Output.open(tar) do |output|\n begin\n current_dir = FileUtils.pwd\n\n copy_include_files\n\n FileUtils.cd(@env[\"package.directory\"])\n Dir.glob(File.join(\".\", \"**\", \"*\")).each do |entry|\n Archive::Tar::Minitar.pack_file(entry, output)\n end\n ensure\n FileUtils.cd(current_dir)\n end\n end\n end\n end",
"def _zip_decender(zipstream, folder, path)\n if path.nil?\n path = folder.name\n else\n path = path + \"/\" + folder.name\n end\n zipstream.dir.mkdir(path)\n \n folder.assets.each do |a|\n logger.info(\"[ZIP] Adding #{a.file_name} in #{a.uploaded_file.path}\")\n zipstream.add(\"#{path}/#{a.file_name}\", a.uploaded_file.path)\n end\n folder.children.each do |f|\n _zip_decender(zipstream, f, path)\n end\n end",
"def zipfile; end",
"def archive_to(ant, path)\n if @build_dir.exist?\n path = FilePath.new(path)\n FilePath.new(path.directoryname).ensure_directory\n puts \"Archiving entire build directory ('#@build_dir') to '#{path}'...\"\n\n ant.jar(:destfile => path.to_s) do\n ant.fileset(:dir => @build_dir.to_s,\n :includes => \"**/testrun*/**, **/tests_aggregation/**\",\n :excludes => \"**/*.jar,**/*.class,**/objectdb/**,**/*.war,**/*.rar,**/var/**,**/repository/**,**/META-INF/**\")\n ant.fileset(:dir => @build_dir.to_s,\n :includes => \"**/boot-jars/**,**/build-config.local,**/war/*.war\")\n end\n\n puts \"Done archiving build.\"\n else\n puts \"#{@build_dir.tos_s} does not exist to archive the testrun\"\n end\n\n end",
"def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end",
"def archive(opts)\n # check if file exists otherwise overwrite the archive\n dst = archive_name(opts)\n if dst.exist? && !opts[:overwrite]\n @logger.info \"Archive #{dst} exists already. Use --overwrite.\"\n return false\n end\n\n # remove existing archive\n File.delete(dst) if dst.exist?\n @logger.info \"Generate archive #{dst}.\"\n\n # filter files that should not be part of the profile\n # TODO ignore all .files, but add the files to debug output\n\n # display all files that will be part of the archive\n @logger.debug \"Add the following files to archive:\"\n files.each { |f| @logger.debug \" \" + f }\n\n if opts[:zip]\n # generate zip archive\n require \"inspec/archive/zip\"\n zag = Inspec::Archive::ZipArchiveGenerator.new\n zag.archive(root_path, files, dst)\n else\n # generate tar archive\n require \"inspec/archive/tar\"\n tag = Inspec::Archive::TarArchiveGenerator.new\n tag.archive(root_path, files, dst)\n end\n\n @logger.info \"Finished archive generation.\"\n true\n end",
"def write_entries(entries, path, zipfile, root_dir)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(root_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path, root_dir)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def zip(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n # Return zip download link\n PUTIO_BASE_URL + (\"/files/zip?file_ids=%s&oauth_token=%s\" % [id, @access_token])\n end",
"def create_zip_file(file_paths, zip_path)\n\n # Delete the file if it exists\n File.delete(zip_path) if File.exist?(zip_path)\n\n # Do not compress and dont store file paths\n cmd = \"zip -Z store -j \\\"#{zip_path}\\\" \"\n file_paths.each { |file| cmd += \"\\\"#{file}\\\" \" }\n\n # Execute the command\n puts cmd\n result_text = `#{cmd} 2>&1`\n #puts result_text\n\n # Return the op result\n return CmdResult.new( $?.success? ? :success : :error , result_text )\n\nend",
"def zip(path_to_files, files_to_zip, zip_filepath, force_new_file = true)\n return unless files_to_zip\n # remove zip file, if existing already\n File.delete zip_filepath if force_new_file and File.file? zip_filepath\n\n directories = []\n\n # open or create the zip file\n Zip::ZipFile.open(zip_filepath, Zip::ZipFile::CREATE) do |zipfile|\n files_to_zip.each do |filename|\n file_path = path_to_files + '/' + filename\n logger.debug \"\\n===> adding '#{filename}' from '#{file_path}'\"\n zipfile.add(filename, file_path)\n\n directories << { :path => path_to_files, :name => filename } if File.directory? file_path\n end\n end\n \n # recursively adding directories, skipped but remembered before\n directories.each do |dir|\n get_dir_list(dir[:path] + '/' + dir[:name]).each do |sub_element|\n sub_filename = dir[:name] + '/' + sub_element\n zip(dir[:path], [ sub_filename ], zip_filepath, false)\n end\n end\n \n # set read permissions on the file\n File.chmod(0644, zip_filepath) \n end",
"def compress_source_zip(path)\n require \"zip\"\n zipfile = Tempfile.create([\"vagrant\", \".zip\"])\n zipfile.close\n if File.file?(path)\n source_items = [path]\n else\n source_items = Dir.glob(File.join(path, \"**\", \"**\", \"*\"))\n end\n c_dir = nil\n Zip::File.open(zipfile.path, Zip::File::CREATE) do |zip|\n source_items.each do |source_item|\n next if File.directory?(source_item)\n trim_item = source_item.sub(path, \"\").sub(%r{^[/\\\\]}, \"\")\n dirname = File.dirname(trim_item)\n zip.mkdir dirname if c_dir != dirname\n c_dir = dirname\n zip.get_output_stream(trim_item) do |f|\n source_file = File.open(source_item, \"rb\")\n while data = source_file.read(2048)\n f.write(data)\n end\n end\n end\n end\n zipfile.path\n end",
"def build\n entries = Dir.entries(@input_dir)\n entries.delete_if {|e| @exclude.include?(e)}\n FileUtils.rm_f(@output_file) # Make sure file doesn't exist\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def archive(branch_or_tag = nil)\n working_dir do\n git 'archive', branch_or_tag || 'HEAD', :binmode => true\n end\n end",
"def generate_output_file(zip_out, contents); end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\r\n entries.each do |e|\r\n zipfile_path = path == '' ? e : File.join(path, e)\r\n disk_file_path = File.join(@input_dir, zipfile_path)\r\n\r\n if File.directory? disk_file_path\r\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\r\n else\r\n put_into_archive(disk_file_path, zipfile, zipfile_path)\r\n end\r\n end\r\n end",
"def seven_zip_archive(zip_file_name, *files)\n seven_zip_executable = @config_manager['tool.7z.executable']\n output, status = popen_capture(seven_zip_executable, 'a', zip_file_name, *files)\n @logger.fine(\"7-zip messages\\n#{output}\")\n raise ExecutionError.new('7-zip encountered errors.') if status.exitstatus != 0\n end",
"def archive(sources_dir, dest_dir, dest_file_name)\n Siba::Archive::Tar::Archive.check_compression_type compression\n\n options = get_tar_option\n extension = Archive.get_tar_extension compression\n\n archive_name = \"#{dest_file_name}.tar#{extension}\"\n archive_path = File.join(dest_dir, archive_name)\n siba_file.run_this do\n raise Siba::Error, \"Archive file already exists: #{archive_path}\" if siba_file.file_file?(archive_path) || siba_file.file_directory?(archive_path)\n\n siba_file.file_utils_cd dest_dir\n command_text = %(tar c#{options}f #{archive_name} -C \"#{sources_dir}\" .)\n # Using -C 'change directory' option to make it work on Windows\n # because Windows will not understand absolute path to tar: \"tar cf c:\\dir\\file.tar .\"\n siba_file.run_shell command_text, \"Failed to archive: #{command_text}\"\n raise Siba::Error, \"Failed to create archive: #{command_text}\" unless siba_file.file_file?(archive_path)\n end\n archive_name\n end",
"def unzip_archive(archive, dest)\n # Adapted from examples at...\n # https://github.com/rubyzip/rubyzip\n # http://seenuvasan.wordpress.com/2010/09/21/unzip-files-using-ruby/\n Zip::File.open(archive) do |zf|\n zf.each do |f|\n f_path = File.join(dest, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zf.extract(f, f_path) unless File.exist?(f_path) # No overwrite\n end\n end\nend",
"def write\n File.delete(@output_file) if File.exist?(@output_file)\n\n Zip::File.open(@output_file, Zip::File::CREATE) do |zipfile|\n zipfile.add(mimetype_entry(zipfile), \"#{@input_dir}/mimetype\")\n\n all_entries.each do |file|\n zipfile.add(file, \"#{@input_dir}/#{file}\")\n end\n end\n end",
"def write_entries(input_dir, entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(input_dir, disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def pack directory_path\n Dir.chdir directory_path\n name = Dir.pwd.split(@fs).last\n files = Dir.glob \"**#{@fs}*\"\n File.open([name, @ext].join(\".\"), \"wb\") do |tar|\n Minitar.pack(files, tar)\n end\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def make_zip(filename)\n filename = basename(filename)\n zip = result_location + filename\n Util::Zip.compress(base_location, zip)\n return zip\n end",
"def compress_file(pfilename)\n \t#path = pfilename.sub(%r[/$],'')\n\tpath = File.dirname(pfilename)\n\tarchwin = File.join(path,File.basename(pfilename))+'.zip'\n\t\n\tarchive = File.basename(pfilename)+'.zip'\n\truta = File.basename(pfilename)\n if File.exist?('/dev/null') #si es linux\n\t system(\"cd #{path} && zip -r #{archive} #{ruta}\")\n\t return path + '/' + ruta + '.zip'\n\telse \n\t system(\"alzip -a #{pfilename} #{archwin}\")\n\t return path + '\\\\' + ruta + '.zip'\n\tend \n end",
"def zip_contents; end",
"def genDataZip(dir='generated', file_name='OdinSampleDataSet.zip', zip_dir='generated')\n # make sure the target file does not already exist\n # if it does, rename it to a tmp file\n runShellCommand(\"zip -j #{dir}/#{file_name} #{zip_dir}/*.xml #{zip_dir}/*.ctl\")\nend",
"def archive\n @archive ||= RestClient.get info['link'] + '/zip'\n end",
"def unpack\n self.dir = Rails.root + 'tmp' + SecureRandom.hex(20)\n FileUtils.mkdir(dir)\n\n dirs = []\n files = []\n\n Zip::Archive.open(file_path) do |archive|\n archive.each do |file|\n next if file.name =~ /__MACOSX/ or file.name =~ /\\.DS_Store/\n destination = dir + file.name\n name = Pathname.new(file.name).cleanpath.to_s\n\n if file.directory?\n FileUtils.mkdir_p(destination)\n dirs << name\n else\n dirname = File.dirname(file.name)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n open(destination, 'wb') {|f| f << file.read}\n files << name\n end\n end\n end\n\n [dirs, files]\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n next\n end\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end",
"def archive_artifact\n subsection 'Archive artifact', color: :green, prefix: @output_prefix unless @silent\n @data = Zip::OutputStream.write_buffer do |out|\n if @artifacts.length == 1\n file = @artifacts.shift\n v '+ ' + File.basename(file)\n out.put_next_entry(File.basename(file))\n out.write File.read(file)\n else\n @artifacts.each do |artifact|\n next if artifact == './'\n\n v '+ ' + artifact\n out.put_next_entry(artifact)\n if File.directory? artifact\n artifact += '/' unless artifact.end_with? '/'\n Zip::Entry.new(nil, artifact).write_to_zip_output_stream(out)\n elsif File.symlink? artifact\n unless (f=File.realpath(artifact)).start_with? File.realpath('./') and File.exist?(f)\n v 'warning: doesn\\'t add ' + artifact + ', because it points outside of target directory.'\n next\n end\n\n d 's ' + artifact\n\n entry = Zip::Entry.new(nil, artifact)\n entry.gather_fileinfo_from_srcpath(artifact)\n entry.write_to_zip_output_stream(out)\n else\n d 'w ' + artifact\n out.write File.read(artifact)\n end\n end\n end\n end\n @data.rewind\n d \"Zip::OutputStream length: #{@data.length}\"\n\n raise 'ZIP data is empty' if @data.length == 0\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |entry|\n zipfile_path = path == '' ? entry : File.join(path, entry)\n disk_file_path = File.join(src_path, zipfile_path)\n\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def tgz___( directory, filename )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_archive( :destination => filename, :source => directory, :compress => true )\r\n end",
"def archive(target = nil, &block)\n require 'rubygems/package'\n unless target\n target = parent.file(\"#{name}.tar\")\n end\n target.write_binary do |io|\n writer = Gem::Package::TarWriter.new(io) do |tar_io|\n archive_dir(tar_io, self, &block)\n end\n end\n target\n end",
"def zip(file, options = Hash.new)\n if options[:output_path]\n output_path = options[:output_path]\n else \n output_path = File.dirname(File.expand_path(file))\n end\n \n options[:remove_original] = true if options[:remove_original].nil?\n \n decompressed_filename = File.expand_path(file)\n compressed_filename = File.join(output_path, File.basename(file) + '.bz2')\n puts \"Compressing #{decompressed_filename} to #{compressed_filename}\"\n Bzip2::Writer.open(compressed_filename, 'w') do |compressed_file|\n File.open(decompressed_filename, 'r') do |decompressed_file|\n compressed_file << decompressed_file.read\n end\n end\n\n if File.exist?(compressed_filename)\n File.delete(decompressed_filename) if options[:remove_original]\n end\n \n return compressed_filename\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\"); entries.delete(\"yamproject.json\"); entries.delete(\".DS_Store\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end"
] | [
"0.74123836",
"0.7021671",
"0.6955902",
"0.68239886",
"0.6787721",
"0.65796155",
"0.654845",
"0.6525048",
"0.645605",
"0.64537454",
"0.6448565",
"0.64361745",
"0.6404247",
"0.63789654",
"0.6362273",
"0.6362273",
"0.63601446",
"0.6352382",
"0.6322369",
"0.6287762",
"0.6287762",
"0.62738806",
"0.62640554",
"0.6259722",
"0.6245367",
"0.6231792",
"0.6212589",
"0.6210522",
"0.6197325",
"0.6175313",
"0.6172759",
"0.6172022",
"0.61509657",
"0.61268204",
"0.61255586",
"0.6122766",
"0.6099266",
"0.60939217",
"0.6074816",
"0.60725224",
"0.6057836",
"0.60362756",
"0.6024385",
"0.6012262",
"0.60090977",
"0.5997641",
"0.5993354",
"0.5991674",
"0.59852123",
"0.5982701",
"0.59791255",
"0.5970962",
"0.5955596",
"0.595127",
"0.5943007",
"0.5940991",
"0.59352136",
"0.5923764",
"0.5923593",
"0.59150165",
"0.58934194",
"0.58636457",
"0.58604467",
"0.585954",
"0.5845437",
"0.5842887",
"0.58401275",
"0.5831323",
"0.58255076",
"0.5820099",
"0.58154225",
"0.58132076",
"0.5812946",
"0.5807702",
"0.5797581",
"0.5796803",
"0.57900906",
"0.57831126",
"0.57831126",
"0.57648754",
"0.5742004",
"0.5739971",
"0.57375216",
"0.5737246",
"0.5735279",
"0.57239467",
"0.5713388",
"0.5712146",
"0.57111",
"0.5709647",
"0.57033324",
"0.5699141",
"0.56940144",
"0.56899893",
"0.56883126",
"0.56661475",
"0.56560266",
"0.56557536",
"0.5641425",
"0.5605624"
] | 0.61296415 | 33 |
Unarchive .zip and .tar.gz files within selected files and directories into current_directory. | def unarchive
unless in_zip?
zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}
zips.each do |item|
FileUtils.mkdir_p current_dir.join(item.basename)
Zip::File.open(item) do |zip|
zip.each do |entry|
FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))
zip.extract(entry, File.join(item.basename, entry.to_s)) { true }
end
end
end
gzs.each do |item|
Zlib::GzipReader.open(item) do |gz|
Gem::Package::TarReader.new(gz) do |tar|
dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\.tar$/, '')
tar.each do |entry|
dest = nil
if entry.full_name == '././@LongLink'
dest = File.join dest_dir, entry.read.strip
next
end
dest ||= File.join dest_dir, entry.full_name
if entry.directory?
FileUtils.mkdir_p dest, mode: entry.header.mode
elsif entry.file?
FileUtils.mkdir_p dest_dir
File.open(dest, 'wb') {|f| f.print entry.read}
FileUtils.chmod entry.header.mode, dest
elsif entry.header.typeflag == '2' # symlink
File.symlink entry.header.linkname, dest
end
unless Dir.exist? dest_dir
FileUtils.mkdir_p dest_dir
File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}
end
end
end
end
end
else
Zip::File.open(current_zip) do |zip|
zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|
FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))
zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }
end
end
end
ls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unpack( archive, into = Dir.pwd )\n Dir.chdir( into ) do \n if archive.match( /\\.tar\\.gz\\Z/ ) or archive.match(/\\.tgz\\Z/) then\n tgz = ::Zlib::GzipReader.new( File.open( local_source, 'rb') )\n ::Archive::Tar::Minitar.unpack( tgz, into )\n elsif archive.match( /\\.gem\\Z/ ) then\n subdir = File.basename( archive, \".gem\" )\n Gem::Installer.new( archive ).unpack( subdir )\n else\n raise \"Unable to extract files from #{File.basename( local_source)} -- unknown format\"\n end\n end\n end",
"def unpack\n self.dir = Rails.root + 'tmp' + SecureRandom.hex(20)\n FileUtils.mkdir(dir)\n\n dirs = []\n files = []\n\n Zip::Archive.open(file_path) do |archive|\n archive.each do |file|\n next if file.name =~ /__MACOSX/ or file.name =~ /\\.DS_Store/\n destination = dir + file.name\n name = Pathname.new(file.name).cleanpath.to_s\n\n if file.directory?\n FileUtils.mkdir_p(destination)\n dirs << name\n else\n dirname = File.dirname(file.name)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n open(destination, 'wb') {|f| f << file.read}\n files << name\n end\n end\n end\n\n [dirs, files]\n end",
"def extract\n for file_path in @files\n if !File.directory?(file_path)\n if file_path.downcase.index('.7zip') || file_path.downcase.index('.7z') || file_path.downcase.index('.zip')\n extension = '7zip' if file_path.downcase.index('.7zip')\n extension = '7z' if file_path.downcase.index('.7z')\n extension = 'zip' if file_path.downcase.index('.zip')\n cmd = \"7za e -o#{@dir} #{file_path}\"\n #puts \"Extracting #{file_path}: #{cmd}\"\n system(cmd)\n if cmd\n if file_path.downcase.index('att')\n file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('enroll')\n file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n elsif file_path.downcase.index('ili') || file_path.downcase.index('h1n1')\n file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n else\n file_name = File.join(@dir, \"ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.#{extension}\")\n end\n File.rename(file_path, file_name)\n FileUtils.mv(file_name, File.join(@dir, \"archive\"))\n end\n end\n end\n end\n\n end",
"def unzip\n file = self\n #destination = \"/\" + self.split(\"/\")[1..-2].join(\"/\") + \"/\"\n destination = self + \"_extracted_files/\"\n Zip::File.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n #puts f_path\n FileUtils.mkdir_p(File.dirname(f_path))\n FileUtils.rm f_path if File.exist?(f_path)\n zip_file.extract(f, f_path) #unless File.exist?(f_path)\n }\n }\n end",
"def unzip\n file = self\n #destination = \"/\" + self.split(\"/\")[1..-2].join(\"/\") + \"/\"\n destination = self + \"_extracted_files/\"\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n #puts f_path\n FileUtils.mkdir_p(File.dirname(f_path))\n FileUtils.rm f_path if File.exist?(f_path)\n zip_file.extract(f, f_path) #unless File.exist?(f_path)\n }\n }\n end",
"def stage_unzipped(zipfile, stage_dir)\n # Unzip file to a specified directory\n Dir.mkdir stage_dir unless Dir.exist?(stage_dir)\n Zip::File.open(zipfile) do |z|\n z.each do |f|\n extract_path = File.join(stage_dir, f.name)\n z.extract(f, extract_path) unless File.exist?(extract_path)\n end\n end\nend",
"def perform\n @extracted_files = Array.new\n @files_to_extract.each do |f|\n @extracted_files.push File.basename(@filename, '.tbz') + '/' + f\n end\n\n extract = extract_command(@basename, @extracted_files.join(' '))\n\n result = system \"cd #{@dirname} && #{extract}\"\n\n if result\n _extracted_files = @extracted_files.map{|f| File.join(@dirname, f)}\n @file_entry = FileEntry.new(@filename, Hash[@files_to_extract.zip(_extracted_files)])\n FileUtils.remove_file(@filename, true) unless keep_tbz_after_extract?\n else\n raise \"Unable to extract files '#{@files_to_extract.join(' ')}' from #{@filename}\"\n end\n\n @file_entry\n end",
"def zip_files\n time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Archive::Zip.archive(File.join(ARCHIVE[0], ARCHIVE[1], time, ARCHIVE[2]), File.join(LOCAL_DIR, '.'))\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each { |file| File.delete(file) }\n end",
"def extract_files\n while file = @package_file.next_header\n if file.pathname == \"control.tar.gz\"\n control_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while control_entry = control_tar_gz.next_header\n case control_entry.pathname\n when \"./control\"\n @control_file_contents = control_tar_gz.read_data\n when \"./preinst\"\n @preinst_contents = control_tar_gz.read_data\n when \"./prerm\"\n @prerm_contents = control_tar_gz.read_data\n when \"./postinst\"\n @postinst_contents = control_tar_gz.read_data\n when \"./postrm\"\n @postrm_contents = control_tar_gz.read_data\n end\n end\n end\n if file.pathname == \"data.tar.gz\"\n data_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while data_entry = data_tar_gz.next_header\n # Skip dirs; they're listed with a / as the last character\n @filelist << data_entry.pathname.sub(/^\\./, \"\") unless data_entry.pathname =~ /\\/$/\n end\n end\n end\n end",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n unless entry.name_is_directory?\n entry.extract(File.join(dir, File.basename(entry.name)))\n end\n end\n\n yield dir\n end\n end\n end",
"def unzip\n files = {}\n unzip_dir = @fullpath[0..-5]\n FileUtils.mkpath(unzip_dir)\n Zip::File.open(@fullpath) do |zipfile|\n zipfile.each do |entry|\n next unless entry.file?\n full_source_path = \"#{unzip_dir}/#{entry.name}\"\n entry.extract(full_source_path) { true } # true for overwrite\n files[full_source_path] = entry.name\n end\n end\n files\n end",
"def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end",
"def unzip_archive(archive, dest)\n # Adapted from examples at...\n # https://github.com/rubyzip/rubyzip\n # http://seenuvasan.wordpress.com/2010/09/21/unzip-files-using-ruby/\n Zip::File.open(archive) do |zf|\n zf.each do |f|\n f_path = File.join(dest, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zf.extract(f, f_path) unless File.exist?(f_path) # No overwrite\n end\n end\nend",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n entry.extract(File.join(dir, File.basename(entry.name))) unless entry.name_is_directory?\n end\n\n yield dir\n end\n end\n end",
"def extract\n base.say_status 'extract', @file\n if @zip_file\n base.exec(\"cd #{@temp_dir} ; unzip #{@file}\")\n else\n base.exec(\"cd #{@temp_dir} ; tar xvfpz #{@file}\")\n end\n \n # Remove the file\n base.destination_files.rm_rf(@file_path)\n end",
"def extract src_path, dst_path = File.dirname(src_path)\n src_path = File.expand_path(src_path)\n src_name = File.basename(src_path)\n src_suffix = File.extname(src_name)\n src_prefix = File.basename(src_name, src_suffix)\n\n Dir.mktmpdir(nil, dst_path) do |tmp_dir|\n # decompress the archive\n cd tmp_dir do\n case src_name.sub(/\\.part$/, '')\n when /\\.(tar\\.gz|tar\\.Z|tgz|taz)$/i\n system 'tar', '-zxf', src_path\n\n when /\\.(tar\\.bz|tar\\.bz2|tbz|tbz2)$/i\n system 'tar', '-jxf', src_path\n\n when /\\.(tar\\.xz|txz)$/i\n system 'tar', '-Jxf', src_path\n\n when /\\.(tar|cpio|gem)$/i\n system 'tar', '-xf', src_path\n\n when /\\.(tar.lzo|tzo)$/i\n system \"lzop -xc #{src_path.inspect} | tar -xf -\"\n\n when /\\.(lzo)$/i\n system 'lzop', '-x', src_path\n\n when /\\.(gz)$/i\n system \"gunzip -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(bz|bz2)$/i\n system \"bunzip2 -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(shar)$/i\n system 'sh', src_path\n\n when /\\.(7z)$/i\n system '7zr', 'x', src_path\n\n when /\\.(zip)$/i\n system 'unzip', src_path\n\n when /\\.(jar)$/i\n system 'jar', 'xf', src_path\n\n when /\\.(rz)$/i\n ln src_path, src_name # rzip removes the archive after extraction\n system 'rzip', '-d', src_name\n\n when /\\.(rar)$/i\n system 'unrar', 'x', src_path\n\n when /\\.(ace)$/i\n system 'unace', 'x', src_path\n\n when /\\.(arj)$/i\n system 'arj', 'x', src_path\n\n when /\\.(arc)$/i\n system 'arc', 'x', src_path\n\n when /\\.(lhz|lha)$/i\n system 'lha', 'x', src_path\n\n when /\\.(a|ar)$/i\n system 'ar', '-x', src_path\n\n when /\\.(Z)$/\n system \"uncompress -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(z)$/\n system \"pcat #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(zoo)$/i\n system 'zoo', 'x//', src_path\n\n when /\\.(cab)$/i\n system 'cabextract', src_path\n\n when /\\.(deb)$/i\n system 'ar', 'x', src_path\n\n when /\\.(rpm)$/i\n system \"rpm2cpio #{src_path.inspect} | cpio -i --make-directories\"\n\n else\n warn \"I do not know how to extract #{src_path.inspect}\"\n end\n end\n\n # clean any mess made by decompression\n manifest = Dir.new(tmp_dir).entries - %w[ . .. ]\n\n if manifest.length == 1 # there was no mess!\n adj_dst = File.join(dst_path, manifest.first)\n adj_src = File.join(tmp_dir, manifest.first)\n else\n adj_src = tmp_dir\n adj_dst = File.join(dst_path, src_name[/.*(?=\\..*?)/])\n end\n\n adj_dst << \"+#{Time.now.to_i}\" until\n not File.exist? adj_dst and\n mv(adj_src, adj_dst, :force => true)\n\n touch tmp_dir # give Dir.mktmpdir() something to remove\n\n adj_dst\n end\nend",
"def decompress_files(compressed_files=[], dir = decompressed_spool_dir )\n\n files = []\n\n compressed_files.each do |file|\n Zip::Archive.open(file) do |ar|\n ar.each do |zf|\n if zf.directory?\n FileUtils.mkdir_p(zf.name)\n else\n dirname = File.dirname(zf.name)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n output_file = File.join(dir, zf.name)\n open(output_file, 'wb') do |f|\n f << zf.read\n end\n files << output_file\n end\n end\n end\n # TODO: Delete processed file\n end\n\n files\n end",
"def extract_zip\n # FileUtils.rmtree(@extract_folder)\n zip_files = Dir[\"#{@download_folder}/*.zip\"]\n\n zip_files.each do |zip|\n Zip::File.open(zip) do |zip_file|\n zip_file.each do |f|\n file_name = f.name\n FileUtils.mkdir_p(\"#{@extract_folder}/#{File.dirname(file_name)}\")\n\n # doesn't extract empty files or files with fake locale\n if f.size && f.size != 0\n # if true overwrite existing files with same name\n zip_file.extract(f, \"#{@extract_folder}/#{f.name}\") { true }\n end\n end\n end\n delete_zip(zip)\n end\n end",
"def unpack_zip_on_darwin archive, destination, clobber\n # Unzipping on OS X\n FileUtils.makedirs destination\n zip_dir = File.expand_path File.dirname(archive)\n zip_name = File.basename archive\n output = File.expand_path destination\n # puts \">> zip_dir: #{zip_dir} zip_name: #{zip_name} output: #{output}\"\n %x(cd #{zip_dir};unzip #{zip_name} -d #{output})\n end",
"def extract (file = nil)\n export_path = archive.path.gsub('.zip', '_content')\n\n Zip::ZipFile.open(file.path) { |zip_file|\n zip_file.each { |image|\n image_path = File.join(export_path, image.name)\n FileUtils.mkdir_p(File.dirname(image_path))\n unless File.exist?(image_path)\n zip_file.extract(image, image_path)\n photo = photos.build\n photo.image = File.open(image_path)\n photo.save\n File.delete(image_path)\n end\n }\n }\n # clean up source files, but leave the zip\n FileUtils.remove_dir(export_path)\n end",
"def compressFiles\n Dir.chdir(\"#{@outputDir}/RDPsummary\")\n #system(\"tar -zcf #{@sampleSetName1}.tar.gz * --exclude=*.log --exclude=*.sra --exclude=*.sff --exclude=*.local.metadata\")\n system(\"tar czf class.result.tar.gz class\")\n system(\"tar czf domain.result.tar.gz domain\")\n system(\"tar czf family.result.tar.gz family\")\n system(\"tar czf genus.result.tar.gz genus\")\n system(\"tar czf order.result.tar.gz order\")\n system(\"tar czf phyla.result.tar.gz phyla\")\n system(\"tar czf species.result.tar.gz species\")\n system(\"tar czf pdf.result.tar.gz 'find . -name `*.pdf`'\")\n Dir.chdir(@scratch)\n end",
"def extract\n # Only used by tar\n compression_switch = \"\"\n compression_switch = \"z\" if downloaded_file.end_with?(\"gz\")\n compression_switch = \"--lzma -\" if downloaded_file.end_with?(\"lzma\")\n compression_switch = \"j\" if downloaded_file.end_with?(\"bz2\")\n compression_switch = \"J\" if downloaded_file.end_with?(\"xz\")\n\n if Ohai[\"platform\"] == \"windows\"\n if downloaded_file.end_with?(*TAR_EXTENSIONS) && source[:extract] != :seven_zip\n returns = [0]\n returns << 1 if source[:extract] == :lax_tar\n\n shellout!(\"tar #{compression_switch}xf #{downloaded_file} --force-local -C#{project_dir}\", returns: returns)\n elsif downloaded_file.end_with?(*COMPRESSED_TAR_EXTENSIONS)\n Dir.mktmpdir do |temp_dir|\n log.debug(log_key) { \"Temporarily extracting `#{safe_downloaded_file}' to `#{temp_dir}'\" }\n\n shellout!(\"7z.exe x #{safe_downloaded_file} -o#{windows_safe_path(temp_dir)} -r -y\")\n\n fname = File.basename(downloaded_file, File.extname(downloaded_file))\n fname << \".tar\" if downloaded_file.end_with?(\"tgz\", \"txz\")\n next_file = windows_safe_path(File.join(temp_dir, fname))\n\n log.debug(log_key) { \"Temporarily extracting `#{next_file}' to `#{safe_project_dir}'\" }\n shellout!(\"7z.exe x #{next_file} -o#{safe_project_dir} -r -y\")\n end\n else\n shellout!(\"7z.exe x #{safe_downloaded_file} -o#{safe_project_dir} -r -y\")\n end\n elsif downloaded_file.end_with?(\".7z\")\n shellout!(\"7z x #{safe_downloaded_file} -o#{safe_project_dir} -r -y\")\n elsif downloaded_file.end_with?(\".zip\")\n shellout!(\"unzip #{safe_downloaded_file} -d #{safe_project_dir}\")\n else\n shellout!(\"#{tar} #{compression_switch}xf #{safe_downloaded_file} -C#{safe_project_dir}\")\n end\n end",
"def unzip_file\n info(\"Extracting file #{@filename} started.\")\n\n Zip::File.open(local_file) do |zip_file|\n zip_file.each do |f|\n info(\"Processing zipped file #{f}\")\n f_path = File.join(DATA_DIR, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n end\n end\n\n info(\"Extracting file #{@filename} completed successfully.\")\n rescue StandardError => e\n error(\"Unable to unzip file #{@filename} due to following error occurred #{e}\")\n end",
"def extract_all\n files.each do |file|\n extract file\n end\n end",
"def zip_xml_files\n logger.debug('ZIPPING ALL FILES.')\n # time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n list_files.push(file)\n end\n puts list_files.length\n list_files.each do |file|\n Archive::Zip.archive((file + ARCHIVE_EXTN), file) if File.extname(file).eql?('.xml')\n end\n list_files.each do |file|\n File.delete(file)\n end\n logger.debug('ALL FILES ZIPPED.')\n end",
"def unpack(args)\n full_path, file = args[:full_path], args[:file]\n \n # Is unpack activated?\n if self.config[:unpack][:active]\n self.files = File.directory?(full_path) ? Unpack.runner!(full_path, self.config[:unpack]) : []\n else\n self.files = []\n end\n \n if files.any?\n self.growl(self.messages[:unpack][:title], file, :unpack); return 5\n else\n return 6\n end\n end",
"def extract_data\n cmd = \"unzip -d #{DATA_DIR} -o #{DATA_PATH}\"\n system cmd\n end",
"def unzip_file_with_translations(zipfile_name, dest_path, files_list, ignore_match)\n # overwrite files if they already exist inside of the extracted path\n Zip.on_exists_proc = true\n\n # files that exists in archive and doesn't match current project configuration\n unmatched_files = []\n\n Zip::File.open(zipfile_name) do |zipfile|\n zipfile.select { |zip_entry| zip_entry.file? }.each do |f|\n filename = f.name\n if @branch_name and @base_path_contains_branch_subfolders\n # strip branch from filename\n filename = f.name.sub(File.join(@branch_name, '/'), '')\n end\n\n # `f' - relative path in archive\n file = files_list[filename]\n if file\n fpath = File.join(dest_path, file)\n FileUtils.mkdir_p(File.dirname(fpath))\n puts \"Extracting: `#{file}'\"\n zipfile.extract(f, fpath)\n else\n unmatched_files << f\n end\n end\n end\n\n unless unmatched_files.empty? or ignore_match\n puts \"Warning: Downloaded translations do not match current project configuration. The following files will be omitted:\"\n unmatched_files.each { |file| puts \" - `#{file}'\" }\n end\nend",
"def untar!(tarball)\n system(\"tar -C #{@tmp} -xzf #{tarball}\")\n end",
"def extract_to!(directory, flags: DEFAULT_FLAGS)\n each_entry.map do |entry|\n raise Danbooru::Archive::Error, \"Can't extract archive containing absolute path (path: '#{entry.pathname_utf8}')\" if entry.pathname_utf8.starts_with?(\"/\")\n raise Danbooru::Archive::Error, \"'#{entry.pathname_utf8}' is not a regular file\" if !entry.file?\n\n path = \"#{directory}/#{entry.pathname_utf8}\"\n entry.extract!(path, flags: flags)\n end\n end",
"def unzip(x)\r\n outdir = x.sub(/.*\\//, '')\r\n outdir = '.' if outdir == \"\"\r\n Zip::ZipFile::open(x) { |zf|\r\n zf.each { |e|\r\n fpath = File.join(outdir, e.name)\r\n FileUtils.mkdir_p(File.dirname(fpath))\r\n zf.extract(e, fpath)\r\n }\r\n }\r\nend",
"def extract\n case @download\n when /\\.tar/ then untar\n when /\\.gz\\z/ then gunzip\n end\n end",
"def unzip_original_file\n system \"unzip -qq -o -j #{filename} -d #{zip_file_directory}\" unless File.directory?(zip_file_directory)\n @dataset_path = zip_file_directory\n end",
"def stage_downloads_archives(directory)\n # /opt/downloads/#{directory}\n full_directory = File.join('/', 'opt', 'downloads', directory)\n archive_path = File.join(Pkg::Config.downloads_archive_path, directory)\n command = <<-CMD\n if [ ! -d #{full_directory} ]; then\n if [ -d #{archive_path} ]; then\n echo \"Directory #{full_directory} has already been staged, skipping . . .\"\n exit 0\n else\n echo \"ERROR: Couldn't find directory #{full_directory}, exiting . . .\"\n exit 1\n fi\n fi\n find #{full_directory} -type l -delete\n sudo chattr -i -R #{full_directory}\n sudo mkdir --parents #{File.dirname(archive_path)}\n sudo chown root:release -R #{Pkg::Config.downloads_archive_path}\n sudo chmod g+w -R #{Pkg::Config.downloads_archive_path}\n mv #{full_directory} #{archive_path}\n CMD\n Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)\n end",
"def unzip_original_file\n system %(unzip -qq -o -j \"#{filename}\" -d #{zip_file_directory}) unless File.directory?(zip_file_directory)\n @dataset_path = zip_file_directory\n end",
"def unmerge(*files)\n files.each do |f|\n f = check_for_file(f)\n @unmerged << f\n end\n end",
"def extract_zip(data)\n dir = Dir.mktmpdir\n process_zip_data(data) do |zipfile|\n zipfile.each do |f|\n f_path = File.join(dir, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zipfile.extract(f, f_path) unless File.exist?(f_path)\n end\n end\n dir\n end",
"def delete\n unless in_zip?\n FileUtils.rm_rf selected_items.map(&:path)\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n if entry.name_is_directory?\n zip.dir.delete entry.to_s\n else\n zip.file.delete entry.to_s\n end\n end\n end\n end\n @current_row -= selected_items.count {|i| i.index <= current_row}\n ls\n end",
"def zipXMLFiles\n logger.debug(\"ZIPPING ALL FILES.\")\n #time = Time.now.strftime(\"%Y-%d-%m_%H-%M-%S\")\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each {\n |file|\n listFiles.push(file)\n }\n puts listFiles.length\n listFiles.each {\n |file|\n if File.extname(file).eql?(\".xml\")\n Archive::Zip.archive((file + ARCHIVE_EXTN), file)\n end\n }\n listFiles.each {\n |file|\n File.delete(file)\n }\n logger.debug(\"ALL FILES ZIPPED.\")\n end",
"def close\n close_buffers\n # Zip it all up using the zip command for now :p\n pwd = Dir.pwd\n Dir.cd(realdir)\n exec(\"zip -r #{filename} *\")\n Dir.cd(pwd)\n FileUtils.rm_r(realdir)\n end",
"def unzip(zipfile_path, parent_folder_dest)\n sh(\"cd #{parent_folder_dest} && unzip -qo #{zipfile_path} > /dev/null 2>&1\")\n end",
"def listArchive\n begin\n load_submission() or return false\n get_submission_file() or return false\n \n require 'rubygems/package'\n require 'zlib'\n\n @files = []\n f = File.new(@filename)\n tar_extract = Gem::Package::TarReader.new(f)\n tar_extract.rewind # The extract has to be rewinded after every iteration\n \n i = 0\n tar_extract.each do |entry|\n\n pathname = entry.full_name\n extension = File.extname pathname\n extension = extension[1..-1]\n if extension == \"c0\" or extension == \"go\" then\n extension = \"c\"\n elsif extension == \"h0\" then\n extension = \"h\"\n elsif extension == \"clac\" or extension == \"sml\" then\n extension = \"txt\"\n end\n \n next if pathname.include? \"__MACOSX\" or\n pathname.include? \".DS_Store\" or\n pathname.include? \".metadata\"\n\n @files << {\n :pathname => pathname,\n :header_position => i,\n :highlight => (Simplabs::Highlight.get_language_sym(extension) or (extension == \"txt\"))\n }\n\n i += 1\n end\n\n tar_extract.close\n\n return\n rescue Exception => e\n COURSE_LOGGER.log(e);\n flash[:error] = \"This does not appear to be a valid archive file.\"\n redirect_to :controller => \"home\", :action => \"error\" and return false\n end\n end",
"def unzip( fn, dest )\n Zip::ZipFile.open fn do |z|\n z.each do |f|\n fpath = File.join dest, f.name\n FileUtils.mkdir_p File.dirname fpath \n z.extract( f, fpath ) unless File.exist? fpath\n end\n end\nend",
"def clean_up_out_dir(zip_binary: nil,\n assembly_dir: nil,\n num_threads: nil)\n\n int_contig_dir = File.join assembly_dir, \"intermediate_contigs\"\n\n # Remove the intermediate contigs\n FileUtils.rm_r int_contig_dir if Dir.exist? int_contig_dir\n\n contig_glob = File.join assembly_dir, \"*.contigs.fa\"\n\n if zip_binary == \"pigz\"\n cmd = \"#{zip_binary} -p #{num_threads} #{contig_glob}\"\n else\n cmd = \"#{zip_binary} #{contig_glob}\"\n end\n\n # Zip the contigs file\n Process.run_it cmd\n end",
"def extract_archive(archive_filename, destination, overwrite = true)\r\n zf = OpenStudio::UnzipFile.new(archive_filename)\r\n zf.extractAllFiles(destination)\r\n end",
"def extract_archive(archive_filename, destination, overwrite = true)\n zf = OpenStudio::UnzipFile.new(archive_filename)\n zf.extractAllFiles(destination)\n end",
"def run_dir(root)\n\tDir.foreach(root) { |fn|\n\t\tnext if fn == \".\" || fn == \"..\"\n\t\tcombined = File.join(root, fn)\n\t\tif File.directory?(combined)\n\t\t\trun_dir(combined)\n\t\telsif File.file?(combined) && (fn[\".dll\"] || fn[\".pdb\"])\n\t\t\tfpath = combined\n\t\t\tfpath = fpath[2..-1] if fpath[0..1] == \"./\"\n\t\t\tfpath = fpath.gsub(\"/\", \"\\\\\")\n\t\t\tprint(\"#{fpath}\\n\")\n\t\t\t`compress -R #{fpath}`\n\t\t\texit(1) if $?.exitstatus != 0\n\t\t\t`del #{fpath}`\n\t\tend\n\t}\t\nend",
"def unzip(file, destination)\n FileUtils.mkdir_p(destination)\n\n Zip::File.open(file) do |zip_file|\n zip_file.each do |f|\n fpath = File.join(destination, f.name)\n zip_file.extract(f, fpath) unless File.exist?(fpath)\n end\n end\nend",
"def extract_archived_files\n unless Rails.env.test?\n puts \"Start to extract files? (archive not extracted? #{!archive_extracted?}) to DB for #{mounted_path}\"\n end\n\n result = true\n return true if archive_extracted?\n\n NfsStore::Manage::ArchivedFile.transaction do\n start_time = Time.now\n iterations = 0\n failures = 0\n\n glob_path = \"#{mounted_path}/**/*\"\n %w([ ] { } ?).each do |c|\n glob_path = glob_path.gsub(c, \"\\\\#{c}\")\n end\n\n files = Dir.glob(glob_path)\n\n puts \"Starting extract_archived_files of #{files.length} files\" unless Rails.env.test?\n\n container = stored_file.container\n\n all_afs = []\n files.each do |f|\n pn = Pathname.new f\n unless pn.directory?\n begin\n # Don't use regex - it breaks with special characters\n archived_file_path = pn.dirname.to_s.sub(\"#{mounted_path}/\", '').sub(mounted_path.to_s, '')\n afval = stored_file.path ? File.join(stored_file.path, archive_file_name) : archive_file_name\n af = NfsStore::Manage::ArchivedFile.new container: container,\n path: archived_file_path,\n archive_file: afval,\n file_name: pn.basename,\n nfs_store_stored_file_id: stored_file.id\n\n af.current_user ||= stored_file.user_id\n af.send :write_attribute, :user_id, stored_file.user_id\n container.current_user ||= stored_file.user_id\n af.current_role_name = stored_file.current_role_name\n af.current_gid = stored_file.current_gid\n af.no_access_check = true\n af.analyze_file!\n all_afs << af\n rescue StandardError => e\n failures += 1\n Rails.logger.warn \"Failure (#{failures}) during extract_archived_files. #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n # Continue on to the next one.\n end\n end\n iterations += 1\n next unless Time.now - start_time > ExtractionTimeout\n\n Rails.logger.warn \"Timeout in extract_archived_files after #{iterations} iterations, \" \\\n \"with #{failures} failures.\"\n result = false\n raise ActiveRecord::Rollback\n end\n\n result = NfsStore::Manage::ArchivedFile.import(all_afs, validate: false) && result\n\n # It is possible that repeated or overlapping background processes lead to double entries in the archive_files\n # table. To fix this it is fastest to complete the import, then remove the duplicates.\n\n NfsStore::Manage::ArchivedFile.remove_duplicates archive_file_name\n end\n\n result\n end",
"def download_all_files files,dest\n return if files.empty?\n RubyUtil::partition files do |sub|\n cmd = \"mv -t #{dest} \"\n cmd += sub.map { |f| \"\\\"#{f.full_path}\\\"\" }.join(' ')\n exec_cmd(cmd) \n end\n # update files object !\n files.map! { |f| f.path = dest; f }\n end",
"def dragged\n \n $dz.determinate(true)\n\n count = $items.count\n percent = 0.0\n\n $dz.begin \"Packing #{count} Dir to #{count} txz file...\"\n\n dirs = $items.map do |dir|\n dir = File.expand_path dir\n if not File.directory? dir\n $dz.alert 'Invalid Dir', \"Invalid Dir #{dir}\"\n return\n end\n $dz.percent percent += 5.0 / count\n dir\n end\n\n dirs.compact!\n\n wd = Dir.getwd\n\n for dir in dirs\n path = File.dirname(dir)#.sub(' ', '\\ ')\n name = File.basename(dir)#.sub(' ', '\\ ')\n #$dz.alert name, path\n `cd \"#{path}\" && XZ_OPT=-9e tar --exclude='__MACOSX*' --exclude='*.DS_Store' -cJf \"#{name}.txz\" \"#{name}\"`\n $dz.percent percent += 95.0 / count\n #\"#{dir}.txz\"\n end\n\n Dir.chdir wd\n\n $dz.finish \"#{count} txz created\"\n $dz.url false\nend",
"def unpack(filename)\n @destination = Dir.mktmpdir\n Zip::File.open(filename){ |zip_file|\n zip_file.each{ |f|\n f_path=File.join(@destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exists?(f_path)\n }\n }\n end",
"def unpack_zip archive, destination, clobber=nil\n validate archive, destination\n\n ##\n # As it turns out, the Rubyzip library corrupts\n # binary files (like the Flash Player) on OSX and is also\n # horribly slow for large archives (like the ~120MB Flex SDK)\n # on all platforms.\n if is_darwin?\n unpack_zip_on_darwin archive, destination, clobber\n else\n Zip::ZipFile.open archive do |zipfile|\n zipfile.each do |entry|\n next if entry.name =~ /__MACOSX/ or entry.name =~ /\\.DS_Store/\n unpack_zip_entry entry, destination, clobber\n end\n end\n end\n end",
"def unpack(src, dest, files = [], options = {}, &block)\n Input.open(src) do |inp|\n if File.exist?(dest) && !dir?(dest)\n raise \"Can't unpack to a non-directory.\"\n end\n\n FileUtils.mkdir_p(dest) unless File.exist?(dest)\n\n inp.each do |entry|\n if files.empty? || files.include?(entry.full_name)\n inp.extract_entry(dest, entry, options, &block)\n end\n end\n end\n end",
"def extract!(directory = nil, flags: DEFAULT_FLAGS, &block)\n raise ArgumentError, \"can't pass directory and block at the same time\" if block_given? && directory.present?\n\n if block_given?\n Dir.mktmpdir([\"danbooru-archive-\", \"-\" + File.basename(file.path)]) do |dir|\n filenames = extract_to!(dir, flags: flags)\n yield dir, filenames\n end\n else\n dir = directory.presence || Dir.mktmpdir([\"danbooru-archive-\", \"-\" + File.basename(file.path)])\n filenames = extract_to!(dir, flags: flags)\n [dir, filenames]\n end\n end",
"def unzip_file(destination)\n ensure_file_open!\n @file.each do |entry|\n entry_path = File.join(destination, entry.name)\n FileUtils.mkdir_p(File.dirname(entry_path))\n @file.extract(entry, entry_path) unless File.exist?(entry_path)\n end\n end",
"def unzip(source, destination)\n Zip::File.open(source) do |zip|\n zip.each do |f|\n path = File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(path))\n zip.extract(f, path) { true }\n end\n end\n end",
"def mount\n res = true\n return :not_archive unless has_archive_extension?\n return if extract_in_progress?\n\n extract_in_progress!\n pn = Pathname.new(mounted_path)\n Dir.rmdir mounted_path if pn.exist? && pn.empty?\n return :non_empty_dir_already_exists if pn.exist?\n\n unless NfsStore::Manage::Group.group_id_range.include?(stored_file.current_gid)\n extract_failed!\n raise FsException::Filesystem,\n \"Current group specificed in stored archive file is invalid: #{stored_file.current_gid}\"\n end\n\n tpn = Pathname.new(temp_mounted_path)\n FileUtils.rm_rf temp_mounted_path if tpn.exist?\n dir = File.join(Manage::Filesystem.temp_directory, \"__filestore__#{SecureRandom.hex}\")\n FileUtils.mkdir_p dir\n\n tmpzipdir = \"#{dir}/zip\"\n FileUtils.mkdir_p tmpzipdir\n\n cmd = ['app-scripts/extract_archive.sh', archive_path, tmpzipdir]\n res = Kernel.system(*cmd)\n unless res\n extract_failed!\n puts \"Failed to unzip the archive file: #{archive_path}\"\n raise FsException::Action, \"Failed to unzip the archive file: #{archive_path}\"\n end\n\n FileUtils.chown_R nil, stored_file.current_gid.to_i, tmpzipdir\n FileUtils.cp_r tmpzipdir, temp_mounted_path\n\n begin\n FileUtils.mv temp_mounted_path, mounted_path\n FileUtils.rm_rf dir\n rescue StandardError => e\n extract_failed!\n begin\n FileUtils.rm_rf temp_mounted_path\n FileUtils.rm_rf mounted_path\n rescue StandardError => e2\n raise FsException::Action,\n \"Failed to move the extracted archive files and remove the mounted path for: #{archive_path}\\n\" \\\n \"#{e}\\n#{e2}\"\n end\n raise FsException::Action, \"Failed to move the extracted archive files: #{archive_path}\\n#{e}\"\n end\n\n extract_completed! if res\n res\n end",
"def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n }\nend",
"def _unzipit(file, show_trace)\n Zip::File.open(file) do |zip_file|\n puts Rainbow(\"Unziping #{file}...\").blue\n zip_file.each do |entry|\n _path = File.join(Dir.pwd, entry.name)\n\n if show_trace\n print Rainbow(\"Extracting file: \").black\n puts Rainbow(\"#{entry.name}\").cyan\n end\n\n FileUtils.mkdir_p(File.dirname(_path))\n zip_file.extract(entry, _path) unless File.exists? _path\n end\n end\n\n FileUtils.rm_rf(file)\n puts Rainbow(\"#{file} removed.\").green\n end",
"def unzip_file(file)\n end",
"def make_tarball_from_files files, options={}\n tarball = options[:filename]\n args = ['czf', tarball, '--exclude-vcs']\n exclude_each options[:exclude] do |exclude|\n args.push '--exclude', exclude\n end\n args.concat files\n run 'tar', *args\n release tarball, :cd => 1\nend",
"def untar(file_to_untar,\n directory_for_untar)\n Log.log_debug('Into untar file_to_untar=' + file_to_untar +\n ' directory_for_untar=' + directory_for_untar)\n returned = []\n begin\n command_output = []\n command = \"/bin/tar -tf #{file_to_untar} | /bin/grep epkg.Z$\"\n Utils.execute2(command, command_output)\n untarred_files_array = command_output[0].split(\"\\n\")\n untarred_files = Utils.string_separated(untarred_files_array,\n ' ')\n #\n cmd = \"/bin/tar -xf #{file_to_untar} \\\n-C #{directory_for_untar} #{untarred_files}\"\n Utils.execute(cmd)\n #\n untarred_files_array.each do |untarred_file|\n absolute_untarred_file =\n ::File.join(directory_for_untar,\n untarred_file)\n returned << absolute_untarred_file\n end\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n if e.message =~ /No space left on device/\n Flrtvc.increase_filesystem(directory_for_untar)\n returned = untar(file_to_untar, directory_for_untar)\n else\n Log.log_warning(\"Propagating exception of type '#{e.class}' \\\nwhen untarring!\")\n raise e\n end\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n Log.log_warning(\"Propagating exception of type '#{e.class}' \\\nwhen untarring!\")\n raise e\n end\n Log.log_debug('Into untar returned=' + returned.to_s)\n returned\n end",
"def extract_pack\n io = Zlib::GzipReader.new(DataDragon.data_pack_path.open)\n\n Gem::Package::TarReader.new(io) do |tar|\n tar.each do |tarfile|\n destination_file = (DataDragon.data_unpacked_path + tarfile.full_name)\n\n if tarfile.directory?\n destination_file.mkpath\n else\n destination_directory = destination_file.dirname\n destination_directory.mkpath unless destination_directory.directory?\n destination_file.write(tarfile.read)\n end\n end\n end\n end",
"def archive_incremental(source_directory, destination_dir, file_prefix, file_suffix, tag_prefix)\n @project.from_directory do\n latest_tag_count = @project.latest_tag_count(tag_prefix)\n\n if latest_tag_count == 0\n archive_single(source_directory, File.join(destination_dir, file_prefix + file_suffix))\n else\n destination_file = File.join(destination_dir,\n \"#{file_prefix}_#{format(\"%04d\", latest_tag_count)}#{file_suffix}\")\n tag = @project.latest_tag(tag_prefix)\n log.debug \"creating #{destination_file} with files newer than #{tag}\"\n\n log.debug \"files that changed since then: #{@project.git.changed_files_since(tag)}\"\n list = @project.git.changed_files_since(tag).select do |file|\n File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\\//\n end.map do |file|\n Pathname.new(file).relative_path_from Pathname.new(source_directory)\n end\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} #{list.join(\" \")}`\n end\n\n destination_file\n end\n end\n end",
"def unzip_file (file, destination)\n Zip::File.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end",
"def compress\n @env[:ui].info I18n.t(\"vagrant.actions.general.package.compressing\", :tar_path => tar_path)\n File.open(tar_path, Platform.tar_file_options) do |tar|\n Archive::Tar::Minitar::Output.open(tar) do |output|\n begin\n current_dir = FileUtils.pwd\n\n copy_include_files\n\n FileUtils.cd(@env[\"package.directory\"])\n Dir.glob(File.join(\".\", \"**\", \"*\")).each do |entry|\n Archive::Tar::Minitar.pack_file(entry, output)\n end\n ensure\n FileUtils.cd(current_dir)\n end\n end\n end\n end",
"def targz\n files = procedure.get_adapter_configuration.attributes['files']\n if files.is_a?(Array)\n puts system_messages[:archiving]; puts system_messages[:compressing]\n %x{ tar -czf #{File.join(tmp_path, compressed_file)} #{files.map{|f| f.gsub(' ', '\\ ')}.join(' ')} }\n elsif files.is_a?(String)\n puts system_messages[:archiving]; puts system_messages[:compressing]\n %x{ tar -czf #{File.join(tmp_path, compressed_file)} #{files.gsub(' ', '\\ ')} }\n end\n end",
"def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end",
"def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end",
"def download_zip(target_directory, strip_top_level_directory = true, description = @component_name)\n download(description) do |file|\n expand_start_time = Time.now\n print \" Expanding #{description} to #{target_directory} \"\n\n FileUtils.rm_rf target_directory\n FileUtils.mkdir_p File.dirname(target_directory)\n\n if strip_top_level_directory\n Dir.mktmpdir do |root|\n shell \"unzip -qq #{file.path} -d #{root} 2>&1\"\n FileUtils.mv Dir[root + '/*'][0], target_directory\n end\n else\n shell \"unzip -qq #{file.path} -d #{target_directory} 2>&1\"\n end\n\n puts \"(#{(Time.now - expand_start_time).duration})\"\n end\n end",
"def untar_file(f, to)\n end",
"def pack directory_path\n Dir.chdir directory_path\n name = Dir.pwd.split(@fs).last\n files = Dir.glob \"**#{@fs}*\"\n File.open([name, @ext].join(\".\"), \"wb\") do |tar|\n Minitar.pack(files, tar)\n end\n end",
"def unpack file_path\n name = file_path.split(@fs).last\n Dir.chdir Dir.tmpdir\n Dir.mkdir name\n Minitar.unpack(file_path, name)\n Dir.chdir name\n @temp_dir = Dir.pwd\n end",
"def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end",
"def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end",
"def compress(src_path, archive_path)\n src_dir = File.dirname( File.expand_path( src_path ) )\n src_file = File.basename( src_path )\n archive_path = File.expand_path( archive_path )\n dest_dir = File.dirname( archive_path )\n\n puts \"src_dir: #{src_dir}\"\n puts \"src_path: #{src_path}\"\n puts \"dest_dir: #{dest_dir}\"\n puts \"archive_path: #{archive_path}\"\n\n # Create the destination dir if it doesn't exist.\n if( !File.exists?( dest_dir ) )\n File.makedirs( dest_dir, true )\n end\n\n cmd_line = \"-tzip u #{archive_path} #{src_path}\"\n\n cur_dir = pwd\n cd( src_dir )\n begin\n execute( cmd_line, false )\n rescue\n # do nothing\n end\n cd( cur_dir )\n end",
"def unzip_file(options)\n\n assignment = Assignment.find(options[:id]);\n logger.debug \"[DEBUG] Inside unzip_file\"\n logger.debug \"[DEBUG] Inside unzip_file, id of record is \" + options[:id].to_s\n\n source = options[:source]\n target = options[:target]\n\n logger.debug \"[DEBUG] Inside unzip_file, source is :\" + source + \" and target is: \" + target;\n\n Zip::ZipFile::open(source) {\n |zf|\n zf.each { |e|\n fpath = File.join(target, e.name)\n FileUtils.mkdir_p(File.dirname(fpath))\n\n logger.debug { \"[DEBUG] Now unzipping: \" + File.join(target, e.name)}\n\n if (File.exists? File.join(target, e.name)) and not (File.directory? File.join(target, e.name))\n logger.debug { \"[DEBUG] Removing file: \" + File.join(target, e.name)}\n FileUtils.rm_rf File.join(target, e.name)\n end\n\n ## RANT begin\n # Since this method is not overwriting files, and its API documentation is a one-line joke,\n # I have to check for the file and remove it manually above.\n # Seriously, guys, I love open source, but you're not 7 year olds just starting to learn programming.\n # It takes < 1 minute to document your freaking API.\n # That 4 year old Kylie from Microsoft's ads could do a better job at\n # documenting than the authors of some of the Ruby projects out there.\n # - SA\n ## RANT end\n zf.extract(e, fpath)\n }\n }\n\n #If all has gone well, let's read the properties\n assignment.read_properties_file\n\n rescue Zip::ZipDestinationFileExistsError => ex\n # I'm going to ignore this and just overwrite the files.\n\n rescue => ex\n puts ex\n\n end",
"def target_files_in_dir(base_dir = T.unsafe(nil)); end",
"def unarchive\n perform_action(:post, 'unarchive')\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end",
"def unpack\n `rm -rf ./tmp/specs`\n `gunzip -f ./tmp/specs.tar.gz`\n `cd tmp; tar xvf specs.tar`\n `mv -f ./tmp/CocoaPods-Specs-* ./tmp/specs`\n end",
"def untar(tarfile, destdir)\n raise \"invalid tar file #{tarfile}\" unless File.file? tarfile\n File.open tarfile, 'r' do |otarfile|\n untar0(otarfile, destdir)\n end\n end",
"def extract(from, to)\n raise \"#{from} does not exist.\" unless @file_sys.exists? from\n raise \"#{from} is not a directory.\" unless @file_sys.is_dir? from\n\n dirs = @file_sys.get_subdirs from\n files = @file_sys.get_files from\n\n @file_sys.mkdir to\n\n files.select { |file| file.end_with? '.rb' }.\n each { |file| strip_file(\"#{from}/#{file}\", to) }\n\n dirs.each { |dir| extract(\"#{from}/#{dir}\", \"#{to}/#{dir}\") }\n end",
"def untar_file(f, to)\n line(\"tar\", \"-xf {file} -C {path}\").pass(file: f, path: to)\n end",
"def uncompress_files(oConfig)\n\n #Just uncompress the files now directly...\n Dir.glob(oConfig.data_dir + \"/*.gz\") do |file_name|\n\n #This code throws no errors, but does nothing.\n Zlib::GzipReader.open(file_name) { |gz|\n new_name = File.dirname(file_name) + \"/\" + File.basename(file_name, \".*\")\n g = File.new(new_name, \"w\")\n g.write(gz.read)\n g.close\n }\n File.delete(file_name)\n end\nend",
"def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end",
"def extract_csv_files_from_zipped_databases(zip_file_paths)\n zip_file_paths.map do |zip_file_path|\n base_directory = File.dirname(zip_file_path)\n filename_wo_ext = File.basename(zip_file_path, \".zip\")\n extraction_directory = File.join(base_directory, filename_wo_ext)\n\n puts \"Creating extraction directory: #{extraction_directory}\"\n FileUtils.mkdir_p(extraction_directory)\n\n puts \"Processing #{zip_file_path}:\"\n extracted_paths = []\n Zip::File.open(zip_file_path) do |zip_file|\n zip_file.each do |entry|\n # Extract each file\n destination_path = File.join(extraction_directory, entry.name)\n log \"Extracting #{entry.name} -> #{destination_path}\"\n if !File.exists?(destination_path)\n entry.extract(destination_path)\n end\n extracted_paths << destination_path\n end\n end\n extracted_paths\n end.flatten.uniq\n end",
"def extract_csv_files_from_zipped_databases(zip_file_paths)\n zip_file_paths.map do |zip_file_path|\n base_directory = File.dirname(zip_file_path)\n filename_wo_ext = File.basename(zip_file_path, \".zip\")\n extraction_directory = File.join(base_directory, filename_wo_ext)\n\n puts \"Creating extraction directory: #{extraction_directory}\"\n FileUtils.mkdir_p(extraction_directory)\n\n puts \"Processing #{zip_file_path}:\"\n extracted_paths = []\n Zip::File.open(zip_file_path) do |zip_file|\n zip_file.each do |entry|\n # Extract each file\n destination_path = File.join(extraction_directory, entry.name)\n log \"Extracting #{entry.name} -> #{destination_path}\"\n if !File.exists?(destination_path)\n entry.extract(destination_path)\n end\n extracted_paths << destination_path\n end\n end\n extracted_paths\n end.flatten.uniq\n end",
"def extract(options = {})\n # Ensure that unspecified options have default values.\n file_path = options.has_key?(:file_path) ?\n options[:file_path].to_s :\n @zip_path\n restore_permissions = options.has_key?(:permissions) ?\n options[:permissions] :\n false\n restore_ownerships = options.has_key?(:ownerships) ?\n options[:ownerships] :\n false\n restore_times = options.has_key?(:times) ?\n options[:times] :\n false\n\n # Make the directory.\n FileUtils.mkdir_p(file_path)\n\n # Restore the metadata.\n ::File.chmod(mode, file_path) if restore_permissions\n ::File.chown(uid, gid, file_path) if restore_ownerships\n ::File.utime(atime, mtime, file_path) if restore_times\n\n nil\n end",
"def unzip_package(zip_file)\n @log.info 'Unzipping ' + zip_file\n\n unless File.exist?(zip_file)\n @log.error zip_file + ' not found.'\n return nil\n end\n\n # create a new directory\n file_dir = File.join(@output_dir, File.basename(zip_file, '.zip'))\n Dir.mkdir file_dir unless Dir.exist?(file_dir)\n\n # extract contents of zip file\n Zip::File.open(zip_file) do |zipfile|\n zipfile.each do |f|\n fpath = File.join(file_dir, f.name)\n zipfile.extract(f, fpath) unless File.exist?(fpath)\n end\n end\n\n file_dir\nend",
"def processFiles\n readRemoteXML\n parsePhotoRequestReponseXMl2\n handle_files\n zip_files\n end",
"def translate(from, to, options={})\n stages = %w{packed unpacked cataloged decoded compressed baked compressed_baked}\n @directories = {}\n @symlinks = {}\n stages.each do |stage|\n @directories[stage.to_sym] = File.expand_path(File.join(to, stage))\n @symlinks[stage.to_sym] = options[:links] + '_' + stage if options[:links]\n end\n do_translate_steps(options).each do |step|\n case step\n when 'pull'\n # TODO DRY this up\n warn \"Pull files from the original archive\" unless options[:quiet]\n clear_stage :packed, options\n pull from, @directories[:packed], force: options[:force], quiet: options[:quiet]\n build_symlink :packed if options[:links] && options[:force]\n when 'unpack'\n warn \"Unpack the files (from Honeywell binary format)\" unless options[:quiet]\n clear_stage :unpacked, options\n clear_stage :cataloged, options\n unpack @directories[:packed], @directories[:unpacked], \n flatten: options[:flatten], strict: options[:strict], fix: options[:fix], \n force: options[:force], quiet: options[:quiet]\n build_symlink :unpacked if options[:links] && options[:force]\n when 'catalog'\n warn \"Catalog the files (using a catalog file)\" unless options[:quiet]\n raise MissingCatalog, \"No catalog specified\" unless options[:catalog]\n clear_stage :cataloged, options\n catalog @directories[:unpacked], @directories[:cataloged], :catalog=>options[:catalog], \n force: options[:force], quiet: options[:quiet]\n build_symlink :cataloged if options[:links]\n when 'decode'\n warn \"Decode the files\" unless options[:quiet]\n from = if File.exists?(@directories[:cataloged])\n @directories[:cataloged]\n else\n @directories[:unpacked]\n end\n clear_stage :decoded, options\n decode from, @directories[:decoded], force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'compress'\n warn \"Compress the files\" unless options[:quiet]\n from = @directories[:decoded]\n clear_stage :compressed, options\n compress @directories[:decoded], @directories[:compressed], \n aggressive: options[:aggressive], link: options[:link],\n force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'bake'\n warn \"Bake the files (i.e. remove metadata)\" unless options[:quiet]\n clear_stage :baked, options\n bake @directories[:compressed], @directories[:baked], force: options[:force], quiet: options[:quiet],\n index: options[:index]\n build_symlink :baked if options[:links] && options[:force]\n when 'tests'\n warn \"Rebuild test cases\" unless options[:quiet]\n cmd = 'bun test build'\n cmd += ' --quiet' if options[:quiet]\n system(cmd)\n else\n raise InvalidStep, \"Unknown step #{step}\"\n end\n end\n end",
"def untar(io, destination)\n Gem::Package::TarReader.new(io) do |tar|\n tar.each do |file_or_dir|\n _extract_file_or_dir(file_or_dir, destination)\n end\n end\n end",
"def unpack(file, dest)\n ::Zip::ZipFile.foreach(file) do |zentry|\n epath = \"#{dest}/#{zentry}\"\n dirname = File.dirname(epath)\n FileUtils.mkdir_p(dirname) unless File.exists?(dirname)\n zentry.extract(epath) unless File.exists?(epath)\n end\n end",
"def compress_files_and_copy\n timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\") + '_'\n tar_file = @backup_folder + timestamp + \"syc-backup.tar.gz\" \n tar_command = \"tar cfz #{tar_file} #{@files.join(\" \")}\"\n\n stdout, stderr, status = Open3.capture3(tar_command)\n\n unless status.exitstatus == 0\n STDERR.puts \"There was a problem executing command\"\n STDERR.puts tar_command\n STDERR.puts stderr\n exit status.exitstatus\n end\n\n tar_file\n end",
"def unzip_excel\n log.info `rm -fr '#{xml_directory}'` # Force delete\n log.info `unzip '#{excel_file}' -d '#{xml_directory}'` # If don't force delete, make sure that force the zip to overwrite old files \n end",
"def cleanup_extract_source(attrs={})\n\n execute \"cleanup_source\" do\n cwd Chef::Config[:file_cache_path]\n command \"rm -rf #{attrs['src_dir']}\"\n not_if do ! FileTest.directory?(attrs['src_dir']) end\n action :run\n end\n\n extract_flags = \"tar zxf\" if attrs['src_file'] =~ /tar\\.gz/\n extract_flags = \"tar jxf\" if attrs['src_file'] =~ /tar\\.bz2/\n extract_flags = \"7za x\" if attrs['src_file'] =~ /7z/\n\n execute \"extract_source\" do\n cwd Chef::Config[:file_cache_path]\n command \"#{extract_flags} #{Chef::Config[:file_cache_path]}/#{attrs['src_file']}\"\n action :run\n end\n\nend",
"def package_extract(file, target)\n sysprint \"Extracting #{file} to #{target}\"\n\n unless File::exists? target\n FileUtils::mkdir_p(target)\n end\n\n extract_cmd = 'tar '\n is_tarball = 1\n case file\n when /\\.tar\\.gz$/, /\\.tgz$/\n extract_cmd << 'xvzf'\n when /\\.tar\\.bz2$/, /\\.tbz$/\n extract_cmd << 'xvjf'\n when /\\.tar.xz$/, /\\.txz$/\n extract_cmd << '--xz -xvf'\n else\n is_tarball = 0\n end\n\n if is_tarball == 0\n case file\n when /\\.zip$/\n extract_cmd = 'unzip'\n when /\\.rar$/\n extract_cmd = 'unrar'\n else\n syserr \"Unsupported archive format\"\n raise\n end\n end\n\n extract_cmd << ' ' + file\n\n FileUtils::cd(target + '/../') do\n sysexec(extract_cmd)\n end\nend"
] | [
"0.62768906",
"0.61366785",
"0.598008",
"0.5943704",
"0.59319764",
"0.59226274",
"0.58503044",
"0.5823995",
"0.5799449",
"0.57321995",
"0.5729694",
"0.5718601",
"0.5682455",
"0.567469",
"0.5632223",
"0.56250256",
"0.557718",
"0.5564379",
"0.5561875",
"0.55276746",
"0.5514639",
"0.54860157",
"0.5480269",
"0.547596",
"0.5452019",
"0.54390144",
"0.54367244",
"0.5427602",
"0.5426026",
"0.5406762",
"0.5374925",
"0.5362481",
"0.53564113",
"0.53415895",
"0.53415114",
"0.5338763",
"0.5328217",
"0.5320498",
"0.5317516",
"0.52895546",
"0.5285505",
"0.52800167",
"0.5279395",
"0.52678025",
"0.52623403",
"0.52611226",
"0.52596426",
"0.5244715",
"0.52429694",
"0.5240596",
"0.52314013",
"0.5220662",
"0.52101743",
"0.5196747",
"0.5188457",
"0.5185923",
"0.51662946",
"0.51662505",
"0.51477325",
"0.5136234",
"0.5124806",
"0.5116454",
"0.5114175",
"0.51042503",
"0.5088987",
"0.5079234",
"0.5075624",
"0.50718164",
"0.50701886",
"0.50701886",
"0.50647587",
"0.5063493",
"0.5045202",
"0.5043297",
"0.5026052",
"0.5026052",
"0.50124407",
"0.5010176",
"0.5009662",
"0.50064397",
"0.50054044",
"0.49855608",
"0.49846146",
"0.49793175",
"0.4972498",
"0.4969646",
"0.49651015",
"0.4962234",
"0.4958359",
"0.4958359",
"0.49529937",
"0.49472758",
"0.49466142",
"0.49405247",
"0.4931599",
"0.491879",
"0.4916719",
"0.491646",
"0.4909312",
"0.49085423"
] | 0.70867246 | 0 |
Current page is the first page? | def first_page?
current_page == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == pages.begin\n end",
"def first_page?\n page == 1\n end",
"def is_first_page?\n p_index.to_i == 1\n end",
"def first_page?\n page_number > first_page_number\n end",
"def first_page?\n return true if total_pages < 1\n return (page == 1)\n end",
"def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend",
"def first_page?\n params[:page].nil?\n end",
"def first_page\n return nil if total_pages < 1\n return 1\n end",
"def first_page\n @links['first']\n end",
"def current_page?(page)\n @current_page == page\n end",
"def current?(page)\n @current == page\n end",
"def first_page_in_class?\n @current_class == \"Druid\" ? false : @cards.current_page == 1\n end",
"def first_page_number\n 1\n end",
"def prev_page?\n page_number > first_page_number\n end",
"def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"def current_page?(url); end",
"def has_next_page\n if first\n paged_nodes.length >= first\n else\n false\n end\n end",
"def root_page?\n current_page == root_page\n end",
"def current_is_last_page?\n @current_page.next_page == 0\n end",
"def first\n perform_request(first_page_uri) if first_page_uri\n end",
"def previous_page?\n page > 1\n end",
"def next_page?\n page.zero? || page < total_pages\n end",
"def has_previous_page?\n @current_page != 1\n end",
"def first_page\n Page.find(self.first_page_id)\n end",
"def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n end",
"def current_page; end",
"def current_page; end",
"def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end",
"def page?\n !!self.page_id\n end",
"def first_page!\n first_page.tap { |page| update_self(page) }\n end",
"def only_first_page?(extension)\n ['.htm', '.html', '.xhtml', '.txt'].include? extension\nend",
"def prev?\n current_page > 1\n end",
"def next_page?\n !next_page_number.nil?\n end",
"def current?(other_page)\n page == other_page\n end",
"def leading\n (@total_pages > 0) ? 1 : nil\n end",
"def first_page_id\n # Some PageTurners use integers, others use GUIDs etc., \n # but page numbers are most common, so default to 1.\n 1\n end",
"def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend",
"def previous?\n return @page > 1\n end",
"def current_page\n first(@raw_page['records'].size)\n end",
"def current_page\n self.page ||= 0\n self.page + 1\n end",
"def last_page?\n current_page == total_pages - 1\n end",
"def next?\n current_page < total_pages\n end",
"def last_page?\n current_page == pages.end\n end",
"def last_page?; ! @doc.has_key? 'next' end",
"def first_page\n # TODO are there cases where main_page = 'README' for 'lib/README'?\n if @options.main_page && (main_file = @all_files.find { |f| f.full_name == @options.main_page })\n main_file\n elsif (file = @simple_files.first)\n file\n elsif (cm = @unique_classes_and_modules.find { |k| !k.comment.empty? })\n cm\n elsif (file = @files_with_comment.first)\n file\n elsif !@unique_classes_and_modules.empty?\n @unique_classes_and_modules.find { |k| k.any_content } or\n @unique_classes_and_modules.first\n else\n @all_files.first\n end\n end",
"def is_page_active(page)\n current_page.url == page\n end",
"def next_page?\n page_number < last_page_number\n end",
"def first\n return nil unless first_page_uri\n perform_request(first_page_uri)\n end",
"def set_home_if_first\n if Page.all.empty?\n self.home = true\n elsif page_collection && page_collection.empty?\n self.home = true\n end\n end",
"def page\r\n @page || 1\r\n end",
"def has_previous?\n return self.current_page != 1 && self.total_pages > 1\n end",
"def next_page?\n !next_page_link.nil?\n end",
"def has_previous_page\n if last\n paged_nodes.length >= last\n else\n false\n end\n end",
"def last_page?\n !next_page_url\n end",
"def current_page\n page_cursor.peek\n end",
"def next?\n return @pages > @page\n end",
"def __page\n @_page || 1\n end",
"def next_page?\n @page.next_page_token?\n end",
"def page\n\t\t\t@navigation ? @navigation.page : nil\n\t\tend",
"def current_page\n @options[:page].blank? ? 1 : @options[:page].to_i\n end",
"def default_page\n current_api.current_page ? current_api.current_page : FIRST_PAGE\n end",
"def current_page\n params[:page] && params[:page].match(/\\d+/) ? params[:page].to_i : 1\n end",
"def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end",
"def last_page?\n current_page == total_pages\n end",
"def last_page?\n page == total_pages\n end",
"def page_selected?(page)\n self.current_page.fullpath =~ /^#{page.fullpath}(\\/.*)?$/\n end",
"def first?\n if defined? @first\n false\n else\n @first = false\n true\n end\n end",
"def first?\n not first.nil?\n end",
"def previous_page?\n !previous_page_number.nil?\n end",
"def go_to_first_page\n to_first_page.click\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page_number == total_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def redirect_to_homepage?\n @page.homepage?\n end",
"def home_page?\n active_page? 'info' => ['index']\n end",
"def last_page?\n last_page_number.nil?\n end",
"def default_page\n self.children.first\n end",
"def first?\n self.rel == \"first\"\n end",
"def page_active?(symbol); selected_page == symbol; end",
"def current_page\n @current_page\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def fetch_starting_page\n case @source\n when 'site' then page_repository.root\n when 'parent' then page_repository.parent_of(current_page) || current_page\n when 'page' then current_page\n else\n page_repository.by_fullpath(@source)\n end\n end",
"def locate\n\t i = self.comic.live_pages.index(self)\n\t i ? (i + 1) : false\n\tend",
"def paginated?\n @pages and @pages.length > 1\n end",
"def is_current_page_home?\n puts \"url_home\"\n puts request.url\n if request.url == \"http://127.0.0.1:3000/\" #home url\n @home = true\n end\n end",
"def current_page\n @page\n end",
"def paginated?\n current_page && current_page > 0\n end",
"def next_page?\n !next_page_token.nil? && !next_page_token.empty?\n end",
"def last_page?\n page_number < last_page_number\n end",
"def on_page?\n false\n end",
"def home_page?\n current_route?('')\n end",
"def first?\n\t locate == 1\n\tend",
"def has_next_page?\n @current_page < page_count\n end"
] | [
"0.9004532",
"0.9004532",
"0.9004532",
"0.9004532",
"0.89854574",
"0.89854574",
"0.897027",
"0.881746",
"0.8721724",
"0.8525082",
"0.8479245",
"0.8342261",
"0.7762188",
"0.77414465",
"0.76476043",
"0.7501462",
"0.74949086",
"0.7410818",
"0.7331915",
"0.720844",
"0.7178685",
"0.7149569",
"0.7139135",
"0.7127373",
"0.70754373",
"0.70314187",
"0.7029895",
"0.702759",
"0.70103693",
"0.6994163",
"0.69923073",
"0.69642323",
"0.69642323",
"0.6949693",
"0.69453245",
"0.69386107",
"0.69328845",
"0.6899647",
"0.689568",
"0.6890067",
"0.6878162",
"0.687017",
"0.686893",
"0.6866426",
"0.68585116",
"0.685182",
"0.6814018",
"0.6808285",
"0.6805226",
"0.68051285",
"0.6802665",
"0.680083",
"0.6800456",
"0.67916214",
"0.6777288",
"0.67696434",
"0.6760311",
"0.67572373",
"0.67559797",
"0.6755294",
"0.6747797",
"0.6744891",
"0.6738121",
"0.6737336",
"0.6726035",
"0.6717182",
"0.67133206",
"0.67059594",
"0.6688447",
"0.6683263",
"0.66812634",
"0.6675007",
"0.6673992",
"0.6660756",
"0.6652167",
"0.6650312",
"0.66455865",
"0.66441",
"0.66407216",
"0.66407216",
"0.6640676",
"0.6632052",
"0.6629774",
"0.6626455",
"0.66260237",
"0.6625064",
"0.6619294",
"0.6606951",
"0.65903753",
"0.65821975",
"0.6557393",
"0.6554743",
"0.6548455",
"0.65431327",
"0.6538686",
"0.6525698",
"0.65150774",
"0.65129435",
"0.6494916",
"0.6494173"
] | 0.89650315 | 7 |
Do we have more pages? | def last_page?
current_page == total_pages - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end",
"def more?\n @current < @pages\n end",
"def page_count()\n if @pages >= 500\n return true\n end\n else\n return false\n end",
"def next?\n return @pages > @page\n end",
"def has_next_page?\n @current_page < page_count\n end",
"def has_next_page\n if first\n paged_nodes.length >= first\n else\n false\n end\n end",
"def next_page?\n page.zero? || page < total_pages\n end",
"def paginated?\n @pages and @pages.length > 1\n end",
"def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def next?\n current_page < total_pages\n end",
"def last_page?\n page == total_pages\n end",
"def check_pages\n if pages.length > 0\n return false\n end\n return true\n end",
"def next_page?\n page_number < last_page_number\n end",
"def has_next_page?\n !@raw_page['nextRecordsUrl'].nil?\n end",
"def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end",
"def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end",
"def next_page?\n !!fetch[\"next_page\"]\n end",
"def more_songs\n get_songs\n return @page_size && @songs.count == @page_size\n end",
"def next_page?\n !next_page_number.nil?\n end",
"def needs_another_request? more_pages, remaining\n update_requests_remaining(remaining)\n more_pages\n end",
"def render?\n pages.to_a.size > 1\n end",
"def max_pages() 1 end",
"def more\n @current += 1\n return \"There is no more.\\r\\n\" if @current > @pages\n page = @my_p.page(@current)\n if more?\n page.items.join(\"\\r\\n\") << \"\\r\\n---Type MORE for next page (#{@current}/#{@pages})---\\r\\n\"\n else\n page.items.join(\"\\r\\n\") << \"\\r\\n\"\n end\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def next_page?\n @page.next_page_token?\n end",
"def out_of_bounds?\n current_page > total_pages\n end",
"def next_page?\n !next_page_link.nil?\n end",
"def last_page?\n current_page >= num_pages\n end",
"def has_next?()\n return false if @limit != nil && @offset >= @limit\n\n load_next_page() if @data == nil\n\n return true if @pos < @data.length\n\n return false if !@truncated\n\n load_next_page()\n\n @pos < @data.length\n end",
"def more?\n all_contents[next_offset].present?\n end",
"def last_page?\n current_page == total_pages\n end",
"def more?\n return @chunks.length > @index\n end",
"def last_page?\n !next_page_url\n end",
"def last_page?\n page_number < last_page_number\n end",
"def next_page?\n !next_page_token.nil? && !next_page_token.empty?\n end",
"def out_of_bounds?\n current_page > total_pages\n end",
"def last_page?\n current_page_number == total_pages\n end",
"def out_of_range?\n current_page > total_pages\n end",
"def last_page?\n current_page == page_count\n end",
"def pagination_candidate?(config, page); end",
"def paging?\n @paging\n end",
"def last_page?\n response['next'].nil?\n end",
"def has_previous_page\n if last\n paged_nodes.length >= last\n else\n false\n end\n end",
"def paginated?\n page_count > 1\n end",
"def page_num_checker \n\t\t@page_num < @total_page || @total_page == 0\n\tend",
"def fetch_more?(options, resp)\n page_size = options[:_pageSize] || options['_pageSize']\n\n return unless page_size && resp.is_a?(Array)\n resp.pop while resp.length > page_size\n\n resp.length < page_size\n end",
"def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"def next_page_token?\n !next_page_token.empty?\n end",
"def last?\n\t locate == self.comic.live_pages.length\n\tend",
"def has_next_page\n @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n end",
"def last_page?\n !out_of_bounds? && next_page.nil?\n end",
"def pagination?(doc)\n !page_count(doc).nil?\n end",
"def out_of_bounds?\n current_page > page_count\n end",
"def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end",
"def paginated?\n\t\t\t!next_page_url.nil?||!prev_page_url.nil?\n\t\tend",
"def last_page?\n\t\t\t!next_page_url if paginated?\n\t\tend",
"def last_page?\n current_page == pages.end\n end",
"def last_page?; ! @doc.has_key? 'next' end",
"def first_page?\n page_number > first_page_number\n end",
"def current_is_last_page?\n @current_page.next_page == 0\n end",
"def get_more\n @reserve = get_chain\n last_link = @reserve\n count = @page_size / 100\n count = 15 if count < 15\n while(count > 0)\n last_link = get_next_for(last_link)\n count -= 1\n end\n @next_object = get_next_for(last_link)\n set_next_for( last_link , nil )\n self\n end",
"def pagination_enabled?(site); end",
"def paginated?\n current_page && current_page > 0\n end",
"def has_more?\n @data[\"more\"].to_s == \"true\"\n end",
"def paginated?\n @choices.size > page_size\n end",
"def show_pagination? response = nil\n response ||= @response\n response.limit_value > 0 && response.total_pages > 1\n end",
"def show_pagination? response = nil\n response ||= @response\n response.limit_value > 0 && response.total_pages > 1\n end",
"def page_count; pages.count; end",
"def max_pages() Pages.keys.size end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def previous_page?\n page > 1\n end",
"def last_page?\n last_page_number.nil?\n end",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def include_page_count?\n JSONAPI.configuration.top_level_meta_include_page_count\n end",
"def first_page?\n page == 1\n end",
"def has_more?\n @data['has_more'].to_s == 'true'\n end",
"def has_more?\n @data['has_more'].to_s == 'true'\n end",
"def more_results?()\n #This is a stub, used for indexing\n end",
"def any?\n !total_pages.zero?\n end",
"def is_last? response, page\n ( (page >= response.max_pages) ||\n (response && response.healthy? && partial_response?(response)) )\n end",
"def paginated?\n false\n end",
"def empty?\n total_pages.zero?\n end",
"def load_page\n @page = params[:page] || '1'\n @per_page = (params[:limit] || '30').to_i\n @per_page = 30 if @per_page > 30\n true\n end",
"def enough_text_detected?\n text_length = @pages.inject(0) {|sum, page| sum + page[:text].length }\n text_length > (@pages.length * 100)\n end",
"def num_pages\n 26\n end",
"def page_count\n 1\n end",
"def withPages\n object.with_pages.nil? ? true : object.with_pages #For users prior to 1.1.5 with_pages used to be nil\n end",
"def show_summary_page?\n return true if (self.no_complete_pdf == false or self.page_count == 1)\n return false\n end",
"def number_of_pages\n return @number_of_pages\n end",
"def has_previous_page?\n @current_page != 1\n end",
"def is_first_page?\n p_index.to_i == 1\n end",
"def next_page?\n # rubocop:disable Style/DoubleNegation\n !!next_page_url\n # rubocop:enable Style/DoubleNegation\n end",
"def new_pages_list_loaded?\n if @new_pages_list_loaded\n true\n else\n @new_pages_list_loaded = true\n false\n end\n end",
"def more?\n rows.length / 2 >= more\n end",
"def prev_page?\n page_number > first_page_number\n end",
"def paginated?\n return false unless current_page\n true\n end",
"def pagination_needed?\n # Using #to_a stops active record trying to be clever\n # by converting queries to select count(*)s which then need to be repeated.\n @pagination_needed ||= primary_records.to_a.size > API_PAGE_SIZE\n end"
] | [
"0.8560216",
"0.849319",
"0.82227594",
"0.80433965",
"0.802607",
"0.7800313",
"0.7765027",
"0.7711835",
"0.7630382",
"0.7561847",
"0.7557496",
"0.7537642",
"0.75276613",
"0.7525138",
"0.744869",
"0.7440024",
"0.73971605",
"0.7381684",
"0.7375007",
"0.73486936",
"0.7313391",
"0.7311489",
"0.72764385",
"0.7262772",
"0.7247286",
"0.7247286",
"0.7238818",
"0.72366965",
"0.721896",
"0.7218324",
"0.72001547",
"0.71911854",
"0.71878195",
"0.7181727",
"0.71762264",
"0.7162841",
"0.7159559",
"0.714888",
"0.70987797",
"0.7098441",
"0.70964247",
"0.7095239",
"0.70907104",
"0.70816725",
"0.70788115",
"0.70751387",
"0.70557666",
"0.7049988",
"0.702875",
"0.7010127",
"0.70095074",
"0.70072305",
"0.6997163",
"0.6993505",
"0.6971494",
"0.6947274",
"0.69471633",
"0.69382316",
"0.69018936",
"0.68971026",
"0.68903995",
"0.68790203",
"0.68563163",
"0.6833227",
"0.68114305",
"0.6804286",
"0.6801153",
"0.6784216",
"0.6784216",
"0.6779506",
"0.67792445",
"0.6774851",
"0.6774851",
"0.6773978",
"0.6772586",
"0.6758716",
"0.6754179",
"0.6746512",
"0.6745132",
"0.6745132",
"0.6738889",
"0.67176837",
"0.6683061",
"0.66727567",
"0.66682005",
"0.6664684",
"0.6664361",
"0.6654809",
"0.66410935",
"0.6631779",
"0.6625827",
"0.66228193",
"0.6618634",
"0.66172713",
"0.6613351",
"0.65878564",
"0.6577405",
"0.65761596",
"0.6572937",
"0.657074"
] | 0.70128536 | 49 |
Number of pages in the current directory. | def total_pages
(items.size - 1) / max_items + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_pages\n pages.size\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end",
"def number_of_pages\n return @number_of_pages\n end",
"def page_count\n @total_pages\n end",
"def page_count; pages.count; end",
"def page_count(arg)\n @pages = arg\n end",
"def page_count\n @page_counter\n end",
"def num_pages\n (total_count.to_f / per_page).ceil\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def number_of_pages\n (total / page_size.to_f).ceil\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def num_pages\n (@total_entries.to_i / per_page.to_f).ceil\n end",
"def page_count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_pages\n end",
"def page_count\n @pages.count\n end",
"def total_pages; end",
"def page_count\n @page_count ||= get_page_count\n end",
"def total_pages\n total = total_items / page_size\n if total_items % page_size != 0\n total += 1\n end\n total\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def num_pages\n if order_bw_pages && order_color_pages\n return 2 + order_bw_pages + order_color_pages\n end\n end",
"def page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end",
"def num_pages\n 26\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def page_count\n # Integer arithmetic is simpler and faster.\n @page_count ||= item_count > 0 ? (item_count - 1) / items_per_page + 1 : 1\n end",
"def number_of_pages=(value)\n @number_of_pages = value\n end",
"def total_pages\n -1\n end",
"def pages(board)\n get(board, 1)[:pages].size\n end",
"def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end",
"def page_count\n file_groups\n @highest_page_count\n end",
"def current_page_number\n @pageset.size\n end",
"def num_pages\n (@limit / 10.0).ceil\n end",
"def page_count(input)\n info = info(input)\n return nil if info.nil?\n info['Pages'].to_i\n end",
"def get_num_pages\n record_count = @model_class.count\n if record_count % @items_per_page == 0\n (record_count / @items_per_page)\n else\n (record_count / @items_per_page) + 1\n end\n end",
"def actual_page_count\n warn \"WARNING: actual_page_count is not yet implemented properly.\"\n warn \" Please send patches.\"\n @pages.count\n end",
"def page_count\n @page_count ||= ( @total_results / @query.page_size.to_f ).ceil\n end",
"def total_pages\n @total_pages ||= (count.to_f / per_page).ceil\n end",
"def total_pages\n (posts.count + PER_PAGE - 1) / PER_PAGE # Taking advantage from integer division\n end",
"def page_count\n @page_count = notices_count/30 + 1\n @page_count = max_pages if @page_count > max_pages\n @page_count\n end",
"def calculate_pages\n pdftk_cmd = \"#{CONFIG[:pdftk]} #{@source} dump_data | grep NumberOfPages | grep -o -e \\\"\\\\([0-9]*\\\\)$\\\"\"\n @pages = %x[#{pdftk_cmd}].to_i\n end",
"def page_count\n if item_count % @items_per_page == 0\n item_count / @items_per_page\n else\n 1 + (item_count / @items_per_page)\n end\n end",
"def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end",
"def number_pages\n pagenum = 1\n @sequence.each do |entry|\n entry.pagenum = pagenum\n next if (is_page? entry and entry.valid_repeat)\n pagenum += 1 if is_page?(entry)\n end\n end",
"def item_count\n @pages.inject(0){|item_count, page| item_count + page.count}\n end",
"def total_pages\n nil\n end",
"def total_pages\n nil\n end",
"def nbpages\n attachments.order(position: 'asc').first.nbpages\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end",
"def page_count\n 1\n end",
"def getTotalPageCount()\n return @helper.getTotalPageCount()\n end",
"def page_count_from_end(current_page, total_pages)\n (total_pages.to_i - current_page.to_i) + 1\n end",
"def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end",
"def total_pages\n @total_pages ||= per_page > 0 ? (total / per_page.to_f).ceil : 1\n end",
"def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end",
"def count\n @document.page_count\n end",
"def total_pages\n (count / per_page.to_f).ceil\n end",
"def total_pages\n\t\t\t\treturn 0 if @total_results == 0\n\t\t\t\t(@total_results.to_f / BATCH_SIZE).ceil\n\t\t\tend",
"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 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 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 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 extract_total_pages\n pag = setup.fetch_page.css('.Ver12C')[70].text\n pag.scan(/\\d+/)[2].to_i\n end",
"def total_pages\n @total_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 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end",
"def page_count\n @page_count\n end",
"def count_all_html_pages(dir)\n perform_global_search('//html', [], dir)\n end",
"def total_pages(games_count)\n (games_count % GAMES_PER_PAGE == 0 ? games_count / GAMES_PER_PAGE : games_count / GAMES_PER_PAGE + 1).to_i\n end",
"def get_number_of_pages(numrec)\n return ((numrec + 50) / 50 * 50) / 50\nend",
"def total_pages\n pagination_adapter.total_pages\n end",
"def get_count(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if !file.is_dir\n file.files_count\n end",
"def page_count\n pages.last\n end",
"def total_pages\n current_page+4\n # hack to remove this count dependency\n #(total_count.to_f / limit_value).ceil\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index >= self.page_count\n @pages[page_index].count\n end",
"def num_pages(url)\n url = ensure_max_per_page(url)\n data = api_request_raw(url)\n\n if data.nil? or data.meta.nil? or data.meta['link'].nil?\n return 1\n end\n\n links = parse_links(data.meta['link'])\n\n if links.nil? or links['last'].nil?\n return 1\n end\n\n params = CGI::parse(URI::parse(links['last']).query)\n params['page'][0].to_i\n end",
"def number_of_pages\n document.at(\"[@itemprop='numberOfPages']\").innerHTML.scan(/\\d+/).first.to_i rescue nil\n end",
"def page_count=(num)\n @page_count = num\n end",
"def total_pages\n collection.total_pages\n end",
"def get_page_count\n first_page = Habr::open_page(Habr::Links.favorites(@userslug))\n count = 1\n\n last_page_link = first_page.xpath(\".//*[@id='nav-pages']/li/noindex/a\").first\n\n if last_page_link\n count = get_page_number_from_url(last_page_link[:href])\n else # no last page link found (that means fav pages count <= 6)\n page_urls = first_page.css(\"#nav-pages>li>a\").map { |link| link[:href] }\n page_numbers = page_urls.map { |url| get_page_number_from_url(url) }\n count = page_numbers.max unless page_numbers.empty?\n end\n\n count\n end",
"def total_pages\n per_page.zero? ? 0 : (total / per_page.to_f).ceil\n end",
"def page_count\n (item_count / @items_per_page.to_f).ceil\n end",
"def number_of_json_pages(state) #this will return an integer representing number of pages, use this to refactor\n state_locations(state)[\"numberOfPages\"]\n end",
"def page_counter\n @counter+=1\n puts \"Page #{@counter} done\"\n get_next_page until @counter >= @pages\n end",
"def total_pages\n self.search.results.total_pages\n end",
"def page_count\n bib_page_count\n end",
"def total_pages\n (total_entries / per_page.to_f).ceil\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 count_page\n num_pages = current_cookbook.num_pages\n render json: {num_pages: num_pages}\n end",
"def total_pages\n populate\n return 0 if @results[:total].nil?\n \n @total_pages ||= (@results[:total] / per_page.to_f).ceil\n end",
"def count_objects\n\n count = 0\n\n Find.find(@basepath) do |path|\n\n next unless File.exist? path\n next if File.stat(path).directory?\n\n count += 1 if path[-5..-1] == '.yaml'\n end\n\n count\n end",
"def get_total_pages\n\t\turl = \"#{@base_url}partners?city=#{@city}\"\n\t\tpage = @mechanize.get(url)\n\t\ttotal_pages = page.search('.pagination li:last a')[0]['href'].split('=')[2].to_i\n\tend",
"def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"def last_page_number\n number_of_pages\n end",
"def total_pages\n @total_pages ||= (@data.rows.length / per_page.to_f).ceil\n end",
"def inodes_per_page\n (size - pos_inode_array - 10) / Innodb::Inode::SIZE\n end",
"def get_total_pages(page)\n\t\t\tsource = getHtml(page).split(\";\")\n\t\t\ttotal_pages = 0 \n\t\t\tsource.each do |pos|\n\t\t\t\tif pos.include? \"total_pages\" \n\t\t\t\t\treturn pos[pos.index(\"=\") + 1, pos.length].to_i \n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def get_page_count(response)\n page_links = response.headers['link'].scan(/<(\\S+)>/).flatten\n /\\?page\\=(\\d+)\\&/.match(page_links.last)[1].to_i\n end",
"def total_pages\n (total / per_page.to_f).ceil\n end"
] | [
"0.76017255",
"0.7576334",
"0.7550106",
"0.7510014",
"0.74603564",
"0.73714846",
"0.7366279",
"0.7283027",
"0.72618014",
"0.7257561",
"0.7248634",
"0.7248634",
"0.7248634",
"0.7248634",
"0.71996856",
"0.7180941",
"0.717446",
"0.71704954",
"0.71568584",
"0.71267605",
"0.7121667",
"0.7121667",
"0.7121491",
"0.7119703",
"0.7113957",
"0.708992",
"0.7081964",
"0.7081642",
"0.7060517",
"0.7057554",
"0.6976502",
"0.69731385",
"0.6949271",
"0.6941254",
"0.6930657",
"0.6900642",
"0.68649304",
"0.6845101",
"0.6843969",
"0.6815086",
"0.6793912",
"0.67893004",
"0.677575",
"0.67695034",
"0.67653936",
"0.6746212",
"0.6742285",
"0.6734586",
"0.6734586",
"0.6728489",
"0.67193145",
"0.6715667",
"0.6713245",
"0.6705182",
"0.6703918",
"0.6674503",
"0.6672988",
"0.6656976",
"0.6652793",
"0.6644746",
"0.66212267",
"0.6618022",
"0.66103834",
"0.66103834",
"0.6603457",
"0.6603112",
"0.660126",
"0.65988225",
"0.6598587",
"0.65851516",
"0.65770006",
"0.65735626",
"0.6563565",
"0.65595716",
"0.6553355",
"0.654545",
"0.65406764",
"0.65405405",
"0.6537579",
"0.6536991",
"0.6525097",
"0.6513214",
"0.6492365",
"0.6481786",
"0.6459143",
"0.6453813",
"0.6451497",
"0.64470935",
"0.64378834",
"0.64157134",
"0.64088035",
"0.6399604",
"0.63852465",
"0.63841355",
"0.6379482",
"0.63783044",
"0.6370916",
"0.63633925",
"0.63623327",
"0.6348115"
] | 0.68678087 | 36 |
Move to the given page number. ==== Parameters +page+ Target page number | def switch_page(page)
main.display (@current_page = page)
@displayed_items = items[current_page * max_items, max_items]
header_l.draw_path_and_page_number path: current_dir.path, current: current_page + 1, total: total_pages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_page(num)\n add_actions \"MovePage(#{num})\"\n end",
"def move_to(x, y)\n cur_page.move_to(x, y)\n end",
"def go_to_page(page)\n get_total_pages unless @total_pages\n return nil if page.to_i < 1 || page.to_i > @total_pages\n ISBNdb::ResultSet.new(\"#{@uri}&page_number=#{page}\", @collection, page)\n end",
"def move_page_to(target_page_number)\n # Page number cannot be <= 0 or > number of total pages\n return if target_page_number.to_i <= 0 || target_page_number.to_i > self.survey_version.pages.count\n current_page_number = self.page_number\n\n # if the page has flow control, you cannot move the page to a higher page number than the target.\n # This would allow the user to possibly cause a loop\n if (self.next_page_id.present? && (self.next_page.page_number <= target_page_number.to_i)) || (self.prev_pages.any? {|page| target_page_number.to_i < current_page_number && page.page_number >= target_page_number.to_i})\n self.errors.add(:base, \"Moving page would break flow control. Please remove flow control from the page and try again.\")\n return false\n end\n\n if current_page_number > target_page_number.to_i\n # 1 2 3 target_page_number 5 6 current_page_number\n self.survey_version.pages\n .where([\n 'pages.page_number >= ? AND pages.page_number < ?',\n target_page_number, current_page_number\n ])\n .update_all('pages.page_number = pages.page_number + 1')\n else\n # 1 2 3 current_page_number 5 6 target_page_number\n self.survey_version.pages\n .where([\n 'pages.page_number > ? AND pages.page_number <= ?',\n current_page_number, target_page_number\n ])\n .update_all('pages.page_number = pages.page_number - 1')\n end\n\n self.update_attribute(:page_number, target_page_number)\n end",
"def go_to_page(k)\n @page_number = k\n state.page = state.pages[k - 1]\n generate_margin_box\n @y = @bounding_box.absolute_top\n end",
"def goto_page(page)\r\n goto_url full_url(page);\r\n end",
"def page=(page)\n if !page.nil? && page < 1\n fail ArgumentError, 'invalid value for \"page\", must be greater than or equal to 1.'\n end\n\n @page = page\n end",
"def change_page(p)\n self.page = p\n self\n end",
"def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end",
"def page(page)\n params['page'] = page\n end",
"def page(page)\n limit(owner.default_per_page).skip(owner.default_per_page * ([page.to_i, 1].max - 1))\n end",
"def page_to_skip(page)\n self.class.page_to_skip(page)\n end",
"def goto(page)\n @current_page = page\n validate\n end",
"def current_page=(page)\n number = page.to_i\n unless number.to_s == page.to_s && number.between?(1, page_count)\n raise PageNotFound, \"Unknown page #{page}, expected 1..#{page_count}\"\n end\n @current_page = number\n end",
"def next_page\n go_to_page(@current_page+1)\n end",
"def goto_line pos\n pages = ((pos * 1.00) / @pagesize).ceil\n pages -= 1\n @sta = pages * @pagesize + 1\n @cursor = pos\nend",
"def next_page!\n return unless next_page?\n @page += 1\n clear!\n end",
"def next_page\n page = self.page() + 1\n request = @request.clone()\n request.replace_param( :page, page )\n @client.execute( request )\n end",
"def begin; pager.offset page; end",
"def goto_page(page)\r\n perform_operation {\r\n @web_browser.goto_page(page) if @web_browser\r\n }\r\n end",
"def next_page\n page = @current_page + 1\n get_page(page)\n end",
"def next; pager.page(page + 1); end",
"def goto_line pos\n pos = pos.to_i\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n $sta = pages * $pagesize + 1\n $cursor = pos\nend",
"def update_progress(page)\n unless page.nil?\n p = page.to_i\n if p > 0 && p <= self.page\n self.page = p\n self.save\n end\n end\n end",
"def next_page\n @page = info(@page[:next_page])\n end",
"def next_page\n return if page >= total_pages\n page + 1\n end",
"def page(page)\n @options[:page] = page\n end",
"def page (page = 1)\n\t \tdiff = (page - 1) * 10\n\t \tall.offset(diff).limit(10)\n\t end",
"def next_page\n p = page + 1\n p > total_pages && p = nil\n p\n end",
"def next\n goto(@current_page + 1)\n end",
"def move_by(dx, dy)\n cur_page.move_by(dx, dy)\n end",
"def next_page\n num = current_page + 1\n num if total_pages >= num\n end",
"def page(number)\n\t\tfail ArgumentError.new(\"Page number cannot be lower than 1, #{number} given\") unless number > 0\n\t\t@result = nil\n\t\t@skip = (number - 1) * get_resultcount\n\t\treturn self\n\tend",
"def goto_line pos\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n #$sta = pages * $pagesize + 1\n $sta = pages * $pagesize + 0\n $cursor = pos\n #$log.debug \"XXX: GOTO_LINE #{$sta} :: #{$cursor}\"\nend",
"def goto_page(page)\n operation_delay\n dump_caller_stack\n @web_browser.goto_page(page) if @web_browser\n end",
"def next_page\n page + 1 if pages.include?(page + 1)\n end",
"def update_page(page)\n case page\n when 'previous'\n @bundle = previous_bundle\n when 'next'\n @bundle = next_bundle\n end\n end",
"def insert_page(page = nil)\n return @insert_page unless page\n if page == :last\n @insert_page = @pageset[-1]\n else\n @insert_page = @pageset[page]\n end\n end",
"def update_page\n if Input.trigger?(Key_nextpage)\n next_page\n elsif Input.trigger?(Key_lastpage) && @page_index > 0\n last_page\n end\n end",
"def page=(page)\n @page = page\n @state = PDF::Reader::PageState.new(page)\n @issues = []\n end",
"def page!(page_number)\n page(page_number).tap { |page| update_self(page) }\n end",
"def page(page_number)\n params[:page] = page_number\n self\n end",
"def post_move_page(name, page_number, new_index, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_move_page_with_http_info(name, page_number, new_index, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_move_page_with_http_info(name, page_number, new_index, opts)\n else\n raise\n end\n return data\n end",
"def next_page\n end",
"def next_page!\n next_page.tap { |page| update_self(page) }\n end",
"def selected_page=(page)\n end",
"def next_page\n set RGhost::Cursor.next_page\n end",
"def next_page\n @current_page + 1 if has_next_page?\n end",
"def set_page\n @page = Page.find(params[:id] || params[:page_id])\n end",
"def set_page\n @page = Page.unscoped.find(params[:id])\n end",
"def page(num)\n @query[:page] = num\n self\n end",
"def page(num)\n @query[:page] = num\n self\n end",
"def move_page_content(page_id, id, params = {})\n move_content(Voog::API::Contents::ParentKind::Page, page_id, id, params)\n end",
"def set_pages(total_pages, page)\n\n @total_pages = @total_pages || total_pages\n if page\n @pages_retrieved = page\n else\n @total_pages = @pages_retrieved\n end\n\n end",
"def turnPage\n @playdate.page_num = params[:new_page_num]\n @playdate.save\n Pusher[@playdate.pusher_channel_name].trigger('turn_page', {\n :player => current_user.id,\n :page => params[:new_page_num]\n })\n end",
"def c_page(n)\n BestiaryConfig::PAGEFX.play\n self.index += n\n end",
"def next_page\n current_page + 1 unless last_page? || out_of_range?\n end",
"def set_page(page)\n @tab_state = page\n @controller.change_tab(page)\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def next\n return @page + 1\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def set_page\n @page = Page.find(params[:id])\n end",
"def next_page; end",
"def change_page(direction)\n raise AttributeError unless [:next, :previous].include?(direction)\n begin\n history[:prev_page] = %r{\\/(\\d+)\\/$}.match(browser.url)[1].to_i\n rescue NoMethodError\n history[:prev_page] = 1\n end\n li = browser.li(class: direction.to_s)\n update_action_log(:li, !li.nil? && li.present?)\n a = li.a\n update_action_log(:a, !a.nil? && a.present?)\n browser.li(class: direction.to_s).a.click\n\n history[:current_page] = %r{\\/(\\d+)\\/$}.match(browser.url)[1].to_i\n\n update_action_log(\n direction.to_s + 'button_click',\n 1 == (history[:prev_page] - history[:current_page]).abs\n )\n end",
"def next_page\n return nil if total_pages == -1\n return nil if page == total_pages\n return page + 1\n end",
"def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end",
"def page(number, records_per_page=40)\n raise ArgumentError, \"the first page number is 1 (got #{number})\" if number < 1\n \n chain { |x|\n x.start_record = (number - 1) * records_per_page\n x.record_count = records_per_page\n }\n end",
"def set_page_page\n @page_page = PagePage.find(params[:id])\n end",
"def add_page_from(page)\n @pages_from << page unless @pages_from.include?(page)\n end",
"def page(num)\n limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))\n end",
"def next_page\n current_page >= total_pages ? nil : current_page + 1\n end",
"def paginate!(curr_page)\n return if !hard_paginate?\n @page = curr_page.to_i\n raise ArgumentError if @page < 1 || @page > total_pages\n adj_page = @page - 1 > 0 ? @page - 1 : 0 \n @prev_page = adj_page > 0 ? adj_page : nil\n @next_page = page < total_pages ? (@page + 1) : nil\n @data.only!(adj_page * per_page..(@page * per_page - 1))\n end",
"def set_page\n\t\t@page = Page.find(params[:id])\n\tend"
] | [
"0.7515494",
"0.73650265",
"0.69876534",
"0.6969776",
"0.69144964",
"0.6897104",
"0.6790838",
"0.6601568",
"0.6497327",
"0.64367515",
"0.6436707",
"0.6426241",
"0.6379423",
"0.63667774",
"0.6322878",
"0.6249541",
"0.624047",
"0.62356037",
"0.6229421",
"0.6211219",
"0.6193853",
"0.61603475",
"0.6136669",
"0.6135551",
"0.61351115",
"0.6119926",
"0.61176205",
"0.6114553",
"0.61143094",
"0.61042786",
"0.60794926",
"0.60681075",
"0.60321707",
"0.6030042",
"0.6029641",
"0.60062516",
"0.5999693",
"0.59968996",
"0.59863204",
"0.59790033",
"0.5960999",
"0.5953798",
"0.5919032",
"0.5900781",
"0.58858514",
"0.58729905",
"0.58690554",
"0.58604574",
"0.5856701",
"0.5852564",
"0.58415896",
"0.58415896",
"0.58387434",
"0.58313984",
"0.58286047",
"0.58195674",
"0.5779118",
"0.57784164",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57772297",
"0.57764906",
"0.5761024",
"0.5761024",
"0.5761024",
"0.5761024",
"0.5761024",
"0.5761024",
"0.5751913",
"0.5744919",
"0.5742955",
"0.5727005",
"0.5716306",
"0.57021666",
"0.56956893",
"0.5693916",
"0.56845325",
"0.56830025",
"0.567488"
] | 0.65823364 | 8 |
Update the header information concerning currently marked files or directories. | def draw_marked_items
items = marked_items
header_r.draw_marked_items count: items.size, size: items.inject(0) {|sum, i| sum += i.size}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh()\n self.contents.clear\n @cHeaders.each() { |cHeader| cHeader.draw() }\n end",
"def generate_header\n \n self.reload\n self.headers.reload\n \n layout_path = self.current_layout.relative_path unless self.current_layout.nil?\n \n # Default header values\n yaml_headers = {'title' => self.name, \n 'created_at' => Time.now,\n 'layout' => layout_path}\n \n self.headers.each do |header|\n yaml_headers[header.name] = header.content\n end\n \n update_attributes(:generated_header => YAML::dump(yaml_headers) + \"---\\n\")\n end",
"def update_meta_info!\n return unless has_been_read?\n\n ensure_meta_info_dir_exists!\n meta_info_file_pathname.write(\"#{@inode}:#{@read_bytes}\")\n end",
"def header_magic(ind, outd)\n dirs = []\n hdrs = []\n\n find_files(ind, /.*\\.h[hxp]*$/) do |p|\n outdir = File.dirname p.sub(ind, outd)\n outfile = File.join(outd, File.basename(p))\n\n directory outdir\n file outfile => p do\n cp_r p, outdir\n end\n dirs.push outdir\n hdrs.push outfile\n CLEAN.include outfile, outdir\n end\n\n dirs+hdrs\nend",
"def update_headers(data)\n # Populate the headers if they're not already set (which is the case with the custom exports)\n CUSTOM_EXPORT_OPTIONS.each_key do |data_type|\n next unless data.dig(data_type, :checked).present? && data.dig(data_type, :headers).blank?\n\n data[data_type][:headers] = data[data_type][:checked].map { |field| ALL_FIELDS_NAMES.dig(data_type, field) }\n end\n end",
"def index\n @headers = Header.all\n add_breadcrumb @headers.first.header_lang(current_user), 'headers'\n end",
"def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end",
"def add_log_header(file)\n end",
"def link_headers\n UI.message '- Linking headers' do\n pod_targets.each do |pod_target|\n # When integrating Pod as frameworks, built Pods are built into\n # frameworks, whose headers are included inside the built\n # framework. Those headers do not need to be linked from the\n # sandbox.\n next if pod_target.build_as_framework? && pod_target.should_build?\n\n pod_target_header_mappings = pod_target.header_mappings_by_file_accessor.values\n pod_target_header_mappings.each do |header_mappings|\n header_mappings.each do |namespaced_path, files|\n pod_target.build_headers.add_files(namespaced_path, files)\n end\n end\n\n public_header_mappings = pod_target.public_header_mappings_by_file_accessor.values\n public_header_mappings.each do |header_mappings|\n header_mappings.each do |namespaced_path, files|\n sandbox.public_headers.add_files(namespaced_path, files)\n end\n end\n end\n end\n end",
"def set_header_fields(request)\n request.smb2_header.tree_id = id\n request.smb2_header.credits = 256\n request\n end",
"def set_common_info(info, path)\n set_common_timestamps(info, path)\n if path.file?\n info.end_of_file = path.size\n info.allocation_size = get_allocation_size(path)\n end\n info.file_attributes = build_fscc_file_attributes(path)\n end",
"def update\n respond_to do |format|\n if @header.update(header_params)\n format.html { redirect_to edit_admin_header_path(@header), notice: 'Header was successfully updated.' }\n format.json { render :show, status: :ok, location: @header }\n else\n format.html { render :edit }\n format.json { render json: @header.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_headers\n @mailbox.update do |yaml|\n yaml[@hash] = @headers\n end\n end",
"def header\n end",
"def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end",
"def add_header\n @document.root = Atom::XML::Node.new('atom:entry')\n\n Atom::XML::Namespace.new(@document.root, 'atom', 'http://www.w3.org/2005/Atom')\n Atom::XML::Namespace.new(@document.root, 'apps', 'http://schemas.google.com/apps/2006')\n Atom::XML::Namespace.new(@document.root, 'gd', 'http://schemas.google.com/g/2005')\n end",
"def textfileHeader\n raw_header = labels.inject(\"\") { |header, l| header + \" \" + l.text}\n header = \"Classes: \" + raw_header\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @widgets = args[:widgets] if args.key?(:widgets)\n end",
"def header=(header)\n @header = header\n end",
"def write_headers\n @sheet.row(0).replace [header]\n @sheet.row(3).replace name_header_row(@player.longs.first.ticker_name, @player.shorts.first.ticker_name, @player.calls.first.ticker_name)\n @sheet.row(4).replace data_header_row(long_short_headers, long_short_headers, call_put_headers)\n\n @sheet.row(17).replace name_header_row(@player.futures.first.ticker_name, 'Total P&L', @player.puts.first.ticker_name)\n @sheet.row(18).replace data_header_row(long_short_headers, overall_headers, call_put_headers)\n end",
"def header=(header)\n @header = header\n end",
"def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Tasks\"\n else\n add_text \"Current Tasks\"\n end\n end \n end",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def update\n respond_to do |format|\n if @header.update(header_params)\n format.html { redirect_to @header, notice: \"Header was successfully updated.\" }\n format.json { render :show, status: :ok, location: @header }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @header.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fileHeader(fname, curDate, misc=\"\")\r\n fname = File.basename(fname, \".gdl\")\r\n header = <<EOF\r\n/* **************************************************************************\r\n * File: #{fname}.gdl\r\n *\r\n * Guideline source generated #{curDate}\r\n * #{misc}\r\n *\r\n * *************************************************************************/\r\n\r\n\r\nEOF\r\n\r\n return header\r\n end",
"def update_header\n header.body_length = body.length\n end",
"def header=(new_header)\n @header = new_header\n # prepare defaults\n @header[\"description\"] ||= \"\"\n # handle tags\n @dependencies = parse_tag_list(Array(@header[\"requires\"]))\n @provides = parse_tag_list(Array(@header[\"provides\"]))\n\n @extends = case @header[\"extends\"]\n when Array then Tag.new(@header[\"extends\"][0])\n when String then Tag.new(@header[\"extends\"])\n else nil\n end\n\n @replaces = case @header[\"replaces\"]\n when Array then Tag.new(@header[\"replaces\"][0])\n when String then Tag.new(@header[\"replaces\"])\n else nil\n end\n end",
"def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Goals\"\n else\n add_text \"Current Goals\"\n end\n end \n \n end",
"def document_header_icon(document)\n level = document.level\n case level\n when 'collection'\n 'search'\n when 'File'\n 'compact'\n else\n 'compact'\n end\n end",
"def update\n respond_to do |format|\n if @admin_header.update(admin_header_params)\n format.html { redirect_to admin_root_path, notice: 'Header was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_header }\n else\n format.html { render :edit }\n format.json { render json: @admin_header.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_head_horizontal_location(column)\n locate_head[1] = column\n end",
"def update_header_menu\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @yaml = ApplicationHelper.get_config_yaml\n\n @yaml[:general]['header_menus'] = [] if @yaml[:general]['header_menus'].nil?\n\n entry = [params[:header_menu]['name'], params[:header_menu]['target'], params[:header_menu]['url']]\n\n unless @yaml[:general]['header_menus'].nil?\n if params[:org_name].nil? or params[:org_name] != entry[0]\n @yaml[:general]['header_menus'].each do |header_menu|\n if header_menu[0] == entry[0]\n flash[:notice] = 'ERROR:' + t('msg.menu_duplicated')\n render(:partial => 'ajax_header_menu', :layout => false)\n return\n end\n end\n end\n end\n\n idx = nil\n unless params[:org_name].nil? or @yaml[:general]['header_menus'].nil?\n i = 0\n @yaml[:general]['header_menus'].each do |header_menu|\n if header_menu[0] == params[:org_name]\n idx = i\n break\n end\n i += 1\n end\n end\n\n if idx.nil?\n @yaml[:general]['header_menus'] << entry\n else\n @yaml[:general]['header_menus'][idx] = entry\n end\n\n ApplicationHelper.save_config_yaml(@yaml)\n\n render(:partial => 'ajax_header_menu', :layout => false)\n end",
"def email_update_header\n col = 18\n hdr = \"------------------------------------------------------------------------\\n\" +\n 'Design : '.rjust(col) + self.oi_instruction.design.directory_name + \"\\n\" +\n 'Category : '.rjust(col) + self.oi_instruction.oi_category_section.oi_category.name + \"\\n\" +\n 'Step : '.rjust(col) + self.oi_instruction.oi_category_section.name + \"\\n\" +\n 'Team Lead : '.rjust(col) + self.oi_instruction.user.name + \"\\n\" +\n 'Designer : '.rjust(col) + self.user.name + \"\\n\" +\n 'Date Assigned : '.rjust(col) + self.created_on.format_dd_mon_yy('timestamp') + \"\\n\" +\n 'Complete : '.rjust(col)\n if self.complete?\n hdr += \"Yes\\n\" +\n 'Completed On : '.rjust(col) + self.completed_on.format_dd_mon_yy('timestamp') + \"\\n\"\n else\n hdr += \"No\\n\"\n end\n\n if self.oi_instruction.oi_category_section.urls.size > 0\n label = true\n self.oi_instruction.oi_category_section.urls.each do |url|\n \n if label\n hdr += 'References : '.rjust(col)\n label = false\n else\n hdr += ' : '.rjust(col)\n end\n \n if url[:text] != ''\n hdr += url[:text] + \"\\n\" + ' : '.rjust(col) + url[:url] + \"\\n\"\n else\n hdr += url[:url] + \"\\n\"\n end\n \n end\n end\n\n hdr += \"------------------------------------------------------------------------\\n\"\n\n \n hdr\n \n end",
"def header_files\n @header_files ||= find_files( @header_search_paths, @header_file_extension ).uniq\n @header_files\n end",
"def update()\n Ini.write_to_file(@path, @inihash, @comment)\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @urls = args[:urls] if args.key?(:urls)\n end",
"def copy_header_mappings\n mappings = super\n unless %w{ JSON XML }.include?(@name)\n (mappings[header_dir] ||= []) << Pathname.new(\"RestKit/Code/#{@name}/#{@name}.h\")\n end\n mappings\n end",
"def set_header\n @header = Header.find(params[:id])\n end",
"def set_header\n @header = Header.find(params[:id])\n end",
"def update!(**args)\n @adobe_hdr = args[:adobe_hdr] if args.key?(:adobe_hdr)\n @google_hdr = args[:google_hdr] if args.key?(:google_hdr)\n end",
"def generateHeader( files )\n output = \"<html><body><h1>CrowdLogs for...:</h1><ul>\"\n files.each do |file|\n output += \"<li><a href='##{file}'>#{file}</a></li>\"\n end\n output += \"</ul>\"\n return output\nend",
"def display_header\n self.design.directory_name + ' - ' +\n self.design.board.platform.name + ' / ' + self.design.board.project.name\n end",
"def favorites_header\n system 'clear'\n puts @header.light_blue\n puts \"My Favourites\".center(@header_length)\n puts @header.light_blue\n end",
"def write_headers(source_doc, output_file)\n items = [\"---\"]\n items << \"layout: #{@options[:layout]}\"\n items << \"title: \\\"#{source_doc.at_css(\"title\").text}\\\"\"\n items << \"description: \\\"#{source_doc.at_css(\"excerpt|encoded\", namespaces).text}\\\"\"\n items << \"date: #{source_doc.at_css(\"pubDate\").text}\"\n items << \"comments: #{@options[:comments]}\"\n items << \"author: #{@options[:author]}\"\n items << \"categories: [#{source_doc.css(\"category[domain='tag']\").collect { |n| n.text }.join(\",\")}]\"\n items << \"---\"\n output_file.write(\"#{items.join(\"\\r\\n\")}\\r\\n\\r\\n\") \n end",
"def update_file_info\n if self.path\n size = File.exists?(self.path) ? File.size(self.path) : nil\n end\n if size\n (value, units) = bits_to_human_readable(size)\n self.size = value unless value.nil? or value.empty?\n self.size_units = units unless units.nil? or units.empty?\n self.save if self.descMetadata.changed?\n end\n end",
"def put_header\n @io.puts 'Calculating -------------------------------------'\n end",
"def update!(**args)\n @header = args[:header] if args.key?(:header)\n @header_title_redundancy = args[:header_title_redundancy] if args.key?(:header_title_redundancy)\n @header_used_in_snippet = args[:header_used_in_snippet] if args.key?(:header_used_in_snippet)\n @items = args[:items] if args.key?(:items)\n @original_total_items = args[:original_total_items] if args.key?(:original_total_items)\n @radish_score = args[:radish_score] if args.key?(:radish_score)\n end",
"def update_feature_header\n feature = Feature.find(params[:feature_id])\n is_a_new_label = (params[:label] != feature.label)\n feature.update_attributes({:label => params[:label], :automatic_rating_mode => params[:automatic_rating_mode], :extract => params[:extract]})\n if is_a_new_label\n Feature.rebuild!\n feature.update_path_and_sort\n end \n redirect_to(features_category_path(feature.category_id)) \n end",
"def header_files\n source_files(HPP_EXTENSIONS)\n end",
"def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end",
"def add_headers(directory, relative_directory, group, app_target, make_public)\n\theader_files = Dir.entries(directory)\n\theader_files.each { |file|\n\t\tif !file.include? \".c\"\n\t\t\tif file.include? \".h\"\n\t\t\t\th_ref = group.new_file(relative_directory + file)\n\t\t\t\tif make_public\n\t\t\t\t\tbuild_file_ref = app_target.headers_build_phase().add_file_reference(h_ref, true)\n\t\t\t\t\tbuild_file_ref.settings = { \"ATTRIBUTES\" => [\"Public\"] }\n\t\t\t\tend\n\t\t\telsif file != \".\" && file != \"..\"\n\t\t\t\ta_header_group = group.new_group(file)\n\t\t\t\tadd_headers(directory + \"/\" + file, relative_directory + \"/\" + file + \"/\", a_header_group, app_target, make_public)\n\t\t\tend\n\t\tend\n\t}\nend",
"def build_header\n @pdf.text_box(\n @labels[:name],\n size: 20,\n align: :left,\n at: [0, y(720) - @push_down],\n width: x(300),\n )\n\n if used? @labels[:sublabels][:name]\n @pdf.text_box(\n @labels[:sublabels][:name],\n size: 12,\n at: [0, y(720) - @push_down - 22],\n width: x(300),\n align: :left\n )\n end\n\n @pdf.text_box(\n @document.number,\n size: 20,\n at: [x(240), y(720) - @push_down],\n width: x(300),\n align: :right\n )\n\n @pdf.move_down(250)\n\n if used? @labels[:sublabels][:name]\n @pdf.move_down(12)\n end\n end",
"def replace_header_tags(text, regex, format, &block)\n @header_tags ||= {}\n @header_tags[regex] ||= []\n\n replace(text, regex) do |tagged_path, line_number|\n results, tags, hammer_files, paths = [], [], [], [], []\n filenames = tagged_path.gsub(regex.to_s[/<!-- (.*?) /], \"\").gsub(\"-->\", \"\").strip.split(\" \")\n\n filenames.each do |filename|\n filename = get_variable(filename) if filename.split(\"\")[0] == \"$\"\n matching_files = find_files_with_dependency(filename, format.to_s)\n name = regex.to_s[/ (.*?) /].strip.gsub(\"@\", \"\").capitalize\n raise \"#{name} tags: <b>#{h filename}</b> couldn't be found.\" if matching_files.empty?\n hammer_files += matching_files\n end\n\n hammer_files_to_tag = []\n hammer_files.each do |file|\n # We don't want this if it's a compiled file, or if it's only an include!\n # next if file.is_a_compiled_file # TODO\n next if File.basename(file).start_with?(\"_\")\n\n path = path_to(file)\n # TODO: WTF do these do\n next if @header_tags[regex].include?(path)\n @header_tags[regex] << path\n\n paths << path\n hammer_files_to_tag << file\n end\n\n if optimized\n file = add_file_from_files(hammer_files_to_tag, format)\n paths = [path_to(file)]\n end\n\n paths.map { |path| block.call(path) }.compact.join(\"\\n\")\n end\n end",
"def change_header( header, value, index=1 )\n index = [index].pack('N')\n RESPONSE[\"CHGHEADER\"] + \"#{index}#{header}\\0#{value}\" + \"\\0\"\n end",
"def header(path, file, locale, date)\n File.read(path)\n .gsub('<file>', file)\n .gsub('<locale>', locale)\n .gsub('<date>', date.to_s)\n end",
"def read_and_write header_flag\n agg_qry = [ match_query, group_all, project_all ]\n @reader.agg_each(agg_qry) do |doc, i|\n data = doc.clone\n data['fiscal_year_id'] = data['fiscal_quarter_id'][0, 4]\n if data['bookings_adjustments_code'] =~ /^L/i\n data['cloud_flag'] = 'Y' \n else\n data['cloud_flag'] = 'N'\n end\n header = data.keys \n if header_flag\n @writer.write_header header\n header_flag = false\n end\n @writer.write_data data\n end\n end",
"def header; end",
"def header; end",
"def header; end",
"def header\n\t\t@json_file\n\tend",
"def header_insert\n super\n end",
"def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end",
"def write\n\t\t#clear the directory before doing anything else\n\t\tclear @path\n\n\t\t#write out source code files\n\t\[email protected] do |mold|\n\t\t\twrite_object(mold.name + \".h\", header(mold))\n\t\t\twrite_object(mold.name + \".m\", source(mold))\n\t\tend\n\tend",
"def build_header \n pdf_writer.margins_in(1)\n if timespan == \"Weekly\"\n add_text \"Status Report for the Week of \" + Time.now.to_formatted_s(:date)\n else\n add_text \"Status Report for \" + Time.now.to_formatted_s(:date)\n end\n end",
"def on_header_init()\n end",
"def pdf_header(pdf, report)\n # TODO: when we can use prawn >= 0.7.1, use the pdf.page_number method instead of counting ourselves\n @page_count = 0\n pdf.header [pdf.margin_box.left, pdf.margin_box.top + 10] do\n pdf.font \"Helvetica\" do\n pdf.text report.title, :size => 12, :align => :left\n pdf.move_up(16) # move back up so that the next two lines are more or less even with the title line\n pdf.text Time.now, :size => 8, :align => :right\n pdf.text \"Page: #{@page_count = @page_count + 1}\", :size => 8, :align => :right\n pdf.stroke_horizontal_rule\n end\n end\n end",
"def build_header\n system \"gdal_translate -of GTiff -a_srs EPSG:4326 #{@processed_path} #{@processed_path}_\"\n FileUtils.rm(@processed_path)\n FileUtils.mv(\"#{@processed_path}_\", @processed_path)\n end",
"def add_headers; end",
"def header mold\n\t\t#puts \"#{@name} url: #{@url}\"\n\n\t\tret = comment(mold.name)\n\n\t\tret << \"@interface #{mold.name} : NSObject\\n\\n\"\n\n\t\t#writes the property declaration in the header file\n\t\tmold.properties.each { |p| ret << property(p) }\n\n\t\tret << \"\\n+ (RKObjectMapping *) mapping;\\n\"\n\n\t\tret << \"\\n@end\"\n\tend",
"def update_contributor(header, val, processed)\n key = header.to_sym\n processed[key] ||= []\n processed[key] << { name: [val.strip] }\n end",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\[email protected] self, @wrapped_object, @window, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def header=(header)\n header = [header] unless header.respond_to? :each\n @header = normalize(header)\n @aliases = header.map do |n|\n n.downcase.gsub(' ', '_').gsub(\"\\n\", '_').to_sym\n end if @aliases.empty?\n end",
"def update_sets\n # new refset is the the workset sans headers not in header table\n refset = @workset.reject {|(i,h)| [email protected]? h}\n\n # new workset is the refset with index of each header in header table\n @workset = refset.collect {|(i,h)| [@table.find_index(h), h]}\n end",
"def formatted_file_list(title, source_files); end",
"def c_refresh\n $filterstr ||= \"M\"\n #$files = `zsh -c 'print -rl -- *(#{$sorto}#{$hidden}#{$filterstr})'`.split(\"\\n\")\n $patt=nil\n $title = nil\n display_dir\nend",
"def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end",
"def Header\r\n\t\tif @page == 1\r\n\t\t\tfirst_page_header\r\n\t\telse\r\n\t\t\tpage_header\t\r\n\t\tend\r\n\tend",
"def header_image_sub_directory\n dirs = Hash.new(\"headers\")\n dirs[\"ski_and_guiding_schools\"] = \"ski-school-headers\"\n dirs[\"summer_holidays\"] = \"summer-headers\"\n dirs[controller.action_name]\n end",
"def heading\n @heading='Browse'\n end",
"def output_header_relations\n ext = @image_files.first[:ext]\n @replaceable_files[Document.header_relations_xml_file] = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>' +\n '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId14\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image1.' +\n ext +\n '\"/></Relationships>'\n end",
"def start_header(attributes)\n @element_stack << :header\n end",
"def start_header(attributes)\n @element_stack << :header\n end",
"def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end",
"def update_local_headers\n nil\n end",
"def print_header\n # Identify method entry\n\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # Header\n cprint BOLD + \"------------------------------\\n\" + RESET\n cprint BOLD + \"watson\" + RESET\n cprint \" - \" + RESET\n cprint BOLD + YELLOW + \"inline issue manager\\n\\n\" + RESET\n cprint \"Run in: #{ Dir.pwd }\\n\"\n cprint \"Run @ #{ Time.now.asctime }\\n\"\n cprint BOLD + \"------------------------------\\n\\n\" + RESET\n\n return true\n end",
"def change_names(offset)\n puts \"Changing files...\"\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n File.rename(item, fullname)\n end\n puts \"Done.\"\nend",
"def render_header\n if @done\n @prompt.decorate(@selected.map(&:name).join(', '), :green)\n elsif @selected.size.nonzero?\n @selected.map(&:name).join(', ')\n elsif @first_render\n @prompt.decorate(@help, :bright_black)\n else\n ''\n end\n end",
"def rearrange_docs!\n docs_table = {}\n custom_order = {}\n\n # pre-sort to normalize default array across platforms and then proceed to create a Hash\n # from that sorted array.\n docs.sort.each do |doc|\n docs_table[doc.relative_path] = doc\n end\n\n metadata[\"order\"].each do |entry|\n custom_order[File.join(relative_directory, entry)] = nil\n end\n\n result = Jekyll::Utils.deep_merge_hashes(custom_order, docs_table).values\n result.compact!\n self.docs = result\n end",
"def rebuild\n header.sh_size = data.size\n @data\n end",
"def information_header\n info_table_src = TTY::Table.new\n @defaults.label_value_pairs.each {|pair| info_table_src << pair}\n info_table_src << [\"Disposition Columns:\", MmMovie.dispositions.join(', ')]\n info_table_src << [\"Transcode File Location:\", self.tempfile ? tempfile&.path : 'n/a']\n\n info_table = C.bold(\"Looking for file(s) and processing them with the following options:\\n\").dup\n info_table << info_table_src.render(:basic) do |renderer|\n a = @defaults.label_value_pairs.map {|p| p[0].length }.max + 1\n b = OutputHelper.console_width - a - 2\n renderer.alignments = [:right, :left]\n renderer.multiline = true\n renderer.column_widths = [a,b]\n end << \"\\n\\n\"\n end",
"def semanticize_table_headers!\n @document.tree.search('table tr:first td').each { |node| node.node_name = 'th' }\n end",
"def header\n if io.kind_of?(File)\n puts colorize(\"Request-log-analyzer summary report\", :white, :bold)\n line(:green)\n puts \"Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke\"\n puts \"Website: #{link('http://github.com/wvanbergen/request-log-analyzer')}\"\n end\n end",
"def test_load_headered\n doc = SimpleDocument.read \"folder/headered\"\n \n assert_equal \"#{DIR}/fixtures/folder/headered.md\", doc.uri\n assert_equal :markdown, doc.format\n assert_equal \"A document with a header.\\n\", doc.body\n \n assert_equal nil, doc.header\n assert_equal \"headered\", doc.name\n assert_equal true, doc.active?\n assert_equal Time.parse(\"2012-01-01\"), doc.mtime\n end",
"def today_header\n system 'clear'\n puts @header.light_blue\n puts \"Check out whats on around Melbourne today!\".center(@header_length)\n puts @header.light_blue\n end",
"def update_headers(request_headers)\n @request_headers.merge!(request_headers)\n end",
"def set_header_options(curl)\n summary = summary_for_feed\n \n unless summary.nil?\n curl.headers['If-None-Match'] = summary[:etag] unless summary[:etag].nil?\n curl.headers['If-Modified-Since'] = summary[:last_modified] unless summary[:last_modified].nil?\n end\n \n curl\n end",
"def update!\n @source.headers.delete(:update)\n set_updated_time(Time.now)\n save\n end",
"def edit_header_menu\n Log.add_info(request, params.inspect)\n\n unless params[:org_name].nil?\n yaml = ApplicationHelper.get_config_yaml\n\n unless yaml[:general]['header_menus'].nil?\n yaml[:general]['header_menus'].each do |header_menu|\n if header_menu[0] == params[:org_name]\n @header_menu_param = header_menu\n break\n end\n end\n end\n end\n\n render(:partial => 'ajax_header_menu_info', :layout => false)\n end",
"def recompute_offsets()\n @header.resource_index.number_of_records = @records.length\n # @header.resource_index.next_index = 0 # TODO: How is this determined?\n\n curr_offset = PDB::Header.round_byte_length\n\n # Compute length of index...\n unless @index == []\n @index.each do |i|\n curr_offset += i.length()\n end\n end\n\n unless @appinfo.nil?\n @header.appinfo_offset = curr_offset\n curr_offset += @appinfo.length()\n end\n\n unless @sortinfo.nil?\n @header.sortinfo_offset = curr_offset\n curr_offset += @sortinfo.length()\n end\n\n ## And here's the mysterious two-byte filler.\n #curr_offset += 2\n\n unless @index.length == 0\n @index.each do |i|\n rec = @records[i.r_id]\n i.offset = curr_offset\n curr_offset += rec.length\n end\n end\n end"
] | [
"0.55350065",
"0.5534353",
"0.5378518",
"0.52742654",
"0.52684754",
"0.52577955",
"0.51829416",
"0.51422334",
"0.5125846",
"0.51111484",
"0.5093663",
"0.5080094",
"0.5074215",
"0.50631094",
"0.5048142",
"0.50269586",
"0.5026468",
"0.49961203",
"0.49961203",
"0.49961203",
"0.4996066",
"0.49884927",
"0.49868",
"0.4976862",
"0.49625534",
"0.4948417",
"0.4938464",
"0.49311954",
"0.4928585",
"0.4922786",
"0.4910776",
"0.49051398",
"0.49017775",
"0.48900616",
"0.4877462",
"0.4870613",
"0.4861215",
"0.48575708",
"0.48505792",
"0.48498315",
"0.48498315",
"0.4844817",
"0.484452",
"0.4836404",
"0.4830298",
"0.48258224",
"0.48237357",
"0.48138204",
"0.48038965",
"0.4803264",
"0.48010245",
"0.47992483",
"0.4796826",
"0.4795078",
"0.47831783",
"0.4782787",
"0.4779578",
"0.4778598",
"0.47766015",
"0.47766015",
"0.47766015",
"0.47737843",
"0.477145",
"0.47644326",
"0.47630295",
"0.4761003",
"0.47599295",
"0.47567835",
"0.47528154",
"0.4749131",
"0.47443855",
"0.47336623",
"0.47301862",
"0.47172225",
"0.47150448",
"0.46915925",
"0.4689125",
"0.46865943",
"0.46799663",
"0.4679371",
"0.46696216",
"0.4667905",
"0.4664848",
"0.4664848",
"0.46644703",
"0.46601906",
"0.4654214",
"0.46537444",
"0.46484968",
"0.4645356",
"0.4642715",
"0.4639425",
"0.4636492",
"0.4635688",
"0.46336463",
"0.46266225",
"0.46171743",
"0.46148413",
"0.46143016",
"0.46085897",
"0.46084377"
] | 0.0 | -1 |
Update the header information concerning total files and directories in the current directory. | def draw_total_items
header_r.draw_total_items count: items.size, size: items.inject(0) {|sum, i| sum += i.size}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_header\n @io.puts 'Calculating -------------------------------------'\n end",
"def files\n @header.dirindexes.map { |idx|\n @header.dirnames[idx]\n }.zip(@header.basenames).map { |dir, name|\n ::File.join(dir, name)\n }.zip(@header.filesizes).map { |path, size|\n Rupert::RPM::File.new(path, size)\n }\n end",
"def update_file_info\n if self.path\n size = File.exists?(self.path) ? File.size(self.path) : nil\n end\n if size\n (value, units) = bits_to_human_readable(size)\n self.size = value unless value.nil? or value.empty?\n self.size_units = units unless units.nil? or units.empty?\n self.save if self.descMetadata.changed?\n end\n end",
"def table_header\n line = \"File|Total\".dup\n line << \"|Line\" if header_line_rate?\n line << \"|Branch\" if header_branch_rate?\n line << \"\\n\"\n end",
"def update_header\n header.body_length = body.length\n end",
"def set_common_info(info, path)\n set_common_timestamps(info, path)\n if path.file?\n info.end_of_file = path.size\n info.allocation_size = get_allocation_size(path)\n end\n info.file_attributes = build_fscc_file_attributes(path)\n end",
"def summary(recursive=false)\n failures = failures(recursive)\n successes = successes(recursive)\n newfiles = new_files(recursive)\n total = failures.size + successes.size + newfiles.size\n summary = \"#{@dir} #{recursive ? \" and sub-directories\" : \"\"} contains #{total} files: #{successes.size} stored, #{failures.size} failed, #{newfiles.size} new\"\n return summary \n end",
"def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end",
"def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Goals\"\n else\n add_text \"Current Goals\"\n end\n end \n \n end",
"def rebuild\n header.sh_size = data.size\n @data\n end",
"def refresh()\n self.contents.clear\n @cHeaders.each() { |cHeader| cHeader.draw() }\n end",
"def set_header_fields(request)\n request.smb2_header.tree_id = id\n request.smb2_header.credits = 256\n request\n end",
"def process_directory(path)\n directories = []\n files = []\n sizes = {}\n Dir.entries(path).sort.each do |filename|\n full_path = \"#{path}/#{filename}\"\n case filename\n when '.' || '..'\n\n when 'index.html'\n\n else\n\n case\n when filename =~ /^\\./\n # ignore hidden files\n when File.directory?(full_path)\n directories << filename\n when File.file?(full_path)\n files << filename\n sizes[full_path] = File.size(full_path)\n end\n\n end # case filename\n end\n\n directories.sort.each do |directory|\n process_directory(\"#{path}/#{directory}\")\n end\n\n # output this directory's info:\n write_index_file(\"#{path}/index.html\", directories, files, sizes)\n puts \"#{path}/index.html\"\nend",
"def header_magic(ind, outd)\n dirs = []\n hdrs = []\n\n find_files(ind, /.*\\.h[hxp]*$/) do |p|\n outdir = File.dirname p.sub(ind, outd)\n outfile = File.join(outd, File.basename(p))\n\n directory outdir\n file outfile => p do\n cp_r p, outdir\n end\n dirs.push outdir\n hdrs.push outfile\n CLEAN.include outfile, outdir\n end\n\n dirs+hdrs\nend",
"def update_meta_info!\n return unless has_been_read?\n\n ensure_meta_info_dir_exists!\n meta_info_file_pathname.write(\"#{@inode}:#{@read_bytes}\")\n end",
"def stats_before_compil\n # Readme available?\n if File.exists?('readme.txt')\n @log_file.puts \"\\nLe fichier README existe !\\n\"\n @log_file.puts IO.read('readme.txt')\n end\n\n # Stats on files\n files_before_compil = Dir::entries('.') - ['.', '..', @results_file_dir]\n @log_file.puts \"\\nLe projet est composé des fichiers suivants :\"\n files_before_compil.each { |e| @log_file.puts \"\\t-#{e}\" }\n\n # Stats on number of lines\n nb_lines = `wc -l *.h *.c`\n @log_file.puts \"\\nStatistiques :\\n #{nb_lines}\"\n\n files_before_compil\n end",
"def process_directory(path)\n directories = []\n files = []\n sizes = {}\n mtimes = {}\n Dir.entries(path).sort.each do |filename|\n full_path = \"#{path}/#{filename}\"\n case filename\n when '.' || '..'\n\n when 'index.html'\n\n else\n\n case\n when filename =~ /^\\./\n # ignore hidden files\n when File.directory?(full_path)\n directories << filename\n when File.file?(full_path)\n files << filename\n sizes[full_path] = File.size(full_path)\n mtimes[full_path] = File.mtime(full_path)\n end\n\n end # case filename\n end\n\n directories.sort.each do |directory|\n process_directory(\"#{path}/#{directory}\")\n end\n\n # output this directory's info:\n write_index_file(\"#{path}/index.html\", directories, files, sizes, mtimes)\n puts \"#{path}/index.html\"\nend",
"def finalize_wav_header()\n\t\t# these are the byte offsets for the Chunksize and Subchunk2Size\n\t\t# parts of the .wav file header\n\t\tchunk_size = @file_offset - 8\n\t\tsubChunk2_size = chunk_size - 36\n\t\t# set ChunkSize in header\n\t\tencode_and_write_int32(chunk_size, mode='file', byte_offset=4)\n\t\t# set Subchunk2Size in header\n\t\tencode_and_write_int32(subChunk2_size, mode='file', byte_offset=40)\n\tend",
"def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end",
"def UpdateTotalProgressValue\n total_progress = 0\n\n if @total_count_to_download == 0\n # no package to download, just use the install size\n total_progress = Ops.divide(\n Ops.multiply(TotalInstalledSize(), 100),\n @total_size_to_install\n )\n else\n # compute the total progress (use both download and installation size)\n total_progress = Ops.add(\n Ops.divide(\n Ops.multiply(@total_count_downloaded, @downloading_pct),\n @total_count_to_download\n ),\n Ops.divide(\n Ops.multiply(\n TotalInstalledSize(),\n Ops.subtract(100, @downloading_pct)\n ),\n @total_size_to_install\n )\n )\n end\n\n Builtins.y2debug(\n \"Total package installation progress: %1%%\",\n total_progress\n )\n SlideShow.StageProgress(total_progress, nil)\n\n nil\n end",
"def update_progress(file, percent_done)\n file_info = filesizes[file]\n\n current_bytes = (percent_done * file_info[:size]) / 100\n since_last = current_bytes - file_info[:transferred]\n filesizes[file][:transferred] = current_bytes\n\n increment_transferred(since_last)\n update_percent(transferred)\n end",
"def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end",
"def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Tasks\"\n else\n add_text \"Current Tasks\"\n end\n end \n end",
"def pdf_header(pdf, report)\n # TODO: when we can use prawn >= 0.7.1, use the pdf.page_number method instead of counting ourselves\n @page_count = 0\n pdf.header [pdf.margin_box.left, pdf.margin_box.top + 10] do\n pdf.font \"Helvetica\" do\n pdf.text report.title, :size => 12, :align => :left\n pdf.move_up(16) # move back up so that the next two lines are more or less even with the title line\n pdf.text Time.now, :size => 8, :align => :right\n pdf.text \"Page: #{@page_count = @page_count + 1}\", :size => 8, :align => :right\n pdf.stroke_horizontal_rule\n end\n end\n end",
"def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end",
"def generate_header\n \n self.reload\n self.headers.reload\n \n layout_path = self.current_layout.relative_path unless self.current_layout.nil?\n \n # Default header values\n yaml_headers = {'title' => self.name, \n 'created_at' => Time.now,\n 'layout' => layout_path}\n \n self.headers.each do |header|\n yaml_headers[header.name] = header.content\n end\n \n update_attributes(:generated_header => YAML::dump(yaml_headers) + \"---\\n\")\n end",
"def add_log_header(file)\n end",
"def header_files\n @header_files ||= find_files( @header_search_paths, @header_file_extension ).uniq\n @header_files\n end",
"def pos_fsp_header\n pos_fil_header + size_fil_header\n end",
"def get_all_size\n s_old = 0\n Dir.glob($dir + '/**/*').each { | a_file |\n dn = File.dirname(a_file)\n s = File.lstat(a_file).size.to_i\n $file_size[ a_file ] = s\n $dir_size[ dn ] = (s_old = $dir_size[ dn ]) ? s_old + s : s\n }\nend",
"def inc_h\n end",
"def processFile dir\n\tdir.each do |file|\n\t\tif File.directory?(file) then next;\n\t\t\telse \n\t\t\t\th = {File.basename(file) => getHash(file)}\n\t\t\t\[email protected]!(h)\n\t\tend\n\tend\n\t@hash\nend",
"def build_header \n pdf_writer.margins_in(1)\n if timespan == \"Weekly\"\n add_text \"Status Report for the Week of \" + Time.now.to_formatted_s(:date)\n else\n add_text \"Status Report for \" + Time.now.to_formatted_s(:date)\n end\n end",
"def header_size\n FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size\n end",
"def add_headers(directory, relative_directory, group, app_target, make_public)\n\theader_files = Dir.entries(directory)\n\theader_files.each { |file|\n\t\tif !file.include? \".c\"\n\t\t\tif file.include? \".h\"\n\t\t\t\th_ref = group.new_file(relative_directory + file)\n\t\t\t\tif make_public\n\t\t\t\t\tbuild_file_ref = app_target.headers_build_phase().add_file_reference(h_ref, true)\n\t\t\t\t\tbuild_file_ref.settings = { \"ATTRIBUTES\" => [\"Public\"] }\n\t\t\t\tend\n\t\t\telsif file != \".\" && file != \"..\"\n\t\t\t\ta_header_group = group.new_group(file)\n\t\t\t\tadd_headers(directory + \"/\" + file, relative_directory + \"/\" + file + \"/\", a_header_group, app_target, make_public)\n\t\t\tend\n\t\tend\n\t}\nend",
"def index\n @headers = Header.all\n add_breadcrumb @headers.first.header_lang(current_user), 'headers'\n end",
"def update_headers(data)\n # Populate the headers if they're not already set (which is the case with the custom exports)\n CUSTOM_EXPORT_OPTIONS.each_key do |data_type|\n next unless data.dig(data_type, :checked).present? && data.dig(data_type, :headers).blank?\n\n data[data_type][:headers] = data[data_type][:checked].map { |field| ALL_FIELDS_NAMES.dig(data_type, field) }\n end\n end",
"def draw_header\n document.text \"Practicing Ruby Weekly Report\", :size => 24\n document.text \"This report summarizes the subscriber count and \"+\n \"change in\\nsubscriber count over time.\"\n\n document.move_down(in2pt(0.75))\n end",
"def monitor\n was_changed = false\n new_state = nil\n self_stat = File.lstat(@path) rescue nil\n if self_stat == nil\n new_state = FileStatEnum::NON_EXISTING\n @files = nil\n @dirs = nil\n @cycles = 0\n elsif @files == nil\n new_state = FileStatEnum::NEW\n @files = Hash.new\n @dirs = Hash.new\n @cycles = 0\n update_dir\n elsif update_dir\n new_state = FileStatEnum::CHANGED\n @cycles = 0\n else\n new_state = FileStatEnum::UNCHANGED\n @cycles += 1\n if @cycles >= @stable_state\n new_state = FileStatEnum::STABLE\n end\n end\n\n # The assignment\n self.state= new_state\n end",
"def order\n header_length = 80\n all_rolls = sorted_rolls\n self.progressbar = ProgressBar.create(:progress_mark => '='.colorize(:green), :length => header_length, :total => all_rolls.length)\n\n # pre installs\n #\n # Yuyi.say '=' * header_length, :color => :green\n Yuyi.say 'APPETIZERS', :justify => :center, :padding => header_length\n\n self.progressbar.reset\n all_rolls.each do |file_name|\n @rolls[file_name].appetizers\n self.progressbar.increment\n end\n Yuyi.say\n\n\n # main installs\n #\n # Yuyi.say '=' * header_length, :color => :green\n Yuyi.say 'ENTREES', :justify => :center, :padding => header_length\n\n self.progressbar.reset\n all_rolls.each do |file_name|\n @rolls[file_name].entree\n self.progressbar.increment\n end\n Yuyi.say\n\n\n # post installs\n #\n # Yuyi.say '=' * header_length, :color => :green\n Yuyi.say 'DESSERT', :justify => :center, :padding => header_length\n\n self.progressbar.reset\n all_rolls.each do |file_name|\n @rolls[file_name].dessert\n self.progressbar.increment\n end\n Yuyi.say\n\n\n Yuyi.say 'YUYI COMPLETED', :color => :light_blue, :justify => :center, :padding => header_length\n Yuyi.say '=' * header_length, :color => :light_blue\n Yuyi.say\n end",
"def header_image_sub_directory\n dirs = Hash.new(\"headers\")\n dirs[\"ski_and_guiding_schools\"] = \"ski-school-headers\"\n dirs[\"summer_holidays\"] = \"summer-headers\"\n dirs[controller.action_name]\n end",
"def pos_fil_header\n 0\n end",
"def process_directory_code_specific\n get_status\n if ctd\n #get_global_results\n if !nonlinear or nonlinear.fortran_false?\n get_growth_rates\n end\n end\n @percent_complete = completed_timesteps.to_f * (istep_nrg||10) / ntimesteps.to_f * 100.0\n end",
"def finish_page_dir\n return unless @page_dir\n\n @files << @page_dir\n\n page_dir = Pathname(@page_dir)\n begin\n page_dir = page_dir.expand_path.relative_path_from @root\n rescue ArgumentError\n # On Windows, sometimes crosses different drive letters.\n page_dir = page_dir.expand_path\n end\n\n @page_dir = page_dir\n end",
"def stat\n factory.system.dir_stat(@path)\n end",
"def summarize_file(path); end",
"def today_header\n system 'clear'\n puts @header.light_blue\n puts \"Check out whats on around Melbourne today!\".center(@header_length)\n puts @header.light_blue\n end",
"def summarise!( header )\n load( summarise( header ).to_a.unshift [ header, 'Count' ] )\n end",
"def file_stats\n @stats = @ff.get_stats\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def update_header(property_type, header)\n\t\t\ti = 0\n\t\t\theader.each do |element|\n\t\t\t\t\n\t\t\t\tif ! element.eql? property_type\n\t\t\t\t\ti = i +1\n\n\t\t\t\telse\n\t\t\t\t\treturn i\n\t\t\t\tend\n\t\t\tend\n\t\t\theader.push(property_type)\n\t\t\treturn i\n\t\tend",
"def result\n { TOTAL_TEST_FILES => @total_test_files,\n TOTAL_SOURCE_FILES => @total_source_files\n }\n end",
"def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end",
"def dir=(value)\n @data['info']['name'] = value if @data['info'].key?('files')\n end",
"def update!(**args)\n @directory_entries = args[:directory_entries] if args.key?(:directory_entries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @directory_entries = args[:directory_entries] if args.key?(:directory_entries)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n respond_to do |format|\n if @header.update(header_params)\n format.html { redirect_to edit_admin_header_path(@header), notice: 'Header was successfully updated.' }\n format.json { render :show, status: :ok, location: @header }\n else\n format.html { render :edit }\n format.json { render json: @header.errors, status: :unprocessable_entity }\n end\n end\n end",
"def header\n if io.kind_of?(File)\n puts colorize(\"Request-log-analyzer summary report\", :white, :bold)\n line(:green)\n puts \"Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke\"\n puts \"Website: #{link('http://github.com/wvanbergen/request-log-analyzer')}\"\n end\n end",
"def size_partial_page_header\n size_fil_header - 4 - 8 - 4\n end",
"def fileHeader(fname, curDate, misc=\"\")\r\n fname = File.basename(fname, \".gdl\")\r\n header = <<EOF\r\n/* **************************************************************************\r\n * File: #{fname}.gdl\r\n *\r\n * Guideline source generated #{curDate}\r\n * #{misc}\r\n *\r\n * *************************************************************************/\r\n\r\n\r\nEOF\r\n\r\n return header\r\n end",
"def added_files\n file_stats.count { |file| file.status == :added }\n end",
"def generate_directory_index(path)\n html = generate_header(path.blank? ? '/' : path, path)\n\n node = @server.tree.node_for_path(path)\n if node.is_a?(ICollection)\n html << '<section><h1>Nodes</h1>'\n html << '<table class=\"nodeTable\">'\n\n sub_nodes = @server.properties_for_children(\n path,\n [\n '{DAV:}displayname',\n '{DAV:}resourcetype',\n '{DAV:}getcontenttype',\n '{DAV:}getcontentlength',\n '{DAV:}getlastmodified'\n ]\n )\n\n sub_nodes.each do |sub_path, _sub_props|\n sub_node = @server.tree.node_for_path(sub_path)\n full_path = @server.base_uri + Http::UrlUtil.encode_path(sub_path)\n (_, display_path) = Http::UrlUtil.split_path(sub_path)\n\n sub_nodes[sub_path]['subNode'] = sub_node\n sub_nodes[sub_path]['fullPath'] = full_path\n sub_nodes[sub_path]['displayPath'] = display_path\n end\n sub_nodes.sort { |a, b| compare_nodes(a, b) }\n\n sub_nodes.each do |_, sub_props|\n type = {\n 'string' => 'Unknown',\n 'icon' => 'cog'\n }\n if sub_props.key?('{DAV:}resourcetype')\n type = map_resource_type(sub_props['{DAV:}resourcetype'].value, sub_props['subNode'])\n end\n\n html << '<tr>'\n html << '<td class=\"nameColumn\"><a href=\"' + escape_html(sub_props['fullPath']) + '\"><span class=\"oi\" data-glyph=\"' + escape_html(type['icon']) + '\"></span> ' + escape_html(sub_props['displayPath']) + '</a></td>'\n html << '<td class=\"typeColumn\">' + escape_html(type['string']) + '</td>'\n html << '<td>'\n if sub_props.key?('{DAV:}getcontentlength')\n html << escape_html(sub_props['{DAV:}getcontentlength'].to_s + ' bytes')\n end\n html << '</td><td>'\n if sub_props.key?('{DAV:}getlastmodified')\n last_mod = sub_props['{DAV:}getlastmodified'].time\n html << escape_html(last_mod.strftime('%B %e, %Y, %l:%M %P'))\n end\n html << '</td>'\n\n button_actions = ''\n if sub_props['sub_node'].is_a?(IFile)\n button_actions = '<a href=\"' + escape_html(sub_props['fullPath']) + '?sabreAction=info\"><span class=\"oi\" data-glyph=\"info\"></span></a>'\n end\n\n box = Box.new(button_actions)\n @server.emit('browserButtonActions', [sub_props['fullPath'], sub_props['subNode'], box])\n button_actions = box.value\n\n html << \"<td>#{button_actions}</td>\"\n html << '</tr>'\n end\n\n html << '</table>'\n\n end\n\n html << '</section>'\n html << '<section><h1>Properties</h1>'\n html << '<table class=\"propTable\">'\n\n # Allprops request\n prop_find = PropFindAll.new(path)\n properties = @server.properties_by_node(prop_find, node)\n\n properties = prop_find.result_for_multi_status[200]\n\n properties.each do |prop_name, prop_value|\n if @uninteresting_properties.include?(prop_name)\n html << draw_property_row(prop_name, prop_value)\n end\n end\n\n html << '</table>'\n html << '</section>'\n\n # Start of generating actions\n\n output = ''\n if @enable_post\n box = Box.new(output)\n @server.emit('onHTMLActionsPanel', [node, box])\n output = box.value\n end\n\n if output\n html << '<section><h1>Actions</h1>'\n html << '<div class=\"actions\">'\n html << output\n html << '</div>'\n html << '</section>'\n end\n\n html << generate_footer\n\n @server.http_response.update_header('Content-Security-Policy', \"img-src 'self'; style-src 'self';\")\n\n html\n end",
"def update_written(event)\n info \"Update file written to file system: #{File.join(Rails.root, event.payload[:path])} (size: #{event.payload[:size]})\"\n end",
"def print_header\n header = \"\"\n Imgrb::BmpMethods::add_bmp_bytes(header, file_size, 4)\n\n #Reserved, depends on application. Safe to set to 0s\n header << 0.chr*4\n\n #Offset. 40 (from DIB) + 14 (from header)\n Imgrb::BmpMethods::add_bmp_bytes(header, 54, 4)\n\n #Size of DIB-header\n Imgrb::BmpMethods::add_bmp_bytes(header, 40, 4)\n\n Imgrb::BmpMethods::add_bmp_bytes(header, @width, 4)\n Imgrb::BmpMethods::add_bmp_bytes(header, @height, 4)\n\n #Color planes, must be set to 1\n Imgrb::BmpMethods::add_bmp_bytes(header, 1, 2)\n\n #Bits per pixel. Always write 24-bit bmps.\n Imgrb::BmpMethods::add_bmp_bytes(header, 24, 2)\n\n #No compression\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n\n #Image size. Can be 0 for compression method 0.\n Imgrb::BmpMethods::add_bmp_bytes(header, image_size, 4)\n\n Imgrb::BmpMethods::add_bmp_bytes(header, @horizontal_res, 4)\n Imgrb::BmpMethods::add_bmp_bytes(header, @vertical_res, 4)\n\n #Default color palette\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n\n #All colors important\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n end",
"def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend",
"def append_file_count(files)\n file_size = files.size\n\n label_count =\n (file_size == 0 || file_size > 1) ? \"#{file_size} files\" : '1 file'\n\n @label = \"#{@label} (#{label_count})\"\n end",
"def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend",
"def generateHeader( files )\n output = \"<html><body><h1>CrowdLogs for...:</h1><ul>\"\n files.each do |file|\n output += \"<li><a href='##{file}'>#{file}</a></li>\"\n end\n output += \"</ul>\"\n return output\nend",
"def UpdateCurrentCdProgress(silent_check)\n return if !SanityCheck(silent_check)\n return if !UI.WidgetExists(:cdStatisticsTable)\n\n\n #\n # Update table entries for current CD\n #\n\n remaining = Ops.get(\n @remaining_sizes_per_cd_per_src,\n [Ops.subtract(@current_src_no, 1), Ops.subtract(@current_cd_no, 1)],\n 0\n )\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(\n :Item,\n Builtins.sformat(\n \"cd(%1,%2)\",\n Ops.subtract(@current_src_no, 1),\n Ops.subtract(@current_cd_no, 1)\n ),\n @size_column\n ),\n FormatRemainingSize(remaining)\n )\n\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(\n :Item,\n Builtins.sformat(\n \"cd(%1,%2)\",\n Ops.subtract(@current_src_no, 1),\n Ops.subtract(@current_cd_no, 1)\n ),\n @pkg_count_column\n ),\n FormatRemainingCount(\n Ops.get(\n @remaining_pkg_count_per_cd_per_src,\n [Ops.subtract(@current_src_no, 1), Ops.subtract(@current_cd_no, 1)],\n 0\n )\n )\n )\n\n if @unit_is_seconds\n # Convert 'remaining' from size (bytes) to time (seconds)\n\n remaining = Ops.divide(remaining, @bytes_per_second)\n\n remaining = 0 if Ops.less_or_equal(remaining, 0)\n\n if Ops.greater_than(remaining, @max_time_per_cd) # clip off at 2 hours\n # When data throughput goes downhill (stalled network connection etc.),\n # cut off the predicted time at a reasonable maximum.\n remaining = Ops.unary_minus(@max_time_per_cd)\n end\n\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(\n :Item,\n Builtins.sformat(\n \"cd(%1,%2)\",\n Ops.subtract(@current_src_no, 1),\n Ops.subtract(@current_cd_no, 1)\n ),\n @time_column\n ),\n FormatTimeShowOverflow(remaining)\n )\n end\n\n\n #\n # Update \"total\" table entries\n #\n\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(:Item, \"total\", @size_column),\n FormatRemainingSize(TotalRemainingSize())\n )\n\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(:Item, \"total\", @pkg_count_column),\n FormatRemainingCount(TotalRemainingPkgCount())\n )\n\n if @unit_is_seconds\n UI.ChangeWidget(\n Id(:cdStatisticsTable),\n term(:Item, \"total\", @time_column),\n FormatTimeShowOverflow(TotalRemainingTime())\n )\n end\n\n nil\n end",
"def add_api_headers(api_headers)\n @api_headers += Utils.expand_folder_list(api_headers, @project_folder)\n end",
"def information_header\n info_table_src = TTY::Table.new\n @defaults.label_value_pairs.each {|pair| info_table_src << pair}\n info_table_src << [\"Disposition Columns:\", MmMovie.dispositions.join(', ')]\n info_table_src << [\"Transcode File Location:\", self.tempfile ? tempfile&.path : 'n/a']\n\n info_table = C.bold(\"Looking for file(s) and processing them with the following options:\\n\").dup\n info_table << info_table_src.render(:basic) do |renderer|\n a = @defaults.label_value_pairs.map {|p| p[0].length }.max + 1\n b = OutputHelper.console_width - a - 2\n renderer.alignments = [:right, :left]\n renderer.multiline = true\n renderer.column_widths = [a,b]\n end << \"\\n\\n\"\n end",
"def local_content_head\n response.headers['Content-Length'] = local_file_size.to_s\n head :ok, content_type: local_file_mime_type\n end",
"def update_tth path, node\n if EventMachine.reactor_thread? || !@update_lock.locked?\n raise 'Should not update tth hashes in reactor thread or without' \\\n ' the local list lock!'\n end\n # Ignore dotfiles\n return if path.basename.to_s.start_with?('.')\n\n # Files might need to have a TTH updated, but only if they've been\n # modified since we last calculated a TTH\n if path.file?\n cached_info = @local_file_info[path]\n child = LibXML::XML::Node.new('File')\n child['Name'] = path.basename.to_s\n if cached_info && path.mtime <= cached_info[:mtime]\n child['TTH'] = cached_info[:tth]\n child['Size'] = cached_info[:size]\n else\n debug 'file-list', \"Hashing: #{path.to_s}\"\n child['TTH'] = file_tth path.to_s\n child['Size'] = path.size.to_s\n end\n @local_file_info[path] = {:mtime => path.mtime,\n :size => child['Size'],\n :tth => child['TTH']}\n node << child\n\n # Directories just need a node and then a recursive update\n elsif path.directory?\n child = LibXML::XML::Node.new('Directory')\n child['Name'] = path.basename.to_s\n path.each_child { |child_path| update_tth child_path, child }\n node << child\n\n # If we're not a file or directory, then we just have to ignore the\n # file for now...\n else\n debug 'file-list', \"Ignoring: #{path}\"\n end\n end",
"def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end",
"def build_header\n @pdf.text_box(\n @labels[:name],\n size: 20,\n align: :left,\n at: [0, y(720) - @push_down],\n width: x(300),\n )\n\n if used? @labels[:sublabels][:name]\n @pdf.text_box(\n @labels[:sublabels][:name],\n size: 12,\n at: [0, y(720) - @push_down - 22],\n width: x(300),\n align: :left\n )\n end\n\n @pdf.text_box(\n @document.number,\n size: 20,\n at: [x(240), y(720) - @push_down],\n width: x(300),\n align: :right\n )\n\n @pdf.move_down(250)\n\n if used? @labels[:sublabels][:name]\n @pdf.move_down(12)\n end\n end",
"def update\n respond_to do |format|\n if @admin_header.update(admin_header_params)\n format.html { redirect_to admin_root_path, notice: 'Header was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_header }\n else\n format.html { render :edit }\n format.json { render json: @admin_header.errors, status: :unprocessable_entity }\n end\n end\n end",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def write\n\t\t#clear the directory before doing anything else\n\t\tclear @path\n\n\t\t#write out source code files\n\t\[email protected] do |mold|\n\t\t\twrite_object(mold.name + \".h\", header(mold))\n\t\t\twrite_object(mold.name + \".m\", source(mold))\n\t\tend\n\tend",
"def update_totals\n update_payment_total\n update_item_total\n update_order_total\n end",
"def output_vs_header(options,output_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tCreating vSphere file #{output_file}\")\n end\n dir_name = File.dirname(output_file)\n top_dir = dir_name.split(/\\//)[0..-2].join(\"/\")\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere boot header file directory\")\n end\n check_dir_owner(options,top_dir,options['uid'])\n check_dir_exists(options,dir_name)\n check_dir_owner(options,dir_name,options['uid'])\n file = File.open(output_file, 'w')\n options['q_order'].each do |key|\n if options['q_struct'][key].type.match(/output/)\n if not options['q_struct'][key].parameter.match(/[a-z,A-Z]/)\n output=options['q_struct'][key].value+\"\\n\"\n else\n output=options['q_struct'][key].parameter+\" \"+options['q_struct'][key].value+\"\\n\"\n if options['verbose'] == true\n handle_output(options,output)\n end\n end\n file.write(output)\n end\n end\n file.close\n return\nend",
"def header\n\t\t@json_file\n\tend",
"def header\n end",
"def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end",
"def update_status(p_audio_file_container)\n\n # Retrieve path-related attributes for the current audio file\n folder = p_audio_file_container[:folder]\n filename = p_audio_file_container[:filename]\n relative_path = \"#{folder}\\\\#{filename}\" # TODO: Eventually path mechanics, combine\n current_audio_file = p_audio_file_container[:file]\n\n # Refresh UI with current status\n @view.update_notification({\n :type => :info,\n :text => tr(\"Processing \\\"#{relative_path}\\\" . . .\")\n })\n\n # Return to be processed audio-file\n current_audio_file\n end",
"def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total\n end",
"def run\n\t\twalk_tree(@folder)\n\t\t@total_size = calculate_tree_size(@folder)\n\t\t@sub_folders.each do |key, value|\n\t\t\t\t@sub_folders[key] = calculate_tree_size(key)\n\t\tend\n\tend",
"def pos_partial_page_header\n pos_fil_header + 4\n end",
"def update_header_vars\r\n @encrypted, @last_rec_no, @del_ctr, @record_class, @col_names, \\\r\n @col_types, @col_indexes, @col_defaults, @col_requireds, \\\r\n @col_extras = @db.engine.get_header_vars(self)\r\n\r\n # These are deprecated.\r\n @field_names = @col_names\r\n @field_types = @col_types\r\n @field_indexes = @col_indexes\r\n @field_defaults = @col_defaults\r\n @field_requireds = @col_requireds\r\n @field_extras = @col_extras\r\n end",
"def monitor\n file_stats = File.lstat(@path) rescue nil\n new_state = nil\n if file_stats == nil\n new_state = FileStatEnum::NON_EXISTING\n @size = nil\n @modification_time = nil\n @cycles = 0\n elsif @size == nil\n new_state = FileStatEnum::NEW\n @size = file_stats.size\n @modification_time = file_stats.mtime.utc\n @cycles = 0\n elsif changed?(file_stats)\n new_state = FileStatEnum::CHANGED\n @size = file_stats.size\n @modification_time = file_stats.mtime.utc\n @cycles = 0\n else\n new_state = FileStatEnum::UNCHANGED\n @cycles += 1\n if @cycles >= @stable_state\n new_state = FileStatEnum::STABLE\n end\n end\n\n # The assignment\n self.state= new_state\n end",
"def directory_slots\n page_header[:n_dir_slots]\n end",
"def write_section_header(link_f, section_info)\n\t\t\twsize = 0\n\t\t\twsize += link_f.write(section_info[:name_idx].to_bin32)\n\t\t\twsize += link_f.write(section_info[:type].to_bin32)\n\t\t\twsize += link_f.write(section_info[:flags].to_bin32)\n\t\t\twsize += link_f.write(section_info[:va_address].to_bin32)\n\t\t\twsize += link_f.write(section_info[:offset].to_bin32)\n\t\t\twsize += link_f.write(section_info[:size].to_bin32)\n\t\t\twsize += link_f.write(section_info[:related_section_idx].to_bin32)\n\t\t\twsize += link_f.write(section_info[:info].to_bin32)\n\t\t\twsize += link_f.write(section_info[:addr_align].to_bin32)\n\t\t\twsize += link_f.write(section_info[:entry_size].to_bin32)\n\t\t\twsize\n\t\tend",
"def recompute_offsets()\n @header.resource_index.number_of_records = @records.length\n # @header.resource_index.next_index = 0 # TODO: How is this determined?\n\n curr_offset = PDB::Header.round_byte_length\n\n # Compute length of index...\n unless @index == []\n @index.each do |i|\n curr_offset += i.length()\n end\n end\n\n unless @appinfo.nil?\n @header.appinfo_offset = curr_offset\n curr_offset += @appinfo.length()\n end\n\n unless @sortinfo.nil?\n @header.sortinfo_offset = curr_offset\n curr_offset += @sortinfo.length()\n end\n\n ## And here's the mysterious two-byte filler.\n #curr_offset += 2\n\n unless @index.length == 0\n @index.each do |i|\n rec = @records[i.r_id]\n i.offset = curr_offset\n curr_offset += rec.length\n end\n end\n end",
"def build_header\n system \"gdal_translate -of GTiff -a_srs EPSG:4326 #{@processed_path} #{@processed_path}_\"\n FileUtils.rm(@processed_path)\n FileUtils.mv(\"#{@processed_path}_\", @processed_path)\n end",
"def update_new_file_state(path=@new_resource.path)\n if !::File.directory?(path) \n @new_resource.checksum(checksum(path))\n end\n\n if Chef::Platform.windows?\n # TODO: To work around CHEF-3554, add support for Windows\n # equivalent, or implicit resource reporting won't work for\n # Windows.\n return\n end\n\n acl_scanner = ScanAccessControl.new(@new_resource, @new_resource)\n acl_scanner.set_all!\n end",
"def sort_files\n # Iterate thru files in @download_path\n cd(@download_path) do\n Find.find(pwd) do |path_to_file|\n @current_file_path = path_to_file\n next if @current_file_path == pwd # don't include the download folder as one of the files\n update_progress\n @file_directory, @file_name = File.split(@current_file_path)\n next if @file_name[0..0] == \".\" # skip any files/directories beginning with .\n # Stop searching this file/directory if it should be skipped, otherwise process the file\n should_skip_folder? ? Find.prune : process_download_file\n end\n end\n end",
"def update_dirline(dirline_widget)\n # Get the directory name\n dir_name = dirline_widget.get_dir_name\n # Check if a scan job is associated to it\n scan_job = @dir_scanner.find_scan_job(dir_name)\n # Get the associated dir_info\n dir_info = @data.dir_info(dir_name)\n dirline_widget.update_dirline_appearance(dir_info, scan_job)\n end",
"def header_files\n source_files(HPP_EXTENSIONS)\n end"
] | [
"0.547578",
"0.54075986",
"0.5406179",
"0.5378685",
"0.53776205",
"0.5325878",
"0.52247036",
"0.5188903",
"0.5131183",
"0.50979203",
"0.50925696",
"0.50591403",
"0.50585264",
"0.50526154",
"0.50321597",
"0.50317526",
"0.5029053",
"0.5016175",
"0.5000742",
"0.49981356",
"0.49727803",
"0.4970241",
"0.49643528",
"0.49275342",
"0.4880111",
"0.487727",
"0.4872862",
"0.48652148",
"0.48618153",
"0.48605347",
"0.482282",
"0.48204282",
"0.48122355",
"0.47959983",
"0.47911295",
"0.47657973",
"0.47653198",
"0.47616136",
"0.47570932",
"0.47510102",
"0.47509846",
"0.47390863",
"0.4738327",
"0.4729863",
"0.4728641",
"0.47137475",
"0.47129247",
"0.47031993",
"0.4695185",
"0.46944144",
"0.4688972",
"0.4681145",
"0.46795824",
"0.46721202",
"0.4667417",
"0.46637505",
"0.4655998",
"0.4655998",
"0.4655374",
"0.46524388",
"0.46491027",
"0.46471322",
"0.4641856",
"0.46386",
"0.4637689",
"0.4636238",
"0.4634291",
"0.46307692",
"0.46302533",
"0.4628022",
"0.4624867",
"0.46238312",
"0.46216205",
"0.46213683",
"0.4619176",
"0.46168524",
"0.46136317",
"0.4613331",
"0.46125937",
"0.46125937",
"0.46076646",
"0.46068323",
"0.46050224",
"0.46036452",
"0.46017265",
"0.46006298",
"0.45971018",
"0.45945436",
"0.4588518",
"0.45873362",
"0.45736971",
"0.4572374",
"0.45687544",
"0.4567699",
"0.45610642",
"0.45587802",
"0.4552164",
"0.4551635",
"0.45513645",
"0.45483616"
] | 0.48428681 | 30 |
Swktch on / off marking on the current file or directory. | def toggle_mark
main.toggle_mark current_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def edl_mark \n send_cmd(\"edl_mark\")\n end",
"def flags; changeset.flags(@path); end",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def switch_flag\n\t\t@flag = !@flag\n\tend",
"def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end",
"def mark; end",
"def toggle_state\n puts \"******* toggle_state *******\"\n end",
"def markSyncOperations\n #N Without this, the sync operations won't be marked\n @sourceContent.markSyncOperationsForDestination(@destinationContent)\n #N Without these puts statements, the user won't receive feedback about what sync operations (i.e. copies and deletes) are marked for execution\n puts \" ================================================ \"\n puts \"After marking for sync --\"\n puts \"\"\n puts \"Local:\"\n #N Without this, the user won't see what local files and directories are marked for copying (i.e. upload)\n @sourceContent.showIndented()\n puts \"\"\n puts \"Remote:\"\n #N Without this, the user won't see what remote files and directories are marked for deleting\n @destinationContent.showIndented()\n end",
"def toggle!\n\t\tif self.can_mark_complete?\n\t\t\tself.mark_complete!\n\t\telsif self.can_re_open?\n\t\t\tself.re_open!\n\t\tend\n\tend",
"def turn_on!\n @turned_off = false\n end",
"def switch_light_off\n puts \"*** switch_light_off\"\n true\nend",
"def mark!(force = false)\n if force or changing?\n mark.blank? ? self.mark = Mark.new(:changed_at => Time.now) : self.mark.changed_at = Time.now\n self.mark.save\n end\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def turn_on()\n 'Turn on the #{model}<br>' \\\n 'If the thermocycler is off, toggle the power switch in the back of the instrument'\n end",
"def off?; !self.on?; end",
"def toggle\n toggle_icon_display\n restart_finder\n icons_showing?\n end",
"def force_current\n @current = true\n end",
"def faint\n self.fainted = true\n end",
"def toggle_on(outlet = 1)\n toggle(outlet, true)\n end",
"def flag\n @flagged != @flagged = true unless @revealed\n end",
"def reset_marks(path, lines_added=[], lines_changed=[])\n [ [:added, lines_added],\n [:changed, lines_changed],\n ].each do |k, lines|\n mark = \"#{ENV[\"TM_BUNDLE_SUPPORT\"]}/#{k}.pdf\"\n mate = ENV[\"TM_MATE\"]\n cmd = mate ? [mate] : %w[ echo mate ] # if invoked from outside textmate (without TM_MATE set) just print what it would run, instead\n cmd << \"--clear-mark=#{mark}\"\n cmd.concat [\"--set-mark=#{mark}\", *lines.map{|n| \"--line=#{n}\" }] unless lines.empty?\n cmd << path\n system *cmd\n end\nend",
"def undo\n fan.off\n end",
"def toggle\n set_switch(!self.switch) if @switch\n end",
"def unmark!\n @session.chanserv.mark(self.name, :off)\n end",
"def movetalk()\n merge(movetalk: 'true')\n end",
"def toggle_selection_mode\n if @mode == 'SEL'\n unselect_all\n @mode = nil\n message 'Selection mode is single. '\n else\n @mode = 'SEL'\n message 'Typing a hint selects the file. Typing again will clear . '\n end\nend",
"def markToDelete\n #N Without this we won't remember that this file is to be deleted\n @toBeDeleted = true\n end",
"def visit\n @mark = true\n end",
"def onCmdFlat(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip\n @watcher.cmdGoFlat\n end",
"def case_sensitive!\n @flags &= ~File::FNM_CASEFOLD\n end",
"def mark_processing(w, batch)\n new_name = join(@basedir, DIR_PROCESSING, File.basename(batch.path))\n @logger.info(\"Marking #{batch} as processing\")\n @logger.debug(\" moving #{batch.path} to #{new_name}\")\n w.sftp.rename(batch.path, new_name, RENAME_NATIVE)\n batch.path = new_name\n batch.state = :processing\n end",
"def enable(thing)\n toggle.enable(thing)\n end",
"def switch_light_on\n puts \"*** switch_light_on\"\n true\nend",
"def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end",
"def mark_read!\n update_is_read_status true\n end",
"def toggle_delta\n self.delta = true\n end",
"def mark!(reason)\n @session.chanserv.mark(self.name, :on, reason)\n end",
"def on!\n set(:on => true)\n end",
"def toggle_off\n set_state_to(:off)\n end",
"def working\n current_user.chef.toggle(:currently_working).save\n end",
"def before_sync(chdir: true, &block)\n @before_sync_hook = Hook.new(block, chdir)\n end",
"def toggle\n @done = !@done\n end",
"def mark_as_bizarre\n biz = File.join(File.dirname(current_path), \"..\", \"bizarre\")\n File.move(current_path, biz)\n end",
"def mark_modified\n @modified = true\n nil\n end",
"def open_fertility_tests\n touch \"* marked:'Fertility testing and workup'\"\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def notify_when_off_sick=(arg)\n @notify_when_off_sick = (arg ? true : false)\n end",
"def cooked_mode!\n Vedeu.log(\"Terminal switching to 'cooked' mode\")\n\n @_mode = :cooked\n end",
"def set_flag\n path = path_to_flag\n return nil unless path\n begin\n img = File.open(path, 'rb'){|f| f.readlines}.join\n File.open(File.join([Rails.root, 'public', \"flag_for_campaign_#{self.id}.png\"]), 'wb'){|f| f.write(img)}\n \"/flag_for_campaign_#{self.id}.png\"\n rescue\n nil\n end\n end",
"def on_op_change_force_uncurrent\n if sake_op_changed?\n write_current_sake_op\n mark_all_tasks_uncurrent\n end\n end",
"def touch_when_logging\n touch\n end",
"def mark_set(mark_name, index)\n super\n return unless mark_name == :insert\n Tk::Event.generate(self, '<<Movement>>')\n end",
"def TreeView_SetCheckState(hwndTV, hti, fCheck)\r\n TreeView_SetItemState(hwndTV, hti, INDEXTOSTATEIMAGEMASK(fCheck ? 2 : 1), TreeViewItemState[:STATEIMAGEMASK])\r\n end",
"def off!\n set(:on => false)\n end",
"def progress_mark; end",
"def check_if_writeoff!\n should_writeoff? ? update_attribute(:writtenoff_on, Time.now) : false\n end",
"def toggle\n\t\tif is_favourited\n\t\t\tself.is_favourited = false\n\t\telse\n\t\t\tself.is_favourited = true\n\t\tend\n\t\tself.save\n\tend",
"def turn_on!\n set_power!(:on)\n end",
"def markNode name\n\t\tgetNode(name).marked = true\n\tend",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def unmark!\n STDERR.puts \"unmark!\" if @trace > 0\n return if @paths.empty?\n n = @paths.rindex {|x| x.instance_of? Proc}\n n and @paths.delete_at(n)\n end",
"def tick flag\n return unless self.class.method_defined? :on_tick\n @is_ticking = self.class.method_defined?(:old_on_tick) unless instance_variable_defined?(:@is_ticking)\n \n return if @is_ticking == flag \n \n @is_ticking = flag\n if flag\n alias_method :on_tick, :old_on_tick\n engine.add_action_handler @action_handlers[:tick]\n else\n alias_method :old_on_tick, :on_tick\n def self.tick; event_terminate; end\n end\n end",
"def turn_on_typekit(key)\n Log.logger.info(\"Ensuring Typekits is On\")\n self.turn_on_fontmanagement\n self.enable_typekit(key)\n Log.logger.info(\"Done with the typekit setup.\")\n end",
"def toggle_delta\n self.class.delta_objects.each { |obj|\n obj.toggle(self)\n } if should_toggle_delta?\n end",
"def mark_as_copied(file)\n cmd = cmd(\"setlabel\", [ file, COPIED ])\n system(cmd)\nend",
"def selection_mode_toggle\n if $mode == 'SEL'\n # we seem to be coming out of select mode with some files\n if $selected_files.size > 0\n run_command $selected_files\n end\n $mode = nil\n else\n #$selection_mode = !$selection_mode\n $mode = 'SEL'\n end\nend",
"def update!\n write_to_disk ? true : false\n end",
"def set_flyto_mode_to(mode)\n Kamelopard::DocumentHolder.instance.current_document.flyto_mode = mode\n end",
"def mark_as_modified\r\n update_attribute :synchronized, false\r\n end",
"def turn_on\n unless on?\n set_attribute('PIO', 1)\n end\n end",
"def mark\n @location = @assembler.location\n\n @patch_points.each do |patch_location, source|\n @assembler.patch patch_location, location - source\n end\n end",
"def mark_down\n post = Post.find(params[:id])\n post.down = true\n post.save\n \n redirect_to :action => \"home\"\n end",
"def updated_file_only=(flag)\r\n @conf[:update] = flag\r\n end",
"def toggle_editmode\n\t\t@editmode = true\n\t\t$screen.write_message(\"Edit mode\")\n\tend",
"def undo\n light.on\n end",
"def undo\n fan.medium\n end",
"def undo\n fan.medium\n end",
"def files_changed(file, event)\n puts motivate\n # return true so that the watch loop keeps running\n return true\n end",
"def sync\n current = @resource.stat ? @resource.stat.mode : 0644\n set(desired_mode_from_current(@should[0], current).to_s(8))\n end",
"def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end",
"def drive(where)\n case where\n when :forward,:forwards\n @backwards_pin.set(0)\n @forwards_pin.set(1)\n when :backwards,:backward\n @forwards_pin.set(0)\n @backwards_pin.set(1)\n else\n @forwards_pin.set(0)\n @backwards_pin.set(0)\n end\n end",
"def selection_mode_toggle\n if $mode == 'SEL'\n # we seem to be coming out of select mode with some files\n if $selected_files.size > 0\n run_command $selected_files\n end\n $mode = nil\n else\n #$selection_mode = !$selection_mode\n $mode = 'SEL'\n end\nend",
"def sync\n current = @resource.stat ? @resource.stat.mode : 0644\n set(desired_mode_from_current(@should[0], current).to_s(8))\n end",
"def in_path(path, &blk)\n old = Dir.pwd\n Dir.chdir path\n say_status :cd, path\n yield\n Dir.chdir old\n end",
"def toggle(switch)\n switch == 1 ? 0 : 1\nend",
"def set_actionstamps_on_save \n return unless dirty?\n set_actionstamps\n end",
"def turn_on_leds\n @entry_led.on\n @exit_led.on \n end",
"def sym_hook\n local_hooks_directory = File.join(barerepopath, 'hooks')\n shell_hook_dir = File.join(Glitter::Application.config.shell_path, 'hooks')\n new_dir_name = \"#{local_hooks_directory}.old.#{Time.now.to_i}\"\n FileUtils.mv(local_hooks_directory, new_dir_name)\n FileUtils.ln_s(shell_hook_dir, local_hooks_directory)\n end",
"def toggle_off(outlet = 1)\n toggle(outlet, false)\n end",
"def mark!(reason)\n @session.nickserv.mark(self.name, :on, reason)\n end",
"def switch_mode!\n return cooked_mode! if raw_mode?\n\n raw_mode!\n end",
"def chdir; end",
"def setMarkerDirLocal _obj, _args\n \"_obj setMarkerDirLocal _args;\" \n end",
"def file_watcher; end",
"def file_watcher; end",
"def test_marked\n end",
"def toggle_faulty\n @item.toggle!(:faulty)\n end",
"def markHelpful\n update_attribute(:isHelpful, true)\n self.save!\n end"
] | [
"0.57452375",
"0.56885517",
"0.5654512",
"0.5560023",
"0.55504096",
"0.5456111",
"0.54291165",
"0.540916",
"0.53911823",
"0.5383848",
"0.5345398",
"0.53184044",
"0.5282469",
"0.5273503",
"0.5237769",
"0.5228008",
"0.5194415",
"0.51476866",
"0.5141669",
"0.51280946",
"0.51065254",
"0.50951695",
"0.50823975",
"0.5052993",
"0.5013568",
"0.5012529",
"0.49913675",
"0.49851868",
"0.49847314",
"0.49842674",
"0.49746394",
"0.49510863",
"0.49353993",
"0.493471",
"0.4931116",
"0.49191388",
"0.49058965",
"0.4904328",
"0.49003354",
"0.4874962",
"0.48706996",
"0.4870268",
"0.4866637",
"0.48621815",
"0.484282",
"0.48378378",
"0.4819576",
"0.48072",
"0.48046967",
"0.48010245",
"0.47992265",
"0.47963434",
"0.47847435",
"0.47722223",
"0.47716048",
"0.47667587",
"0.4765461",
"0.47570658",
"0.47459728",
"0.47452888",
"0.4731402",
"0.4731402",
"0.47273228",
"0.47211966",
"0.47142652",
"0.4712998",
"0.47121271",
"0.4708423",
"0.47048035",
"0.47030687",
"0.4700913",
"0.46976367",
"0.46938288",
"0.4690992",
"0.46907955",
"0.46902204",
"0.46886647",
"0.4686169",
"0.4686169",
"0.46851188",
"0.46838468",
"0.46802473",
"0.46727496",
"0.4672584",
"0.46659935",
"0.46656427",
"0.46648675",
"0.4662239",
"0.4655437",
"0.46539372",
"0.46533257",
"0.46494773",
"0.4647243",
"0.46445403",
"0.46441162",
"0.4642824",
"0.4642824",
"0.46369585",
"0.46346188",
"0.46345812"
] | 0.5859266 | 0 |
Get a char as a String from user input. | def get_char
c = Curses.getch
c if (0..255) === c.ord
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character_from_user\n puts \" Please enter your name: \"\n gets.chomp.to_str\n puts \"\"\n end",
"def get_character_from_user\n puts \"Please enter a character\"\n character = gets.chomp.downcase\nend",
"def get_character_from_user\n puts \"Please enter a character:\"\n return gets.chomp.downcase\n\nend",
"def get_char\n\tbegin\n\t\tsystem(\"stty raw -echo\")\n\t\tchar = STDIN.getc\n\tensure\n\t\tsystem(\"stty -raw echo\")\n\tend\n\treturn char\nend",
"def get_character(input = T.unsafe(nil)); end",
"def getChar(c)\n c.chr\nend",
"def getChar(c)\n c.chr\nend",
"def get_character( input = STDIN )\n raw_no_echo_mode\n\n begin\n input.getc\n ensure\n restore_mode\n end\n end",
"def grab_input_char\n @input.slice!(0).ord unless input.length == 0\n end",
"def get_character( input = STDIN )\n Win32API.new(\"crtdll\", \"_getch\", [ ], \"L\").Call\n end",
"def get_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system 'stty raw -echo'\n char = STDIN.getc.chr\n # gather next two characters of special keys\n if char == \"\\e\"\n char << STDIN.read_nonblock(3) rescue nil\n char << STDIN.read_nonblock(2) rescue nil\n end\n\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n\n key = IOChar.char_to_key(char)\n\n if key == 'ctrl-c' or key == 'ctrl-d'\n raise Interrupt\n end\n\n char\n end",
"def get_char\n\t\tc = read_char\n\n\t\tcase c\n\t\twhen \"\\e[A\"\n\t\t\treturn :up\n\t\twhen \"\\e[B\"\n\t\t\treturn :down\n\t\twhen \"\\e[C\"\n\t\t\treturn :right\n\t\twhen \"\\e[D\"\n\t\t\treturn :left\n\t\twhen \"\\177\"\n\t\t\treturn :backspace\n\t\twhen \"\\004\"\n\t\t\treturn :delete\n\t\twhen \"\\e[3~\"\n\t\t\treturn :altdelete\n\t\twhen \"\\u0003\" # Ctrl C\n\t\t\texit 0\n\t\twhen /^.$/ # Only one char\n\t\t\treturn c\n\t\telse\n\t\t\tSTDERR.puts \"strange char: #{c.inspect}\"\n\t\tend\n\tend",
"def readChar\n\tinput = STDIN.read_nonblock(1) rescue nil\n\tif input == \"\\e\" then\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\tend\n\t\n\treturn input\nend",
"def get_character( input = STDIN )\n WinAPI._getch\n end",
"def get_char(options)\n if options[:raw]\n WinAPI.getch.chr\n else\n options[:echo] ? @input.getc : WinAPI.getch.chr\n end\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue StandardError\n nil\n end\n begin\n input << STDIN.read_nonblock(2)\n rescue StandardError\n nil\n end\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def show_char(c)\n chars = %w( nul sch stx etx eot enq ack bel bs tab nl vtab\n ff cr so si dle dcl dc2 dc3 dc4 nak syn etb\n can em sub esc fs gs rs us sp\n )\n return(chars[c.ord])\nend",
"def get_letter_player\n print \"Please give a letter: \"\n @guess_letter = gets.chomp.upcase\n puts \"\\nYou chose #{@guess_letter}\"\n end",
"def get_single_char\n printf \"> \"\n tty_param = `stty -g`\n system 'stty raw'\n input_single_char = IO.read '/dev/stdin', 1\n system \"stty #{tty_param}\"\n# print \"#{input_single_char}\\n\"\n\nreturn input_single_char\n\nend",
"def get_user_input\n gets.strip\nend",
"def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend",
"def get_char\n begin\n system(\"stty raw -echo 2>/dev/null\") # turn raw input on\n c = nil\n #if $stdin.ready?\n c = $stdin.getc\n cn=c.ord\n return \"ENTER\" if cn == 10 || cn == 13\n return \"BACKSPACE\" if cn == 127\n return \"C-SPACE\" if cn == 0\n return \"SPACE\" if cn == 32\n # next does not seem to work, you need to bind C-i\n return \"TAB\" if cn == 8\n if cn >= 0 && cn < 27\n x= cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff=c.chr\n while true\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n #puts \"got #{k}\"\n buff += k.chr\n else\n x=$kh[buff]\n return x if x\n #puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n #end\n return c.chr if c\n ensure\n #system \"stty -raw echo\" # turn raw input off\n system(\"stty -raw echo 2>/dev/null\") # turn raw input on\n end\nend",
"def get_input\n input = gets\n return input\nend",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n \tinput << STDIN.read_nonblock(3) rescue nil\n \tinput << STDIN.read_nonblock(2) rescue nil\n \tend\nensure\n \tSTDIN.echo = true\n \tSTDIN.cooked!\n \treturn input\nend",
"def read_char\n raw_tty! do\n input = $stdin.getc.chr\n return input unless input == \"\\e\"\n\n input << begin\n $stdin.read_nonblock(3)\n rescue\n ''\n end\n input << begin\n $stdin.read_nonblock(2)\n rescue\n ''\n end\n input\n end\n rescue IOError\n \"\\e\"\n end",
"def get_char\n c = @window.getchar\n case c\n when 13,10\n return \"ENTER\"\n when 32\n return \"SPACE\"\n when 127\n return \"BACKSPACE\"\n when 27\n return \"ESCAPE\"\n end\n keycode_tos c\n# if c > 32 && c < 127\n #return c.chr\n #end\n ## use keycode_tos from Utils.\nend",
"def decode_char(input)\n input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def getChar\n if @index <= @code.size - 1\n return @code[@index] if !@code[@index].nil?\n end\n # If nil return empty string.\n return nil\n end",
"def read_character\n unless @input.empty?\n result(@input.at(0), advance(1))\n else\n failure(\"less than one character available\")\n end\n end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def get_user_input(message)\n puts message\n gets.chomp\n end",
"def read_char\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n return input\nend",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend",
"def get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def get_input\n @input = gets.strip\n end",
"def get_user_input(prompt, default)\n print(prompt)\n r = gets.chomp\n if r.length() > 0\n return r\n else\n return default\n end\nend",
"def get_input\n gets.chomp\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n input\n ensure\n STDIN.echo = true\n STDIN.cooked!\n end",
"def prompt(char)\n proc do |target_self, nest_level, pry|\n [\n \"[#{pry.input_array.size}] \",\n \"kc(#{Pry.view_clip(target_self.class)})\",\n \"#{\":#{nest_level}\" unless nest_level == 0}#{char} \",\n ].join\n end\n end",
"def letter\n case @letter\n when \"q\"\n return \"qu\"\n else\n return @letter\n end\n end",
"def get_keyboard_input\n c = read_char\n\n case c\n # when \" \"\n # \"SPACE\"\n # when \"\\t\"\n # :query\n when \"\\r\"\n :error\n # when \"\\n\"\n # \"LINE FEED\"\n when \"\\e\"\n :abort\n # when \"\\e[A\"\n # \"UP ARROW\"\n # :error\n # when \"\\e[B\"\n # \"DOWN ARROW\"\n # :error\n when \"\\e[C\"\n \"RIGHT ARROW\"\n :right\n when \"\\e[D\"\n \"LEFT ARROW\"\n :left\n when \"\\177\"\n :backspace\n when \"\\004\"\n :delete\n when \"\\e[3~\"\n :delete\n # when \"\\u0003\"\n # \"CONTROL-C\"\n # exit 0\n when /^.$/\n c\n else\n :error\n end\n end",
"def get_console_char\n STDIN.getch\n end",
"def consume(str, char)\n raise AssertionError.new(\"Expected '#{char}'\") unless str[0] == char\n return str[1..-1].strip\n end",
"def get_user_choice\n puts \"Do you want to be X or O?\"\n puts \"Type 'X' or 'O': \"\n # assign the choice to a variable\n @symbol = gets.chomp\n # call the method to then get the computers symbol for the game\n get_computer_choice\n end",
"def read_char()\n STDIN.getch()\nend",
"def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend",
"def get_title(question)\n\tputs question\n\t@user_input = gets.chomp.tr(' ','+')\nend",
"def user_input\n\tgets\nend",
"def char\n raise MathError, \"Non-integer for char\" unless int?\n raise MathError, \"Out of range for char\" unless between?(0, 255)\n if zero?\n \"\"\n else\n to_i.chr\n end\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend",
"def read_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system \"stty raw -echo\"\n c = STDIN.getc.chr\n # gather next two characters of special keys\n if(c==\"\\e\")\n extra_thread = Thread.new{\n c = c + STDIN.getc.chr\n c = c + STDIN.getc.chr\n }\n # wait just long enough for special keys to get swallowed\n extra_thread.join(0.00001)\n # kill thread so not-so-long special keys don't wait on getc\n extra_thread.kill\n end\n rescue => ex\n puts \"#{ex.class}: #{ex.message}\"\n puts ex.backtrace\n ensure\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n return c\nend",
"def read_character\n lit = read_literal\n\n return \" \" if lit.empty? && peek_char == \" \"\n CHARACTERS.fetch(lit.downcase) do\n # Return just the first character\n unread(lit[1..-1])\n lit[0,1]\n end\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend",
"def get_user_input\n Termbox.tb_poll_event(@event)\n ascii_to_symbol @event[:ch]\n end",
"def get_user_name\n\tputs \"Quel sera ton nom pour cette partie ?\"\n\tprint \"> \"\n\tname = gets.chomp\n\treturn name\nend",
"def user_input_value()\n puts \"Enter a value: \"\n value = gets.chomp.to_s\n return value\nend",
"def char\n\t\t\t\t@char\n\t\t\tend",
"def encode_char(immune, input)\n input\n end",
"def get_char(options)\n if options[:raw] && options[:echo]\n if options[:nonblock]\n get_char_echo_non_blocking\n else\n get_char_echo_blocking\n end\n elsif options[:raw] && !options[:echo]\n options[:nonblock] ? get_char_non_blocking : get_char_blocking\n elsif !options[:raw] && !options[:echo]\n options[:nonblock] ? get_char_non_blocking : get_char_blocking\n else\n @input.getc\n end\n end",
"def getChar\n $look = ARGF.readchar\nend",
"def get_input\n gets.chomp \nend",
"def get_print_char x,y, leer = nil, one = 'X', two = 'O'\n\n #return \"@\" if @field[x][y].winner\n\n case @field[x][y].player\n when 1 then one\n when 2 then two\n else\n if leer.nil? then\n $keymap.invert[[x,y]].to_s\n else\n leer\n end\n end\n end",
"def get_input(*msg)\n print *msg\n return gets.strip\n end",
"def choose_letter \n puts \"\\nPick your letter (X/O).\"\n print \"> \"\n letter = STDIN.gets.chomp.upcase\n\n\n if (letter != \"X\") && (letter != \"O\")\n puts \"\\nWrong character.\\nPlease press the \\\"X\\\" or \\\"O\\\" key\\non your keyboard.\\n\\n\\n\"\n letter = choose_letter\n end\n letter\nend",
"def determine_username\n\tputs \"What is your name?\"\n\tusername = gets.strip.to_s\nend",
"def get_choice\n puts \"\\nThank you for using our Solar System Explorer! Here are your options:\n (A) Add a planet to the list\n (B) View a planet\n (C) Exit the program\"\n print \"\\nPlease select a letter: \"\n choice = gets.chomp.upcase\n choice\nend",
"def char\n self[@char]\n end",
"def user_input_letter\n puts \"Type the first letter of the student names you want to see and press return.\".center(100)\n first_letter = STDIN.gets.chomp\nend",
"def read_char\nSTDIN.echo = false\nSTDIN.raw!\ninput = STDIN.getc.chr\nif input == \"\\e\" then\ninput << STDIN.read_nonblock(3) rescue nil\ninput << STDIN.read_nonblock(2) rescue nil\nend\nensure\nSTDIN.echo = true\nSTDIN.cooked!\nreturn input\nend",
"def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend",
"def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend",
"def getInfo \n puts 'Enter your CSA :'\n puts 'Option \"X\": for escape'\n csa = gets\n \n return csa\n end",
"def first_char (input)\n input[0].downcase\n end",
"def get_input message\n\n puts message\n input = gets.chomp.downcase\n\nend",
"def input(prompt)\n raw_input(prompt).strip\n end",
"def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end",
"def read_user_char\n char = nil\n # Don't read keyboard more than x times per second\n time = Time.new\n if !@prev_time || time - @prev_time >= 0.25\n @prev_time = time\n begin\n system('stty raw -echo') # => Raw mode, no echo\n char = (STDIN.read_nonblock(1) rescue nil)\n ensure\n system('stty -raw echo') # => Reset terminal mode\n end\n end\n char\n end",
"def get_input\n\t#Get input from the user.\n return gets.chomp\nend",
"def choose_character(character_1, character_2)\n character_1\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def parse_char(char)\n RUBY_VERSION > '1.9' ? char : char.chr\n end",
"def get_character( input = STDIN )\n old_settings = Termios.getattr(input)\n\n new_settings = old_settings.dup\n new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)\n new_settings.c_cc[Termios::VMIN] = 1\n\n begin\n Termios.setattr(input, Termios::TCSANOW, new_settings)\n input.getc\n ensure\n Termios.setattr(input, Termios::TCSANOW, old_settings)\n end\n end",
"def getchar\n state = `stty -g`\n `stty raw -echo -icanon isig`\n STDIN.getc.chr\nensure\n `stty #{state}`\nend",
"def getInput\n puts \"Guess a letter:\"\n checkLetter(gets.chomp)\nend",
"def get_char\n system('stty raw -echo 2>/dev/null') # turn raw input on\n c = nil\n # if $stdin.ready?\n c = $stdin.getc\n cn = c.ord\n return 'ENTER' if cn == 10 || cn == 13\n return 'BACKSPACE' if cn == 127\n return 'C-SPACE' if cn == 0\n return 'SPACE' if cn == 32\n # next does not seem to work, you need to bind C-i\n return 'TAB' if cn == 8\n\n if cn >= 0 && cn < 27\n x = cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff = c.chr\n loop do\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n # puts \"got #{k}\"\n buff += k.chr\n else\n x = @kh[buff]\n return x if x\n\n # puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n # end\n return c.chr if c\nensure\n # system('stty -raw echo 2>/dev/null') # turn raw input on\n # 2019-03-29 - echo was causing printing of arrow key code on screen\n # if moving fast\n system('stty -raw 2>/dev/null') # turn raw input on\nend",
"def get_user_input\n input = gets.chomp\n #input\nend",
"def get_string(value_name)\r\n puts \"please input a value for #{value_name} (letters)\"\r\n answer = gets.chomp\r\n while answer.strip.empty?\r\n puts \"Please don't leave this value blank\"\r\n answer = gets.chomp\r\n end\r\n answer\r\n end",
"def readchar() end",
"def readchar() end",
"def readchar() end"
] | [
"0.7871303",
"0.7673719",
"0.75132406",
"0.71197957",
"0.7078796",
"0.69755065",
"0.69755065",
"0.69593936",
"0.69462353",
"0.69060874",
"0.67512596",
"0.6746199",
"0.6716986",
"0.65987957",
"0.6577152",
"0.6457742",
"0.64533496",
"0.6435029",
"0.6423935",
"0.64192325",
"0.6410728",
"0.64092153",
"0.64092153",
"0.64092153",
"0.64092153",
"0.6389426",
"0.6389426",
"0.63721573",
"0.6356884",
"0.6322862",
"0.6321749",
"0.6312469",
"0.62986547",
"0.6273367",
"0.6257439",
"0.62422204",
"0.6191301",
"0.61805534",
"0.6167365",
"0.61666983",
"0.61666983",
"0.61654675",
"0.6143955",
"0.6130878",
"0.6130692",
"0.612976",
"0.6125191",
"0.61140555",
"0.6107266",
"0.61015165",
"0.6092284",
"0.6091161",
"0.60892594",
"0.60891795",
"0.6088076",
"0.6086075",
"0.60785496",
"0.60737944",
"0.6068262",
"0.60568166",
"0.6049269",
"0.6048498",
"0.60469687",
"0.60469186",
"0.60386014",
"0.6029918",
"0.6027498",
"0.60196584",
"0.60190094",
"0.60131586",
"0.6003335",
"0.5996833",
"0.5993495",
"0.59921956",
"0.59905505",
"0.59868926",
"0.5986063",
"0.5982729",
"0.5982729",
"0.597607",
"0.5971926",
"0.5968739",
"0.5965475",
"0.59433335",
"0.5940234",
"0.5935947",
"0.5933136",
"0.59263504",
"0.5926229",
"0.5926229",
"0.59226155",
"0.59116805",
"0.5909313",
"0.5907614",
"0.5899591",
"0.58909327",
"0.5890396",
"0.5885669",
"0.5885669",
"0.5885669"
] | 0.65854675 | 14 |
Accept user input, and directly execute it as a Ruby method call to the controller. ==== Parameters +preset_command+ A command that would be displayed at the command line before user input. +default_argument+ A default argument for the command. | def process_command_line(preset_command: nil, default_argument: nil)
prompt = preset_command ? ":#{preset_command} " : ':'
command_line.set_prompt prompt
cmd, *args = command_line.get_command(prompt: prompt, default: default_argument).split(' ')
if cmd && !cmd.empty? && respond_to?(cmd)
ret = self.public_send cmd, *args
clear_command_line
ret
end
rescue Interrupt
clear_command_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(raw_input)\n clean_input, verbosity = sanitize_input raw_input\n\n if clean_input.length > 0\n command = find_command(clean_input) || @modes.current_mode.dynamic_command(clean_input) || @modes.global_mode.command_not_found\n user_args = extract_user_args command, clean_input\n command_ctx = build_context(command, user_args, verbosity)\n args = resolve_args(command, command_ctx)\n\n command.method.call(*args)\n end\n end",
"def default(*options, &block)\n if options.size == 1 && options.first.is_a?(Symbol) && !block_given?\n command :__default => options.first\n else\n command :__default, *options, &block\n end\n end",
"def run_built_in(command)\n _, command, *args = command.strip.split(/\\s+/)\n case command\n when 'user' then user_command(args)\n when 'reset' then reset_command(args)\n when 'version' then version_command(args)\n when 'help' then help_command(args)\n else '-> usage: v user|reset|version|help'\n end\n end",
"def command_processor(user_input)\r\n case user_input.downcase\r\n when \"help\"\r\n list_available_commands\r\n when \"create\"\r\n ui_create_event\r\n when \"view-day\"\r\n ui_view_by_day\r\n when \"view-month\"\r\n ui_view_by_month\r\n when \"delete\"\r\n ui_delete_event\r\n when \"modify\"\r\n ui_modify_event\r\n else\r\n puts \"#{user_input} is not a command. type 'help' to see a list of commands\"\r\n end\r\nend",
"def run(songs) # I thought we were supposed to call this bit 'runner'?\n puts \"Welcome to my Jukebox!\\n\\n Please enter a command:\\n\\n Help, List, Play, or Exit\\n\\n\"\n help\n command = gets.strip.to_s\n case command # I originally used if-else\n when \"help\"\n help\n when \"list\"\n list(songs)\n when \"play\"\n play(songs) # runs play songs method\n when \"exit\" # or use unless\n exit_jukebox\n # else\n # puts \"Erroneous Command\"\n # exit_jukebox\n end\nend",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def deliver(default = nil)\n # Design decision: the pre-prompt behavior\n # gets evaluated *once*, not every time the\n # user gets prompted. This prevents multiple\n # evaluations when bad options are provided.\n _eval_pre if @pre\n\n valid_option_chosen = false\n until valid_option_chosen\n response = messenger.prompt(@prompt_text, default)\n if validate(response)\n valid_option_chosen = true\n @answer = evaluate_behaviors(response)\n _eval_post if @post\n else\n messenger.error(@last_error_message)\n end\n end\n end",
"def method_missing(command_name, input = nil, &block)\n action = nil\n options_def = ''\n\n unless block.nil?\n action = block\n options_def = input\n\n if !options_def.nil? && !options_def.instance_of?(String)\n raise 'Invalid options'\n end\n end\n\n if input.instance_of? Consoler::Application\n action = input\n options_def = ''\n end\n\n if action.nil?\n raise 'Invalid subapp/block'\n end\n\n command = command_name.to_s\n\n _add_command(command, options_def, action)\n\n nil\n end",
"def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end",
"def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end",
"def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend",
"def prompt(text, args, options = {}, &block)\n key = options[:key]\n default = options[:default] || ''\n if key\n arg = args[key]\n if arg && yield(arg)\n print \"#{text}: #{arg}\\n\"\n STDOUT.flush\n return\n end\n end\n while true\n print \"#{text} [#{default}]: \"\n STDOUT.flush\n value = STDIN.gets.chomp!\n value = default if value.blank?\n break if yield value\n end\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def run(*args)\n print_help_and_exit if args.first == \"-?\"\n directive = args.first || \"default\"\n command = command_for(directive)\n \n if command.is_a?(Array)\n exec_multiple_directives directive, command\n else\n exec_directive directive, command\n end\n end",
"def exec_command_or_do(command, from, &block)\n return if self.exec_command(command, from)\n\n unless block.nil?\n @log.info \"Executing default action\"\n block.call(command, from)\n end\n end",
"def run\n \n if parsed_options?\n \n process_command\n end\n \n end",
"def original_run_command=(_arg0); end",
"def run_cmd(input); end",
"def test_method\n prompt('test method')\nend",
"def run(input, options = {})\n command = Command.new(options: options)\n yield(command) if block_given?\n command.run(input)\n end",
"def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend",
"def read_user_input(message, default = \"\", show_input = true)\n print interpolate_message(message, default)\n show_input ? gets : silent_command { gets }\n ($_.chomp.empty?) ? default.chomp : $_.chomp\n end",
"def call(input = nil)\n default_settings = self.default_settings\n\n runner =\n if default_settings\n self.runner.new(self, default_settings)\n else\n self.runner.new(self)\n end\n\n if around\n around.call(runner, input)\n else\n runner.call(input)\n end\n end",
"def menu\n\n puts \"~~~~~~~~Best Calculator EVER!~~~~~~~~\"\n puts \"Choose Function\"\n print \"(b)asic, (a)dvanced or (q)uit: \"\n option_1 = gets.chomp.downcase\n\n if option_1 == \"b\"\n basic_calc\n elsif option_1 == \"a\"\n advanced_calc\n else \n \"q\"\n \n end\nend",
"def process_command(user, command, args, params = nil)\n command = command.to_sym\n if actions.include?(command)\n @current_user = user\n @params = paramify(args)\n puts \"-> #{self.class}.#{command}\"\n self.instance_exec &actions[command.to_sym]\n else\n raise \"Class #{self.class} does not have an action named #{command}\"\n end\n end",
"def run_action_requiring_special_handling(command: nil, parameter_map: nil, action_return_type: nil)\n action_return = nil\n closure_argument_value = nil # only used if the action uses it\n\n case command.method_name\n when \"sh\"\n error_callback = proc { |string_value| closure_argument_value = string_value } if parameter_map[:error_callback]\n command_param = parameter_map[:command]\n log_param = parameter_map[:log]\n action_return = Fastlane::FastFile.sh(command_param, log: log_param, error_callback: error_callback)\n end\n\n command_return = ActionCommandReturn.new(\n return_value: action_return,\n return_value_type: action_return_type,\n closure_argument_value: closure_argument_value\n )\n\n return command_return\n end",
"def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend",
"def prompt(caller = nil)\n case caller\n when \"list\"\n puts \"please select by number\"\n # when \"select\"\n # puts \"\"\n else\n COMMANDS.each_with_index{|command, index| puts index.to_s + \".\" + command}\n end\n @command = gets.chomp\n execute(@command)\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def input(applied_action_as_symbol_or_string = :inspect)\r\n gets.send(applied_action_as_symbol_or_string)\r\nend",
"def call(*command); end",
"def call_command\n verb = match.captures[match.names.index('command')]\n verb = normalize_command_string(verb)\n public_send(verb)\n end",
"def handle_input\n # Takes user input\n input = STDIN.gets.chomp\n system('clear')\n\n # Single word commands\n # QUIT\n if input == 'quit'\n @run_game = false\n puts \"Thanks for playing!\"\n sleep(3)\n system('clear')\n\n # BACKPACK\n elsif input == 'backpack'\n @player.print_backpack\n\n # HELP\n elsif input == 'help'\n puts \"Use the commands to move around the AirBnB and use items to help you escape.\"\n\n else\n # Double word commands \n input_arr = input.split(\" \")\n # User has only entered one word\n if input_arr.size > 1\n command1 = input_arr[0]\n command2 = input_arr[1]\n # TAKE ITEM\n if command1 == \"take\"\n take_item(command2)\n # USE ITEM\n elsif command1 == \"use\"\n use_item(command2)\n # GO ROOM\n elsif command1 == \"go\"\n go_room(command2)\n else\n # User doesn't specify second command\n puts \"I'll need more information than that!\"\n end\n else\n # User enters invalid command word\n puts \"That isn't a valid command\"\n end\n end\n end",
"def send_command_prompt\n send_data options[:command_prompt]\n end",
"def execute\r\n $LOG.debug \"ParseDecisionApp::execute\"\r\n\r\n\t options = @user_choices\r\n if(!options[:logging])\r\n\t\toptions[:logging] = false\r\n end\r\n \r\n if(@user_choices[:which])\r\n puts \"Location: #{$0}\"\r\n return\r\n end\r\n \r\n @controller.setOptions(options)\r\n\t \r\n\t if(@user_choices[:cmdArg].empty?) # If no cmd line arg...\r\n if( [email protected]() )\r\n\t\t\treturn\r\n\t\tend\r\n else\r\n\t\t if( [email protected](@user_choices[:cmdArg]) )\r\n\t\t\treturn\r\n\t\t end\r\n\t end\r\n \r\n @controller.execute()\r\n end",
"def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend",
"def execute(input: $stdin, output: $stdout)\n\n prompt = TTY::Prompt.new\n\n choices = %w[small medium large]\n\n heading prompt.select('What size? (simple)', choices)\n\n choices = { small: 1, medium: 2, large: 3 }\n\n heading prompt.select('What size? (key/value)', choices)\n\n choices = [\n { name: 'small', value: 1 },\n { name: 'medium', value: 2, disabled: '(out of stock)' },\n { name: 'large', value: 3 }\n ]\n\n heading prompt.select('What size? (json config)', choices)\n\n result = prompt.select('What size? (dsl)') do |menu|\n menu.choice name: 'small', value: 1\n menu.choice name: 'medium', value: 2, disabled: '(out of stock)'\n menu.choice name: 'large', value: 3\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (custom value via proc)?') do |menu|\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', -> { 'Nice choice captain!' }\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (default)?') do |menu|\n menu.default 3\n\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', 3\n end\n\n heading result\n\n heading prompt.select('Choose your destiny (cycle)?', %w(Scorpion Kano Jax), cycle: true)\n\n prompt.select('Choose your destiny (extra config)?', %w(Scorpion Kano Jax), help: '(Bash keyboard)', symbols: {marker: '>'})\n\n prompt.on(:keyctrl_x, :keyescape) do\n raise ExitApp\n end\n\n choices = %w[small medium large]\n\n begin\n heading prompt.select('What size? (PRESS ESC or CTRL+X to exit)', choices)\n rescue ExitApp\n puts\n prompt.warn 'e[x]iting....'\n end\n\n :gui\n end",
"def read_command(prompt); end",
"def fallback_parsing(*arguments)\n arguments = arguments.flatten\n case command = arguments.shift\n when nil, \"list\"\n @action = :list\n if arg = arguments.shift\n @state ||= arg.to_sym if %w(open closed).include? arg\n @user, @repo = arg.split \"/\" if arg.count(\"/\") == 1\n end\n when \"search\"\n @action = :search\n @search_term ||= arguments.shift\n when \"show\", /^-?(\\d+)$/\n @action = :show\n @number ||= ($1 || arguments.shift[/\\d+/]).to_i\n when \"open\"\n @action = :open\n when \"edit\"\n @action = :edit\n @number ||= arguments.shift[/\\d+/].to_i\n when \"close\"\n @action = :close\n @number ||= arguments.shift[/\\d+/].to_i\n when \"reopen\"\n @action = :reopen\n @number ||= arguments.shift[/\\d+/].to_i\n when \"label\"\n @action = :label\n @number ||= arguments.shift[/\\d+/].to_i\n @label ||= arguments.shift\n when \"unlabel\"\n @action = :unlabel\n @number ||= arguments.shift[/\\d+/].to_i\n @label ||= arguments.shift\n when \"comment\"\n @action = :comment\n @number ||= arguments.shift[/\\d+/].to_i\n when \"claim\"\n @action = :claim\n @number ||= arguments.shift[/\\d+/].to_i\n when %r{^([^/]+)/([^/]+)$}\n @action = :list\n @user, @repo = $1, $2\n when \"url\", \"web\"\n @action = :url\n @number ||= arguments.shift[/\\d+/].to_i\n end\n if @action\n @args = @argv.dup\n args.delete_if { |arg| arg == command }\n option_parser.parse!(*args)\n return true\n end\n unless command.start_with? \"-\"\n warn \"#{File.basename $0}: what do you mean, '#{command}'?\"\n end\n end",
"def step\n n = gets\n if n == nil\n puts \"\"\n return 0\n end\n n.chomp!\n meth = n.split(' ')[0]\n if n.split(' ').size > 1\n arg = n[n.index(' ')..-1].strip\n else\n arg = nil\n end\n if commands.keys.include?(meth)\n commands[meth].call( arg )\n else\n puts \"Command '#{meth}' not recognized.\"\n end\n end",
"def get_default_or_custom\n loop do\n puts \"Please enter 'default' to use the default options or 'custom'\"\n print \"to enter your own: \"\n default_or_custom = gets.chomp.downcase\n redo if default_or_custom != \"default\" && default_or_custom != \"custom\"\n return default_or_custom\n end\nend",
"def run_cmd(input)\n return @session.process(input,false)\n end",
"def cmd_to_run\n\tarr = ARGV.dup\n\tarr = default_cmd if arr.empty?\n\tarr\nend",
"def process_simple_command(command, board)\n\n case command\n when \"help\"\n puts command_list\n return true\n when \"display\"\n board.display\n return true\n when \"exit\"\n abort\n end\n\n false\nend",
"def do_action(cmd, options = {})\n # XXX Finish this\n end",
"def ask_for_action\n puts 'Log Me In Calculator test'\n puts 'Please select your test type (enter the corresponding number)'\n puts '[1]- Operational'\n puts '[2]- Functionnal'\n puts '[3]- All'\n test_to_run = gets.strip\n recreate_default_config(test_to_run)\n read_config\n run_tests\nend",
"def post_option_parser(configuration)\n # we could test or manipulate input values here\n if ARGV.length >= 1\n configuration[:command] = ARGV.shift \n end\n\n raise \"Action must be say_goodbye or get_towel\" unless [\"say_goodbye\", \"get_towel\"].include?(configuration[:command])\n end",
"def ask_with_default(question, default='')\n user_answer = ask(\"#{question} (default: #{default.to_s})\").strip\n user_answer.empty? ? default : user_answer\nend",
"def dispatch(input)\n continue = true\n commands = input.split(\" \")\n case commands[0].downcase\n when \"store\"\n continue = process_store(commands[1..-1])\n when \"factory\"\n continue = process_factory(commands[1..-1])\n when \"quit\"\n continue = process_quit\n when \"resources\"\n continue = process_resources\n when \"project\"\n continue = process_projects(commands[1..-1])\n when \"produce\"\n continue = process_production(commands[1..-1])\n when \"pick\"\n continue = process_pick(commands[1..-1])\n when \"next\"\n continue = process_next\n when \"save\"\n continue = process_save\n when \"scheduling\"\n continue = process_scheduling\n else\n puts \"unknown command: #{input}\"\n end\n return continue\n end",
"def execute(args, default = nil, &block)\n parse(args)\n check_constraints\n pre_execute_block\n execute_options(default) if !default\n if block\n block.call(extra_args)\n end\n execute_options(default) if default\n post_execute_block\n end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def prepare_input(prompt); end",
"def default_command(name)\n @io.puts \"#### [Default Command] #{name}\" unless name.nil?\n end",
"def default_command(command_name = nil)\n if command_name\n if commands.has_key?(command_name)\n @default_command = commands[command_name] if command_name\n @default_command\n else\n raise ArgumentError.new(\"'#{command_name}' couldn't be found in this command's list of commands.\")\n end\n else\n @default_command\n end\n end",
"def process\n command = get_command()\n\n if command\n verify_command(command)\n else\n help\n end\n end",
"def runner_command input_path, output_path\n # run as either local or hadoop\n case run_mode\n when 'local'\n $stderr.puts \" Reading STDIN / Writing STDOUT\"\n command = local_command input_path, output_path\n when 'hadoop', 'mapred'\n $stderr.puts \" Launching hadoop as\"\n command = hadoop_command input_path, output_path\n else\n raise \"Need to use --run=local or --run=hadoop; or to use the :default_run_mode in config.yaml just say --run \"\n end\n end",
"def run\n job = handle_input(show_menu)\n\n # job = handle_input(get_menu_choice) # here we the menu choice and handle the choice together and return value will be the selected job or exit command\n\n # if job is a valid job instance then show details and offer to open in browser\n if job.class == FreelancerFinder::Job\n show_job_details(job)\n open_in_browser?(job)\n end\n # selected_job\n job\n end",
"def interpret_command(*args)\n format = nil\n command = nil\n if args.last.is_a? Hash\n options = args.last\n ca = (options[:args] || []).join(' ')\n command = \"#{options[:command]} #{ca}\".strip.to_sym\n format = options[:format]\n else\n command = args.last.to_sym\n end\n\n if %i[exit quit].include?(command)\n if (@exit_command_counter == 0) && !exit_ok?\n @exit_command_counter += 1\n logger.warn { \"You have running load agents: terminate first or #{command} again\" }\n else\n puts 'Bye'\n @exit_command_counter = -1 # \"express\" exit\n end\n\n else\n @exit_command_counter = 0 # reset exit intention\n match_data = nil\n grammar.each do |rule|\n match_data = rule.match(command.to_s)\n break unless match_data.nil?\n end\n\n if match_data\n method_name = match_data[1].to_sym\n method_args = match_data.to_a\n .slice(2, match_data.length - 1)\n .collect { |e| e.blank? ? nil : e }.compact.collect(&:strip)\n if (method_args.length == 1) && (method_args.first == 'help')\n help(method_name)\n else\n # defer to application for further processing\n method_args.push(format) unless format.nil?\n send(method_name, *method_args)\n return method_name\n end\n else\n raise(UnknownCommandException, \"#{command} is unknown\")\n end\n end\n end",
"def run( *args )\n\n\t\tself.setup_completion\n\t\tself.read_history\n\n\t\t# Run until something sets the quit flag\n\t\tuntil @quitting\n\t\t\tinput = Readline.readline( @prompt, true )\n\t\t\tself.log.debug \"Input is: %p\" % [ input ]\n\n\t\t\t# EOL makes the shell quit\n\t\t\tif input.nil?\n\t\t\t\tself.log.debug \"EOL: setting quit flag\"\n\t\t\t\t@quitting = true\n\n\t\t\t# Blank input -- just reprompt\n\t\t\telsif input == ''\n\t\t\t\tself.log.debug \"No command. Re-displaying the prompt.\"\n\n\t\t\t# Act on everything else\n\t\t\telse\n\t\t\t\tself.log.debug \"Dispatching input: %p\" % [ input ]\n\t\t\t\tcommand, *args = Shellwords.shellwords( input )\n\t\t\t\tself.dispatch_command( command, *args )\n\t\t\tend\n\t\tend\n\n\t\tself.save_history\n\n\tend",
"def handle_cmd_input arg\n comm = \"\"\n dPlayer = @player\n return if dPlayer == nil\n\n one_arg(arg, comm, true)\n return if comm.empty?\n\n if @snoop\n @snoop.each do |sock|\n sock.send_data(\"(Snoop) #{arg}\" + ENDL) if sock.weakref_alive?\n end\n end\n\n how_many = nil\n begin \n how_many = Integer(comm)\n # also pull the real command\n one_arg! arg, comm, true\n one_arg! arg, comm, false\n return if comm.empty?\n rescue \n one_arg! arg, comm, false\n how_many = 1\n end\n\n begin\n # execute it this many times in a row.\n how_many.times do \n dPlayer.execute_command(comm, arg)\n end\n rescue Exception=>e\n dPlayer.view \"Command failed.\" + ENDL\n log_exception e\n end\n end",
"def await_command(message = nil)\n puts message if message\n print \"#{@config.prompt} \".magenta\n input = STDIN.gets.chomp\n\n # Strip and process\n action, *params = input.strip.gsub(/\\s{2,}/, \" \").split(\" \")\n run_command(action || \"help\", params)\n end",
"def input(mes, default = :none, &validator)\n default_fmt = ' (default: %s)'\n print mes\n print format(default_fmt, default) unless default == :none || default.nil?\n print ': '\n input = STDIN.gets.chomp.strip\n input = default if input.empty? && default != :none\n return input unless block_given?\n\n validator.call(input) ? input : default\nend",
"def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end",
"def run_cmd(input)\n return self.process(input,false)\n end",
"def run_command(input_filename, file_operation)\n\tLog.info \"Inside run_command\"\n\tif !Config['FileOperations'].key?(file_operation)\n\t\treturn \"#{file_operation} isn't a valid preset\"\n\tend\n\n\ttranscode_settings = Config['FileOperations'][file_operation]\n\n\tLog.info transcode_settings.to_s\n\n\tbegin\n\t\tif !transcode_settings.key?('command')\n\t\t\treturn \"#{file_operation} doesn't have a command\"\n\t\tend\n\n\t\tcommand_template = transcode_settings['command']\n\t\tfilename = File.basename(input_filename)\n\t\tbase_filename = File.basename(input_filename, File.extname(input_filename))\n\n\t\t\n\t\tif transcode_settings.key?('location')\n\t\t\toutput_filename = [transcode_settings['location'], base_filename].join('/')\n\t\telse\n\t\t\toutput_filename = [Config['WebServer']['webroot'], Config['WebServer']['transcode_dir'], base_filename].join('/')\n\t\tend\n\n\t\tcommand = command_template % {input_filename:input_filename, output_filename: output_filename}\n\n\t\tLog.info command\n\n\t\t# Update the channel to let them know what's happening\n\t\tcall_mattermost({:text => \"Running command #{file_operation} on file #{filename}\"})\n\n\t\tif system(command)\n\t\t\tif transcode_settings.key?('text')\n\t\t\t\toutput_text = transcode_settings['text'] % {input_filename:input_filename, output_filename: output_filename}\n\t\t\telse\n\t\t\t\toutput_text = \"Finished running command #{file_operation} on file #{filename}\"\n\t\t\tend\n\t\t\t\n\t\t\tcall_mattermost({:text => output_text})\t\n\t\telse\n\t\t\tcall_mattermost({:text => \"ERROR: Could not run command #{file_operation} on file #{filename}\"})\n\t\tend\n\n\trescue Exception => e\n\t\tLog.error e.to_s\n\t\treturn 'There was an error'\n\tend\nend",
"def ask_with_default(question, color, default)\n question = (question.split(\"?\") << \" [#{default}]?\").join\n answer = ask(question, color)\n answer.to_s.strip.empty? ? default : answer\nend",
"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 obtain(prompt, default = '')\n Settings.console.ask \"#{prompt}: \" do |answer|\n answer.default = default\n end\n end",
"def run(command, &callback)\n if reset?(command)\n callback.call(run_built_in(command))\n else\n @commands.push({command: command.strip, callback: callback})\n end\n end",
"def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend",
"def execute(input: $stdin, output: $stdout)\n loop do\n case @subcommand\n when :gui\n gui\n when :filter\n require_relative 'demo_filter'\n subcmd = PocShotstack::Commands::DemoFilter.new({})\n when :image\n require_relative 'demo_image'\n subcmd = PocShotstack::Commands::DemoImage.new({})\n when :status\n require_relative 'demo_status'\n subcmd = PocShotstack::Commands::DemoStatus.new({})\n when :text\n require_relative 'demo_text'\n subcmd = PocShotstack::Commands::DemoText.new({})\n when :title\n require_relative 'demo_title'\n subcmd = PocShotstack::Commands::DemoTitle.new({})\n when :dsl\n require_relative 'demo_dsl'\n subcmd = PocShotstack::Commands::DemoDsl.new({})\n else\n break\n end\n @subcommand = subcmd&.execute(input: input, output: output)\n end\n end",
"def process_input(raw_input)\n @engine.inject_command(normalized_input(raw_input), self)\n @engine.execute_pending_commands\n end",
"def do_manual\n display_world\n puts \"Press enter to continue\"\n STDOUT.flush\n input = STDIN.gets.chomp\n if input == \"quit\" or input == \"exit\"\n exit\n end\n end",
"def user_answer\n $stdout.print('>> ')\n $stdin.gets.chomp\nend",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def default_command(name)\n abstract!\n end",
"def action_command\n Command.new(serverside_command_path, @serverside_version, *task) do |cmd|\n given_applicable_options = given_options & applicable_options\n given_applicable_options.each do |option|\n cmd.argument(option.type, option.to_switch, @arguments[option.name])\n end\n end\n end",
"def run_command(full_command)\n raise NotImplementedError.new(\"run_command is only available in concrete implementations\")\n end",
"def command_file prompt, *command\n pauseyn = command.shift\n command = command.join \" \"\n #print \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n t = \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n file = ask_hint t, $view[$cursor]\n #print \"#{prompt} :: Enter file shortcut: \"\n #file = ask_hint\n perror \"Command Cancelled\" unless file\n return unless file\n file = File.expand_path(file)\n if File.exists? file\n file = Shellwords.escape(file)\n pbold \"#{command} #{file} (press a key)\"\n c_system \"#{command} #{file}\"\n pause if pauseyn == \"y\"\n c_refresh\n else\n perror \"File #{file} not found\"\n end\nend",
"def test_run_default_directive\n with_fixture do\n out = capture_subprocess_io { system \"dotrun\" }\n assert_includes out.join, \"default result\"\n assert !out.join.include?(\"sample result\")\n end\n end",
"def prompt(message, default = nil)\n if default\n print \"#{message} [#{default}]: \"\n input = gets.chomp\n\n if input.empty?\n default\n else\n input\n end\n else\n print \"#{message}: \"\n gets.chomp\n end\n end",
"def action (opt, arg, parms)\n @proc.call(opt, arg, parms)\n end",
"def test_command_should_default_to_default_command\n assert_equal \"git\", @source.command\n @source.local { assert_equal \"git\", @source.command }\n end",
"def ask(question, options={})\n print \"#{question} [default: #{options[:default]}] \"\n reply = STDIN.readline.chomp\n if reply.empty?\n options[:default]\n else\n reply\n end\n end",
"def get_user_input(prompt, default)\n print(prompt)\n r = gets.chomp\n if r.length() > 0\n return r\n else\n return default\n end\nend",
"def default_command(name)\n @io.puts \"[Default Command] #{name}\" unless name.nil?\n end",
"def test_method\n prompt(\"test message\")\nend",
"def process_argv!\n super\n if raw_script_name =~ /(\\w+)-([\\w\\-]+)/\n self.command = $2\n else\n self.command = rest.shift\n end\n end",
"def prompt(question, default: nil)\n answer = ask(question) \n answer.empty? ? default : answer\nend",
"def execute(input)\n unless input.strip.empty? || input.strip[0] == \"!\"\n log_history_command(input.strip)\n end\n\n #Morpheus::Logging::DarkPrinter.puts \"Shell command: #{input}\"\n input = input.to_s.strip\n\n # allow pasting in commands that have 'morpheus ' prefix\n if input[0..(prog_name.size)] == \"#{prog_name} \"\n input = input[(prog_name.size + 1)..-1] || \"\"\n end\n if !input.empty?\n\n if input == 'exit'\n #print cyan,\"Goodbye\\n\",reset\n #@history_logger.info \"exit\" if @history_logger\n @exit_now_please = true\n return 0\n #exit 0\n elsif input == 'help'\n out = \"\"\n if @temporary_shell_mode\n out << \"You are in a (temporary) morpheus shell\\n\"\n else\n out << \"You are in a morpheus shell.\\n\"\n end\n out << \"See the available commands below.\\n\"\n\n out << \"\\nCommands:\\n\"\n # commands = @morpheus_commands + @shell_commands\n # @morpheus_commands.sort.each {|cmd|\n # out << \"\\t#{cmd.to_s}\\n\"\n # }\n sorted_commands = Morpheus::Cli::CliRegistry.all.values.sort { |x,y| x.command_name.to_s <=> y.command_name.to_s }\n sorted_commands.each {|cmd|\n # JD: not ready to show description yet, gotta finish filling in every command first\n # maybe change 'View and manage' to something more concise like 'Manage'\n # out << \"\\t#{cmd.command_name.to_s.ljust(28, ' ')} #{cmd.command_description}\\n\"\n out << \"\\t#{cmd.command_name.to_s}\\n\"\n }\n #puts \"\\n\"\n out << \"\\nShell Commands:\\n\"\n @shell_commands.each {|cmd|\n # out << \"\\t#{cmd.to_s.ljust(28, ' ')} #{@shell_command_descriptions ? @shell_command_descriptions[cmd] : ''}\\n\"\n out << \"\\t#{cmd.to_s}\\n\"\n }\n out << \"\\n\"\n out << \"For more information, see https://clidocs.morpheusdata.com\"\n out << \"\\n\"\n print out\n return 0\n elsif input =~ /^\\s*#/\n Morpheus::Logging::DarkPrinter.puts \"ignored comment: #{input}\" if Morpheus::Logging.debug?\n return 0\n elsif input == 'clear'\n print \"\\e[H\\e[2J\"\n return 0\n elsif input == 'reload' || input == 'reload!'\n # clear registry\n Morpheus::Cli::CliRegistry.instance.flush\n # reload code\n Morpheus::Cli.reload!\n # execute startup scripts\n if File.exist?(Morpheus::Cli::DotFile.morpheus_profile_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheus_profile_filename).execute()\n end\n if File.exist?(Morpheus::Cli::DotFile.morpheusrc_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheusrc_filename).execute()\n end\n # recalculate shell environment\n reinitialize()\n\n Morpheus::Logging::DarkPrinter.puts \"shell has been reloaded\" if Morpheus::Logging.debug?\n return 0\n elsif input == '!!'\n cmd_number = @history.keys[-1]\n input = @history[cmd_number]\n if !input\n puts \"There is no previous command\"\n return false\n end\n return execute(input)\n elsif input =~ /^\\!.+/\n cmd_number = input.sub(\"!\", \"\").to_i\n if cmd_number != 0\n old_input = @history[cmd_number]\n if !old_input\n puts \"Command not found by number #{cmd_number}\"\n return 0\n end\n #puts \"executing history command: (#{cmd_number}) #{old_input}\"\n # log_history_command(old_input)\n # remove this from readline, and replace it with the old command\n Readline::HISTORY.pop\n Readline::HISTORY << old_input\n return execute(old_input)\n end\n\n elsif input == \"insecure\"\n Morpheus::RestClient.enable_ssl_verification = false\n return 0\n\n elsif [\"hello\",\"hi\",\"hey\",\"hola\"].include?(input.strip.downcase)\n user_msg = input.strip.downcase\n # need a logged_in? method already damnit\n wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials\n help_msg = case user_msg\n when \"hola\"\n \"¿como puedo ayudarte? tratar #{cyan}help#{reset}\"\n else\n \"how may I #{cyan}help#{reset} you?\"\n end\n greeting = \"#{user_msg.capitalize}#{wallet ? (' '+green+wallet['username'].to_s+reset) : ''}, #{help_msg}#{reset}\"\n puts greeting\n return 0\n elsif input.strip =~ /^shell\\s*/\n # just allow shell to fall through\n # we should reload the configs and history file after the sub shell process terminates though.\n # actually, that looks like it is working just fine already...?\n print cyan,\"starting a subshell\",reset,\"\\n\"\n elsif input =~ /^\\.\\s/\n # dot alias for source <file>\n log_history_command(input)\n return Morpheus::Cli::SourceCommand.new.handle(input.split[1..-1])\n end\n exit_code, err = 0, nil\n begin\n argv = Shellwords.shellsplit(input)\n cmd_name = argv[0]\n cmd_args = argv[1..-1]\n # crap hack, naming conflicts can occur with aliases\n @return_to_log_level = [\"log-level\",\"debug\"].include?(cmd_name) ? nil : Morpheus::Logging.log_level\n @return_to_coloring = [\"coloring\"].include?(cmd_name) ? nil : Term::ANSIColor::coloring?\n @return_to_benchmarking = [\"benchmark\"].include?(cmd_name) ? nil : Morpheus::Benchmarking.enabled?\n \n #if Morpheus::Cli::CliRegistry.has_command?(cmd_name) || Morpheus::Cli::CliRegistry.has_alias?(cmd_name)\n #log_history_command(input)\n # start a benchmark, unless the command is benchmark of course\n if my_terminal.benchmarking || cmd_args.include?(\"-B\") || cmd_args.include?(\"--benchmark\")\n if cmd_name != 'benchmark' # jd: this does not work still 2 of them printed.. fix it!\n # benchmark_name = \"morpheus \" + argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n benchmark_name = argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n start_benchmark(benchmark_name)\n end\n end\n exit_code, err = Morpheus::Cli::CliRegistry.exec_expression(input)\n benchmark_record = stop_benchmark(exit_code, err) # if benchmarking?\n Morpheus::Logging::DarkPrinter.puts(cyan + dark + benchmark_record.msg) if benchmark_record\n # else\n # puts_error \"#{Morpheus::Terminal.angry_prompt}'#{cmd_name}' is not recognized. Use 'help' to see the list of available commands.\"\n # @history_logger.warn \"Unrecognized Command #{cmd_name}\" if @history_logger\n # exit_code, err = -1, \"Command not recognized\"\n # end\n rescue Interrupt\n # user pressed ^C to interrupt a command\n @history_logger.warn \"shell interrupt\" if @history_logger\n print \"\\nInterrupt. aborting command '#{input}'\\n\"\n exit_code, err = 9, \"aborted command\"\n rescue SystemExit => cmdexit\n # nothing to do, assume the command that exited printed an error already\n # print \"\\n\"\n if cmdexit.success?\n exit_code, err = cmdexit.status, nil\n else\n exit_code, err = cmdexit.status, \"Command exited early.\"\n end\n rescue => e\n # some other type of failure..\n @history_logger.error \"#{e.message}\" if @history_logger\n exit_code, err = Morpheus::Cli::ErrorHandler.new(my_terminal.stderr).handle_error(e) # lol\n \n ensure\n if @return_to_log_level\n Morpheus::Logging.set_log_level(@return_to_log_level)\n ::RestClient.log = Morpheus::Logging.debug? ? Morpheus::Logging::DarkPrinter.instance : nil\n @return_to_log_level = nil\n end\n if @return_to_coloring != nil\n Term::ANSIColor::coloring = @return_to_coloring\n @return_to_coloring = nil\n end\n if @return_to_benchmarking != nil\n Morpheus::Benchmarking.enabled = @return_to_benchmarking\n my_terminal.benchmarking = Morpheus::Benchmarking.enabled\n @return_to_benchmarking = nil\n end\n end\n\n return exit_code, err\n end\n\n end",
"def run_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:run, shell_command, input_query, response)\nend",
"def call_option(input)\n if (/^[0-#{@@main_ops.length - 1}]$/.match(input))\n print \"\\e[H\\e[2J\"\n puts @@headings[input.to_i]\n case input\n when '0'\n add_contact\n pause\n when '1'\n modify_contact\n pause\n when '2'\n display_all_contacts\n pause\n when '3'\n display_one_contact\n pause\n when '4'\n display_attribute_across\n pause\n when '5'\n delete_contact\n pause\n end \n else \n puts \"Error: option #{input} not recognized.\"\n end\n end",
"def run \n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\"\n process_arguments(@validoptions.args)\n puts \"Finished at #{DateTime.now}\"\n else\n raise BoilerMakerErr.new(\"Could not parse options. An unknown error has ocurred.\")\n exit $!\n end\n end"
] | [
"0.5753752",
"0.5311514",
"0.52760154",
"0.5255442",
"0.5209559",
"0.52045923",
"0.5193481",
"0.5190856",
"0.512851",
"0.5098161",
"0.5068501",
"0.50610435",
"0.505512",
"0.5027248",
"0.50228804",
"0.49825186",
"0.49575496",
"0.4947826",
"0.49460825",
"0.49459407",
"0.49411976",
"0.49376097",
"0.4926475",
"0.49211422",
"0.49207547",
"0.49181768",
"0.49088308",
"0.49052078",
"0.48635128",
"0.48542598",
"0.48513252",
"0.4850188",
"0.4849445",
"0.48379984",
"0.4828185",
"0.4824201",
"0.48239586",
"0.48198545",
"0.48088264",
"0.48071557",
"0.47983402",
"0.4793964",
"0.47890526",
"0.4786416",
"0.47815168",
"0.47805575",
"0.47786966",
"0.47762308",
"0.47732386",
"0.47506237",
"0.47493055",
"0.47493055",
"0.47493055",
"0.4746734",
"0.47451943",
"0.47382152",
"0.4738108",
"0.47366527",
"0.4727806",
"0.4726074",
"0.47220224",
"0.47102052",
"0.47066963",
"0.47034112",
"0.47009894",
"0.47006118",
"0.4695844",
"0.46929538",
"0.4688882",
"0.4687514",
"0.46869412",
"0.46862534",
"0.4682535",
"0.46811777",
"0.4681099",
"0.4671629",
"0.4670695",
"0.4670695",
"0.4670695",
"0.4670695",
"0.4670695",
"0.4670695",
"0.4665552",
"0.46524346",
"0.46424484",
"0.46402866",
"0.46385247",
"0.46375534",
"0.46369535",
"0.462881",
"0.46268943",
"0.46265623",
"0.46258268",
"0.46228784",
"0.46199867",
"0.46136993",
"0.4612629",
"0.46108553",
"0.4610332",
"0.46084043"
] | 0.80562204 | 0 |
Accept user input, and directly execute it in an external shell. | def process_shell_command
command_line.set_prompt ':!'
cmd = command_line.get_command(prompt: ':!')[1..-1]
execute_external_command pause: true do
system cmd
end
rescue Interrupt
ensure
command_line.clear
command_line.noutrefresh
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:run, shell_command, input_query, response)\nend",
"def run_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:run, shell_command, input_query, response)\n end",
"def run_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:run, shell_command, input_query, response)\n end",
"def run_script(content)\n user_switch = \"\"\n\n unless @user == \"root\"\n user_switch = USER_SWITCH_COMMAND\n end\n\n wrapper = <<-EOF\n if [ -e /dev/fd/0 ]\n then\n #{user_switch} /bin/sh /dev/fd/0\n elif [ -e /dev/stdin ]\n then\n #{user_switch} /bin/sh /dev/stdin\n else\n echo \"Cannot find method of communicating with the shell via stdin\"\n exit 1\n fi\n EOF\n\n exec_ssh(wrapper, content)\n end",
"def run_cmd(input); end",
"def execute(input: $stdin, output: $stdout)\n heading 'Only press [a,s,d,f or x]'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n prompt.say event.value if event.value == 'a'\n prompt.warn event.value if event.value == 's'\n prompt.error event.value if event.value == 'd'\n prompt.ok event.value if event.value == 'f'\n\n if event.value == 'x'\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n end\n\n until exiting do reader.read_keypress end\n\n heading 'Press any key or ^x or Esc to exit'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n puts event.value\n end\n reader.on(:keyctrl_x, :keyescape) do\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n\n until exiting do reader.read_keypress end\n\n :gui\n end",
"def ask_for_user_input(msg=nil, opts={})\n print msg if msg\n print \": \"\n STDOUT.flush\n if opts[:password]\n system \"stty -echo\"\n result = STDIN.gets\n system \"stty echo\"\n puts\n else\n result = STDIN.gets\n end\n result.chomp\nend",
"def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)\n send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|\n if data =~ input_query\n if response\n logger.info \"#{data} #{\"*\"*(rand(10)+5)}\", channel[:host]\n channel.send_data \"#{response}\\n\"\n else\n logger.info data, channel[:host]\n response = ::Capistrano::CLI.password_prompt \"#{data}\"\n channel.send_data \"#{response}\\n\"\n end\n else\n logger.info data, channel[:host]\n end\n end\n end",
"def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)\n send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|\n if data =~ input_query\n if response\n logger.info \"#{data} #{\"*\"*(rand(10)+5)}\", channel[:host]\n channel.send_data \"#{response}\\n\"\n else\n logger.info data, channel[:host]\n response = ::Capistrano::CLI.password_prompt \"#{data}\"\n channel.send_data \"#{response}\\n\"\n end\n else\n logger.info data, channel[:host]\n end\n end\nend",
"def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)\n send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|\n\n if data =~ input_query\n if response\n logger.info \"#{data} #{\"*\"*(rand(10)+5)}\", channel[:host]\n channel.send_data \"#{response}\\n\"\n else\n logger.info data, channel[:host]\n response = ::Capistrano::CLI.password_prompt \"#{data}\"\n channel.send_data \"#{response}\\n\"\n end\n else\n logger.info data, channel[:host]\n end\n end\n end",
"def run_program(cmd, input = \"\")\n stdout, = Open3.capture2e(shell_out_env, *cmd, stdin_data: input)\n\n stdout\n end",
"def prompt_and_get_input_from_user\n prompt_user\n input = $stdin.readline.strip\nend",
"def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n return :gui\n end",
"def shell(*) end",
"def run_cmd(input)\n return @session.process(input,false)\n end",
"def handle_input(str)\n str.strip!\n return prompt if str.empty?\n execute_command(str)\n end",
"def prompt_cmd\n print \"> \"\n input_str = @input.gets.chomp\n Input.str_to_cmd input_str\n end",
"def execute(input: $stdin, output: $stdout)\n logger = TTY::Logger.new\n begin\n raise ArgumentError, 'Wrong data'\n rescue ArgumentError => e\n logger.fatal('Error:', e)\n end\n\n :gui\n end",
"def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"def user_answer\n $stdout.print('>> ')\n $stdin.gets.chomp\nend",
"def execute(input: $stdin, output: $stdout)\n\n prompt = TTY::Prompt.new\n\n choices = %w[small medium large]\n\n heading prompt.select('What size? (simple)', choices)\n\n choices = { small: 1, medium: 2, large: 3 }\n\n heading prompt.select('What size? (key/value)', choices)\n\n choices = [\n { name: 'small', value: 1 },\n { name: 'medium', value: 2, disabled: '(out of stock)' },\n { name: 'large', value: 3 }\n ]\n\n heading prompt.select('What size? (json config)', choices)\n\n result = prompt.select('What size? (dsl)') do |menu|\n menu.choice name: 'small', value: 1\n menu.choice name: 'medium', value: 2, disabled: '(out of stock)'\n menu.choice name: 'large', value: 3\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (custom value via proc)?') do |menu|\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', -> { 'Nice choice captain!' }\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (default)?') do |menu|\n menu.default 3\n\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', 3\n end\n\n heading result\n\n heading prompt.select('Choose your destiny (cycle)?', %w(Scorpion Kano Jax), cycle: true)\n\n prompt.select('Choose your destiny (extra config)?', %w(Scorpion Kano Jax), help: '(Bash keyboard)', symbols: {marker: '>'})\n\n prompt.on(:keyctrl_x, :keyescape) do\n raise ExitApp\n end\n\n choices = %w[small medium large]\n\n begin\n heading prompt.select('What size? (PRESS ESC or CTRL+X to exit)', choices)\n rescue ExitApp\n puts\n prompt.warn 'e[x]iting....'\n end\n\n :gui\n end",
"def execute_shell(command, input = nil)\n Open3.popen3(command) do |stdin, stdout, stderr, thrd|\n stdin.puts input unless input.nil?\n stdin.close\n SystemCallError.new(\"Error invoking #{command}, #{stderr.read}\", thrd.value.exitstatus)\n out = stdout.read\n end\n rescue Errno::EPIPE\n \"\"\n end",
"def read_and_execute(inp)\n args = inp.split(' ') # Split the input by space\n cmd_name = args[0] # First argument of the command name\n cmd_args = args[1..inp.length] # Second argument is the argument of the commands\n @commands_available[cmd_name].execute(cmd_args)\n end",
"def main\n print \" ruby> \"\n input = gets\n puts eval(input)\n main\nend",
"def test_stdin_redir\n with_fixture 'stdinredir' do\n assert system(\"ruby\", ocra, \"stdinredir.rb\", *DefaultArgs)\n assert File.exist?(\"stdinredir.exe\")\n system(\"stdinredir.exe < input.txt\")\n assert 104, $?.exitstatus\n end\n end",
"def run_cmd(input)\n return self.process(input,false)\n end",
"def exec(input)\n @forced = false\n input, out, err = if @send_to_stdin\n stdin_exec(input)\n else\n file_param_exec(input)\n end\n @ctx.logger.debug { \"Executed #{cmd}\" }\n rewind out, err\n result = build_result input, out, err\n \n yield result\n end",
"def user_input\n print '>> '.yellow\n case raw_input = gets.chomp\n when 'c', 'cancel' then tell_user \"\\n\";raise ProgramExceptions::Cancel.new\n else\n tell_user \"\\n\"\n return raw_input\n end\n rescue => error\n raise ProgramExceptions::Exit.new if\\\n error.class == ProgramExceptions::Exit ||\n (defined?(IRB) && error.class == IRB::Abort)\n raise error\n end",
"def run!(input)\n stdout, stderr, process = run(input)\n\n if process.success?\n puts stdout\n\n STDERR.puts(stderr) unless stderr.empty?\n else\n abort stderr\n end\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 read_input()\n print \"> \"\n $stdout.flush\n gets\n end",
"def execute(input: $stdin, output: $stdout)\n message = 'Standard'\n puts message\n puts Pastel.new.green(TTY::Font.new(:standard).write(message))\n\n :gui\n end",
"def pretend_user_input(input:)\n pretend_user_input = StringIO.new\n pretend_user_input.puts input\n pretend_user_input.rewind\n \n $stdin = pretend_user_input\n return $stdin\nend",
"def input_command\n\t\tloop do\n\t\t\tputs \"\"\n\t\t\tputs \"What are your commands master #{$account}?\"\n\t\t\t# cmd = ('say \"What are your commands my master?\"')\n\t\t\t# system cmd\n\t\t\tgive_command(gets.chomp.upcase)\n\t\tend\n\tend",
"def execute(input)\n unless input.strip.empty? || input.strip[0] == \"!\"\n log_history_command(input.strip)\n end\n\n #Morpheus::Logging::DarkPrinter.puts \"Shell command: #{input}\"\n input = input.to_s.strip\n\n # allow pasting in commands that have 'morpheus ' prefix\n if input[0..(prog_name.size)] == \"#{prog_name} \"\n input = input[(prog_name.size + 1)..-1] || \"\"\n end\n if !input.empty?\n\n if input == 'exit'\n #print cyan,\"Goodbye\\n\",reset\n #@history_logger.info \"exit\" if @history_logger\n @exit_now_please = true\n return 0\n #exit 0\n elsif input == 'help'\n out = \"\"\n if @temporary_shell_mode\n out << \"You are in a (temporary) morpheus shell\\n\"\n else\n out << \"You are in a morpheus shell.\\n\"\n end\n out << \"See the available commands below.\\n\"\n\n out << \"\\nCommands:\\n\"\n # commands = @morpheus_commands + @shell_commands\n # @morpheus_commands.sort.each {|cmd|\n # out << \"\\t#{cmd.to_s}\\n\"\n # }\n sorted_commands = Morpheus::Cli::CliRegistry.all.values.sort { |x,y| x.command_name.to_s <=> y.command_name.to_s }\n sorted_commands.each {|cmd|\n # JD: not ready to show description yet, gotta finish filling in every command first\n # maybe change 'View and manage' to something more concise like 'Manage'\n # out << \"\\t#{cmd.command_name.to_s.ljust(28, ' ')} #{cmd.command_description}\\n\"\n out << \"\\t#{cmd.command_name.to_s}\\n\"\n }\n #puts \"\\n\"\n out << \"\\nShell Commands:\\n\"\n @shell_commands.each {|cmd|\n # out << \"\\t#{cmd.to_s.ljust(28, ' ')} #{@shell_command_descriptions ? @shell_command_descriptions[cmd] : ''}\\n\"\n out << \"\\t#{cmd.to_s}\\n\"\n }\n out << \"\\n\"\n out << \"For more information, see https://clidocs.morpheusdata.com\"\n out << \"\\n\"\n print out\n return 0\n elsif input =~ /^\\s*#/\n Morpheus::Logging::DarkPrinter.puts \"ignored comment: #{input}\" if Morpheus::Logging.debug?\n return 0\n elsif input == 'clear'\n print \"\\e[H\\e[2J\"\n return 0\n elsif input == 'reload' || input == 'reload!'\n # clear registry\n Morpheus::Cli::CliRegistry.instance.flush\n # reload code\n Morpheus::Cli.reload!\n # execute startup scripts\n if File.exist?(Morpheus::Cli::DotFile.morpheus_profile_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheus_profile_filename).execute()\n end\n if File.exist?(Morpheus::Cli::DotFile.morpheusrc_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheusrc_filename).execute()\n end\n # recalculate shell environment\n reinitialize()\n\n Morpheus::Logging::DarkPrinter.puts \"shell has been reloaded\" if Morpheus::Logging.debug?\n return 0\n elsif input == '!!'\n cmd_number = @history.keys[-1]\n input = @history[cmd_number]\n if !input\n puts \"There is no previous command\"\n return false\n end\n return execute(input)\n elsif input =~ /^\\!.+/\n cmd_number = input.sub(\"!\", \"\").to_i\n if cmd_number != 0\n old_input = @history[cmd_number]\n if !old_input\n puts \"Command not found by number #{cmd_number}\"\n return 0\n end\n #puts \"executing history command: (#{cmd_number}) #{old_input}\"\n # log_history_command(old_input)\n # remove this from readline, and replace it with the old command\n Readline::HISTORY.pop\n Readline::HISTORY << old_input\n return execute(old_input)\n end\n\n elsif input == \"insecure\"\n Morpheus::RestClient.enable_ssl_verification = false\n return 0\n\n elsif [\"hello\",\"hi\",\"hey\",\"hola\"].include?(input.strip.downcase)\n user_msg = input.strip.downcase\n # need a logged_in? method already damnit\n wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials\n help_msg = case user_msg\n when \"hola\"\n \"¿como puedo ayudarte? tratar #{cyan}help#{reset}\"\n else\n \"how may I #{cyan}help#{reset} you?\"\n end\n greeting = \"#{user_msg.capitalize}#{wallet ? (' '+green+wallet['username'].to_s+reset) : ''}, #{help_msg}#{reset}\"\n puts greeting\n return 0\n elsif input.strip =~ /^shell\\s*/\n # just allow shell to fall through\n # we should reload the configs and history file after the sub shell process terminates though.\n # actually, that looks like it is working just fine already...?\n print cyan,\"starting a subshell\",reset,\"\\n\"\n elsif input =~ /^\\.\\s/\n # dot alias for source <file>\n log_history_command(input)\n return Morpheus::Cli::SourceCommand.new.handle(input.split[1..-1])\n end\n exit_code, err = 0, nil\n begin\n argv = Shellwords.shellsplit(input)\n cmd_name = argv[0]\n cmd_args = argv[1..-1]\n # crap hack, naming conflicts can occur with aliases\n @return_to_log_level = [\"log-level\",\"debug\"].include?(cmd_name) ? nil : Morpheus::Logging.log_level\n @return_to_coloring = [\"coloring\"].include?(cmd_name) ? nil : Term::ANSIColor::coloring?\n @return_to_benchmarking = [\"benchmark\"].include?(cmd_name) ? nil : Morpheus::Benchmarking.enabled?\n \n #if Morpheus::Cli::CliRegistry.has_command?(cmd_name) || Morpheus::Cli::CliRegistry.has_alias?(cmd_name)\n #log_history_command(input)\n # start a benchmark, unless the command is benchmark of course\n if my_terminal.benchmarking || cmd_args.include?(\"-B\") || cmd_args.include?(\"--benchmark\")\n if cmd_name != 'benchmark' # jd: this does not work still 2 of them printed.. fix it!\n # benchmark_name = \"morpheus \" + argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n benchmark_name = argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n start_benchmark(benchmark_name)\n end\n end\n exit_code, err = Morpheus::Cli::CliRegistry.exec_expression(input)\n benchmark_record = stop_benchmark(exit_code, err) # if benchmarking?\n Morpheus::Logging::DarkPrinter.puts(cyan + dark + benchmark_record.msg) if benchmark_record\n # else\n # puts_error \"#{Morpheus::Terminal.angry_prompt}'#{cmd_name}' is not recognized. Use 'help' to see the list of available commands.\"\n # @history_logger.warn \"Unrecognized Command #{cmd_name}\" if @history_logger\n # exit_code, err = -1, \"Command not recognized\"\n # end\n rescue Interrupt\n # user pressed ^C to interrupt a command\n @history_logger.warn \"shell interrupt\" if @history_logger\n print \"\\nInterrupt. aborting command '#{input}'\\n\"\n exit_code, err = 9, \"aborted command\"\n rescue SystemExit => cmdexit\n # nothing to do, assume the command that exited printed an error already\n # print \"\\n\"\n if cmdexit.success?\n exit_code, err = cmdexit.status, nil\n else\n exit_code, err = cmdexit.status, \"Command exited early.\"\n end\n rescue => e\n # some other type of failure..\n @history_logger.error \"#{e.message}\" if @history_logger\n exit_code, err = Morpheus::Cli::ErrorHandler.new(my_terminal.stderr).handle_error(e) # lol\n \n ensure\n if @return_to_log_level\n Morpheus::Logging.set_log_level(@return_to_log_level)\n ::RestClient.log = Morpheus::Logging.debug? ? Morpheus::Logging::DarkPrinter.instance : nil\n @return_to_log_level = nil\n end\n if @return_to_coloring != nil\n Term::ANSIColor::coloring = @return_to_coloring\n @return_to_coloring = nil\n end\n if @return_to_benchmarking != nil\n Morpheus::Benchmarking.enabled = @return_to_benchmarking\n my_terminal.benchmarking = Morpheus::Benchmarking.enabled\n @return_to_benchmarking = nil\n end\n end\n\n return exit_code, err\n end\n\n end",
"def run_shell(command, env: {}, stdin_data: '')\n # If we're passed a string, convert it to an array beofre passing to capture3\n command = command.split unless command.is_a?(Array)\n Salus::ShellResult.new(*Open3.capture3(env, *command, stdin_data: stdin_data))\n end",
"def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end",
"def send_input(string)\n @stdin.print string\n end",
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/,\"\\n\")\n prompt = MULTILINE_PROMPT\n Readline::HISTORY.push(cmd)\n next\n else\n final_cmd += cmd\n Readline::HISTORY.push(cmd)\n end\n\n execute(final_cmd)\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n end\n end",
"def user_input\n\tgets\nend",
"def sudo_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:sudo, shell_command, input_query, response)\n end",
"def sudo_with_input(shell_command, input_query=/^Password/, response=nil)\n handle_command_with_input(:sudo, shell_command, input_query, response)\n end",
"def read_input\n $stdin.gets.strip\n rescue NoMethodError\n abort \"\\nInput aborted at user request.\"\n end",
"def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n result = prompt.collect do\n key(:name).ask('Name?')\n\n key(:age).ask('Age?', convert: :int, required: true)\n\n key(:address) do\n key(:street).ask('Street?', required: true)\n key(:city).ask('City?')\n key(:zip).ask('Zip?', validate: /\\A\\d{3}\\Z/)\n end\n end\n\n puts result\n\n result = prompt.collect do\n key(:name).ask('Name?')\n\n key(:age).ask('Age?', convert: :int)\n\n while prompt.yes?('continue, add many addresses?')\n key(:addresses).values do\n key(:street).ask('Street?', required: true)\n key(:city).ask('City?')\n key(:zip).ask('Zip?', validate: /\\A\\d{3}\\Z/)\n end\n end\n end\n\n puts result\n\n :gui\n end",
"def handle(args, stdin, stdout)\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def echo (input)\n input\n end",
"def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend",
"def get_stdin(*args)\n if args.include?(:noecho)\n val = STDIN.noecho(&:gets)\n else\n val = STDIN.gets\n end\n\n if val.nil?\n cancel_publish\n else\n val.chomp!\n return val\n end\nend",
"def prompt(input)\n Kernel.puts(\"=> #{input}\")\nend",
"def run( *args )\n\n\t\tself.setup_completion\n\t\tself.read_history\n\n\t\t# Run until something sets the quit flag\n\t\tuntil @quitting\n\t\t\tinput = Readline.readline( @prompt, true )\n\t\t\tself.log.debug \"Input is: %p\" % [ input ]\n\n\t\t\t# EOL makes the shell quit\n\t\t\tif input.nil?\n\t\t\t\tself.log.debug \"EOL: setting quit flag\"\n\t\t\t\t@quitting = true\n\n\t\t\t# Blank input -- just reprompt\n\t\t\telsif input == ''\n\t\t\t\tself.log.debug \"No command. Re-displaying the prompt.\"\n\n\t\t\t# Act on everything else\n\t\t\telse\n\t\t\t\tself.log.debug \"Dispatching input: %p\" % [ input ]\n\t\t\t\tcommand, *args = Shellwords.shellwords( input )\n\t\t\t\tself.dispatch_command( command, *args )\n\t\t\tend\n\t\tend\n\n\t\tself.save_history\n\n\tend",
"def input(prompt)\n raw_input(prompt).strip\n end",
"def enter_command\n\t\tanswer = $screen.ask(\"command:\",$command_hist)\n\t\teval(answer)\n\t\t$screen.write_message(\"done\")\n\trescue\n\t\t$screen.write_message(\"Unknown command\")\n\tend",
"def execute\n puts HEADER\n\n loop do\n cmd = gets.chomp\n\n if valid_command?(cmd)\n execute_command(cmd)\n else\n puts 'Not valid command'\n end\n end\n end",
"def prompt(text)\n @output += %(#{text}\\n)\n print text\n STDIN.gets\n end",
"def capture_name\n # puts \"Please type in your first name\" => add outside of testing\n name = $stdin.gets.chomp\n \"Hello, #{name}\"\nend",
"def process_input(raw_input)\n @engine.inject_command(normalized_input(raw_input), self)\n @engine.execute_pending_commands\n end",
"def get_console_input\n STDIN.noecho(&:gets).chomp\n end",
"def stdin; end",
"def run_command\n do_on_interactive_process do |match|\n @logger.debug \"Read: #{match}\"\n exec_each_prompt match[1]\n end\n end",
"def prompt(text)\n print text\n input = readline.chomp\n throw(:quit, lambda {return \"New Action to Render\"} ) if input == \"\"\n return input\nend",
"def read_from_console\n puts 'Enter URL, please:'\n @url = STDIN.gets.chomp\n\n puts 'Enter the name to this link, please:'\n @text = STDIN.gets.chomp\n end",
"def execute_command(command)\n @stdin.puts command\n end",
"def prompt\r\n print \"> \"\r\n input = $stdin.gets.chomp\r\n return input\r\nend",
"def run_shell(command, env: {}, stdin_data: '',\n chdir: File.expand_path(@repository&.path_to_repo))\n # If we're passed a string, convert it to an array before passing to capture3\n command = command.split unless command.is_a?(Array)\n Salus::PluginManager.send_event(:run_shell, command, chdir: chdir)\n # chdir: '/some/directory'\n opts = { stdin_data: stdin_data }\n opts[:chdir] = chdir unless chdir.nil? || chdir == \".\"\n Salus::ShellResult.new(*Open3.capture3(env, *command, opts))\n end",
"def execute(input_string)\n input = Input.new(input_string)\n\n send \"#{input.command.downcase}_command\".to_sym, input.args\n end",
"def main\n puts \"Welcome to the Ada Slack CLI!\"\n @workspace = Slack::Workspace.new\n\n choice = get_user_input\n until (OPTIONS[-1].include? choice) #checks for quit command from user\n perform_action(choice)\n choice = get_user_input\n end\n puts \"\\n>>>>>> Thank you for using the Slack CLI! Goodbye.\"\nend",
"def local_os_shell\n cls\n banner\n prompt = \"(Local)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit$|^quit$|^back$/i\n puts \"OK, Returning to Main Menu\".light_red + \"....\".white\n break\n else\n begin\n rez = commandz(cmd) #Run command passed\n puts \"#{rez.join}\".cyan #print results nicely for user....\n rescue Errno::ENOENT => e\n puts \"#{e}\".light_red\n rescue => e\n puts \"#{e}\".light_red\n end\n end\n end\nend",
"def run_locally(stdin_text = nil, &block)\n raise ArgumentError.new('block required') unless block_given?\n\n cmd = block.call\n # cmd = \"echo '#{stdin_text}' | #{cmd}\" if stdin_text\n\n raise \"Unable to run_locally - fork method not useable\" unless Process.respond_to? :fork\n\n # preload stdin if there is input to avoid a race condition\n if stdin_text\n stdin_pipe, child_stdin = IO.pipe if stdin_text\n count = child_stdin.write(stdin_text.to_s)\n child_stdin.close\n end\n\n child_stdout, stdout_pipe = IO.pipe\n child_stderr, stderr_pipe = IO.pipe\n unless (pid = Process.fork)\n if stdin_text\n STDIN.reopen(stdin_pipe)\n else\n STDIN.close\n end\n STDOUT.reopen(stdout_pipe)\n STDERR.reopen(stderr_pipe)\n begin\n Process.exec ENV, cmd\n rescue SystemCallError => e\n STDERR.write(\"Unable to execute command '#{cmd}'\\n #{e}\")\n ensure\n exit\n end\n end\n\n Process.wait\n\n stdout = ''\n stderr = ''\n loop do\n reads, writes, obands = IO.select([child_stdout, child_stderr], [], [], 1)\n break if reads.nil?\n stdout += child_stdout.read_nonblock(1024) if reads.include? child_stdout\n stderr += child_stderr.read_nonblock(1024) if reads.include? child_stderr\n end\n stdout = nil if stdout.empty?\n stderr = nil if stderr.empty?\n\n [stdout, stderr, cmd]\n end",
"def ask(question)\n $stdout.puts(question)\n $stdout.print('> ')\n $stdin.gets.chomp\nend",
"def read_command(prompt); end",
"def run_in_shell(cmd, ret = false)\n\treturn `#{cmd}` if ret\n\tsystem cmd\nend",
"def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend",
"def get_command_from_user choices=[\"quit\",\"help\", \"suspend\", \"shell_output\"]\n @_command_history ||= Array.new\n str = rb_gets(\"Cmd: \", choices) { |q| q.default = @_previous_command; q.history = @_command_history }\n @_command_history << str unless @_command_history.include? str\n # shell the command\n if str =~ /^!/\n str = str[1..-1]\n suspend(false) { \n #system(str); \n $log.debug \"XXX STR #{str} \" if $log.debug? \n\n output=`#{str}`\n system(\"echo ' ' \");\n $log.debug \"XXX output #{output} \" if $log.debug? \n system(\"echo '#{output}' \");\n system(\"echo Press Enter to continue.\");\n system(\"read\"); \n }\n return nil # i think\n else\n # TODO\n # here's where we can take internal commands\n #alert \"[#{str}] string did not match :!\"\n str = str.to_s #= str[1..-1]\n cmdline = str.split\n cmd = cmdline.shift #.to_sym\n return unless cmd # added 2011-09-11 FFI\n f = @form.get_current_field\n if respond_to?(cmd, true)\n if cmd == \"close\"\n throw :close # other seg faults in del_panel window.destroy executes 2x\n else\n res = send cmd, *cmdline\n end\n elsif f.respond_to?(cmd, true)\n res = f.send(cmd, *cmdline)\n else\n alert \"App: #{self.class} does not respond to #{cmd} \"\n ret = false\n # what is this execute_this: some kind of general routine for all apps ?\n ret = execute_this(cmd, *cmdline) if respond_to?(:execute_this, true)\n rb_puts(\"#{self.class} does not respond to #{cmd} \", :color_pair => $promptcolor) unless ret\n # should be able to say in red as error\n end\n end\n end",
"def process(raw_input)\n clean_input, verbosity = sanitize_input raw_input\n\n if clean_input.length > 0\n command = find_command(clean_input) || @modes.current_mode.dynamic_command(clean_input) || @modes.global_mode.command_not_found\n user_args = extract_user_args command, clean_input\n command_ctx = build_context(command, user_args, verbosity)\n args = resolve_args(command, command_ctx)\n\n command.method.call(*args)\n end\n end",
"def prompt_and_user_input(downcased: true)\n print('-> '.bold.green)\n inp = $stdin.gets.chomp&.strip\n downcased ? inp.downcase : inp\n end",
"def execute(input: $stdin, output: $stdout)\n loop do\n case @subcommand\n when :gui\n gui\n when :filter\n require_relative 'demo_filter'\n subcmd = PocShotstack::Commands::DemoFilter.new({})\n when :image\n require_relative 'demo_image'\n subcmd = PocShotstack::Commands::DemoImage.new({})\n when :status\n require_relative 'demo_status'\n subcmd = PocShotstack::Commands::DemoStatus.new({})\n when :text\n require_relative 'demo_text'\n subcmd = PocShotstack::Commands::DemoText.new({})\n when :title\n require_relative 'demo_title'\n subcmd = PocShotstack::Commands::DemoTitle.new({})\n when :dsl\n require_relative 'demo_dsl'\n subcmd = PocShotstack::Commands::DemoDsl.new({})\n else\n break\n end\n @subcommand = subcmd&.execute(input: input, output: output)\n end\n end",
"def run_shell_command(line)\n TOPLEVEL_BINDING.eval('self').execute_shell_command_internal(line)\n end",
"def execute_command(command, input)\n command.new(self, input).process\n end",
"def send_command_prompt\n send_data options[:command_prompt]\n end",
"def process_user_input\n command = get_user_input\n while command != \"quit\"\n perform_command(command)\n command = get_user_input\n end\n puts \"Good bye!\"\nend",
"def read_command\n @std_output.print COMMAND_PROMPT\n @std_input.gets.chomp\n end",
"def exec!(command, input = nil)\n result = exec command, input\n return result.stdout if result.succeeded?\n \n raise \"exec! command exited with non-zero code #{result.exit_code}\"\n end",
"def prompt_input\n class_invariant\n print ps1\n command = gets.chomp\n class_invariant\n return command\n end",
"def execute(input: $stdin, output: $stdout)\n loop do\n case @command\n when :config\n require_relative 'config'\n cmd = PocShotstack::Commands::Config.new('gui', {})\n @command = cmd&.execute(input: input, output: output)\n when :demo\n require_relative 'demo'\n cmd = PocShotstack::Commands::Demo.new('gui', {})\n @command = cmd&.execute(input: input, output: output)\n when :exit\n break\n else\n @command = gui\n end\n \n end\n end",
"def ask(question)\n puts question\n begin\n system \"stty raw -echo\"\n out = STDIN.getc.chr.downcase\n ensure\n system \"stty -raw echo\"\n end\n return case out\n when 'c' then exit\n when 'y' then true\n when 'n' then false\n else ask(question)\n end\nend",
"def prepare_input(prompt); end",
"def run input, params = {}\n if options[:kaf]\n language, input = kaf_elements(input)\n else\n language = options[:language]\n end\n\n unless valid_language?(language)\n raise Core::UnsupportedLanguageError, language\n end\n\n kernel = language_constant(language).new(:args => options[:args])\n\n stdout, stderr, process = Open3.capture3(\n *kernel.command.split(\" \"),\n :stdin_data => input\n )\n\n raise stderr unless process.success?\n\n return stdout\n end",
"def shell\n verbose { \"Shell(#{@id})\" }\n ___init_readline\n loop do\n line = ___input || break\n puts ___exe(___cmds(line)) || @shell_output_proc.call\n end\n @terminate_procs.inject(self) { |a, e| e.call(a) }\n Msg.msg('Quit Shell', 3)\n end",
"def get_user_input\n print \"username: \"\n username = STDIN.gets.chomp\n\n print \"password: \"\n password = STDIN.noecho(&:gets).chomp\n end",
"def run(input, output)\n output.print \"=> \"\n reader = @reader.new(input)\n\n loop do\n begin\n token = reader.next\n break if token.nil?\n\n show(output, evaler.call(token, environment))\n rescue ExecutionError => e\n handle_exec_error(output, e)\n rescue StandardError => e\n handle_standard_error(output, e)\n end\n\n output.print \"=> \"\n end\n rescue Interrupt\n output.puts \"see you soon\"\n end",
"def do_shell(line)\n shell = ENV['SHELL']\n line ? write(%x(#{line}).strip) : system(shell)\n end",
"def ask(string)\r\n log '', string\r\n STDIN.gets.strip\r\n end",
"def execute(input: $stdin, output: $stdout)\n soundtrack = Shotstack::Soundtrack.new(effect: \"fadeInFadeOut\", src: soundtrack_src)\n\n title_asset = Shotstack::TitleAsset.new(style: \"minimal\", text: \"Hello World\")\n\n title_clip = Shotstack::Clip.new(\n asset: title_asset,\n length: 5,\n start: 0,\n effect: \"zoomIn\")\n\n track1 = Shotstack::Track.new(clips: [title_clip])\n\n timeline = Shotstack::Timeline.new(background: \"#000000\", soundtrack: soundtrack, tracks: [track1])\n\n output = Shotstack::Output.new(format: \"mp4\", resolution: \"sd\")\n\n edit = Shotstack::Edit.new(timeline: timeline, output: output)\n\n render_id = shotstack_post_render(edit)\n\n set(:last_video_render_id, render_id)\n\n :gui\n end",
"def handle_input(message)\n user = extract_user message\n id = message[:data][:id]\n request = message[:data][:args]\n if (term = TTY[user, id])\n term.write << request.join\n else\n message[:error] = 'Terminal does not exist.'\n end\n end",
"def receive_input\n STDIN.gets.strip\n end",
"def shell(command, output: false)\n command += ' > /dev/null 2>&1' if !output\n system(command)\nrescue => e\n lex(e, \"Failed to execute shell command: #{command}\")\nend",
"def get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend"
] | [
"0.7645436",
"0.7439496",
"0.7439496",
"0.6826866",
"0.68079025",
"0.665073",
"0.6628359",
"0.6615934",
"0.65914255",
"0.6584348",
"0.65698004",
"0.65551454",
"0.65296143",
"0.6454558",
"0.64445966",
"0.63904905",
"0.6388665",
"0.6372787",
"0.633815",
"0.6322621",
"0.63027275",
"0.6299441",
"0.62784743",
"0.6273569",
"0.6267169",
"0.62641484",
"0.62037957",
"0.62028486",
"0.6176179",
"0.6161739",
"0.6144881",
"0.61320853",
"0.6128624",
"0.61274135",
"0.61271644",
"0.61064386",
"0.6095683",
"0.6092988",
"0.60910356",
"0.6081574",
"0.6005038",
"0.6005038",
"0.60035264",
"0.59993446",
"0.5988169",
"0.59823906",
"0.59740597",
"0.59467274",
"0.5938555",
"0.5930601",
"0.5923093",
"0.59216315",
"0.59087706",
"0.59086055",
"0.59010637",
"0.58995074",
"0.5891206",
"0.58867335",
"0.58789736",
"0.58705443",
"0.5864192",
"0.58557796",
"0.58549565",
"0.58465445",
"0.58461905",
"0.58450806",
"0.58415693",
"0.5824417",
"0.5821027",
"0.58204716",
"0.58183753",
"0.5815006",
"0.58053595",
"0.57986474",
"0.5796782",
"0.5796231",
"0.5784588",
"0.5783255",
"0.5777782",
"0.5777496",
"0.57751554",
"0.5773172",
"0.57711947",
"0.5770018",
"0.5759645",
"0.5759527",
"0.5757951",
"0.5753958",
"0.57525814",
"0.5751883",
"0.57517755",
"0.5751538",
"0.57404435",
"0.5739677",
"0.57284456",
"0.5727359",
"0.5721388",
"0.57199395",
"0.57199395",
"0.57199067"
] | 0.6692589 | 5 |
Let the user answer y or n. ==== Parameters +prompt+ Prompt message | def ask(prompt = '(y/n)')
command_line.set_prompt prompt
command_line.refresh
while (c = Curses.getch)
next unless [?N, ?Y, ?n, ?y, 3, 27] .include? c # N, Y, n, y, ^c, esc
clear_command_line
break (c == 'y') || (c == 'Y')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yes?(prompt)\n begin\n answer = ask(\"#{prompt} [y/n]: \") { |q| q.limit = 1; q.case = :downcase }\n end until %w(y n).include? answer\n answer == 'y'\n end",
"def confirm(prompt)\n return true if config[:yes]\n valid_responses = %w[yes no y n]\n response = nil\n 3.times do\n response = ui.ask(prompt).downcase\n break if valid_responses.include? response\n ui.warn \"Valid responses are #{valid_responses}\"\n end\n response.match(/^y/)\n end",
"def yes_no_prompt(msg)\n answer = \"\"\n while answer !~ /^y$|^n$/\n print \"#{@script} -> #{msg} [y/n] ? \"\n answer = STDIN.gets.chomp\n end\n return true if answer =~ /^y$/i\n false\nend",
"def confirm(prompt)\n readline(prompt) == \"y\"\n end",
"def ask(question)\n answer = 'n'\n answer = 'y' if agree(\"#{question} (y/n) \")\n answer\n end",
"def prompt_quit\n ans = ''\n\tloop do\n\t print \"\\nDo you want to play another round (Y/N)? \"\n\t ans = gets.chomp.upcase\n\t break if ['Y', 'N'].include? ans\n\t puts \"Invalid answer! Try again...\"\n\tend\n\tans == 'N'\n end",
"def prompt_quit\n\t ans = ''\n\t loop do\n\t print \"\\nDo you want to play another round (Y/N)? \"\n\t ans = gets.chomp.upcase\n\t\tbreak if ['Y', 'N'].include? ans\n\t\tputs \"Invalid answer! Try again...\"\n\t end\n\t ans == 'N'\n\tend",
"def confirm_YN(choice)\n\tif choice == \"Y\" or choice == \"N\"\n\t\tchoice\n\telse\n\t\tputs \"Please type Y or N\"\n\t\tchoice = gets.strip\n\t\tconfirm_YN(choice)\n\tend\nend",
"def yes_no(prompt)\n medium_rainbow_typer(prompt)\n br\n TTY::Prompt.new.yes?('?')\n end",
"def confirm(prompt)\n 'y'\n end",
"def ask_yes_or_no question\n case(r = ask_getch(question, \"ynYN\"))\n when ?y.ord, ?Y.ord\n true\n when nil\n nil\n else\n false\n end\n end",
"def y_or_n\r\n\t\tputs \"Please answer [y]es or [n]:\"\r\n\t\tanswer = gets.chomp.downcase\r\n\t\tif answer == 'y' || answer == 'yes' || answer == '[y]es'\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend",
"def ask_the_question(question, valid_response)\n loop do\n answer = ask(question + \"? [Y/N] \") { |yn| yn.limit = 1, yn.validate = /[yn]/i }\n return answer if answer.downcase == valid_response.downcase || valid_response == ''\n end\nend",
"def ask(msg)\n request(\"#{msg} [yn] \") == 'y'\n end",
"def ask_input_yes_no question\n begin\n puts \"#{question} (Y or N)\"\n # 'gets' includes the newline, so need chomp to prevent the include? from returning false\n decision = gets.chomp\n end while (not ([\"Y\", \"y\", \"N\", \"n\"].include? decision))\n decision == 'Y' || decision == 'y'\n end",
"def ask_for_yes_no(msg)\n ['y','yes'].include?(ask_for_user_input(\"#{msg} [y/N]\").strip.downcase)\nend",
"def yes_no?(prompt, default: true)\n return true if yes?\n\n default = case default\n when :y, :yes\n true\n when :n, :no\n false\n when true, false\n default\n else\n fail ArgumentError, \"invalid :default\"\n end\n\n loop do\n y = default ? Rainbow('Y').bright : Rainbow('y').darkgray\n n = !default ? Rainbow('N').bright : Rainbow('n').darkgray\n\n begin\n print \"#{prompt} #{y}/#{n}: \"\n case $stdin.gets.chomp\n when ''\n return default\n when /^[Yy]/\n return true\n when /^[Nn]/\n return false\n else\n warn \"Unrecognized response\"\n end\n rescue Interrupt\n puts\n raise\n end\n end\n end",
"def prompt( ask = \"\" )\n answer = nil\n\n puts ask\n begin\n until %w( k ok y yes n no ).include?(answer = $stdin.gets.chomp.downcase)\n puts \"(psst... please type y or n)\"\n puts ask\n end\n rescue Interrupt\n return false\n end\n\n return false if answer =~ /n/\n\n return true\nend",
"def prompt_yes_no(msg, default)\n def yes_no(x)\n return (x.downcase == \"y\" or x.downcase == \"yes\" or\n x.downcase == \"n\" or x.downcase == \"no\")\n end\n return promptFunction(msg, default, method(:yes_no)).chars.first == \"y\"\n end",
"def play_again_Q\n\tputs \"\\nDo you want to play again? (Y/N)\"\n\tchoice = gets.strip\n\tconfirm_YN(choice)\nend",
"def ask_play_again\n correct_input = 0\n until correct_input == 1\n print 'Do you want to play again? (y/n): '\n option = gets.chomp.downcase\n if %w[y n].include?(option)\n correct_input = 1\n else\n puts 'PLEASE ENTER Y OR N'\n end\n end\n puts \"\\n\\n\"\n option\n end",
"def confirm(prompt)\r\n print \"#{prompt} \"\r\n yes = gets.downcase.strip[0] == 'y'\r\n puts 'Skipping.' if !yes\r\n yes\r\nend",
"def ask_continue_exit\n puts \"Do you want to continue shopping? (Y/N)\"\n answer = gets.chomp\n answer.upcase == \"Y\"\nend",
"def yes_no_q(question)\n\tresponse = \"\"\n\tloop do\n\t\tp question + \" (y/n)\"\n \t\tresponse = gets.chomp\n \t\tresponse = yn_booleen(response)\n \t\tbreak if response == true || response == false\n \tend #loop\n \tresponse\nend",
"def confirm(prompt, default)\n default_str = default ? 'Y/n' : 'N/y'\n while true do\n begin\n response = readline('%s (%s) ' % [prompt, default_str])\n rescue EOFError\n return default\n end\n response = response.strip.downcase\n\n # We don't catch \"Yes, I'm sure\" or \"NO!\", but I leave that\n # as an exercise for the reader.\n break if YES_OR_NO.member?(response)\n msg \"Please answer 'yes' or 'no'. Try again.\"\n end\n return YES.member?(response)\n end",
"def yes?(prompt)\n begin\n @console.yes?(prompt)\n rescue TTY::Prompt::ConversionError => exception\n say \"Invalid input. Proceeding as if \\\"Y\\\" was entered.\"\n return true\n end\n end",
"def ask\n puts \"do you have everything? (y/n)\"\n @answer = gets.chomp\nend",
"def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end",
"def y_or_n?(statement, color = nil)\n loop do\n case ask(statement, color, :add_to_history => false).downcase\n when 'y'\n return true\n when 'n'\n return false\n else\n puts \"please respond 'y' or 'n'\"\n end\n end\n end",
"def ask_bool(question)\n puts(question)\n puts 'y/n'\n answer = gets.chomp!\n answer.downcase\nend",
"def continue?\n puts \"Do you want to calculate again? [Y/N]\"\n print '> '\n response = gets.chomp.upcase\n response == 'Y'\nend",
"def yes_or_no(question)\n loop do\n print \"#{question}\\nyes(y), no(n), quit(q): \"\n $stdout.flush # Clear buffer\n response = gets.chomp\n case response.downcase\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n when 'q', 'quit' then exit\n else $stderr.puts \"Please answer \\\"yes\\\", \\\"no\\\", or \\\"quit\\\".\"\n end\n end\nend",
"def prompt_user(message)\n \"no\"\n end",
"def play_again?\n puts \"do you want to play again? (y/n)\"\n ans = gets.chomp.downcase\n if ans != 'y'\n exit\n end\nend",
"def confirm(question)\n loop do\n print(question)\n print(\" (y/n): \")\n STDOUT.flush\n s = STDIN.gets\n exit if s == nil\n s.chomp!\n\n return true if s == 'y'\n return false if s == 'n'\n end\nend",
"def prompt_new_game\n puts \"\"\n puts \"Do you want to play again? (y)\"\n puts \"Press any other key to exit\"\n return gets.chomp\nend",
"def y_n_input\n print \"[Y/n]: \"\n input = gets.chomp\n input.to_s.downcase\n end",
"def query_yesno(message_string)\n print message_string\n\n yesno_input = gets.chomp\n if yesno_input == 'Y'\n yesno_input = 'y'\n elsif yesno_input == 'N'\n yesno_input = 'n' end\n\n until yesno_input == 'y' || yesno_input == 'n' do\n print \"Regrettably, a binary choice ('y' or 'n') is required: \"\n yesno_input = gets.chomp\n end\n return yesno_input\nend",
"def yes? response \r\n case response\r\n when \"y\", \"Y\"\r\n return true\r\n when \"n\", \"N\", \"exit\"\r\n return false\r\n else\r\n puts \"Please enter y/Y or n/N:\".colorize(:red)\r\n yes?(gets.chomp)\r\n end\r\n end",
"def response\n response = gets.chomp\n if (response.downcase == \"yes\" || response.downcase == \"y\")\n initialize\n welcome\n return true\n elsif (response.downcase == \"no\" || response.downcase == \"n\")\n return true\n end\n end",
"def continue?(message = 'Continue? (y|n)', expectation = 'y')\n abort 'Aborted!' unless prompt(message) == expectation\nend",
"def answer_prompt(answer)\n\tputs \"The answer to your problem is: #{answer}\"\nend",
"def prompt(question, default: nil)\n answer = ask(question) \n answer.empty? ? default : answer\nend",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n\n answer\nend",
"def ask_yes_no(question, default=nil)\n unless tty?\n if default.nil?\n raise Gem::OperationNotSupportedError,\n \"Not connected to a tty and no default specified\"\n else\n return default\n end\n end\n\n default_answer = case default\n when nil\n 'yn'\n when true\n 'Yn'\n else\n 'yN'\n end\n\n result = nil\n\n while result.nil? do\n result = case ask \"#{question} [#{default_answer}]\"\n when /^y/i then true\n when /^n/i then false\n when /^$/ then default\n else nil\n end\n end\n\n return result\n end",
"def yes_or_no\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"yes\", \"y\" then \"yes\"\n\t\t\twhen \"no\", \"n\" then \"no\"\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That's not a valid option!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def get_confirmation(msg)\n print msg << \"(y/n) \"\n loop do\n answer = gets\n if answer.nil?\n return false\n end\n case answer.strip\n when \"y\", \"yes\" then break true\n when \"n\", \"no\" then break false\n else\n puts \"Invalid answer, must be y/n or yes/no\"\n end\n end\n end",
"def again_response\n input = ''\n x = 1\n while input.downcase != 'y' && input.downcase != 'n'\n if x != 1\n say('Invalid choice. Play again? [Y/N]')\n end\n input = gets.chomp\n x += 1\n end\n input.downcase\nend",
"def print_something\n puts \"Would you like me to print 'something'? (y/n)\"\n answer = gets.chomp\n if answer == \"y\"\n puts \"something\"\n else\n end\nend",
"def play_again?\n choice = ''\n loop do\n puts 'Do you want to play again? y/n '\n choice = gets.chomp.downcase\n break if %w(y n).include?(choice)\n puts \"invalid response. enter 'y' or 'n'\"\n end\n choice == 'y'\nend",
"def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend",
"def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend",
"def query_yesno\n yesno_input = gets.chomp\n until yesno_input == 'y' || yesno_input == 'n' do\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n yesno_input = gets.chomp\n end\n return yesno_input\nend",
"def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend",
"def continue_prompt\n puts \"Do you wish to continue?\"\n response = gets.chomp\n response.downcase\nend",
"def continue_prompt\n puts \"\\nWould you like to explore more?\"\n puts \"Yes/No\"\n input = gets.strip.downcase\n if input == \"n\" || input == \"no\" || input == \"exit\"\n goodbye\n else\n system(\"clear\")\n initial_prompt\n end\n end",
"def action_0\nputs \"Are you ready to start a new game?\\n [ Y ] [ N ]\"\n user_input = gets.chomp.downcase\n if user_input == \"y\"\n action_1\n elsif user_input == \"n\"\n puts \"\\nSmart decision! Come back later :)\\n\\n\"\n exit\n else\n nil\n end\nend",
"def ask question\n\twhile true\n\tputs question\n\treply = gets.chomp.downcase\n\tif reply == 'yes'\n\t\treturn true\n\tend\n\tif reply == 'no'\n\t\treturn false\n\tend\n\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def yes_or_no(question)\n\t\twhile true\n\t\t\tprint (question + \" (y/n): \")\n\t\t\tresponse = gets.chomp.strip.downcase\n\t\t\tif response == 'y' || response == 'yes'\n\t\t\t\treturn true\n\t\t\telsif response == 'n' || response == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend",
"def yes_entered?\n /y|Y/.match(connection.gets.chomp)\n end",
"def greet_again\n puts \"Hello!\"\n print \"Greet Again? (y/n)\"\n answer = gets.chomp\n case answer\n when \"n\"\n puts \"Ok, Goodbye!\"\n when \"y\"\n greet_again\n else\n \"Ok, Goodbye!\"\n end\nend",
"def confirm(msg)\n print(\"%s (y/n) \" % msg)\n\n $stdout.flush\n\n exit(1) unless $stdin.gets.strip.match?(/^(?:y|yes)$/i)\n end",
"def ask()\n puts 'Do you like eating tacos? (y or n)'\n input = gets.chomp\n if input == 'y'\n print 'We can be friends!'\n return\n end\n if input == 'n'\n print 'Get out of my sight!'\n return\n end\n puts 'Try again'\n ask()\nend",
"def ask(question)\n puts question\n begin\n system \"stty raw -echo\"\n out = STDIN.getc.chr.downcase\n ensure\n system \"stty -raw echo\"\n end\n return case out\n when 'c' then exit\n when 'y' then true\n when 'n' then false\n else ask(question)\n end\nend",
"def prompt(message=\"Are you sure?\", options=\"Yn\")\n opts = options.scan(/./)\n optstring = opts.join(\"/\") # case maintained\n defaults = opts.select{|o| o.upcase == o }\n opts = opts.map{|o| o.downcase}\n\n raise \"Error: Too many default values for the prompt: #{default.inspect}\" if defaults.size > 1\n\n default = defaults.first\n\n loop do\n\n print \"#{message} (#{optstring}) \"\n\n response = STDIN.gets.strip.downcase\n\n case response\n when *opts\n return response\n when \"\"\n return default.downcase\n else\n puts \" |_ Invalid option: #{response.inspect}. Try again.\"\n end\n\n end\nend",
"def prompt(message=\"Are you sure?\", options=\"Yn\")\n opts = options.scan(/./)\n optstring = opts.join(\"/\") # case maintained\n defaults = opts.select{|o| o.upcase == o }\n opts = opts.map{|o| o.downcase}\n\n raise \"Error: Too many default values for the prompt: #{default.inspect}\" if defaults.size > 1\n\n default = defaults.first\n\n loop do\n\n print \"#{message} (#{optstring}) \"\n\n response = STDIN.gets.strip.downcase\n\n case response\n when *opts\n return response\n when \"\"\n return default.downcase\n else\n puts \" |_ Invalid option: #{response.inspect}. Try again.\"\n end\n\n end\nend",
"def prompt_b\n loop do\n print \"[(yes/no)]\"\n print \"> \"\n input_str = @input.gets\n if input_str.nil?\n raise \"No input left (must be automated input)\"\n end\n input_str = input_str.chomp\n input_bool = Input.str_to_bool input_str\n unless input_bool.nil?\n return input_bool\n else\n print \"[Please enter yes/no, y/n or true/false]\"\n end\n end\n end",
"def get_yn(message)\n while true\n print \"#{message} \"\n case STDIN.gets.strip\n when 'N', 'n'\n puts \"Aborting!\"\n exit\n when 'Y', 'y'\n puts \"\"\n break\n end\n end\n end",
"def repeat?\n answer = \"\"\n\n until answer.match(/[y|n]/)\n puts \"\\nWould you like to play again? (y/n)\"\n answer = gets.strip.downcase\n puts \"★ Thanks for playing. Come back soon! ★\" if answer == \"n\"\n end\n answer\nend",
"def prompt(question)\n puts question\n gets.chomp\nend",
"def prompt(prompt_string = \"?\", default = \"\")\n print \"#{prompt_string} (#{default}) \"\n response = gets\n response.chomp!\n return response == \"\" ? default : response\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\t\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\tend\n\n\t\t if reply == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == \"yes\" || reply == \"no\")\n\t\t\tif reply == \"yes\"\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"Please answer 'yes' or 'no'.\"\n\t\tend\n\tend\n\n\tanswer # this will return (true or false).\nend",
"def are_you_sure? # Define a method. Note question mark!\n while true # Loop until we explicitly return\n print \"Are you sure? [y/n]: \" # Ask the user a question\n response = gets # Get her answer\n case response # Begin case conditional\n when /^[yY]/ # If response begins with y or Y\n return true # Return true from the method\n when /^[nN]/, /^$/ # If response begins with n,N or is empty\n return false # Return false\n end\n end\nend",
"def ask_yesno(question)\n\t\tupdate_screen_size\n\t\[email protected] Curses::A_REVERSE\n\t\twrite_str(@rows-1,0,\" \"*@cols)\n\t\twrite_str(@rows-1,0,question)\n\t\tanswer = \"cancel\"\n\t\tloop do\n\t\t\tc = Curses.getch\n\t\t\tnext if c > 255 # don't accept weird characters\n\t\t\tif c.chr.downcase == \"y\"\n\t\t\t\tanswer = \"yes\"\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tif c.chr.downcase == \"n\"\n\t\t\t\tanswer = \"no\"\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tif c == $ctrl_c\n\t\t\t\tanswer = \"cancel\"\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\[email protected] Curses::A_REVERSE\n\t\treturn answer\n\tend",
"def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\tif reply == 'yes'\r\n\t\t\t\treturn true\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\tif reply == 'no'\r\n\t\t\t\treturn false\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\t#else - I had an \"else\" in here, which doesn't belong. Need to remove and just 'Puts' if neither of the two above are included.\r\n\r\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\t\tend\r\n\t\r\nend",
"def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true \t\t\t #I like to state return values explictly\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\nend",
"def ask(prompt)\n print \"#{prompt}: \"\n $stdin.gets.chomp\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n \n answer # This is what we return (true or false).\nend",
"def ask_yes_no(question, default = nil)\n ui.ask_yes_no question, default\n end",
"def main \n puts \"---------------------\"\n puts \"Welcome to Mike's Number guessing game\"\n puts \"----------------------\"\n puts \"Do you want to play?\"\n choice = gets.chomp.to_s\n while !valid(choice)\n puts \"please enter either y or n\"\n choice = gets.chomp.to_s\n end \n if choice == 'y'\n mode \n else \n puts \"Well, I hope you come back soon to play!\"\n end \nend",
"def yes_no_input(msg)\n print msg\n response = gets.chomp.upcase\n while response != \"Y\" && response != \"N\"\n puts \"Error! Wrong input!\"\n print msg\n response = gets.chomp.upcase\n end\n response\nend",
"def continue?\n answer = gets.chop\n if answer =='y' || answer =='Y'\n true\n else\n false\n end\n end",
"def check_yes_no_input(input)\n\twhile input != 'y' && input != 'n'\n\t\tputs \"Wrong Input! Please type 'y' to continue to game or 'n' to quit\"\n\t\tinput = gets.strip.downcase\n\tend\n\tinput\nend",
"def play_again?\n puts \"\\n\" + SMALL_BANNER\n puts \"\\nWould you like to play again?\"\n print \"('y' for yes; otherwise exit):\"\n answer = gets.chomp\n answer.downcase.start_with?('y')\nend",
"def are_you_sure?\n while true\n print \"are you sure? [y/n]:\"\n response = gets\n case response\n when /^[yY]/\n return true\n when /^[nN]/, /^$/\n return false\n end\nend\nend",
"def confirm(question)\n formatted_question = \"\\n #{question} [Y/n]\"\n answer = ask(formatted_question).strip\n fail unless [\"Y\", \"y\", \"\"].include?(answer)\n end",
"def ask_user\n\tmessages = [\"You will get it!\", \"Sorry it won't happen\", \"You bet\", \"No way\", \"Maybe\", \"It depends on you\", \"I believe in you\", \"The odds are against you\"]\n\tquestion = puts \"This is magic 8-Ball. Do you want to shake the eight ball? Y/N\"\n\tuser_response = gets.chomp.capitalize\n\twhile(true)\n\t\tif user_response == \"Y\" || user_response == \"Yes\"\n\t\t\tputs messages[rand(0..7)]\n\t\t\task_user\n\t\t\tbreak\n\t\telsif user_response == \"N\" || user_response == \"No\"\n\t\t\tputs \"Bye!\"\n\t\t\tbreak\n\t\telse\n\t puts \"Type Y/N please\"\n\t ask_user\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer by either \"yes\" or \"no\".'\n end\n end\n\n answer # this is what we return (true or false)\nend",
"def ask(prompt, echo = T.unsafe(nil)); end",
"def ask( prompt )\n print prompt\n gets.chomp\nend",
"def better_get_y_or_n\n loop do \n puts \">> Do you want me to print something? (y/n)\"\n user_input = gets.chomp\n return user_input if %w(y n).include? user_input.downcase\n puts \">> Invalid input! Please enter y or n\" \n end\nend",
"def prompt\n puts \"Enter a number or bye\"\nend",
"def get_input\n\t\tinput_given = gets.chomp\n\t\treturn nil if input_given == \"\"\n\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\tconfirmation = gets.chomp\n\t\twhile confirmation.upcase == 'N'\n\t\t\tputs \"Please re-enter\"\n\t\t\tinput_given = gets.chomp\n\t\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\t\tconfirmation = gets.chomp\n\t\tend\n\t\tinput_given\n\tend",
"def another_game?\n\n puts \"Do you want to play another game? Y/N \"\n\n answer = gets.chomp\n\n return true if answer == 'Y'\n\n false\n\nend",
"def prompt( message )\n\tprint message\n\tgets.chomp\nend",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply || 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #this is what is returned\nend",
"def prompt(message)\n\tprint messaage\n\tgets.chomp # implicit return\nend",
"def ask_play_again?()\n input = get_input \"Play again?\"\n if input == \"y\"\n 1\n elsif input == \"n\"\n 2\n else\n 3\n end\nend",
"def x__confirm(message='y(es) or no? ')\n print message\n e_confirm = STDIN.gets.chomp\n case e_confirm\n when /\\Ay(es)?\\z/i\n true\n else\n false\n end\n end"
] | [
"0.80290097",
"0.7902345",
"0.7898017",
"0.7848584",
"0.7838065",
"0.78200847",
"0.7800907",
"0.7713918",
"0.76968974",
"0.7657936",
"0.7621666",
"0.7616819",
"0.7614349",
"0.7606154",
"0.7588236",
"0.7578107",
"0.7577071",
"0.75265247",
"0.744422",
"0.7440114",
"0.7406236",
"0.73688585",
"0.7353729",
"0.7346485",
"0.7343389",
"0.7341393",
"0.7321153",
"0.7306035",
"0.73000985",
"0.72854763",
"0.728313",
"0.72723407",
"0.7266216",
"0.7260513",
"0.7226353",
"0.72184384",
"0.72047925",
"0.71383727",
"0.7111502",
"0.70987105",
"0.7084996",
"0.7084848",
"0.7046356",
"0.70397186",
"0.7025542",
"0.70181596",
"0.7003185",
"0.7001187",
"0.7000358",
"0.699693",
"0.6991374",
"0.6991374",
"0.6983101",
"0.6978928",
"0.6971915",
"0.6968618",
"0.69633394",
"0.69596565",
"0.6955956",
"0.69557446",
"0.6944425",
"0.69353104",
"0.6934581",
"0.6926302",
"0.6910247",
"0.6910247",
"0.6899615",
"0.68980116",
"0.6894431",
"0.6891296",
"0.6888223",
"0.6883574",
"0.6881621",
"0.68797433",
"0.6879012",
"0.68789124",
"0.6870334",
"0.68632346",
"0.68585914",
"0.6843306",
"0.6832186",
"0.683178",
"0.6826729",
"0.68260545",
"0.6812535",
"0.68112093",
"0.6810296",
"0.6773735",
"0.67717135",
"0.675323",
"0.67469496",
"0.674267",
"0.6731285",
"0.6724347",
"0.67239755",
"0.672389",
"0.67231745",
"0.67081654",
"0.67023915",
"0.6701185"
] | 0.78442377 | 4 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.